/* ============================================================
   SmartPOS Design System
   Version 1.0
   The single source of truth for all visual decisions.
   Change a token here — it updates everywhere.
   ============================================================ */

/* ── LAYER 1: DESIGN TOKENS ────────────────────────────────── */
:root {

    /* Surfaces */
    --bg:          #0d0d14;
    --surface-1:   #13131e;
    --surface-2:   #1a1a28;
    --surface-3:   #222235;
    --border:      rgba(255,255,255,0.07);
    --border-hover:rgba(255,255,255,0.14);

    /* Brand */
    --primary:        #6366f1;
    --primary-hover:  #4f52d4;
    --primary-light:  rgba(99,102,241,0.12);
    --primary-glow:   rgba(99,102,241,0.35);

    /* Semantic */
    --success:       #22c55e;
    --success-light: rgba(34,197,94,0.12);
    --warning:       #f59e0b;
    --warning-light: rgba(245,158,11,0.12);
    --danger:        #ef4444;
    --danger-light:  rgba(239,68,68,0.12);
    --info:          #38bdf8;
    --info-light:    rgba(56,189,248,0.12);

    /* Text */
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --text-disabled:  #2d3748;

    /* Typography */
    --font:         'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* Scale */
    --text-xs:   0.70rem;
    --text-sm:   0.80rem;
    --text-base: 0.875rem;
    --text-md:   1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    /* Spacing */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-7:  28px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 24px var(--primary-glow);

    /* Transitions */
    --transition-fast:   120ms ease;
    --transition-base:   200ms ease;
    --transition-slow:   350ms ease;

    /* Layout */
    --sidebar-width:     260px;
    --sidebar-collapsed: 64px;
    --topbar-height:     64px;
}

/* ── LAYER 2: BASE RESET & GLOBALS ─────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font);
    font-size: var(--text-base);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

input, select, textarea, button {
    font-family: var(--font);
    font-size: var(--text-base);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LAYER 3: TYPOGRAPHY ────────────────────────────────────── */
.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-base     { font-size: var(--text-base); }
.text-md       { font-size: var(--text-md); }
.text-lg       { font-size: var(--text-lg); }
.text-xl       { font-size: var(--text-xl); }
.text-2xl      { font-size: var(--text-2xl); }
.text-3xl      { font-size: var(--text-3xl); }
.text-4xl      { font-size: var(--text-4xl); }

.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--primary); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }

.uppercase { text-transform: uppercase; }
.tracking   { letter-spacing: 0.08em; }
.mono       { font-family: var(--font-mono); }

/* ── LAYER 3: LAYOUT ────────────────────────────────────────── */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-base);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .sidebar-badge {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-3);
}

.sidebar.collapsed .nav-item i {
    margin: 0;
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-height);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 16px var(--primary-glow);
}

.sidebar-logo i {
    color: #fff;
    font-size: 0.9rem;
}

.sidebar-brand-text {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-badge {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99,102,241,0.3);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* Sidebar global-search trigger — looks like a search bar, sits
   above the mode switch. Clicking it opens the Ctrl+K modal. */
.sidebar-search-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: calc(100% - 2 * var(--space-2));
    margin: var(--space-3) var(--space-2) 0;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.sidebar-search-trigger:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}
.sidebar-search-trigger i { font-size: 0.85rem; }
.sidebar-search-trigger .nav-label { flex: 1; text-align: left; }
.sidebar-search-trigger kbd {
    margin-left: auto;
    font-size: 9px;
    opacity: 0.8;
}
.sidebar.collapsed .sidebar-search-trigger {
    justify-content: center;
    width: auto;
}
.sidebar.collapsed .sidebar-search-trigger .nav-label,
.sidebar.collapsed .sidebar-search-trigger kbd { display: none; }
[dir="rtl"] .sidebar-search-trigger .nav-label { text-align: right; }
[dir="rtl"] .sidebar-search-trigger kbd { margin-left: 0; margin-right: auto; }

/* Sidebar Mode Switch (POS / Operations / Management) */
.sidebar-mode-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    margin: var(--space-3) var(--space-2);
}

.mode-btn {
    flex: 1;
    padding: 6px 4px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99,102,241,0.3);
}

.mode-btn:hover:not(.active) {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* ── Product Variants (Phase 10) ── */
.variants-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    background: var(--surface-2);
}
.section-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-weight: 600;
    color: var(--text-primary);
}
.section-divider .toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
}
.variant-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 0.8fr 1.2fr auto;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-2);
}
.variant-row .btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}
.variant-row .btn-remove:hover { background: rgba(239,68,68,0.12); }
@media (max-width: 640px) {
    .variant-row { grid-template-columns: 1fr 1fr; }
}

.variant-picker-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
    max-height: 60vh;
    overflow-y: auto;
}
.variant-pick-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.variant-pick-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--surface-3);
}
.variant-pick-name  { font-weight: 600; font-size: var(--text-sm); flex: 1; text-align: left; }
.variant-pick-price { font-weight: 700; color: var(--primary); }
.variant-pick-stock { font-size: var(--text-xs); color: var(--text-muted); min-width: 56px; text-align: right; }
[dir="rtl"] .variant-pick-name  { text-align: right; }
[dir="rtl"] .variant-pick-stock { text-align: left; }

/* ── Global Search (Phase 8) ── */
.gs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
}
.gs-modal {
    position: fixed;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(640px, 90vw);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 9999;
    overflow: hidden;
}
.gs-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.gs-icon { color: var(--text-muted); }
.gs-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--text-lg);
    color: var(--text-primary);
    outline: none;
}
.gs-results { max-height: 400px; overflow-y: auto; }
.gs-empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
}
.gs-result-section {
    padding: var(--space-2) var(--space-4) var(--space-1);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.gs-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.gs-result-item:hover,
.gs-result-item.selected { background: var(--surface-2); }
.gs-result-name { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.gs-result-sub  { font-size: var(--text-xs); color: var(--text-muted); }
.gs-footer {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── Loyalty redemption card (Phase 7) ── */
.loyalty-section {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fbbf24;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-2);
    color: #78350f;
}
.loyalty-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: #78350f;
}
.loyalty-header .badge { margin-left: auto; }
.loyalty-redeemed {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--success);
    font-size: var(--text-sm);
}
[dir="rtl"] .loyalty-header .badge { margin-left: 0; margin-right: auto; }

/* ── POS keyboard shortcut hint + kbd badges (Phase 5) ── */
kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1.4;
}

/* When the kbd chip sits inside a solid-colour primary action
   button (e.g. the purple "Complete Sale" button on the POS),
   switch to a translucent frosted-glass look so the F12 label
   reads cleanly against the button's background. */
.btn-complete-sale kbd,
.btn-primary kbd {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
    color: currentColor;
}

.shortcut-hint {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 100;
}
.shortcut-hint i.fa-keyboard {
    color: var(--primary);
    font-size: 0.9rem;
}
.shortcut-hint-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.shortcut-hint-close:hover { background: var(--surface-2); color: var(--text-primary); }

/* Hover tooltip — full shortcut list. Hidden until the badge is
   hovered or keyboard-focused. */
.shortcut-hint-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity var(--transition-fast),
                transform var(--transition-fast),
                visibility var(--transition-fast);
    pointer-events: none;
}
.shortcut-hint:hover .shortcut-hint-tooltip,
.shortcut-hint:focus-within .shortcut-hint-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.shortcut-hint-tooltip .row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    color: var(--text-primary);
    font-size: var(--text-xs);
    white-space: nowrap;
}
.shortcut-hint-tooltip kbd { margin-left: 0; }

/* ── Onboarding Card (Phase 4) ── */
.onboarding-card {
    background: linear-gradient(135deg,
        rgba(99,102,241,0.10) 0%,
        var(--surface-1) 100%);
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-6);
}
.onboarding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.onboarding-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.onboarding-sub {
    font-size: var(--text-sm);
    color: var(--text-muted);
}
.onboarding-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.onboarding-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border);
    transition: background var(--transition-fast),
                border-color var(--transition-fast);
}
.onboarding-step:hover {
    background: var(--surface-2);
    border-color: var(--primary);
}
.onboarding-step.done {
    opacity: 0.55;
}
.onboarding-step .step-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--surface-2);
    font-size: 0.95rem;
    flex-shrink: 0;
}
.onboarding-step.done .step-check {
    color: var(--success);
    background: rgba(34,197,94,0.12);
}
.onboarding-step .step-info { flex: 1; min-width: 0; }
.onboarding-step .step-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}
.onboarding-step .step-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.onboarding-step .step-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.onboarding-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.onboarding-bar {
    flex: 1;
    height: 6px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
}
.onboarding-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* Hide nav-items whose data-mode doesn't match the sidebar's
   data-active-mode. Driven by a single attribute on the sidebar
   so the filter survives any role/plan guards that might later
   touch inline display. */
.sidebar[data-active-mode="pos"]  .nav-item[data-mode]:not([data-mode="pos"]),
.sidebar[data-active-mode="ops"]  .nav-item[data-mode]:not([data-mode="ops"]),
.sidebar[data-active-mode="mgmt"] .nav-item[data-mode]:not([data-mode="mgmt"]) {
    display: none !important;
}

/* Hide the switcher when the sidebar is collapsed */
.sidebar.collapsed .sidebar-mode-switch { display: none; }

/* Sidebar Navigation */
/* FIX: min-height:0 is critical for column flex children with overflow.
   Without it, the nav refuses to shrink below its content height
   (flex items default to min-height:auto), pushing the footer offscreen. */
.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-3) 0;
}

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: var(--space-4) var(--space-5) var(--space-2);
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4);
    margin: 1px var(--space-2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: 1px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(99,102,241,0.2);
}

.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.nav-label { flex: 1; }

.nav-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--danger);
    color: #fff;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

/* Sidebar Footer — always visible at bottom.
   All 4 items (Settings link, Theme button, Language button, Logout button)
   are normalized below for consistent icon alignment + height. */
.sidebar-footer {
    padding: var(--space-2) var(--space-2);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Unified appearance for every direct child of the footer, regardless of tag. */
.sidebar-footer > a,
.sidebar-footer > button {
    margin: 0 !important;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    text-align: left;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.sidebar-footer > a:hover,
.sidebar-footer > button:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}

.sidebar-footer > a.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(99,102,241,0.2);
}

/* Equal-width icons for all footer items so text lines up vertically. */
.sidebar-footer > a > i,
.sidebar-footer > button > i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-footer .nav-label,
.sidebar-footer span {
    flex: 1;
}

/* Collapsed sidebar: center the icon only. */
.sidebar.collapsed .sidebar-footer > a,
.sidebar.collapsed .sidebar-footer > button {
    justify-content: center;
    padding: var(--space-2);
}
.sidebar.collapsed .sidebar-footer .nav-label,
.sidebar.collapsed .sidebar-footer span {
    display: none;
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: 99;
    transition: left var(--transition-base);
    backdrop-filter: blur(12px);
}

.topbar.shifted { left: var(--sidebar-collapsed); }

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.page-breadcrumb {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

/* Toggle button */
.btn-toggle {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.btn-toggle:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Avatar */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    border: 1px solid rgba(99,102,241,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: var(--space-6);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition-base);
}

.main-content.shifted {
    margin-left: var(--sidebar-collapsed);
}

/* ── LAYER 3: COMPONENTS ────────────────────────────────────── */

/* ── Card ── */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-6);
}

/* ── Stat Card ── */
.stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
    transparent,
    var(--primary-light),
    transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover { border-color: var(--border-hover); }
.stat-card:hover::before { opacity: 1; }

.stat-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-icon.indigo  { background: var(--primary-light); color: var(--primary); }
.stat-icon.green   { background: var(--success-light); color: var(--success); }
.stat-icon.amber   { background: var(--warning-light); color: var(--warning); }
.stat-icon.red     { background: var(--danger-light);  color: var(--danger);  }
.stat-icon.blue    { background: var(--info-light);    color: var(--info);    }

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.stat-sub .up   { color: var(--success); }
.stat-sub .down { color: var(--danger); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.5;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 0 var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success-light);
    color: var(--success);
    border-color: rgba(34,197,94,0.2);
}

.btn-success:hover {
    background: var(--success);
    color: #fff;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-md);
    border-radius: var(--radius-md);
}

.btn-icon-only {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary   { background: var(--primary-light);  color: var(--primary);  border: 1px solid rgba(99,102,241,0.2); }
.badge-success   { background: var(--success-light);  color: var(--success);  border: 1px solid rgba(34,197,94,0.2); }
.badge-warning   { background: var(--warning-light);  color: var(--warning);  border: 1px solid rgba(245,158,11,0.2); }
.badge-danger    { background: var(--danger-light);   color: var(--danger);   border: 1px solid rgba(239,68,68,0.2); }
.badge-neutral   { background: var(--surface-3);      color: var(--text-secondary); border: 1px solid var(--border); }

/* Plan badges */
.badge-basic      { background: rgba(56,189,248,0.1); color: var(--info);    border: 1px solid rgba(56,189,248,0.2); }
.badge-business   { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(99,102,241,0.2); }
.badge-enterprise { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

/* Status badges */
.badge-active    { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-inactive  { background: var(--surface-3);     color: var(--text-muted); border: 1px solid var(--border); }
.badge-suspended { background: var(--danger-light);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }

/* Stock badges */
.badge-in-stock  { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-low-stock { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.badge-out-stock { background: var(--danger-light);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }

/* ── Forms ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    outline: none;
    line-height: 1.5;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:hover { border-color: var(--border-hover); }

.form-control:focus {
    border-color: var(--primary);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-light);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
    cursor: pointer;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.input-icon-wrap .form-control {
    padding-left: calc(var(--space-3) + 20px);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

.sp-table {
    width: 100%;
    border-collapse: collapse;
}

.sp-table th {
    padding: var(--space-3) var(--space-5);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}

.sp-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.sp-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.sp-table td {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.sp-table tr:last-child td { border-bottom: none; }

.sp-table tbody tr {
    transition: background var(--transition-fast);
}

.sp-table tbody tr:hover td {
    background: var(--surface-2);
    color: var(--text-primary);
}

.sp-table .cell-primary {
    color: var(--text-primary);
    font-weight: 500;
}

.sp-table .cell-mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.98);
    transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body { padding: var(--space-6); }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
}

.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* ── Alert / Toast ── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-color: rgba(34,197,94,0.2);
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border-color: rgba(245,158,11,0.2);
}

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 300;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid transparent;
    min-width: 280px;
    animation: slideIn var(--transition-base) ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

.toast.hiding { animation: slideOut var(--transition-base) ease forwards; }

.toast-success {
    background: var(--surface-2);
    color: var(--success);
    border-color: rgba(34,197,94,0.2);
}

.toast-error {
    background: var(--surface-2);
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}

.toast-info {
    background: var(--surface-2);
    color: var(--info);
    border-color: rgba(56,189,248,0.2);
}

/* ── Progress / Bar ── */
.progress-track {
    background: var(--surface-3);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width 0.8s ease;
}

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-4) 0;
}

/* ── Empty State ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
    gap: var(--space-3);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.empty-state-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state-text,
.empty-state-sub {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 320px;
}

/* ── Skeleton Loader ── */
.skeleton {
    background: linear-gradient(
            90deg,
            var(--surface-2) 25%,
            var(--surface-3) 50%,
            var(--surface-2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Skeleton table row — drop-in placeholder while data loads */
.skeleton-row {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}
.skeleton-cell {
    height: 14px;
    background: linear-gradient(
            90deg,
            var(--surface-2) 25%,
            var(--surface-3) 50%,
            var(--surface-2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    flex: 1;
}
/* When skeleton rows live inside a <tbody>, render them as table rows */
tbody .skeleton-row { display: table-row; }
tbody .skeleton-row .skeleton-cell { display: table-cell; padding: 12px 8px; }
tbody .skeleton-row .skeleton-cell::before {
    content: '';
    display: block;
    height: 14px;
    background: linear-gradient(
            90deg,
            var(--surface-2) 25%,
            var(--surface-3) 50%,
            var(--surface-2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
tbody .skeleton-row .skeleton-cell {
    /* When inside a tbody we use the ::before for the shimmer so the
       td itself can size to the column width naturally. */
    background: transparent !important;
    animation: none !important;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Grid Utilities ── */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

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

/* ── Spacing Utilities ── */
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* ── Login Page ── */
.auth-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-logo {
    width: 52px;
    height: 52px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    box-shadow: 0 0 32px var(--primary-glow);
}

.auth-logo i { color: #fff; font-size: 1.3rem; }

.auth-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.auth-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.auth-box {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}

.auth-box-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.auth-box-sub {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-6);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Toolbar ── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.toolbar-left  { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ── Topbar notification dot ── */
.notif-dot {
    position: relative;
}

.notif-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface-1);
}

/* ── Password show/hide toggle ── */
.pw-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    line-height: 1;
    z-index: 2;
    transition: color 0.15s;
}
.pw-toggle-btn:hover { color: var(--text-primary); }

/* ── Appearance settings row ── */
.appearance-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}
.appearance-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.appearance-info {
    flex: 1;
    min-width: 0;
}

/* ── Notification bell badge ── */
.notif-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid var(--surface-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    line-height: 1;
}

/* ── Notification dropdown ── */
#notifDropdown {
    position: fixed;
    z-index: 9999;
    width: 340px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#notifDropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.notif-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.notif-badge {
    min-width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.notif-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 16px;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.notif-empty i { color: #22c55e; font-size: 1.1rem; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }

.notif-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 1px;
}

.notif-item-critical .notif-item-icon { background: rgba(239,68,68,0.12); color: #ef4444; }
.notif-item-warning  .notif-item-icon { background: rgba(234,179,8,0.12);  color: #eab308; }
.notif-item-info     .notif-item-icon { background: rgba(99,102,241,0.12); color: var(--accent); }

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-msg {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.notif-item-arrow {
    color: var(--text-muted);
    font-size: 11px;
    align-self: center;
    flex-shrink: 0;
}

/* ── Plan card (pricing) ── */
.plan-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    transition: all var(--transition-base);
    position: relative;
}

.plan-card.featured {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-glow);
}

.plan-card.featured::before {
    content: 'Most Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 3px 14px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.plan-price {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.plan-price span {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text-muted);
}

.plan-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.plan-feature {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.plan-feature i {
    color: var(--success);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.plan-feature.disabled {
    color: var(--text-muted);
    text-decoration: line-through;
}

.plan-feature.disabled i { color: var(--text-muted); }

/* ── Responsive ── */
/* Hamburger button — hidden on desktop, shown < 768px */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 200;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}
[dir="rtl"] .sidebar-toggle { left: auto; right: var(--space-3); }

.sidebar-overlay { display: none; }

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }

    /* Sidebar off-screen by default */
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 300;
        transition: left 0.25s ease;
        box-shadow: none;
        transform: none;
    }
    [dir="rtl"] .sidebar { left: auto; right: -300px; }

    body.sidebar-open .sidebar { left: 0; box-shadow: var(--shadow-lg); }
    [dir="rtl"] body.sidebar-open .sidebar { left: auto; right: 0; }

    /* Tap overlay behind the sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 299;
        backdrop-filter: blur(1px);
    }
    body.sidebar-open .sidebar-overlay { display: block; }

    /* Full-width content + room for the hamburger */
    .main-content,
    .main-content.shifted {
        margin-left: 0 !important;
        padding-top: 56px;
    }
    [dir="rtl"] .main-content,
    [dir="rtl"] .main-content.shifted { margin-right: 0 !important; }
    .topbar, .topbar.shifted { left: 0 !important; right: 0 !important; }

    /* Mode switch: smaller buttons */
    .mode-btn { font-size: 10px; padding: 4px 2px; }

    /* Tables scroll horizontally (covers the existing wrapper
       classes too, so no per-page HTML changes are needed). */
    .table-container,
    .table-wrap,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Single-column cards */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

    /* Full-screen modals */
    .modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        border-radius: 0 !important;
        min-height: 100vh;
    }

    /* POS stacks vertically */
    .pos-wrapper { grid-template-columns: 1fr !important; }
    .pos-left, .pos-right { height: auto; }
}

/* ── LIGHT MODE TOKEN OVERRIDES ─────────────────────────────── */
[data-theme="light"] {
    --bg:          #f0f2f8;
    --surface-1:   #ffffff;
    --surface-2:   #f4f6fb;
    --surface-3:   #e8ecf4;
    --border:      rgba(0,0,0,0.09);
    --border-hover:rgba(0,0,0,0.18);

    --primary:        #5254cc;
    --primary-hover:  #3f41b0;
    --primary-light:  rgba(82,84,204,0.10);
    --primary-glow:   rgba(82,84,204,0.25);

    --success:       #16a34a;
    --success-light: rgba(22,163,74,0.10);
    --warning:       #d97706;
    --warning-light: rgba(217,119,6,0.10);
    --danger:        #dc2626;
    --danger-light:  rgba(220,38,38,0.10);
    --info:          #0284c7;
    --info-light:    rgba(2,132,199,0.10);

    --text-primary:   #0f172a;
    --text-secondary: #334155;
    --text-muted:     #64748b;
    --text-disabled:  #cbd5e1;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
}

/* ── THEME TOGGLE BUTTON ─────────────────────────────────────── */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    margin: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: 1px solid transparent;
    background: none;
    width: 100%;
}

.theme-toggle-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}

.theme-toggle-btn i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar.collapsed .theme-toggle-btn {
    justify-content: center;
    padding: var(--space-3);
}

.sidebar.collapsed .theme-toggle-btn .nav-label {
    display: none;
}

/* Smooth theme transition on body */
body {
    transition: background var(--transition-slow), color var(--transition-slow);
}
