/* ==========================================================
   RVT Employee Experience v2 — Modern Full-Screen UI
   ========================================================== */

:root {
    --rvt-bg: #0b1220;
    --rvt-bg-2: #111a2e;
    --rvt-surface: #ffffff;
    --rvt-surface-2: #f6f8fb;
    --rvt-text: #0f172a;
    --rvt-text-muted: #5b6576;
    --rvt-border: #e4e8ef;

    --rvt-accent: #6FAE2C;
    --rvt-accent-dark: #5B9225;
    --rvt-accent-soft: #8DC63F;
    --rvt-accent-glow: rgba(111, 174, 44, 0.35);

    --rvt-sidebar: #0f172a;
    --rvt-sidebar-2: #111f3d;
    --rvt-sidebar-hover: rgba(255, 255, 255, 0.07);
    --rvt-sidebar-active: linear-gradient(135deg, #6FAE2C 0%, #8DC63F 100%);

    --rvt-danger: #ef4444;
    --rvt-warn: #f59e0b;
    --rvt-info: #3b82f6;

    --rvt-radius: 16px;
    --rvt-radius-sm: 10px;
    --rvt-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    --rvt-shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.20);

    --rvt-sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--rvt-text);
    background: var(--rvt-surface-2);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--rvt-accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================
   LOGIN SCREEN — full-screen gradient, glass card
   ========================================================== */

.rvt-login-body {
    min-height: 100vh;
    margin: 0;
    background:
      radial-gradient(1200px 800px at 10% 10%, rgba(111, 174, 44, 0.22) 0%, transparent 50%),
      radial-gradient(1200px 800px at 90% 90%, rgba(59, 130, 246, 0.15) 0%, transparent 55%),
      linear-gradient(135deg, #0b1220 0%, #111a2e 50%, #1a2540 100%);
    background-attachment: fixed;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.rvt-login-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.rvt-login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 24px;
    box-shadow: var(--rvt-shadow-lg);
    padding: 44px 40px 36px;
    animation: rvt-fade-in 0.5s ease;
}

@keyframes rvt-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rvt-login-logo {
    text-align: center;
    margin-bottom: 20px;
}
.rvt-login-logo img {
    max-width: 240px;
    max-height: 80px;
    width: auto;
    height: auto;
    filter: drop-shadow(0 6px 20px rgba(111, 174, 44, 0.35));
}

.rvt-login-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    text-align: center;
    letter-spacing: -0.02em;
}
.rvt-login-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    margin: 0 0 28px;
}

.rvt-field {
    margin-bottom: 16px;
}
.rvt-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.rvt-field input,
.rvt-field select,
.rvt-field textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 13px 14px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.rvt-field input::placeholder,
.rvt-field textarea::placeholder {
    color: rgba(255, 255, 255, 0.40);
}
.rvt-field input:focus,
.rvt-field select:focus,
.rvt-field textarea:focus {
    border-color: var(--rvt-accent);
    background: rgba(255, 255, 255, 0.10);
    box-shadow: 0 0 0 4px var(--rvt-accent-glow);
}
.rvt-field select option { color: #0f172a; }

/* Required-field validation state */
.rvt-field-invalid > input,
.rvt-field-invalid > select,
.rvt-field-invalid > textarea,
.rvt-field-invalid input,
.rvt-field-invalid select,
.rvt-field-invalid textarea {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}
.rvt-field-invalid > label,
.rvt-field-invalid label {
    color: #ef4444 !important;
}
.rvt-field-error {
    display: block;
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}
.rvt-required-shake {
    animation: rvtRequiredShake 0.35s ease-in-out;
}
@keyframes rvtRequiredShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

.rvt-remember {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 2px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    user-select: none;
}
.rvt-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--rvt-accent);
    cursor: pointer;
    flex: none;
    margin: 0;
}
.rvt-remember:hover { color: rgba(255, 255, 255, 0.95); }

.rvt-login-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}
.rvt-login-actions .rvt-btn { flex: 1; }

.rvt-login-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.rvt-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.30);
    color: #fca5a5;
}
.rvt-alert.success {
    background: rgba(111, 174, 44, 0.14);
    border-color: rgba(111, 174, 44, 0.32);
    color: #bef264;
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.rvt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.rvt-btn:active { transform: translateY(1px); }

.rvt-btn-primary {
    background: linear-gradient(135deg, var(--rvt-accent) 0%, var(--rvt-accent-soft) 100%);
    color: #0c1a05;
    box-shadow: 0 8px 24px rgba(111, 174, 44, 0.30);
}
.rvt-btn-primary:hover {
    box-shadow: 0 10px 30px rgba(111, 174, 44, 0.45);
}

.rvt-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
}
.rvt-btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.rvt-btn-dark {
    background: #1f2937;
    color: #fff;
}
.rvt-btn-dark:hover { background: #111827; }

.rvt-btn-secondary {
    background: var(--rvt-surface-2);
    color: var(--rvt-text);
    border-color: var(--rvt-border);
}
.rvt-btn-secondary:hover { background: #eef1f6; }

.rvt-btn-danger {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.30);
}
.rvt-btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

.rvt-btn-warning {
    background: rgba(245, 158, 11, 0.10);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.30);
}
.rvt-btn-warning:hover { background: rgba(245, 158, 11, 0.18); }

.rvt-btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
    gap: 6px;
}

.rvt-btn-icon {
    padding: 8px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
}

/* Keyboard toggle next to scan inputs (kiosk: inputmode="none" by default,
   tap this to temporarily enable the on-screen keyboard for manual lookup).
   Requires the scanner to be in EmuKey mode so raw key events bypass the IME. */
.rvt-kbd-btn { padding: 0 14px; flex-shrink: 0; }
.rvt-kbd-btn.active {
    background: var(--rvt-accent);
    color: #fff;
    border-color: var(--rvt-accent);
}

.rvt-select {
    height: 52px;
    padding: 0 32px 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--rvt-text);
    background-color: var(--rvt-surface-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6576' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    border: 1px solid var(--rvt-border);
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.rvt-select:focus {
    border-color: var(--rvt-accent);
    box-shadow: 0 0 0 3px var(--rvt-accent-glow);
}

.rvt-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ==========================================================
   APP SHELL — full-screen sidebar + content
   ========================================================== */

.rvt-app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.rvt-sidebar {
    width: var(--rvt-sidebar-w);
    height: 100vh;
    height: 100dvh; /* dynamic viewport height — handles mobile address-bar shrink */
    max-height: 100vh;
    max-height: 100dvh;
    background: linear-gradient(180deg, var(--rvt-sidebar) 0%, var(--rvt-sidebar-2) 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 50;
    overflow: hidden;
}

.rvt-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 6px 22px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.rvt-brand img { max-width: 180px; max-height: 50px; width: auto; height: auto; }

.rvt-nav {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
    overscroll-behavior: contain;       /* don't let the scroll chain to body */
    /* subtle scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
    /* room for scrollbar without clipping active-state pills */
    padding-right: 4px;
    margin-right: -4px;
    /* breathing room so the last item is fully reachable above the user card */
    padding-bottom: 24px;
}
.rvt-nav::-webkit-scrollbar { width: 6px; }
.rvt-nav::-webkit-scrollbar-track { background: transparent; }
.rvt-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }
.rvt-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.32); }

.rvt-brand, .rvt-sidebar-bottom { flex: 0 0 auto; }

.rvt-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, transform 0.08s;
}
.rvt-nav a i { width: 20px; text-align: center; font-size: 15px; }
.rvt-nav a:hover {
    background: var(--rvt-sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.rvt-nav a.active {
    background: var(--rvt-sidebar-active);
    color: #0c1a05;
    box-shadow: 0 8px 20px rgba(111, 174, 44, 0.30);
}

.rvt-sidebar-bottom {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rvt-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}
.rvt-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rvt-accent) 0%, var(--rvt-accent-soft) 100%);
    color: #0c1a05;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px;
    flex-shrink: 0;
}
.rvt-user-meta { min-width: 0; }
.rvt-user-meta .name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rvt-user-meta .role { font-size: 11px; color: rgba(255, 255, 255, 0.55); text-transform: uppercase; letter-spacing: 0.04em; }

.rvt-logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.30);
    color: #fca5a5;
}
.rvt-logout:hover { background: rgba(239, 68, 68, 0.20); }

/* Sidebar collapse / expand toggle — sits in the top-right corner of .rvt-brand
   on desktop only (hidden on mobile where the hamburger handles open/close). */
.rvt-brand { position: relative; }
.rvt-sidebar-collapse-btn {
    position: absolute;
    top: 6px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--rvt-sidebar-2, #111f3d);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    z-index: 2;
}
.rvt-sidebar-collapse-btn:hover {
    background: var(--rvt-accent, #6FAE2C);
    color: #0c1a05;
    transform: scale(1.05);
}
.rvt-sidebar-collapse-btn .rvt-sb-expand-icon { display: none; }
.rvt-sb-collapsed .rvt-sidebar-collapse-btn .rvt-sb-collapse-icon { display: none; }
.rvt-sb-collapsed .rvt-sidebar-collapse-btn .rvt-sb-expand-icon { display: inline-block; }

/* ==========================================================
   COLLAPSED SIDEBAR (desktop only; mobile uses overlay open/close)
   Toggled by <html class="rvt-sb-collapsed">. Width shrinks to a
   compact 72px and only icons remain visible; nav-group bodies hide
   entirely; the user card collapses to just the avatar; .rvt-main's
   left margin shrinks to match.
   ========================================================== */
@media (min-width: 1367px) {
    .rvt-sb-collapsed { --rvt-sidebar-w: 72px; }

    .rvt-sb-collapsed .rvt-sidebar {
        padding: 18px 8px;
    }
    .rvt-sb-collapsed .rvt-brand {
        padding: 6px 0 16px;
        margin-bottom: 6px;
        overflow: hidden;
    }
    .rvt-sb-collapsed .rvt-brand img {
        max-width: 44px;
        max-height: 38px;
    }
    .rvt-sb-collapsed .rvt-sidebar-collapse-btn {
        top: 4px;
        right: 4px;
    }

    /* Nav links: keep icon centered, hide the text label, show a hover tooltip. */
    .rvt-sb-collapsed .rvt-nav a {
        justify-content: center;
        padding: 12px 8px;
        gap: 0;
        font-size: 0; /* hides text without removing it; icon stays visible because <i> font-size is set explicitly */
        position: relative;
    }
    .rvt-sb-collapsed .rvt-nav a i {
        font-size: 17px;
    }
    .rvt-sb-collapsed .rvt-nav a:hover::after {
        content: attr(aria-label);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: #fff;
        padding: 6px 10px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        z-index: 100;
        box-shadow: 0 4px 12px rgba(0,0,0,0.25);
        pointer-events: none;
    }
    /* Hide nav-group toggles (their bodies live behind them) and any divider/label
       which is just decoration. The flat links above still cover Dashboard/Check-in/etc. */
    .rvt-sb-collapsed .rvt-nav-group,
    .rvt-sb-collapsed .rvt-nav-divider,
    .rvt-sb-collapsed .rvt-nav-label {
        display: none;
    }

    /* User card collapses to the avatar only. */
    .rvt-sb-collapsed .rvt-user-card {
        padding: 8px;
        justify-content: center;
        gap: 0;
    }
    .rvt-sb-collapsed .rvt-user-meta { display: none; }

    /* Main content area shifts to match the new sidebar width. */
    .rvt-sb-collapsed .rvt-main {
        margin-left: 72px;
    }
}

/* Content area */
.rvt-main {
    margin-left: var(--rvt-sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--rvt-surface-2);
}

.rvt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: var(--rvt-surface);
    border-bottom: 1px solid var(--rvt-border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.rvt-topbar-left { display: flex; align-items: center; gap: 14px; }
.rvt-topbar h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}
.rvt-topbar-right { display: flex; align-items: center; gap: 10px; }

/* Global search in topbar (admin) */
.rvt-topbar-search input::placeholder { color: var(--rvt-text-muted); }
.rvt-topbar-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(111,174,44,0.15); }

/* Notification bell hover */
.rvt-notif-btn:hover { background: var(--rvt-border) !important; }
.rvt-notif-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(111,174,44,0.18); }

@media (max-width: 900px) {
    /* Hide global search on narrow screens — available via menu/sidebar instead */
    .rvt-topbar-search { display: none; }
    .rvt-notif-dropdown { width: 320px !important; right: -80px !important; }
}

.rvt-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--rvt-surface-2);
    border: 1px solid var(--rvt-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--rvt-text-muted);
}
.rvt-chip i { color: var(--rvt-accent); }

.rvt-topbar-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #b91c1c;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.rvt-topbar-logout:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.rvt-topbar-logout i { font-size: 13px; }

.rvt-hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--rvt-text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

.rvt-content {
    flex: 1;
    padding: 32px;
    /* No max-width cap so data-heavy pages (Voucher Distribution,
       Fulfillment, Reports, etc.) get every pixel of column width
       available on modern wide / ultrawide displays. The 32px side
       padding still gives breathing room from the viewport edge.
       Text-heavy pages (manuals, forms) handle their own internal
       max-width via per-card styling. */
    width: 100%;
}

/* ==========================================================
   CARDS / PANELS
   ========================================================== */

.rvt-card {
    background: var(--rvt-surface);
    border: 1px solid var(--rvt-border);
    border-radius: var(--rvt-radius);
    box-shadow: var(--rvt-shadow);
    padding: 28px;
}
.rvt-card + .rvt-card { margin-top: 20px; }

.rvt-card h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 18px;
    letter-spacing: -0.01em;
}

.rvt-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.rvt-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.rvt-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.rvt-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
}

/* Light theme field overrides inside main content */
.rvt-main .rvt-field label {
    color: var(--rvt-text);
}
.rvt-main .rvt-field input,
.rvt-main .rvt-field select,
.rvt-main .rvt-field textarea {
    background: var(--rvt-surface-2);
    border-color: var(--rvt-border);
    color: var(--rvt-text);
}
.rvt-main .rvt-field input::placeholder,
.rvt-main .rvt-field textarea::placeholder {
    color: #9ca3af;
}
.rvt-main .rvt-field input:focus,
.rvt-main .rvt-field select:focus,
.rvt-main .rvt-field textarea:focus {
    background: #fff;
}
.rvt-main .rvt-btn-ghost {
    background: var(--rvt-surface-2);
    color: var(--rvt-text);
    border-color: var(--rvt-border);
}
.rvt-main .rvt-btn-ghost:hover { background: #eef1f6; }

/* ==========================================================
   DASHBOARD
   ========================================================== */

.rvt-stat {
    background: var(--rvt-surface);
    border: 1px solid var(--rvt-border);
    border-radius: var(--rvt-radius);
    box-shadow: var(--rvt-shadow);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.rvt-stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--rvt-accent) 0%, var(--rvt-accent-soft) 100%);
    color: #0c1a05;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
a.rvt-stat {
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s, box-shadow 0.15s;
    cursor: pointer;
}
a.rvt-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    text-decoration: none;
}

.rvt-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--rvt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rvt-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--rvt-text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.rvt-stat-sub {
    font-size: 11px;
    color: var(--rvt-text-muted);
    margin-top: 2px;
    font-weight: 500;
}
.rvt-stat-body { flex: 1; min-width: 0; }

/* Report sidebar */
.rvt-report-link:hover { background: var(--rvt-surface-2); }

/* Preset / action button row — equal-width grid that wraps evenly */
.rvt-preset-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.rvt-preset-btn {
    width: auto;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .rvt-preset-btn { padding: 9px 10px !important; font-size: 12px !important; }
}

/* Reports page layout: 2-col on desktop, collapses on tablet/mobile */
.rvt-report-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
    min-width: 0;
}
.rvt-report-layout > * { min-width: 0; }
.rvt-report-sidebar {
    padding: 14px 0;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

@media (max-width: 1100px) {
    .rvt-report-layout {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }
    .rvt-report-sidebar {
        position: static !important;
        padding: 6px !important;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    /* Hide category headers on tablet/mobile — the chip row is flat */
    .rvt-report-sidebar > div:not([class]) { display: none !important; }
    /* Pills instead of full-width rows */
    .rvt-report-sidebar .rvt-report-link {
        flex: 0 0 auto !important;
        padding: 8px 14px !important;
        border-left: none !important;
        border-radius: 999px !important;
        border: 1px solid var(--rvt-border) !important;
        background: var(--rvt-surface) !important;
        white-space: nowrap !important;
        font-size: 12px !important;
        color: var(--rvt-text) !important;
        font-weight: 600 !important;
    }
    .rvt-report-sidebar .rvt-report-link.active {
        background: var(--rvt-accent) !important;
        color: #fff !important;
        border-color: var(--rvt-accent) !important;
    }
    .rvt-report-sidebar .rvt-report-link.active span {
        color: #fff !important;
    }
    /* Shrink KPI grid & table padding on narrow screens */
    .rvt-grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .rvt-table th, .rvt-table td { padding: 8px 10px !important; font-size: 12px !important; }
    .rvt-filter-bar { padding: 12px !important; gap: 8px !important; }
    .rvt-filter-bar .rvt-field { min-width: 120px !important; }
}

@media (max-width: 600px) {
    /* Keep KPIs at 2 per row on phones so the summary isn't a long scroll */
    .rvt-grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .rvt-stat {
        padding: 10px !important;
        gap: 10px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .rvt-stat-icon { width: 32px !important; height: 32px !important; font-size: 13px !important; border-radius: 9px !important; }
    .rvt-stat-value { font-size: 16px !important; }
    .rvt-stat-label { font-size: 9px !important; }
    .rvt-stat-sub { font-size: 10px !important; }
    /* Chart — smaller on phones */
    #dailyChart { max-height: 200px !important; }
}

/* ==========================================================
   TABLES
   ========================================================== */

.rvt-table-wrap {
    background: var(--rvt-surface);
    border: 1px solid var(--rvt-border);
    border-radius: var(--rvt-radius);
    box-shadow: var(--rvt-shadow);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.rvt-table { width: 100%; border-collapse: collapse; }
.rvt-table th, .rvt-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--rvt-border);
    font-size: 14px;
}
.rvt-table th {
    background: var(--rvt-surface-2);
    font-size: 12px;
    font-weight: 700;
    color: var(--rvt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rvt-table tr:last-child td { border-bottom: none; }
.rvt-table tbody tr:hover { background: #fafbfd; }

.rvt-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(111, 174, 44, 0.12);
    color: var(--rvt-accent-dark);
    border: 1px solid rgba(111, 174, 44, 0.25);
}
.rvt-pill.warn { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.30); }
.rvt-pill.info { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.30); }
.rvt-pill.danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; border-color: rgba(239, 68, 68, 0.30); }

.rvt-empty {
    padding: 40px;
    text-align: center;
    color: var(--rvt-text-muted);
}
.rvt-empty i { font-size: 40px; margin-bottom: 12px; color: #cbd5e1; display: block; }

/* ==========================================================
   NAV DIVIDER & LABEL (Admin/Client sections)
   ========================================================== */

.rvt-nav-divider {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rvt-nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.40);
    padding: 0 14px;
    margin-bottom: 4px;
    font-weight: 700;
}

/* Collapsible nav groups (admin sidebar) */
.rvt-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
}
.rvt-nav-group:first-of-type { margin-top: 4px; }
.rvt-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.92);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}
.rvt-nav-group-toggle > span {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}
.rvt-nav-group-toggle > span > i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.95;
}
.rvt-nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
}
.rvt-nav-chevron {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.rvt-nav-group.collapsed .rvt-nav-chevron {
    transform: rotate(-90deg);
}
.rvt-nav-group-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 800px;
    transition: max-height 0.22s ease;
}
.rvt-nav-group.collapsed .rvt-nav-group-body {
    max-height: 0;
}
/* Children of a nav-group: smaller text, indented past where the parent icon
   sits, no per-link icons (only the parent header carries the icon). */
.rvt-nav-group-body > a {
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: 46px;
    font-size: 13px;
    font-weight: 500;
}
.rvt-nav-group-body > a i { display: none; }

/* ==========================================================
   MODAL SYSTEM
   ========================================================== */

.rvt-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.rvt-modal-backdrop.open {
    display: flex;
}

.rvt-modal {
    background: var(--rvt-surface);
    border-radius: var(--rvt-radius);
    box-shadow: var(--rvt-shadow-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: rvt-fade-in 0.2s ease;
}

.rvt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--rvt-border);
}
.rvt-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}
.rvt-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--rvt-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.rvt-modal-close:hover { background: var(--rvt-surface-2); }

.rvt-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.rvt-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--rvt-border);
}

/* ==========================================================
   TABS
   ========================================================== */

.rvt-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--rvt-border);
    margin-bottom: 20px;
}

.rvt-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--rvt-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.rvt-tab:hover { color: var(--rvt-text); }
.rvt-tab.active {
    color: var(--rvt-accent-dark);
    border-bottom-color: var(--rvt-accent);
}

.rvt-tab-content {
    display: none;
}
.rvt-tab-content.active {
    display: block;
}

/* ==========================================================
   FILTER BAR
   ========================================================== */

.rvt-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 16px 20px;
    background: var(--rvt-surface-2);
    border: 1px solid var(--rvt-border);
    border-radius: var(--rvt-radius-sm);
    margin-bottom: 18px;
}

.rvt-filter-bar .rvt-field {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.rvt-filter-bar .rvt-field label {
    font-size: 11px;
    margin-bottom: 4px;
}

.rvt-filter-bar .rvt-field input,
.rvt-filter-bar .rvt-field select {
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* ==========================================================
   TOAST NOTIFICATIONS
   ========================================================== */

.rvt-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rvt-toast {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #1f2937;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: rvt-fade-in 0.2s ease;
    max-width: 380px;
}
.rvt-toast.success { background: #166534; }
.rvt-toast.error { background: #991b1b; }
.rvt-toast.warning { background: #92400e; }

/* ==========================================================
   CONFIRM DIALOG
   ========================================================== */

.rvt-confirm-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    align-items: center;
    justify-content: center;
}
.rvt-confirm-backdrop.open { display: flex; }

.rvt-confirm-dialog {
    background: var(--rvt-surface);
    border-radius: var(--rvt-radius);
    box-shadow: var(--rvt-shadow-lg);
    padding: 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.rvt-confirm-dialog p {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--rvt-text);
}
.rvt-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ==========================================================
   DATATABLES OVERRIDES
   ========================================================== */

.rvt-table-wrap .dataTables_wrapper {
    padding: 0;
}
.rvt-table-wrap .dataTables_filter {
    padding: 14px 18px 0;
}
.rvt-table-wrap .dataTables_filter input {
    background: var(--rvt-surface-2);
    border: 1px solid var(--rvt-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--rvt-text);
    outline: none;
    margin-left: 8px;
}
.rvt-table-wrap .dataTables_filter input:focus {
    border-color: var(--rvt-accent);
    box-shadow: 0 0 0 3px var(--rvt-accent-glow);
}
.rvt-table-wrap .dataTables_length {
    padding: 14px 18px 0;
}
.rvt-table-wrap .dataTables_length select {
    background: var(--rvt-surface-2);
    border: 1px solid var(--rvt-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--rvt-text);
}
.rvt-table-wrap .dataTables_info {
    padding: 14px 18px;
    font-size: 12px;
    color: var(--rvt-text-muted);
}
.rvt-table-wrap .dataTables_paginate {
    padding: 10px 18px 14px;
    text-align: right;
}
.rvt-table-wrap .dataTables_paginate .paginate_button {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--rvt-text-muted);
    border: 1px solid var(--rvt-border);
    background: var(--rvt-surface);
    transition: background 0.15s;
}
.rvt-table-wrap .dataTables_paginate .paginate_button:hover {
    background: var(--rvt-surface-2);
}
.rvt-table-wrap .dataTables_paginate .paginate_button.current {
    background: var(--rvt-accent);
    color: #0c1a05;
    border-color: var(--rvt-accent);
    font-weight: 700;
}
.rvt-table-wrap .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: default;
}

/* ==========================================================
   CHART CONTAINER
   ========================================================== */

/* When a card contains a chart, let it flex so the chart can fill remaining height */
.rvt-card:has(> .rvt-chart-wrap) {
    display: flex;
    flex-direction: column;
}
.rvt-card:has(> .rvt-chart-wrap) > .rvt-chart-wrap {
    flex: 1;
}

.rvt-chart-wrap {
    position: relative;
    width: 100%;
    height: 300px;
    min-height: 220px;
}
.rvt-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
}
@media (max-width: 768px) {
    .rvt-chart-wrap { height: 240px; min-height: 200px; }
}
@media (max-width: 480px) {
    .rvt-chart-wrap { height: 200px; min-height: 180px; }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1024px) {
    .rvt-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .rvt-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .rvt-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 1366px) {
    .rvt-hamburger { display: inline-flex; }
    .rvt-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .rvt-sidebar.open { transform: translateX(0); }
    .rvt-main { margin-left: 0; min-width: 0; max-width: 100%; }
    .rvt-content { padding: 14px; max-width: 100%; }
    .rvt-topbar {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .rvt-topbar h1 { font-size: 17px; }
    .rvt-topbar-right { flex-wrap: wrap; gap: 6px; }
    .rvt-chip {
        padding: 5px 10px;
        font-size: 11px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* Keep KPI cards 2-per-row on mobile for density */
    .rvt-grid-4, .rvt-grid-5 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .rvt-grid-2, .rvt-grid-3 { grid-template-columns: 1fr; gap: 12px; }
    .rvt-card { padding: 16px; }
    .rvt-card h2 { font-size: 16px; margin-bottom: 14px; }
    /* Stack stat content vertically so 2-col cards fit nicely */
    .rvt-stat {
        padding: 14px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    .rvt-stat-icon { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }
    .rvt-stat-value { font-size: 22px; }
    .rvt-stat-label { font-size: 10px; }
    .rvt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .rvt-card .rvt-table { display: block; overflow-x: auto; white-space: nowrap; }
    .rvt-sidebar-backdrop {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
    }
    .rvt-sidebar-backdrop.open { display: block; }
}

/* ==========================================================
   PHONES: Stack data tables as cards (no horizontal scroll)
   ========================================================== */
@media (max-width: 768px) {
    .rvt-table-wrap { overflow-x: visible; }
    .rvt-card .rvt-table,
    .rvt-table {
        display: block;
        overflow-x: visible;
        white-space: normal;
        border: none;
        background: transparent;
    }
    .rvt-table thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px; height: 1px;
        overflow: hidden;
    }
    .rvt-table tbody { display: block; }
    .rvt-table tbody tr {
        display: block;
        background: var(--rvt-surface);
        border: 1px solid var(--rvt-border);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 4px 0;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }
    .rvt-table tbody tr:hover { background: var(--rvt-surface); }
    .rvt-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center;
        gap: 12px;
        padding: 10px 14px !important;
        border: none !important;
        border-bottom: 1px solid var(--rvt-border) !important;
        text-align: left !important;
        white-space: normal;
        width: auto !important;
        min-width: 0;
    }
    .rvt-table tbody tr td:last-child { border-bottom: none !important; }
    .rvt-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 10.5px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--rvt-text-muted);
        flex: 0 0 auto;
        max-width: 42%;
        word-break: break-word;
    }
    .rvt-table tbody td[data-label=""]::before,
    .rvt-table tbody td:not([data-label])::before {
        display: none;
    }
    /* Action / button cells: let buttons take full width on the right */
    .rvt-table tbody td .rvt-actions {
        flex: 1;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }
    .rvt-table tbody td > .rvt-btn {
        margin-left: auto;
    }
    /* "Loading..." rows that span all columns */
    .rvt-table tbody td[colspan] {
        justify-content: center;
        text-align: center !important;
    }
    .rvt-table tbody td[colspan]::before { display: none; }

    /* Fitting page: per-row Delete button stretches to full row width on mobile
       so it's an easy thumb target on the kiosk. */
    .ft-remove-btn {
        width: 100%;
        flex: 1;
        margin-left: 0 !important;
        justify-content: center;
        padding: 12px 14px;
        font-size: 14px;
    }
    /* Inputs/selects inside the mobile card sit to the right of the label;
       give them flexible width instead of width:100% so they don't overflow. */
    .rvt-table .ft-rating-select,
    .rvt-table .ft-notes-input {
        width: auto !important;
        flex: 1 1 0;
        min-width: 0;
        max-width: 56%;
    }
    .rvt-table .ft-qty-input {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .rvt-content { padding: 10px; }
    .rvt-card { padding: 14px; }
    .rvt-topbar { padding: 8px 12px; }
    .rvt-topbar h1 { font-size: 16px; }
    .rvt-stat { padding: 12px; gap: 6px; }
    .rvt-stat-icon { width: 36px; height: 36px; font-size: 14px; }
    .rvt-stat-value { font-size: 20px; }
    .rvt-card h2 { font-size: 15px; }
    .rvt-grid-4, .rvt-grid-5 { gap: 8px; }
}

@media (max-width: 360px) {
    /* Very narrow phones: fall back to single column */
    .rvt-grid-4, .rvt-grid-5 { grid-template-columns: 1fr; }
    .rvt-stat { flex-direction: row; align-items: center; }
}
