/* ═══════════════════════════════════════════════════════════
   REGTRIX — Design System
   Sistema de Punto de Venta Inteligente
   Centralized CSS Variables + Components + Utilities
   ═══════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ══════════════════════════════════════════
   DESIGN TOKENS — DARK THEME (default)
   ══════════════════════════════════════════ */
:root {
    /* ── Backgrounds ── */
    --bg-deepest:   #0c0a14;
    --bg-dark:      #13111c;
    --bg-surface:   #1a1726;
    --bg-elevated:  #211e2e;
    --bg-hover:     #2a2640;
    --bg-active:    #332e4a;

    /* ── Text ── */
    --text-primary:   #f1f0f5;
    --text-secondary: #9d97b0;
    --text-muted:     #6b6581;
    --text-on-accent: #ffffff;

    /* ── Accent (Amber/Orange — Regtrix identity) ── */
    --accent:       #f59e0b;
    --accent-hover: #fbbf24;
    --accent-soft:  rgba(245, 158, 11, .12);
    --accent-glow:  rgba(245, 158, 11, .20);

    /* ── Gradient (Brand) ── */
    --gradient-main:   linear-gradient(135deg, #f59e0b, #f97316, #ef4444);
    --gradient-subtle: linear-gradient(135deg, rgba(245,158,11,.10), rgba(249,115,22,.10));
    --gradient-warm:   linear-gradient(135deg, #f59e0b, #ec4899);
    --gradient-text:   linear-gradient(135deg, #fbbf24, #f97316, #ef4444);

    /* ── Semantic Colors ── */
    --success:    #34d399;
    --success-bg: rgba(52, 211, 153, .12);
    --warning:    #fbbf24;
    --warning-bg: rgba(251, 191, 36, .12);
    --danger:     #f87171;
    --danger-bg:  rgba(248, 113, 113, .12);
    --info:       #60a5fa;
    --info-bg:    rgba(96, 165, 250, .12);

    /* ── Borders ── */
    --border:        rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .16);
    --border-accent: rgba(245, 158, 11, .30);

    /* ── Shadows ── */
    --shadow-sm:   0 2px 8px rgba(0, 0, 0, .30);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, .40);
    --shadow-lg:   0 8px 32px rgba(0, 0, 0, .50);
    --shadow-glow: 0 0 24px rgba(245, 158, 11, .15);

    /* ── Radius ── */
    --radius-xs:  4px;
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full: 9999px;

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

    /* ── Spacing (4px base) ── */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* ── Layout ── */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* ── Transitions ── */
    --transition:      all .25s cubic-bezier(.4, 0, .2, 1);
    --transition-fast: all .15s ease;
}

/* ══════════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════════ */
[data-theme="light"] {
    --bg-deepest:   #f5f3f0;
    --bg-dark:      #ffffff;
    --bg-surface:   #ffffff;
    --bg-elevated:  #faf9f7;
    --bg-hover:     #f0ede8;
    --bg-active:    #e8e4dd;

    --text-primary:   #1c1917;
    --text-secondary: #57534e;
    --text-muted:     #a8a29e;
    --text-on-accent: #ffffff;

    --accent:       #d97706;
    --accent-hover: #b45309;
    --accent-soft:  rgba(217, 119, 6, .10);
    --accent-glow:  rgba(217, 119, 6, .12);

    --gradient-main:   linear-gradient(135deg, #d97706, #ea580c, #dc2626);
    --gradient-subtle: linear-gradient(135deg, rgba(217,119,6,.06), rgba(234,88,12,.06));
    --gradient-warm:   linear-gradient(135deg, #d97706, #be185d);
    --gradient-text:   linear-gradient(135deg, #b45309, #ea580c, #dc2626);

    --success:    #16a34a;
    --success-bg: rgba(22, 163, 74, .08);
    --warning:    #ca8a04;
    --warning-bg: rgba(202, 138, 4, .08);
    --danger:     #dc2626;
    --danger-bg:  rgba(220, 38, 38, .08);
    --info:       #2563eb;
    --info-bg:    rgba(37, 99, 235, .08);

    --border:        rgba(0, 0, 0, .08);
    --border-strong: rgba(0, 0, 0, .15);
    --border-accent: rgba(217, 119, 6, .25);

    --shadow-sm:   0 2px 8px rgba(0, 0, 0, .06);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, .08);
    --shadow-lg:   0 8px 32px rgba(0, 0, 0, .12);
    --shadow-glow: 0 0 24px rgba(217, 119, 6, .10);
}

/* ══════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-deepest);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

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

::selection {
    background: var(--accent);
    color: var(--text-on-accent);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ══════════════════════════════════════════
   LAYOUT — APP SHELL
   ══════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-brand {
    height: var(--header-height);
    padding: 0 var(--sp-5);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-main);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-3) var(--sp-3);
}

.nav-section {
    margin-bottom: var(--sp-2);
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: var(--sp-3) var(--sp-3) var(--sp-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    position: relative;
}

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

.nav-item.active {
    background: var(--gradient-subtle);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--gradient-main);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--sp-3);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.sidebar-user:hover { background: var(--bg-hover); }

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top Header ── */
.top-header {
    height: var(--header-height);
    background: rgba(19, 17, 28, .85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    position: sticky;
    top: 0;
    z-index: 900;
}

[data-theme="light"] .top-header {
    background: rgba(255, 255, 255, .88);
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.btn-sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.btn-sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.header-search {
    position: relative;
}

.header-search input {
    width: 280px;
    height: 38px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 var(--sp-4) 0 36px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font);
    transition: var(--transition-fast);
}

.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Header Actions ── */
.header-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: var(--sp-6);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
    gap: var(--sp-4);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ══════════════════════════════════════════
   COMPONENTS — CARDS
   ══════════════════════════════════════════ */
.card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

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

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

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

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

.card-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
}

/* ── Stat Cards ── */
.stat-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-accent);
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: var(--sp-4);
}

.stat-icon.amber  { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green  { background: var(--success-bg);  color: var(--success); }
.stat-icon.blue   { background: var(--info-bg);     color: var(--info); }
.stat-icon.red    { background: var(--danger-bg);    color: var(--danger); }
.stat-icon.purple { background: rgba(168,85,247,.12); color: #a855f7; }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: var(--sp-2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ══════════════════════════════════════════
   COMPONENTS — BUTTONS
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #ef4444;
    box-shadow: 0 0 16px rgba(248, 113, 113, .25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none !important;
}

/* ══════════════════════════════════════════
   COMPONENTS — FORMS
   ══════════════════════════════════════════ */
.form-group {
    margin-bottom: var(--sp-5);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
}

.form-control {
    width: 100%;
    height: 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 var(--sp-4);
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font);
    transition: var(--transition-fast);
}

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

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

textarea.form-control {
    height: auto;
    min-height: 100px;
    padding: var(--sp-3) var(--sp-4);
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239d97b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: var(--sp-1);
}

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

.input-icon-wrapper .form-control {
    padding-left: 40px;
}

.input-icon-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* ══════════════════════════════════════════
   COMPONENTS — TABLE
   ══════════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background: var(--bg-hover);
}

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

/* ══════════════════════════════════════════
   COMPONENTS — BADGES
   ══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-bg);  color: var(--success); }
.badge-warning { background: var(--warning-bg);  color: var(--warning); }
.badge-danger  { background: var(--danger-bg);   color: var(--danger); }
.badge-info    { background: var(--info-bg);      color: var(--info); }
.badge-neutral {
    background: rgba(255, 255, 255, .06);
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════
   COMPONENTS — ALERTS
   ══════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: var(--sp-4);
}

.alert-success { background: var(--success-bg); border: 1px solid rgba(52,211,153,.2);  color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border: 1px solid rgba(248,113,113,.2); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(251,191,36,.2);  color: var(--warning); }
.alert-info    { background: var(--info-bg);    border: 1px solid rgba(96,165,250,.2);  color: var(--info); }

/* ══════════════════════════════════════════
   COMPONENTS — MODAL
   ══════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .60);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(.96);
    transition: var(--transition);
}

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

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

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

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

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

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

/* ══════════════════════════════════════════
   COMPONENTS — TOAST
   ══════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    transform: translateX(120%);
    transition: var(--transition);
}

.toast.show { transform: translateX(0); }
.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info); }

/* ══════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deepest);
    position: relative;
    overflow: hidden;
    padding: var(--sp-6);
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(245,158,11,.06) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(249,115,22,.04) 0%, transparent 50%);
    animation: authBg 20s ease-in-out infinite;
}

[data-theme="light"] .auth-page {
    background: linear-gradient(140deg, #fef3c7 0%, #fff7ed 35%, #fce7f3 70%, #ede9fe 100%);
}
[data-theme="light"] .auth-page::before { display: none; }

@keyframes authBg {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.1); opacity: .7; }
}

.auth-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
}

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

.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-main);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow-glow);
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: var(--sp-1);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin: var(--sp-6) 0;
    color: var(--text-muted);
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: var(--sp-6);
    font-size: 13px;
    color: var(--text-secondary);
}
.auth-footer a { color: var(--accent); font-weight: 600; }

.auth-theme-toggle {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: 10;
}

/* ══════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════ */

/* Display */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-block { display: block; }
.d-none  { display: none; }
.d-inline-flex { display: inline-flex; }

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

/* Gap */
.gap-1  { gap: var(--sp-1); }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-5  { gap: var(--sp-5); }
.gap-6  { gap: var(--sp-6); }
.gap-8  { gap: var(--sp-8); }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }

/* Margin */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

/* Padding */
.p-0  { padding: 0; }
.p-2  { padding: var(--sp-2); }
.p-4  { padding: var(--sp-4); }
.p-6  { padding: var(--sp-6); }

/* Text */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-center    { text-align: center; }
.text-right     { text-align: right; }

/* Font */
.fs-xs { font-size: 11px; }
.fs-sm { font-size: 12px; }
.fs-md { font-size: 14px; }
.fs-lg { font-size: 16px; }
.fs-xl { font-size: 20px; }
.fs-2xl { font-size: 24px; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Other */
.w-full { width: 100%; }
.rounded    { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.overflow-hidden { overflow: hidden; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gradient text */
.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .header-search input { width: 200px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --header-height: 52px;
    }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .btn-sidebar-toggle { display: flex; }

    .main-content { margin-left: 0; }

    .top-header {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        padding: 0 var(--sp-3);
        padding-top: env(safe-area-inset-top);
    }

    .page-content {
        padding: var(--sp-4);
        padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + var(--sp-4));
    }

    .header-search { display: none; }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
    }

    .table-wrapper { overflow-x: auto; }
    .table { min-width: 600px; }

    .modal { max-width: 95vw; }

    .auth-card { padding: 28px 20px; }

    .page-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .grid-2 { grid-template-columns: 1fr !important; }
    .stat-card { padding: var(--sp-4); }
}

/* ── Sidebar Mobile Overlay ── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* ── iOS Input Zoom Prevention ── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fadeIn .3s ease forwards; }
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
