/* ============================================================
   ProVend Admin — common design system (used by every module)
   ============================================================ */

:root {
    --pv-primary: #4f46e5;
    --pv-primary-dark: #4338ca;
    --pv-primary-soft: #eef2ff;
    --pv-success: #16a34a;
    --pv-success-soft: #f0fdf4;
    --pv-danger: #dc2626;
    --pv-danger-soft: #fef2f2;
    --pv-warning: #d97706;
    --pv-warning-soft: #fffbeb;
    --pv-info: #0284c7;
    --pv-info-soft: #f0f9ff;
    --pv-body-bg: #f1f5f9;
    --pv-surface: #ffffff;
    --pv-border: #e2e8f0;
    --pv-text: #0f172a;
    --pv-text-muted: #64748b;
    --pv-sidebar-bg: #0f172a;
    --pv-sidebar-text: #cbd5e1;
    --pv-sidebar-active: #1e293b;
    --pv-radius: 12px;
    --pv-radius-lg: 16px;
    --pv-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --pv-shadow-lg: 0 20px 45px rgba(15, 23, 42, .18);
    --pv-sidebar-width: 250px;
    --pv-navbar-height: 62px;
}

/* ---------- Scrollbars: thin + light everywhere (pages, modals, lists) ---------- */
/* Chromium / Safari. Chrome 121+ ignores these on any element that has the
   standard scrollbar-width / scrollbar-color — and scrollbar-color inherits, so
   setting it on html switched them off everywhere. The standard properties are
   therefore scoped to Firefox only. */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
}

/* ---------- Base ---------- */
html { font-size: 15px; }
body {
    background: var(--pv-body-bg);
    color: var(--pv-text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--pv-primary); text-decoration: none; }
a:hover { color: var(--pv-primary-dark); }
h1, h2, h3, h4, h5 { font-weight: 600; }

/* ---------- App shell ---------- */
.pv-shell { display: flex; min-height: 100vh; }
.pv-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--pv-sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}
.pv-content { flex: 1; padding: 1.5rem; }
.pv-footer {
    padding: .9rem 1.5rem;
    color: var(--pv-text-muted);
    font-size: .85rem;
    border-top: 1px solid var(--pv-border);
    background: var(--pv-surface);
}

/* ---------- Sidebar ---------- */
.pv-sidebar {
    width: var(--pv-sidebar-width);
    background: var(--pv-sidebar-bg);
    color: var(--pv-sidebar-text);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}
.pv-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.25rem;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.pv-sidebar-brand .pv-logo {
    width: 34px; height: 34px;
    border-radius: 8px; /* square with soft corners — never circular */
    background: var(--pv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
}
.pv-sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.pv-sidebar-section {
    padding: .85rem 1.25rem .35rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}
.pv-sidebar-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 1.25rem;
    color: var(--pv-sidebar-text);
    font-size: .92rem;
    border-left: 3px solid transparent;
}
.pv-sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.pv-sidebar-link.active {
    color: #fff;
    background: var(--pv-sidebar-active);
    border-left-color: var(--pv-primary);
}
.pv-sidebar-link .pv-icon { width: 1.25rem; text-align: center; }
.pv-sidebar-link.disabled { opacity: .45; pointer-events: none; }

/* Collapsible parent → child groups */
button.pv-sidebar-link { width: 100%; background: transparent; border: 0; border-left: 3px solid transparent; text-align: left; }
.pv-nav-caret { margin-left: auto; font-size: 1rem !important; opacity: .6; transition: transform .2s ease; }
.pv-nav-group.open > .pv-nav-parent .pv-nav-caret { transform: rotate(90deg); }
.pv-nav-group.has-active > .pv-nav-parent { color: #fff; }
.pv-nav-children { display: grid; grid-template-rows: 0fr; }
.pv-nav-children > div { overflow: hidden; min-height: 0; }
.pv-nav-group.open > .pv-nav-children { grid-template-rows: 1fr; }
.pv-nav-ready .pv-nav-children { transition: grid-template-rows .2s ease; }
.pv-nav-child { padding: .45rem 1.25rem .45rem 2.35rem; font-size: .86rem; }
.pv-sidebar .pv-sidebar-link.pv-nav-child .bx { font-size: 1rem; }
.pv-nav-flyout-title { display: none; }

/* Desktop mini rail: icons only, group links fly out on hover */
.pv-sidebar { transition: transform .25s ease, width .25s ease; }
@media (min-width: 992px) {
    html.pv-sidebar-mini { --pv-sidebar-width: 72px; }
    .pv-sidebar-mini .pv-sidebar-brand { justify-content: center; padding-inline: .5rem; }
    .pv-sidebar-mini .pv-brand-text,
    .pv-sidebar-mini .pv-nav-text,
    .pv-sidebar-mini .pv-nav-caret { display: none; }
    .pv-sidebar-mini .pv-sidebar-nav { overflow: visible; }
    .pv-sidebar-mini .pv-sidebar-link { justify-content: center; gap: 0; padding: .7rem 0; }
    .pv-sidebar-mini .pv-nav-group { position: relative; }
    .pv-sidebar-mini .pv-nav-group.has-active > .pv-nav-parent { background: var(--pv-sidebar-active); border-left-color: var(--pv-primary); }
    .pv-sidebar-mini .pv-nav-children {
        display: none;
        position: absolute;
        left: 100%;
        top: 0;
        min-width: 210px;
        padding: .35rem 0;
        background: var(--pv-sidebar-bg);
        border-radius: 0 8px 8px 0;
        box-shadow: 8px 8px 24px rgba(15, 23, 42, .35);
    }
    .pv-sidebar-mini .pv-nav-group:hover > .pv-nav-children,
    .pv-sidebar-mini .pv-nav-group:focus-within > .pv-nav-children { display: block; }
    .pv-sidebar-mini .pv-nav-flyout-title { display: block; padding: .4rem 1rem .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
    .pv-sidebar-mini .pv-nav-children .pv-nav-text { display: inline; }
    .pv-sidebar-mini .pv-nav-child { justify-content: flex-start; gap: .6rem; padding: .5rem 1rem; }
}

/* ---------- Navbar ---------- */
.pv-navbar {
    height: var(--pv-navbar-height);
    background: var(--pv-surface);
    border-bottom: 1px solid var(--pv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.pv-navbar .pv-burger { display: inline-flex; }
.pv-user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.pv-avatar {
    width: 36px; height: 36px;
    border-radius: 8px; /* square avatar per design guideline */
    background: var(--pv-primary-soft);
    color: var(--pv-primary);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Page header / breadcrumbs ---------- */
.pv-page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.pv-page-title { font-size: 1.35rem; margin: 0; }
.breadcrumb { margin: 0; font-size: .82rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }

/* ---------- Cards ---------- */
.pv-card {
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    box-shadow: var(--pv-shadow);
}
.pv-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.pv-card-body { padding: 1.25rem; }

/* Stat cards */
.pv-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
}
.pv-stat-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.pv-stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.pv-stat-label { color: var(--pv-text-muted); font-size: .82rem; }

/* Simple horizontal bar chart */
.pv-bar-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .7rem; }
.pv-bar-label { width: 130px; font-size: .85rem; color: var(--pv-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-bar-track { flex: 1; background: var(--pv-primary-soft); border-radius: 6px; height: 12px; overflow: hidden; }
.pv-bar-fill { height: 100%; background: var(--pv-primary); border-radius: 6px; }
.pv-bar-value { width: 90px; text-align: right; font-size: .85rem; font-weight: 600; }

/* ---------- Dashboard (compact) ---------- */
.pv-dash .pv-page-header { margin-bottom: .85rem; }
.pv-dash .pv-card-header { padding: .6rem 1rem; min-height: 44px; }
.pv-dash .pv-card-header h6 { font-size: .9rem; font-weight: 600; }
.pv-dash .pv-card-body { padding: .85rem 1rem; }
.pv-dash .pv-table thead th { padding: .45rem .75rem; font-size: .7rem; }
.pv-dash .pv-table tbody td { padding: .45rem .75rem; font-size: .84rem; }
.pv-dash .pv-empty { padding: 1.25rem 1rem; }
.pv-dash .pv-empty .pv-empty-icon { font-size: 1.6rem; margin-bottom: .25rem; }
.pv-dash .pv-empty h5 { font-size: .9rem; margin-bottom: .2rem; }
.pv-dash .pv-empty p { font-size: .8rem; }
.pv-dash .pv-skeleton-row { padding: .55rem .75rem; }
.pv-dash .pv-bar-row { margin-bottom: .45rem; }
.pv-dash .pv-bar-track { height: 8px; }
.pv-dash .pv-bar-label, .pv-dash .pv-bar-value { font-size: .8rem; }
.pv-dash-scroll { max-height: 290px; overflow-y: auto; }
.pv-dash-scroll thead th { position: sticky; top: 0; z-index: 1; }
.pv-dash-sku { color: var(--pv-text-muted); font-size: .72rem; margin-left: .2rem; }
.pv-dash-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .7rem; font-weight: 600; color: var(--pv-text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
@media (min-width: 768px) { .pv-dash-split + .pv-dash-split { border-left: 1px solid var(--pv-border); } }

/* Filter toolbar (page header) */
.pv-dash-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pv-dash-range { width: auto; flex-wrap: nowrap; }
.pv-dash-range .form-control { width: 135px; flex: none; }
.pv-dash-store { width: 170px; }

/* Count tiles */
.pv-dash-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.pv-dash-tile { display: flex; align-items: center; gap: .65rem; padding: .6rem .8rem; color: inherit; text-decoration: none; transition: border-color .15s ease; }
.pv-dash-tile:hover { border-color: var(--pv-primary); color: inherit; }
.pv-dash-tile > div { min-width: 0; }
.pv-dash-tile .pv-stat-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; }
.pv-dash-tile .pv-stat-icon .bx { font-size: 1.1rem; }
.pv-dash-tile .pv-stat-value { font-size: 1.15rem; }
.pv-dash-tile .pv-stat-label { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1199.98px) { .pv-dash-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .pv-dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sales KPI strip */
.pv-kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-bottom: 1px solid var(--pv-border); }
.pv-kpi { padding: .65rem 1rem; border-right: 1px solid var(--pv-border); min-width: 0; }
.pv-kpi:last-child { border-right: 0; }
.pv-kpi-label { font-size: .7rem; color: var(--pv-text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-kpi-value { font-size: 1.1rem; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-kpi-sub { font-size: .72rem; font-weight: 500; color: var(--pv-text-muted); }
@media (max-width: 1399.98px) {
    .pv-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .pv-kpi:nth-child(4n) { border-right: 0; }
    .pv-kpi:nth-child(-n+4) { border-bottom: 1px solid var(--pv-border); }
}
@media (max-width: 575.98px) {
    .pv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pv-kpi:nth-child(2n) { border-right: 0; }
    .pv-kpi:nth-child(-n+6) { border-bottom: 1px solid var(--pv-border); }
}

/* Column chart */
.pv-cols { display: flex; align-items: stretch; gap: 3px; height: 130px; }
.pv-col { flex: 1 1 0; max-width: 42px; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pv-col-track { flex: 1; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--pv-border); }
.pv-col-bar { width: 100%; background: var(--pv-primary); border-radius: 3px 3px 0 0; transition: background .15s ease; }
.pv-col:hover .pv-col-bar { background: var(--pv-primary-dark); }
.pv-col:hover .pv-col-track { background: var(--pv-primary-soft); }
.pv-col-label { font-size: .66rem; color: var(--pv-text-muted); margin-top: .25rem; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--pv-primary); border-color: var(--pv-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--pv-primary-dark); border-color: var(--pv-primary-dark); }
.btn-outline-primary { color: var(--pv-primary); border-color: var(--pv-primary); }
.btn-outline-primary:hover { background: var(--pv-primary); border-color: var(--pv-primary); }
.btn-icon { padding: .3rem .55rem; line-height: 1; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .88rem; }
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--pv-border);
    padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--pv-primary);
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12);
}
.field-validation-error { color: var(--pv-danger); font-size: .8rem; display: block; margin-top: .2rem; }
.input-validation-error { border-color: var(--pv-danger) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; color: var(--pv-danger); font-size: .85rem; }

/* Every checkbox renders as a toggle switch (no markup changes needed).
   Grey track + white knob when off; primary track with the knob on the right when on. */
.form-check { padding-left: 2.75em; }
.form-check .form-check-input { margin-left: -2.75em; }
.form-check-input[type="checkbox"],
.form-check-input[type="checkbox"]:focus {
    width: 2.25em; height: 1.25em; margin-top: .125em;
    border-radius: 2em; border-color: #cbd5e1; background-color: #cbd5e1;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: left center; background-repeat: no-repeat; background-size: contain;
    transition: background-position .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
    cursor: pointer;
}
.form-check-input[type="checkbox"]:hover:not(:checked):not(:disabled) { background-color: #b8c2d0; border-color: #b8c2d0; }
.form-check-input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .18); }
.form-check-input[type="checkbox"]:focus:not(:focus-visible) { box-shadow: none; }
.form-check-input[type="checkbox"]:checked {
    background-color: var(--pv-primary); border-color: var(--pv-primary);
    background-position: right center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}
.form-check-input[type="checkbox"]:disabled { cursor: default; opacity: .5; }

/* ---------- Tables ---------- */
.pv-table-wrap { overflow-x: auto; }
.pv-table { width: 100%; margin: 0; }
.pv-table thead th {
    background: #f8fafc;
    color: var(--pv-text-muted);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--pv-border);
    padding: .7rem 1rem;
    white-space: nowrap;
}
.pv-table tbody td { padding: .75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--pv-border); font-size: .9rem; }
.pv-table tbody tr:hover { background: #f8fafc; }
th.pv-sortable { cursor: pointer; user-select: none; }
th.pv-sortable .pv-sort-icon { opacity: .35; margin-left: .25rem; }
th.pv-sortable.sorted .pv-sort-icon { opacity: 1; color: var(--pv-primary); }

/* ---------- Badges ---------- */
.pv-badge {
    display: inline-block;
    padding: .28em .65em;
    font-size: .74rem;
    font-weight: 600;
    border-radius: 999px;
}
.pv-badge-success { background: var(--pv-success-soft); color: var(--pv-success); }
.pv-badge-danger { background: var(--pv-danger-soft); color: var(--pv-danger); }
.pv-badge-warning { background: var(--pv-warning-soft); color: var(--pv-warning); }
.pv-badge-info { background: var(--pv-info-soft); color: var(--pv-info); }
.pv-badge-muted { background: #f1f5f9; color: var(--pv-text-muted); }

/* ---------- Pagination ---------- */
.pv-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; flex-wrap: wrap; }
.pv-pagination .page-link { border-radius: 8px; margin: 0 2px; border-color: var(--pv-border); color: var(--pv-text); font-size: .85rem; }
.pv-pagination .page-item.active .page-link { background: var(--pv-primary); border-color: var(--pv-primary); }
.pv-page-info { color: var(--pv-text-muted); font-size: .85rem; }

/* ---------- Custom modal (always centered, standard footer) ---------- */
.pv-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1050;
    display: flex;
    align-items: center;      /* vertical centre */
    justify-content: center;  /* horizontal centre */
    padding: 1.5rem 1rem;
    opacity: 0;
    transition: opacity .18s ease;
}
.pv-modal-backdrop.show { opacity: 1; }
.pv-modal {
    background: var(--pv-surface);
    border-radius: var(--pv-radius-lg);
    box-shadow: var(--pv-shadow-lg);
    width: 100%;
    max-width: 560px;
    transform: translateY(10px) scale(.98);
    transition: transform .18s ease, height .22s ease;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3rem);
}
.pv-modal-backdrop.show .pv-modal { transform: translateY(0) scale(1); }
.pv-modal.pv-modal-sm { max-width: 420px; }
.pv-modal.pv-modal-lg { max-width: 760px; }
.pv-modal.pv-modal-xl { max-width: 1000px; }
.pv-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.05rem 1.4rem;
    border-bottom: 1px solid var(--pv-border);
    position: sticky; top: 0;
    background: var(--pv-surface);
    border-radius: var(--pv-radius-lg) var(--pv-radius-lg) 0 0;
}
.pv-modal-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.pv-modal-close {
    border: 0; background: #f1f5f9; border-radius: 8px;
    width: 32px; height: 32px; line-height: 1;
    color: var(--pv-text-muted); font-size: 1.05rem;
}
.pv-modal-close:hover { background: var(--pv-danger-soft); color: var(--pv-danger); }
.pv-modal-body { padding: 1.4rem; overflow-y: auto; position: relative; }
.pv-modal-footer {
    display: flex; justify-content: flex-end; gap: .6rem;
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--pv-border);
    position: sticky; bottom: 0;
    background: var(--pv-surface);
    border-radius: 0 0 var(--pv-radius-lg) var(--pv-radius-lg);
}
.pv-modal-loading {
    position: absolute; inset: 0;
    background: rgba(255, 255, 255, .75);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
/* Loading placeholder: fixed height, no scrollbar (see modal.js showLoading). */
.pv-modal-body.pv-modal-busy { min-height: 160px; overflow: hidden; }
/* While the dialog animates to its content height, keep the body's scrollbar hidden. */
.pv-modal-resizing .pv-modal-body { overflow: hidden; }
.pv-modal-body-in { animation: pv-modal-content-in .2s ease; }
@keyframes pv-modal-content-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toasts ---------- */
.pv-toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 1080; display: flex; flex-direction: column; gap: .6rem; max-width: 360px; }
.pv-toast {
    display: flex; align-items: flex-start; gap: .7rem;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-left: 4px solid var(--pv-info);
    border-radius: 10px;
    box-shadow: var(--pv-shadow-lg);
    padding: .8rem 1rem;
    animation: pv-toast-in .22s ease;
    font-size: .9rem;
}
.pv-toast.success { border-left-color: var(--pv-success); }
.pv-toast.error { border-left-color: var(--pv-danger); }
.pv-toast.warning { border-left-color: var(--pv-warning); }
@keyframes pv-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- Loader / skeleton ---------- */
.pv-spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--pv-primary-soft);
    border-top-color: var(--pv-primary);
    border-radius: 50%;
    animation: pv-spin .7s linear infinite;
}
@keyframes pv-spin { to { transform: rotate(360deg); } }
.pv-skeleton-row { display: flex; gap: 1rem; padding: .85rem 1rem; border-bottom: 1px solid var(--pv-border); }
.pv-skeleton {
    height: 14px; border-radius: 6px; flex: 1;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%);
    background-size: 200% 100%;
    animation: pv-shimmer 1.1s infinite;
}
@keyframes pv-shimmer { to { background-position: -200% 0; } }

/* ---------- Empty state ---------- */
.pv-empty { text-align: center; padding: 3rem 1.5rem; color: var(--pv-text-muted); }
.pv-empty .pv-empty-icon { font-size: 2.4rem; margin-bottom: .6rem; opacity: .5; }
.pv-empty h5 { color: var(--pv-text); }

/* ---------- Auth pages ---------- */
.pv-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%);
    padding: 2rem 1rem;
}
.pv-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--pv-surface);
    border-radius: var(--pv-radius-lg);
    box-shadow: var(--pv-shadow-lg);
    padding: 2.25rem;
}
.pv-auth-card.pv-auth-wide { max-width: 860px; }
.pv-auth-brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.25rem; }
.pv-auth-brand .pv-logo {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--pv-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Icons (Boxicons) ---------- */
.bx { vertical-align: -2px; }
.btn .bx { font-size: 1.05em; margin-right: .3rem; vertical-align: -2px; }
.btn-icon .bx { margin-right: 0; font-size: 1.1rem; }
.pv-sidebar-link .bx { font-size: 1.15rem; width: 1.35rem; text-align: center; }
.pv-stat-icon .bx { font-size: 1.4rem; }
.pv-toast .bx { font-size: 1.15rem; }

/* ---------- Full-height grids ---------- */
/* The content column stretches; a .pv-grid-card fills the remaining height and
   only the table area scrolls — no fixed heights, adapts to resize/zoom. */
.pv-content { display: flex; flex-direction: column; min-height: 0; }
.pv-grid-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pv-grid-host { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pv-grid-host .pv-table-wrap { flex: 1; overflow: auto; min-height: 0; }
.pv-grid-host .pv-empty { margin: auto; }
.pv-grid-host .pv-pagination { flex: none; border-top: 1px solid var(--pv-border); }

/* ---------- Signup stepper ---------- */
.pv-stepper { display: flex; gap: .5rem; margin-bottom: 1.75rem; }
.pv-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--pv-border);
    color: var(--pv-text-muted);
    font-size: .85rem;
    font-weight: 500;
}
.pv-step .pv-step-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #e2e8f0;
    color: var(--pv-text-muted);
    font-size: 1.05rem;
    flex: none;
}
.pv-step.active { background: var(--pv-primary-soft); border-color: var(--pv-primary); color: var(--pv-primary); }
.pv-step.active .pv-step-icon { background: var(--pv-primary); color: #fff; }
.pv-step.done { color: var(--pv-success); border-color: var(--pv-success); background: var(--pv-success-soft); }
.pv-step.done .pv-step-icon { background: var(--pv-success); color: #fff; }
.pv-step-panes { position: relative; overflow: hidden; }
.pv-step-pane { display: none; animation: pv-step-in .25s ease; }
.pv-step-pane.active { display: block; }
@keyframes pv-step-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@media (max-width: 575.98px) {
    .pv-step span.pv-step-label { display: none; }
    .pv-step { justify-content: center; }
}

/* ---------- Utilities ---------- */
.pv-muted { color: var(--pv-text-muted); }
.pv-fs-sm { font-size: .85rem; }
.pv-nowrap { white-space: nowrap; }
.pv-w-160 { width: 160px; }
.pv-gap-2 { gap: .5rem; }
.pv-mono { font-family: Consolas, monospace; font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .pv-main { margin-left: 0; }
    .pv-sidebar { transform: translateX(-100%); }
    .pv-sidebar.open { transform: translateX(0); }
    .pv-navbar .pv-burger { display: inline-flex; }
    .pv-sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1035;
    }
}
@media (max-width: 575.98px) {
    .pv-content { padding: 1rem; }
    .pv-modal-backdrop { padding: 1rem .5rem; }
    .pv-bar-label { width: 90px; }
}

/* ==================================================================
   Auth redesign (M-batch 2026-07-10): split-screen hero + form panel,
   icon inputs, password toggle, numbered stepper with connectors.
   ================================================================== */
.pv-auth {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--pv-body-bg);
    padding: 0;
}

/* Left hero panel */
.pv-auth-hero {
    display: none;
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    color: #f1f5f9;
    /* Slate overlay on top of the photo keeps the white copy readable;
       if the image is missing, the gradient alone still renders. */
    background:
        radial-gradient(1000px 500px at -10% -10%, rgba(255, 255, 255, .10), transparent 60%),
        linear-gradient(160deg, rgba(15, 23, 42, .82) 0%, rgba(30, 41, 59, .66) 55%, rgba(15, 23, 42, .80) 100%),
        url("../images/auth-hero.jpg") center / cover no-repeat,
        #1e293b;
    padding: 3rem 3.25rem;
    text-shadow: 0 1px 3px rgba(15, 23, 42, .45);
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
@media (min-width: 992px) { .pv-auth-hero { display: flex; } }
.pv-auth-hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -120px auto;
    width: 340px; height: 340px;
    border-radius: 36% 64% 58% 42% / 46% 39% 61% 54%;
    background: rgba(255, 255, 255, .07);
    pointer-events: none;
}
.pv-auth-hero .pv-auth-hero-brand { display: flex; align-items: center; gap: .7rem; font-weight: 800; font-size: 1.35rem; letter-spacing: .2px; }
.pv-auth-hero .pv-logo {
    width: 44px; height: 44px; border-radius: 10px; /* matches the sidebar logo tile */
    background: var(--pv-primary);
    color: #fff; font-size: 1.35rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.pv-auth-hero h2 { font-weight: 800; font-size: 1.9rem; line-height: 1.25; margin: 0 0 .75rem; color: #fff; }
.pv-auth-hero p.lead-line { color: #cbd5e1; font-size: 1rem; max-width: 40ch; }
.pv-auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-top: 1.1rem; }
.pv-auth-feature .bx {
    flex: none; width: 34px; height: 34px; border-radius: 9px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: #e2e8f0;
}
.pv-auth-feature strong { display: block; color: #fff; font-size: .95rem; }
.pv-auth-feature span { color: #cbd5e1; font-size: .85rem; }
.pv-auth-hero-foot { color: #94a3b8; font-size: .8rem; }

/* Right form panel */
.pv-auth-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.25rem;
    background:
        radial-gradient(600px 300px at 85% -10%, rgba(79, 70, 229, .07), transparent 60%),
        var(--pv-body-bg);
    overflow-y: auto;
}
.pv-auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius-lg);
    box-shadow: var(--pv-shadow-lg);
    padding: 2.5rem 2.5rem 2.1rem;
}
.pv-auth-card.pv-auth-wide { max-width: 880px; }
.pv-auth-brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.25rem; }
.pv-auth-brand .pv-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--pv-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
@media (min-width: 992px) { .pv-auth-card .pv-auth-brand { display: none; } } /* hero already carries the brand */
.pv-auth-title { font-weight: 800; letter-spacing: -.2px; }

/* Icon inputs + password toggle */
.pv-input-icon { position: relative; }
.pv-input-icon > .bx {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    color: var(--pv-text-muted); font-size: 1.05rem; pointer-events: none;
}
.pv-input-icon > .form-control, .pv-input-icon > .form-select { padding-left: 2.4rem; }
.pv-input-icon > .pv-pw-toggle {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--pv-text-muted);
    width: 34px; height: 34px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
}
.pv-input-icon > .pv-pw-toggle:hover { background: var(--pv-primary-soft); color: var(--pv-primary); }
.pv-auth .form-control, .pv-auth .form-select { padding-top: .6rem; padding-bottom: .6rem; border-radius: 10px; }
.pv-auth .form-label { font-weight: 600; font-size: .86rem; color: var(--pv-text); }
.pv-auth .field-validation-error { display: flex; align-items: center; gap: .25rem; font-weight: 500; }

/* Section intro inside signup steps */
.pv-step-intro { margin-bottom: 1.1rem; }
.pv-step-intro h6 { font-weight: 700; margin-bottom: .15rem; }
.pv-step-intro p { color: var(--pv-text-muted); font-size: .85rem; margin: 0; }

/* Numbered stepper with connectors (overrides the M4 chip stepper) */
.pv-stepper { display: flex; align-items: flex-start; gap: 0; margin-bottom: 1.9rem; }
.pv-step {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .45rem;
    padding: 0; border: 0; background: transparent; position: relative;
    font-size: .82rem; font-weight: 600; color: var(--pv-text-muted);
}
.pv-step:not(:first-child)::before {
    content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px;
    background: var(--pv-border); z-index: 0; transform: translateX(-18px);
}
.pv-step.active:not(:first-child)::before, .pv-step.done:not(:first-child)::before { background: var(--pv-primary); }
.pv-step .pv-step-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pv-surface); border: 2px solid var(--pv-border);
    color: var(--pv-text-muted); font-size: 1.05rem; z-index: 1;
    transition: all .2s ease;
}
.pv-step.active { color: var(--pv-primary); }
.pv-step.active .pv-step-icon {
    background: var(--pv-primary); border-color: var(--pv-primary); color: #fff;
    box-shadow: 0 0 0 5px var(--pv-primary-soft);
}
.pv-step.done { color: var(--pv-success); }
.pv-step.done .pv-step-icon { background: var(--pv-success); border-color: var(--pv-success); color: #fff; }

@media (max-width: 991.98px) {
    .pv-auth-panel { padding: 1.5rem .75rem; }
    .pv-auth-card { padding: 1.75rem 1.4rem; }
}

/* ==================================================================
   POS counter (2026-07-10): standalone billing screen under _PosLayout.
   Full-viewport grid, touch-first controls, sticky checkout, no admin chrome.
   ================================================================== */
.pv-pos-body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--pv-body-bg);
}

/* Top bar: brand + context chips + user actions. The only chrome the POS has. */
.pv-pos-topbar {
    height: 58px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    background: var(--pv-sidebar-bg);
    color: #e2e8f0;
}
.pv-pos-brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; }
.pv-pos-brand .pv-logo {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--pv-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.pv-pos-context { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; overflow: hidden; }
.pv-pos-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    padding: .3rem .8rem;
    font-size: .84rem;
    white-space: nowrap;
    max-width: 240px;
}
.pv-pos-chip span { overflow: hidden; text-overflow: ellipsis; }
.pv-pos-chip .bx { color: #94a3b8; flex: none; }
.pv-pos-chip-shift.open { background: rgba(22, 163, 74, .25); border-color: rgba(34, 197, 94, .5); }
.pv-pos-chip-shift.open .bx { color: #4ade80; }
.pv-pos-user { display: flex; align-items: center; gap: .5rem; }
.pv-pos-user .btn { display: inline-flex; align-items: center; gap: .35rem; }

/* Main split: cart (left, fluid) + payment rail (right, fixed) */
.pv-pos-main { flex: 1; min-height: 0; padding: .75rem; }
.pv-pos-grid {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: .75rem;
}
.pv-pos-left { display: flex; flex-direction: column; min-height: 0; gap: .6rem; }

.pv-pos-setup {
    flex: none;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    padding: .55rem .75rem;
}
.pv-pos-setup .form-select { width: 220px; }
.pv-pos-shift-note { margin-left: auto; font-size: .85rem; color: var(--pv-text-muted); }

/* Scanner row: the biggest control on screen; must always stay visible */
.pv-pos-scanrow { flex: none; display: flex; gap: .6rem; }
.pv-pos-scanwrap { position: relative; flex: 1; }
.pv-pos-scanwrap > .bx {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    font-size: 1.6rem; color: var(--pv-primary);
}
.pv-pos-scan {
    width: 100%;
    height: 64px;
    font-size: 1.25rem;
    padding: 0 1rem 0 3.25rem;
    border: 2px solid var(--pv-primary);
    border-radius: var(--pv-radius);
    background: var(--pv-surface);
    outline: none;
    box-shadow: 0 0 0 4px var(--pv-primary-soft);
}
.pv-pos-scan:disabled { border-color: var(--pv-border); box-shadow: none; background: #f8fafc; }
.pv-pos-scan:focus { box-shadow: 0 0 0 5px rgba(79, 70, 229, .25); }

/* Cart fills the remaining height and scrolls internally */
.pv-pos-cart {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
}
.pv-pos-cart-table thead th { position: sticky; top: 0; background: var(--pv-surface); z-index: 1; }
.pv-pos-cart-table tbody td { font-size: 1rem; padding: .55rem .75rem; }
.pv-pos-cart-table tbody tr.selected { background: var(--pv-primary-soft); box-shadow: inset 3px 0 0 var(--pv-primary); }
.pv-pos-cart-table .form-control { font-size: 1rem; }

/* Touch qty stepper */
.pv-pos-qty { display: inline-flex; align-items: stretch; gap: .25rem; }
.pv-pos-qty .btn {
    width: 40px; padding: 0; font-size: 1.15rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.pv-pos-qty input { width: 58px; text-align: center; -moz-appearance: textfield; }
.pv-pos-qty input::-webkit-outer-spin-button, .pv-pos-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Quick actions: large touch pads in one row */
.pv-pos-actions {
    flex: none;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
}
.pv-pos-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem;
    min-height: 64px;
    font-size: .82rem;
    line-height: 1.15;
    border: 1px solid var(--pv-border);
    text-align: center;
}
.pv-pos-btn .bx { font-size: 1.4rem; margin: 0; }
.pv-pos-scanrow .pv-pos-btn { min-width: 96px; min-height: 64px; }

/* Right rail */
.pv-pos-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: var(--pv-radius);
    overflow: hidden;
}
.pv-pos-payhead {
    flex: none;
    padding: .7rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--pv-border);
    display: flex; align-items: center; gap: .4rem;
}
.pv-pos-payscroll { flex: 1; min-height: 0; overflow-y: auto; padding: .9rem 1rem .3rem; }
.pv-pos-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pv-pos-methods .btn {
    border: 1.5px solid var(--pv-border);
    min-height: 58px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    font-size: .85rem;
}
.pv-pos-methods .btn .bx { font-size: 1.3rem; margin: 0; }
.pv-pos-methods .btn.active { border-color: var(--pv-primary); background: var(--pv-primary-soft); color: var(--pv-primary); font-weight: 700; }

/* Summary + sticky checkout: always visible, never scrolls away */
.pv-pos-summary {
    flex: none;
    border-top: 1px solid var(--pv-border);
    padding: .75rem 1rem .25rem;
    font-size: .95rem;
    display: flex; flex-direction: column; gap: .25rem;
}
.pv-pos-grand {
    display: flex; justify-content: space-between; align-items: baseline;
    font-weight: 800;
    font-size: 1.65rem;
    color: var(--pv-text);
    margin-top: .35rem;
    padding-top: .5rem;
    border-top: 2px dashed var(--pv-border);
}
.pv-pos-checkout {
    flex: none;
    margin: .75rem 1rem 1rem;
    min-height: 66px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .3px;
}
.pv-pos-checkout .bx { font-size: 1.4rem; }

/* Product-search modal rows (rendered by pos.js) */
.pv-pos-result {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--pv-border);
    border-radius: 10px;
    background: var(--pv-surface);
    margin-bottom: .45rem;
    text-align: left;
}
.pv-pos-result:hover { border-color: var(--pv-primary); background: var(--pv-primary-soft); }

/* Responsive: rail drops below the cart on narrow screens/tablets (portrait) */
@media (max-width: 1199.98px) {
    .pv-pos-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; overflow-y: auto; }
    .pv-pos-body { overflow: auto; }
    .pv-pos-right { max-height: none; }
    .pv-pos-actions { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 575.98px) {
    .pv-pos-setup .form-select { width: 100%; }
    .pv-pos-actions { grid-template-columns: repeat(2, 1fr); }
    .pv-pos-context { display: none; }
}
/* ---------- Sidebar scrollbar: dark thumb on the dark sidebar (global rules at the top) ---------- */
.pv-sidebar-nav::-webkit-scrollbar-thumb { background-color: #334155; }
.pv-sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: var(--pv-primary); }
@supports not selector(::-webkit-scrollbar) {
    .pv-sidebar-nav { scrollbar-color: #334155 transparent; }
}


.pv-nav-tabs.nav-pills .nav-link {
    color: var(--pv-text-muted);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
}

    .pv-nav-tabs.nav-pills .nav-link:hover {
        color: var(--pv-primary);
        background-color: var(--pv-primary-soft);
    }

    .pv-nav-tabs.nav-pills .nav-link.active {
        color: #fff;
        background-color: var(--pv-primary);
        border-color: var(--pv-primary);
    }

/* ---------- Permission accordion (Roles module, M17) ---------- */
.pv-perm-group {
    border: 1px solid var(--pv-border);
    border-radius: .5rem;
    margin-bottom: .75rem;
    background: var(--pv-surface);
    overflow: hidden;
}

.pv-perm-group-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .9rem;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
}

.pv-perm-group-icon {
    font-size: 1.15rem;
    color: var(--pv-primary);
}

.pv-perm-group-title { font-weight: 600; }

.pv-perm-chevron { transition: transform .18s ease; font-size: 1.2rem; }

.pv-perm-group.collapsed .pv-perm-chevron { transform: rotate(180deg); }

.pv-perm-group.collapsed .pv-perm-group-body { display: none; }

.pv-perm-group-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .25rem .75rem;
    padding: .6rem .9rem .8rem;
}

.pv-perm-item {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .4rem .5rem;
    border-radius: .4rem;
    margin: 0;
    cursor: pointer;
}

.pv-perm-item:hover { background: var(--pv-primary-soft); }

.pv-perm-item .form-check-input { margin-top: .2rem; flex-shrink: 0; }

.pv-perm-item.d-none-search { display: none; }

/* ---------- Custom controls: searchable dropdown + date picker (controls.js) ---------- */
/* The native element stays in the form (posted + validated) but is visually hidden.
   1px, not display:none — jquery-validation skips :hidden fields. */
.pv-native {
    position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important;
    margin: -1px !important; padding: 0 !important; border: 0 !important;
    opacity: 0 !important; overflow: hidden !important; clip-path: inset(50%) !important; pointer-events: none !important;
}

/* Trigger button — carries the select's own classes (.form-select, -sm, widths). */
.pv-sel {
    text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.5; padding-right: 2.25rem; cursor: pointer;
    background-color: var(--pv-surface); color: var(--pv-text);
}
.pv-sel:disabled { cursor: default; background-color: #f1f5f9; color: var(--pv-text-muted); }
.pv-sel-empty { color: var(--pv-text-muted); }
.pv-sel.open, .pv-date-input.open { border-color: var(--pv-primary); box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12); }

.pv-date-input {
    padding-right: 2.25rem; cursor: pointer;
    background: var(--pv-surface) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2'/%3e%3cpath d='M16 2v4M8 2v4M3 10h18'/%3e%3c/svg%3e") no-repeat right .75rem center / 16px 16px;
}
.pv-date-input:disabled, .pv-date-input[readonly] { cursor: default; background-color: #f1f5f9; }

/* Floating panel (appended to <body>, position:fixed — never clipped by modals/tables). */
.pv-dd {
    position: fixed; z-index: 1070; display: flex; flex-direction: column;
    background: var(--pv-surface); border: 1px solid var(--pv-border); border-radius: 10px;
    box-shadow: var(--pv-shadow-lg); overflow: hidden; font-size: .9rem; color: var(--pv-text);
    animation: pv-dd-in .12s ease-out;
}
@keyframes pv-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.pv-dd-search { position: relative; padding: .5rem; border-bottom: 1px solid var(--pv-border); flex-shrink: 0; }
.pv-dd-search .bx { position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%); color: var(--pv-text-muted); }
.pv-dd-search .form-control { padding-left: 2rem; }
.pv-dd-list { overflow-y: auto; padding: .3rem; min-height: 0; flex: 1 1 auto; }
.pv-dd-opt { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-radius: 6px; cursor: pointer; user-select: none; }
.pv-dd-opt.active { background: var(--pv-primary-soft); }
.pv-dd-opt.selected { color: var(--pv-primary); font-weight: 600; }
.pv-dd-opt.disabled { opacity: .45; cursor: not-allowed; }
.pv-dd-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pv-dd-tick { font-size: 1.1rem; visibility: hidden; }
.pv-dd-opt.selected .pv-dd-tick { visibility: visible; }
.pv-dd-box {
    width: 16px; height: 16px; flex-shrink: 0; border: 1.5px solid #cbd5e1; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
}
.pv-dd-opt.selected .pv-dd-box { background: var(--pv-primary); border-color: var(--pv-primary); }
.pv-dd-opt.selected .pv-dd-box::after {
    content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0;
    transform: translateY(-1px) rotate(-45deg);
}
.pv-dd-group { padding: .55rem .6rem .2rem; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--pv-text-muted); }
.pv-dd-empty { padding: .7rem .6rem; color: var(--pv-text-muted); font-size: .85rem; text-align: center; }

/* Calendar */
.pv-dd-cal { padding: .75rem; }
.pv-cal-head { display: flex; align-items: center; justify-content: space-between; gap: .25rem; margin-bottom: .5rem; }
.pv-cal-nav, .pv-cal-title { border: 0; background: none; border-radius: 8px; color: var(--pv-text); }
.pv-cal-nav { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.pv-cal-title { font-weight: 600; padding: .3rem .6rem; }
.pv-cal-nav:hover, .pv-cal-title:not(:disabled):hover { background: var(--pv-primary-soft); color: var(--pv-primary); }
.pv-cal-title:disabled { color: var(--pv-text); }
.pv-cal-grid { display: grid; gap: 2px; }
.pv-cal-days { grid-template-columns: repeat(7, 1fr); }
.pv-cal-months, .pv-cal-years { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pv-cal-dow { text-align: center; font-size: .72rem; font-weight: 600; color: var(--pv-text-muted); padding: .2rem 0; }
.pv-cal-day, .pv-cal-cell { border: 0; background: none; border-radius: 8px; color: var(--pv-text); font-size: .85rem; }
.pv-cal-day { height: 34px; }
.pv-cal-cell { height: 44px; }
.pv-cal-day:hover:not(:disabled), .pv-cal-cell:hover:not(:disabled), .pv-cal-day.active { background: var(--pv-primary-soft); }
.pv-cal-day.other { color: #94a3b8; }
.pv-cal-day.today, .pv-cal-cell.today { box-shadow: inset 0 0 0 1px var(--pv-primary); }
.pv-cal-day.selected, .pv-cal-cell.selected { background: var(--pv-primary); color: #fff; font-weight: 600; }
.pv-cal-day:disabled { opacity: .3; cursor: not-allowed; }
.pv-cal-foot { display: flex; justify-content: space-between; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--pv-border); }