/*
 * ═══════════════════════════════════════════════════════════════════════
 * INTERLINK ACCOUNTS - Design System
 * ═══════════════════════════════════════════════════════════════════════
 * A beautifully premium, hand-crafted design system.
 * No frameworks. No dependencies. Pure, exquisite CSS.
 * ═══════════════════════════════════════════════════════════════════════
 */


/* ─── 1. Design Tokens (CSS Custom Properties) ────────────────────── */

:root {
    /* Brand Palette */
    --brand-50:  #EEF2FF;
    --brand-100: #E0E7FF;
    --brand-200: #C7D2FE;
    --brand-300: #A5B4FC;
    --brand-400: #818CF8;
    --brand-500: #6366F1;
    --brand-600: #4F46E5;
    --brand-700: #4338CA;
    --brand-800: #3730A3;
    --brand-900: #312E81;

    /* Neutral Palette (Warm Greys) */
    --grey-25:  #FCFCFD;
    --grey-50:  #F9FAFB;
    --grey-100: #F3F4F6;
    --grey-200: #E5E7EB;
    --grey-300: #D1D5DB;
    --grey-400: #9CA3AF;
    --grey-500: #6B7280;
    --grey-600: #4B5563;
    --grey-700: #374151;
    --grey-800: #1F2937;
    --grey-900: #111827;
    --grey-950: #030712;

    /* Semantic Colours */
    --success-50:  #F0FDF4;
    --success-100: #DCFCE7;
    --success-500: #22C55E;
    --success-600: #16A34A;
    --success-700: #15803D;

    --warning-50:  #FFFBEB;
    --warning-100: #FEF3C7;
    --warning-500: #F59E0B;
    --warning-600: #D97706;
    --warning-700: #B45309;

    --danger-50:  #FEF2F2;
    --danger-100: #FEE2E2;
    --danger-500: #EF4444;
    --danger-600: #DC2626;
    --danger-700: #B91C1C;

    --info-50:  #EFF6FF;
    --info-100: #DBEAFE;
    --info-500: #3B82F6;
    --info-600: #2563EB;
    --info-700: #1D4ED8;

    /* Surface System - Light Mode */
    --surface-bg:       #F9FAFB;
    --surface-primary:  #FFFFFF;
    --surface-secondary:#F3F4F6;
    --surface-tertiary: #E5E7EB;
    --surface-hover:    #F3F4F6;
    --surface-active:   #E5E7EB;

    /* Text System */
    --text-primary:   #111827;
    --text-secondary: #4B5563;
    --text-tertiary:  #6B7280;
    --text-muted:     #9CA3AF;
    --text-inverse:   #FFFFFF;
    --text-brand:     #4F46E5;
    --text-link:      #4F46E5;
    --text-link-hover:#4338CA;

    /* Border System */
    --border-light:   #F3F4F6;
    --border-default: #E5E7EB;
    --border-medium:  #D1D5DB;
    --border-heavy:   #9CA3AF;
    --border-focus:   #4F46E5;

    /* Sidebar */
    --sidebar-bg:          #0C1222;
    --sidebar-text:        #8896AB;
    --sidebar-text-active: #F1F5F9;
    --sidebar-hover:       rgba(255, 255, 255, 0.04);
    --sidebar-active:      rgba(99, 102, 241, 0.1);
    --sidebar-border:      rgba(255, 255, 255, 0.06);
    --sidebar-icon:        #556278;
    --sidebar-icon-active: #818CF8;
    --sidebar-accent:      #6366F1;
    --sidebar-width:       260px;
    --sidebar-width-collapsed: 72px;

    /* Header */
    --header-height: 64px;
    --header-bg:     #FFFFFF;
    --header-border: #E5E7EB;

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

    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    --leading-tight:  1.25;
    --leading-normal: 1.5;
    --leading-relaxed:1.625;

    --weight-normal:   400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;

    /* Spacing */
    --space-0:   0;
    --space-1:   0.25rem;
    --space-2:   0.5rem;
    --space-3:   0.75rem;
    --space-4:   1rem;
    --space-5:   1.25rem;
    --space-6:   1.5rem;
    --space-8:   2rem;
    --space-10:  2.5rem;
    --space-12:  3rem;
    --space-16:  4rem;
    --space-20:  5rem;
    --space-24:  6rem;

    /* Border Radius */
    --radius-sm:   0.25rem;
    --radius-md:   0.375rem;
    --radius-lg:   0.5rem;
    --radius-xl:   0.75rem;
    --radius-2xl:  1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs:   0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:   0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg:   0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl:   0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-2xl:  0 25px 50px -12px rgba(0, 0, 0, 0.2);
    --shadow-inner:inset 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-focus:0 0 0 3px rgba(79, 70, 229, 0.2);

    /* Transitions */
    --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-dropdown:  1000;
    --z-sticky:    1020;
    --z-overlay:   1040;
    --z-modal:     1060;
    --z-toast:     1080;
    --z-tooltip:   1100;
}


/* ─── 1b. Dark Mode Tokens ────────────────────────────────────────── */

.dark {
    --surface-bg:       #0B1120;
    --surface-primary:  #1E293B;
    --surface-secondary:#0F172A;
    --surface-tertiary: #334155;
    --surface-hover:    #1E293B;
    --surface-active:   #334155;

    --text-primary:   #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-tertiary:  #94A3B8;
    --text-muted:     #64748B;
    --text-inverse:   #0F172A;
    --text-brand:     #818CF8;
    --text-link:      #818CF8;
    --text-link-hover:#A5B4FC;

    --border-light:   #1E293B;
    --border-default: #334155;
    --border-medium:  #475569;
    --border-heavy:   #64748B;

    --header-bg:     #0F172A;
    --header-border: #1E293B;

    /* Semantic Colours - Dark */
    --success-50:  #052E16;
    --success-100: #064E3B;
    --success-500: #22C55E;
    --success-600: #4ADE80;
    --success-700: #86EFAC;

    --warning-50:  #422006;
    --warning-100: #451A03;
    --warning-200: #78350F;
    --warning-500: #F59E0B;
    --warning-600: #FBBF24;
    --warning-700: #FCD34D;
    --warning-800: #FDE68A;

    --danger-50:  #450A0A;
    --danger-100: #7F1D1D;
    --danger-500: #EF4444;
    --danger-600: #F87171;
    --danger-700: #FCA5A5;

    --info-50:  #172554;
    --info-100: #1E3A5F;
    --info-500: #3B82F6;
    --info-600: #60A5FA;
    --info-700: #93C5FD;

    --brand-50:  #1E1B4B;
    --brand-100: #312E81;

    --shadow-xs:   0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:   0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg:   0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl:   0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-focus:0 0 0 3px rgba(129, 140, 248, 0.3);
}


/* ─── 2. Reset & Base ─────────────────────────────────────────────── */

*, *::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;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--surface-bg);
    min-height: 100vh;
}

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

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

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

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

::selection {
    background-color: var(--brand-100);
    color: var(--brand-900);
}
.dark ::selection {
    background-color: var(--brand-800);
    color: var(--brand-100);
}

:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}


/* ─── 3. Layout ───────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0F172A 0%, #0C1222 40%, #080E1A 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: width var(--transition-slow);
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

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

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-width-collapsed);
}

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-8);
    gap: var(--space-4);
    z-index: var(--z-sticky);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}
.dark .app-header {
    background: rgba(15, 23, 42, 0.78);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.app-content {
    flex: 1;
    padding: var(--space-8);
    max-width: 1440px;
    width: 100%;
}


/* ─── 3b. Sidebar Components ──────────────────────────────────────── */

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

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #818CF8 0%, #6366F1 50%, #4F46E5 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: var(--weight-bold);
    font-size: var(--text-sm);
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.02em;
}

.sidebar-brand-text {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-sub {
    font-size: var(--text-xs);
    color: var(--sidebar-text);
    font-weight: var(--weight-normal);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sidebar-section {
    margin-top: var(--space-4);
    margin-bottom: var(--space-1);
}

.sidebar-section-label {
    font-size: 0.625rem;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.25);
    padding: var(--space-1) calc(var(--space-3) + var(--space-1));
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 7px var(--space-3);
    border-radius: var(--radius-lg);
    color: var(--sidebar-text);
    font-size: 0.8125rem;
    font-weight: var(--weight-medium);
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    margin: 0 var(--space-1);
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-accent);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}
.nav-item.active .nav-icon {
    color: var(--sidebar-icon-active);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--sidebar-icon);
    transition: color var(--transition-fast);
}
.nav-item:hover .nav-icon {
    color: var(--sidebar-text-active);
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: var(--space-3) var(--space-2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}


/* ─── 3c. Header Components ───────────────────────────────────────── */

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

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

.header-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}
.header-breadcrumb a {
    color: var(--text-tertiary);
}
.header-breadcrumb a:hover {
    color: var(--text-primary);
}
.header-breadcrumb .separator {
    color: var(--text-muted);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-normal);
}
.sidebar-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}
.dark .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}


/* ─── 4. Typography ───────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base);}
h6 { font-size: var(--text-sm);  }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.page-header-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.page-title {
    font-size: 1.375rem;
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.3;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    line-height: 1.5;
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}


/* ─── 5. Buttons ──────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
    letter-spacing: 0.01em;
}
.btn:focus-visible {
    box-shadow: var(--shadow-focus);
    outline: none;
}
.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn--primary {
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
    color: #fff;
    border-color: var(--brand-600);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn--primary:hover {
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
    border-color: var(--brand-700);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-0.5px);
}
.btn--primary:active {
    background: var(--brand-700);
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.15);
}

.btn--secondary {
    background: var(--surface-primary);
    color: var(--text-primary);
    border-color: var(--border-default);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn--secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

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

.btn--danger {
    background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
    color: #fff;
    border-color: var(--danger-600);
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}
.btn--danger:hover {
    background: linear-gradient(135deg, var(--danger-600) 0%, var(--danger-700) 100%);
    border-color: var(--danger-700);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
    transform: translateY(-0.5px);
}

.btn--success {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: #fff;
    border-color: var(--success-600);
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.2);
}
.btn--success:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    border-color: var(--success-700);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
    transform: translateY(-0.5px);
}

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

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

.btn--icon {
    padding: var(--space-2);
    width: 36px;
    height: 36px;
}

.btn--icon.btn--sm {
    width: 32px;
    height: 32px;
    padding: var(--space-1);
}


/* ─── 6. Forms ────────────────────────────────────────────────────── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}

.form-label .required {
    color: var(--danger-500);
    margin-left: var(--space-1);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px var(--space-3);
    font-size: var(--text-sm);
    line-height: 1.25rem;
    color: var(--text-primary);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    appearance: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dark .form-input,
.dark .form-select,
.dark .form-textarea {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-medium);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dark .form-input:focus,
.dark .form-select:focus,
.dark .form-textarea:focus {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger-500);
}
.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

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

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    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='%236B7280' d='M2.22 4.47a.75.75 0 0 1 1.06 0L6 7.19l2.72-2.72a.75.75 0 1 1 1.06 1.06L6 9.31 2.22 5.53a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-10);
}

.form-checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.form-checkbox:checked {
    background: var(--brand-600);
    border-color: var(--brand-600);
    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='white' d='M10.28 2.28a.75.75 0 0 1 0 1.06l-5.5 5.5a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 1 1 1.06-1.06L4.25 7.19l4.97-4.97a.75.75 0 0 1 1.06.06Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
.form-checkbox:focus-visible {
    box-shadow: var(--shadow-focus);
}

.form-grid {
    display: grid;
    gap: var(--space-5);
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-6);
}


/* ─── 7. Cards ────────────────────────────────────────────────────── */

.card {
    background: var(--surface-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}
.dark .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.card--elevated {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}
.card--elevated:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04);
}
.dark .card--elevated {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-secondary);
}
.dark .card-header {
    background: rgba(255, 255, 255, 0.02);
}

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

.card-subtitle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

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

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

.card-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-light);
    background: linear-gradient(to bottom, var(--surface-secondary), var(--surface-primary));
}


/* ─── 8. Tables ───────────────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: var(--surface-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.dark .table-container {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    padding: 10px var(--space-4);
    text-align: left;
    font-weight: var(--weight-semibold);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}
.dark .table th {
    background: rgba(255, 255, 255, 0.03);
}

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

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

.table tbody tr {
    transition: background var(--transition-fast);
}
.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}
.dark .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table .text-right {
    text-align: right;
}

.table .text-center {
    text-align: center;
}

.table .text-mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-feature-settings: "tnum";
}

.table--compact th,
.table--compact td {
    padding: var(--space-2) var(--space-3);
}

.table-empty {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--text-muted);
}

.table-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-3);
    color: var(--text-muted);
    opacity: 0.5;
}


/* ─── 8b. Bulk Actions ────────────────────────────────────────────── */

.bulk-checkbox {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center;
}
.bulk-checkbox .form-checkbox {
    margin: 0 auto;
    display: block;
}
.bulk-checkbox-header {
    position: relative;
}
.bulk-checkbox-header .form-checkbox.is-indeterminate {
    background: var(--brand-600);
    border-color: var(--brand-600);
    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%3Crect fill='white' x='2' y='5' width='8' height='2' rx='1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.table tbody tr.is-selected {
    background: rgba(99, 102, 241, 0.06);
}
.dark .table tbody tr.is-selected {
    background: rgba(99, 102, 241, 0.12);
}
.table tbody tr.is-selected:hover {
    background: rgba(99, 102, 241, 0.09);
}
.dark .table tbody tr.is-selected:hover {
    background: rgba(99, 102, 241, 0.16);
}

.bulk-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--brand-600);
    color: white;
    padding: var(--space-3) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: bulkBarSlideUp 0.2s ease-out;
}
@keyframes bulkBarSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.bulk-bar-count {
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    white-space: nowrap;
    min-width: 90px;
}
.bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex: 1;
}
.bulk-bar .btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: var(--text-xs);
    padding: 5px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: var(--weight-medium);
}
.bulk-bar .btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}
.bulk-bar .btn--danger {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}
.bulk-bar .btn--danger:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.7);
}
.bulk-bar-deselect {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: var(--text-xs);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.bulk-bar-deselect:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* ─── 9. Badges ───────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    font-size: 0.6875rem;
    font-weight: var(--weight-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
    line-height: 1rem;
    letter-spacing: 0.01em;
}

.badge--default {
    background: var(--grey-100);
    color: var(--grey-700);
}
.dark .badge--default {
    background: var(--grey-800);
    color: var(--grey-300);
}

.badge--brand {
    background: var(--brand-50);
    color: var(--brand-700);
}
.dark .badge--brand {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-300);
}

.badge--success {
    background: var(--success-50);
    color: var(--success-700);
}
.dark .badge--success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-500);
}

.badge--warning {
    background: var(--warning-50);
    color: var(--warning-700);
}
.dark .badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-500);
}

.badge--danger {
    background: var(--danger-50);
    color: var(--danger-700);
}
.dark .badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-500);
}

.badge--info {
    background: var(--info-50);
    color: var(--info-700);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.badge--success .badge-dot { background: var(--success-500); }
.badge--warning .badge-dot { background: var(--warning-500); }
.badge--danger .badge-dot  { background: var(--danger-500);  }
.badge--info .badge-dot    { background: var(--info-500);    }
.badge--brand .badge-dot   { background: var(--brand-500);   }

.badge--neutral {
    background: var(--grey-100);
    color: var(--grey-600);
}
.dark .badge--neutral {
    background: var(--grey-800);
    color: var(--grey-400);
}


/* ─── 9b. Toggle Switch ──────────────────────────────────────────── */

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--grey-300);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
.dark .toggle-slider {
    background: var(--grey-700);
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: var(--radius-full);
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider {
    background: var(--brand-500);
}
.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}
.toggle input:focus-visible + .toggle-slider {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}


/* ─── 10. Financial Typography ────────────────────────────────────── */

.amount {
    font-family: var(--font-sans);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    font-weight: var(--weight-medium);
    white-space: nowrap;
}

.amount--debit {
    color: var(--text-primary);
}

.amount--credit {
    color: var(--success-600);
}

.amount--negative {
    color: var(--danger-600);
}

.amount--large {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.025em;
}

.amount--xl {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.025em;
}

.account-code {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    background: var(--surface-secondary);
    padding: 2px 7px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    letter-spacing: 0.02em;
}
.dark .account-code {
    border-color: rgba(255, 255, 255, 0.06);
}

.currency-symbol {
    color: var(--text-tertiary);
    margin-right: 1px;
}


/* ─── 11. Modals ──────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.modal-close:hover {
    background: var(--surface-hover);
    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-light);
    background: var(--surface-secondary);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }


/* ─── 12. Dropdowns ───────────────────────────────────────────────── */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 200px;
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    z-index: var(--z-dropdown);
    padding: var(--space-1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transition: all var(--transition-normal);
}
.dark .dropdown-menu {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.08);
}
.dropdown-menu.active,
.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-1) 0;
}


/* ─── 13. Toasts / Flash Messages ─────────────────────────────────── */

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 420px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: toastSlideIn var(--transition-slow) ease-out;
    backdrop-filter: blur(8px);
}
.dark .toast {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toast--success { border-left: 3px solid var(--success-500); }
.toast--warning { border-left: 3px solid var(--warning-500); }
.toast--danger  { border-left: 3px solid var(--danger-500);  }
.toast--info    { border-left: 3px solid var(--info-500);    }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.toast--success .toast-icon { color: var(--success-500); }
.toast--warning .toast-icon { color: var(--warning-500); }
.toast--danger .toast-icon  { color: var(--danger-500);  }
.toast--info .toast-icon    { color: var(--info-500);    }

.toast-content {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}
.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ─── 14. Stats / KPI Widgets ─────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
}

.stat-card {
    background: var(--surface-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: all var(--transition-normal);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.stat-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}
.stat-card:hover::before {
    opacity: 1;
}
.dark .stat-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.dark .stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal);
}
.stat-card:hover .stat-icon {
    transform: scale(1.05);
}
.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-icon--brand   { background: var(--brand-50);   color: var(--brand-600); }
.stat-icon--success { background: var(--success-50); color: var(--success-600); }
.stat-icon--warning { background: var(--warning-50); color: var(--warning-600); }
.stat-icon--danger  { background: var(--danger-50);  color: var(--danger-600); }
.stat-icon--info    { background: var(--info-50);    color: var(--info-600); }

.dark .stat-icon--brand   { background: rgba(99, 102, 241, 0.15); }
.dark .stat-icon--success { background: rgba(34, 197, 94, 0.15); }
.dark .stat-icon--warning { background: rgba(245, 158, 11, 0.15); }
.dark .stat-icon--danger  { background: rgba(239, 68, 68, 0.15); }
.dark .stat-icon--info    { background: rgba(59, 130, 246, 0.15); }

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.03em;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}
.stat-change--up   { color: var(--success-600); }
.stat-change--down { color: var(--danger-600);  }

.stat-footer {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}


/* ─── 15. Dashboard Grid ──────────────────────────────────────────── */

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

.dashboard-grid .span-1 {
    grid-column: span 1;
}

.dashboard-grid .span-2 {
    grid-column: span 2;
}

.dashboard-grid .span-3 {
    grid-column: span 3;
}

a.dashboard-task-link:hover {
    background: var(--surface-hover, rgba(0, 0, 0, 0.04));
}


/* ─── 16. Empty States ────────────────────────────────────────────── */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    color: var(--brand-400);
    opacity: 0.35;
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 360px;
    margin-bottom: var(--space-6);
}


/* ─── 17. Pagination ──────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.pagination-info {
    color: var(--text-tertiary);
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    text-decoration: none;
    border: 1px solid transparent;
}
.pagination-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}
.pagination-link.active {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    color: #fff;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}


/* ─── 18. Search ──────────────────────────────────────────────────── */

.search-input-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px var(--space-3) 8px var(--space-10);
    font-size: var(--text-sm);
    background: var(--surface-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-primary);
    transition: all var(--transition-normal);
}
.dark .search-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}
.search-input:focus {
    outline: none;
    background: var(--surface-primary);
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.search-input::placeholder {
    color: var(--text-muted);
}

.search-kbd {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.625rem;
    font-family: var(--font-sans);
    color: var(--text-muted);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    line-height: 1.2;
}

.search-clear {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: var(--surface-tertiary);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 150ms;
    padding: 0;
}
.search-clear:hover {
    background: var(--danger-50);
    color: var(--danger-600);
}
.dark .search-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
}

/* ─── Search Dropdown ─────────────────────────────────────────────── */

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 420px;
    max-height: 460px;
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.06),
        0 10px 15px -3px rgba(0, 0, 0, 0.08),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
    z-index: var(--z-dropdown, 1000);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dark .search-dropdown {
    background: var(--surface-secondary);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.2),
        0 10px 15px -3px rgba(0, 0, 0, 0.3),
        0 20px 25px -5px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Transitions */
.search-enter { transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1); }
.search-enter-start { opacity: 0; transform: translateY(-6px) scale(0.98); }
.search-enter-end { opacity: 1; transform: translateY(0) scale(1); }
.search-leave { transition: all 120ms ease-in; }
.search-leave-start { opacity: 1; transform: translateY(0) scale(1); }
.search-leave-end { opacity: 0; transform: translateY(-4px) scale(0.98); }

/* ─── Search Results ──────────────────────────────────────────────── */

.search-results {
    overflow-y: auto;
    max-height: 400px;
    padding: var(--space-2) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}
.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

.search-group {
    padding: 0;
}
.search-group + .search-group {
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-1);
    padding-top: var(--space-1);
}

.search-group-label {
    font-size: 0.65rem;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-4) var(--space-1);
    user-select: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 80ms ease;
    border-radius: 0;
    margin: 0 var(--space-2);
    border-radius: var(--radius-md);
}
.search-result-item:hover,
.search-result-item.is-selected {
    background: var(--brand-50);
}
.dark .search-result-item:hover,
.dark .search-result-item.is-selected {
    background: rgba(99, 102, 241, 0.1);
}
.search-result-item.is-selected {
    background: var(--brand-50);
}
.dark .search-result-item.is-selected {
    background: rgba(99, 102, 241, 0.15);
}

.search-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--surface-secondary);
    color: var(--text-tertiary);
    transition: all 150ms;
}
.dark .search-result-icon {
    background: rgba(255, 255, 255, 0.06);
}
.search-result-item.is-selected .search-result-icon,
.search-result-item:hover .search-result-icon {
    background: var(--brand-100);
    color: var(--brand-600);
}
.dark .search-result-item.is-selected .search-result-icon,
.dark .search-result-item:hover .search-result-icon {
    background: rgba(99, 102, 241, 0.2);
    color: var(--brand-400);
}

.search-result-body {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.search-result-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-top: 1px;
}

.search-highlight {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-700);
    border-radius: 2px;
    padding: 0 1px;
}
.dark .search-highlight {
    background: rgba(99, 102, 241, 0.25);
    color: var(--brand-300);
}

/* ─── Search Loading Shimmer ──────────────────────────────────────── */

.search-loading {
    padding: var(--space-4);
}

.search-shimmer {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.search-shimmer > div {
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(
        90deg,
        var(--surface-secondary) 25%,
        var(--surface-tertiary) 50%,
        var(--surface-secondary) 75%
    );
    background-size: 200% 100%;
    animation: searchShimmer 1.2s ease-in-out infinite;
}
.search-shimmer > div:nth-child(2) { opacity: 0.7; width: 85%; }
.search-shimmer > div:nth-child(3) { opacity: 0.4; width: 65%; }

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

/* ─── Search Empty State ──────────────────────────────────────────── */

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    text-align: center;
    gap: var(--space-2);
}
.search-empty p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* ─── Search Footer ───────────────────────────────────────────────── */

.search-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border-light);
    font-size: 0.65rem;
    color: var(--text-muted);
    user-select: none;
    background: var(--surface-secondary);
}
.dark .search-footer {
    background: rgba(255, 255, 255, 0.02);
}
.search-footer kbd {
    display: inline-block;
    font-size: 0.6rem;
    font-family: var(--font-sans);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: 3px;
    padding: 0 4px;
    line-height: 1.4;
    min-width: 16px;
    text-align: center;
}
.dark .search-footer kbd {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ─── Search Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .search-input-wrapper {
        max-width: 100%;
    }
    .search-dropdown {
        min-width: unset;
        left: -40px;
        right: -60px;
    }
    .search-kbd {
        display: none;
    }
}


/* ─── 19. Tabs ────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-6);
}

.tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    white-space: nowrap;
    position: relative;
}
.tab:hover {
    color: var(--text-primary);
}
.tab.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
    font-weight: var(--weight-semibold);
}
.dark .tab.active {
    color: var(--brand-400);
    border-bottom-color: var(--brand-400);
}

.tab-count {
    margin-left: var(--space-2);
    font-size: 0.625rem;
    background: var(--surface-secondary);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
    font-weight: var(--weight-semibold);
}
.tab.active .tab-count {
    background: var(--brand-50);
    color: var(--brand-600);
}
.dark .tab.active .tab-count {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-400);
}


/* ─── 20. Avatars ─────────────────────────────────────────────────── */

.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar--sm { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar--lg { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar--xl { width: 48px; height: 48px; font-size: var(--text-base); }

.avatar--brand   { background: var(--brand-100);   color: var(--brand-700); }
.avatar--success { background: var(--success-100); color: var(--success-700); }
.avatar--warning { background: var(--warning-100); color: var(--warning-700); }
.avatar--danger  { background: var(--danger-100);  color: var(--danger-700); }

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ─── 21. Activity Feed ───────────────────────────────────────────── */

.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--brand-500);
    flex-shrink: 0;
    margin-top: 6px;
}

.activity-content {
    flex: 1;
    font-size: var(--text-sm);
}

.activity-text {
    color: var(--text-secondary);
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: var(--weight-medium);
}

.activity-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}


/* ─── 22. Auth Layout ─────────────────────────────────────────────── */

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 35%, #111827 65%, #312E81 100%);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
}
.auth-layout::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.auth-card {
    background: var(--surface-primary);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 440px;
    padding: var(--space-10);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.auth-brand-logo {
    display: block;
    line-height: 0;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.3));
    transition: transform var(--duration-fast) ease;
}

.auth-brand-logo:hover {
    transform: scale(1.05);
}

.auth-brand-name {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.auth-brand-tagline {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}


/* ─── 22b. Auth Split (Two-Pane Register) ────────────────────────── */

.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-split__form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    background: var(--surface-primary);
}

.auth-split__logo {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.auth-split__logo span {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-split__content {
    width: 100%;
    max-width: 440px;
}

.auth-split__content h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-split__content > p {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.auth-split__hero {
    background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 35%, #111827 65%, #312E81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-split__geo-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.auth-split__hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 48px;
}

.auth-split__rings {
    margin: 0 auto 32px;
}

.auth-split__ring--outer {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: auth-ring-pulse 4s ease-in-out infinite;
}

.auth-split__ring--mid {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: auth-ring-pulse 4s ease-in-out 0.5s infinite;
}

.auth-split__ring--inner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.35) 0%, rgba(79, 70, 229, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes auth-ring-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

.auth-split__hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.3;
}

.auth-split__hero-text {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.6;
}

@media (max-width: 767px) {
    .auth-split {
        grid-template-columns: 1fr;
    }
    .auth-split__hero {
        display: none;
    }
    .auth-split__form {
        padding: 80px 24px 40px;
    }
}


/* ─── 23. Quick Actions Grid ──────────────────────────────────────── */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    background: var(--surface-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.quick-action:hover {
    border-color: var(--brand-200);
    background: var(--brand-50);
    color: var(--brand-700);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}
.dark .quick-action:hover {
    border-color: var(--brand-800);
    background: rgba(99, 102, 241, 0.1);
    color: var(--brand-300);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--surface-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--transition-normal);
}
.quick-action:hover .quick-action-icon {
    background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
    color: var(--brand-600);
    transform: scale(1.08);
}

.quick-action-icon svg {
    width: 20px;
    height: 20px;
}

.quick-action-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-align: center;
}


/* ─── 24. Utilities ───────────────────────────────────────────────── */

.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-muted     { color: var(--text-muted); }
.text-brand     { color: var(--text-brand); }
.text-success   { color: var(--success-600); }
.text-warning   { color: var(--warning-600); }
.text-danger    { color: var(--danger-600); }
.text-sm        { font-size: var(--text-sm); }
.text-xs        { font-size: var(--text-xs); }
.text-lg        { font-size: var(--text-lg); }
.font-medium    { font-weight: var(--weight-medium); }
.font-semibold  { font-weight: var(--weight-semibold); }
.font-bold      { font-weight: var(--weight-bold); }
.font-mono      { font-family: var(--font-mono); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mr-2 { margin-right: var(--space-2); }
.ml-auto { margin-left: auto; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

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

.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; }
.flex-shrink-0 { flex-shrink: 0; }
.inline-flex { display: inline-flex; }

.grid { display: grid; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.relative { position: relative; }
.absolute { position: absolute; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden { display: none; }

.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-6) 0;
}

.link {
    color: var(--text-link);
    font-weight: var(--weight-medium);
    transition: all var(--transition-fast);
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}
.link:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
    text-decoration-color: var(--text-link-hover);
}


/* ─── 25. Responsive ──────────────────────────────────────────────── */

@media (max-width: 1279px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid .span-2 {
        grid-column: span 2;
    }
    .dashboard-grid .span-3 {
        grid-column: span 2;
    }
}

@media (max-width: 1023px) {
    .app-sidebar {
        transform: translateX(-100%);
        z-index: var(--z-overlay);
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-collapsed .app-main {
        margin-left: 0;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid .span-2,
    .dashboard-grid .span-3 {
        grid-column: span 1;
    }
    .page-header {
        flex-direction: column;
        gap: var(--space-3);
    }
    .page-actions {
        width: 100%;
    }
    .page-actions .btn {
        flex: 1;
    }
    .app-content {
        padding: var(--space-4);
    }
    .auth-card {
        padding: var(--space-6);
    }
    .pagination {
        flex-direction: column;
        gap: var(--space-3);
    }
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 639px) {
    :root {
        --header-height: 56px;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    .modal {
        margin: var(--space-4);
        max-height: calc(100vh - var(--space-8));
    }
}


/* ─── 26. Journal Entry ──────────────────────────────────────────── */

.journal-header-grid {
    display: grid;
    grid-template-columns: 180px 180px 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.journal-balance-bar {
    margin-bottom: var(--space-6);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    transition: all var(--transition-normal);
}

.journal-balance-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.journal-balance--empty {
    background: var(--surface-secondary);
    border: 1px dashed var(--border-medium);
}

.journal-balance--balanced {
    background: var(--success-50);
    border: 1px solid var(--success-500);
}
.dark .journal-balance--balanced {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
}

.journal-balance--unbalanced {
    background: var(--danger-50);
    border: 1px solid var(--danger-500);
}
.dark .journal-balance--unbalanced {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

.journal-balance-icon {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}
.journal-balance-icon.balanced {
    color: var(--success-700);
}
.dark .journal-balance-icon.balanced {
    color: var(--success-500);
}
.journal-balance-icon.unbalanced {
    color: var(--danger-700);
}
.dark .journal-balance-icon.unbalanced {
    color: var(--danger-500);
}

.journal-balance-totals {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
}

.journal-balance-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.journal-balance-amount {
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    min-width: 80px;
    text-align: right;
}

.journal-balance-sep {
    color: var(--text-muted);
    font-weight: var(--weight-bold);
    margin: 0 var(--space-1);
}

.journal-lines-wrapper {
    overflow-x: auto;
    margin: 0 calc(-1 * var(--space-6));
    padding: 0 var(--space-6);
}

.journal-table thead th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.journal-line {
    transition: background var(--transition-fast);
}
.journal-line:hover {
    background: var(--surface-hover);
}
.journal-line--has-value {
    background: var(--brand-50);
}
.dark .journal-line--has-value {
    background: rgba(99, 102, 241, 0.06);
}

.form-input--compact,
.form-select--compact {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
    height: 34px;
    border-radius: var(--radius-md);
}

.form-input--money {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.journal-foot-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.journal-foot-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.journal-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.journal-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.journal-meta-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.journal-meta-value {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}

.journal-show-table thead th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.journal-totals-row {
    border-top: 2px solid var(--border-default);
}
.journal-totals-row td {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-6) 0;
}

@media (max-width: 767px) {
    .journal-header-grid {
        grid-template-columns: 1fr;
    }
    .journal-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .journal-balance-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
}


/* ─── 27. Reconciliation ─────────────────────────────────────────── */

.reconcile-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.reconcile-card {
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}
.reconcile-card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.reconcile-summary {
    display: grid;
    grid-template-columns: 90px 1fr auto auto 32px;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.reconcile-summary:hover {
    background: var(--surface-hover);
}

.reconcile-date {
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
}

.reconcile-desc {
    min-width: 0;
}
.reconcile-desc-main {
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reconcile-desc-ref {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.reconcile-amount {
    text-align: right;
    white-space: nowrap;
}

.reconcile-direction {
    display: block;
    font-size: 0.6875rem;
    font-weight: var(--weight-medium);
    margin-top: 1px;
}
.reconcile-direction--in {
    color: var(--success-600);
}
.reconcile-direction--out {
    color: var(--danger-600);
}

.reconcile-expand {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.reconcile-form {
    padding: var(--space-4) var(--space-5);
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-light);
}

.reconcile-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 140px 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.reconcile-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.amount--credit {
    color: var(--success-600);
}
.dark .amount--credit {
    color: var(--success-500);
}
.amount--debit {
    color: var(--danger-600);
}
.dark .amount--debit {
    color: var(--danger-500);
}

/* File Upload */
.file-upload-zone {
    position: relative;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.file-upload-zone:hover {
    border-color: var(--brand-400);
    background: var(--brand-50);
}
.dark .file-upload-zone:hover {
    background: rgba(99, 102, 241, 0.05);
}

.file-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

[x-cloak] {
    display: none !important;
}

@media (max-width: 767px) {
    .reconcile-summary {
        grid-template-columns: 1fr auto 24px;
    }
    .reconcile-date {
        display: none;
    }
    .reconcile-form-grid {
        grid-template-columns: 1fr;
    }
}


/* ─── 28. Financial Reports ──────────────────────────────────────── */

.report-card {
    overflow: hidden;
}

.report-header {
    text-align: center;
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-6);
    border-bottom: 2px solid var(--border-default);
}

.report-company {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.report-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-600);
    margin-top: var(--space-1);
}
.dark .report-title {
    color: var(--brand-400);
}

.report-period {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.report-table thead th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-totals-row {
    border-top: 2px solid var(--border-default);
}
.report-totals-row td {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.report-major-section {
    margin-bottom: var(--space-6);
}

.report-major-title {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--brand-500);
    margin-bottom: var(--space-4);
}

.report-section {
    margin-bottom: var(--space-4);
}

.report-section-header {
    padding: var(--space-2) 0;
    margin-bottom: var(--space-1);
}

.report-section-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
}

.report-line {
    display: flex;
    align-items: center;
    padding: var(--space-1) 0;
    font-size: var(--text-sm);
}

.report-line-code {
    width: 60px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}

.report-line-name {
    flex: 1;
    color: var(--text-primary);
}

.report-line-amount {
    width: 120px;
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    flex-shrink: 0;
}

.report-empty-line {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-1) 0;
    padding-left: 60px;
}

.report-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    margin-top: var(--space-1);
    border-top: 1px solid var(--border-light);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
}
.report-subtotal .amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.report-gross-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    margin: var(--space-4) 0;
    border-radius: var(--radius-lg);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
}
.report-gross-line--positive {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid var(--success-500);
}
.dark .report-gross-line--positive {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-500);
    border-color: rgba(34, 197, 94, 0.3);
}
.report-gross-line--negative {
    background: var(--danger-50);
    color: var(--danger-700);
    border: 1px solid var(--danger-500);
}
.dark .report-gross-line--negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-500);
    border-color: rgba(239, 68, 68, 0.3);
}

.report-net-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    margin-top: var(--space-4);
    border-radius: var(--radius-lg);
    font-weight: var(--weight-bold);
    font-size: var(--text-base);
}
.report-net-line--positive {
    background: linear-gradient(135deg, var(--success-50), var(--brand-50));
    color: var(--success-700);
    border: 2px solid var(--success-500);
}
.dark .report-net-line--positive {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(99, 102, 241, 0.05));
    color: var(--success-500);
    border-color: rgba(34, 197, 94, 0.4);
}
.report-net-line--negative {
    background: linear-gradient(135deg, var(--danger-50), var(--warning-50));
    color: var(--danger-700);
    border: 2px solid var(--danger-500);
}
.dark .report-net-line--negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.05));
    color: var(--danger-500);
    border-color: rgba(239, 68, 68, 0.4);
}


/* ─── 28b. VAT Return ────────────────────────────────────────────── */

.vat-boxes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.vat-section {
    margin-bottom: var(--space-4);
}

.vat-section-title {
    font-size: 0.6875rem;
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.vat-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    transition: background var(--transition-fast);
}
.vat-box:hover {
    background: var(--surface-hover);
}

.vat-box-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.vat-box-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 24px;
    font-size: 0.6875rem;
    font-weight: var(--weight-bold);
    color: var(--brand-600);
    background: var(--brand-50);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.dark .vat-box-number {
    color: var(--brand-400);
    background: rgba(99, 102, 241, 0.1);
}

.vat-box-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.vat-box-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.vat-box-value--large {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
}

.vat-box--subtotal {
    background: var(--surface-secondary);
    border: 1px solid var(--border-light);
}

.vat-box--net {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
}
.vat-box--owe {
    background: var(--danger-50);
    border: 2px solid var(--danger-500);
}
.dark .vat-box--owe {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}
.vat-box--owe .vat-box-value {
    color: var(--danger-700);
}
.dark .vat-box--owe .vat-box-value {
    color: var(--danger-500);
}

.vat-box--reclaim {
    background: var(--success-50);
    border: 2px solid var(--success-500);
}
.dark .vat-box--reclaim {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
}
.vat-box--reclaim .vat-box-value {
    color: var(--success-700);
}
.dark .vat-box--reclaim .vat-box-value {
    color: var(--success-500);
}


/* ─── 28c. Wizard Steps ──────────────────────────────────────────── */

.wizard-step {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--border-light);
}
.wizard-step--final {
    border-bottom: none;
    padding-bottom: 0;
}

.wizard-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-full);
    background: var(--surface-secondary);
    color: var(--text-secondary);
    font-weight: var(--weight-bold);
    font-size: var(--text-sm);
    border: 1px solid var(--border-default);
}

.wizard-step-content {
    flex: 1;
}

.wizard-step-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: var(--space-2) 0;
}


.report-index-card {
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.report-index-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-300);
}
.dark .report-index-card:hover {
    border-color: var(--brand-600);
}


/* ─── 29. Print ───────────────────────────────────────────────────── */

@media print {
    /* ── Hide chrome ── */
    .app-sidebar,
    .app-header,
    .toast-container,
    .pagination,
    .search-input-wrapper,
    .page-header-actions,
    .page-actions,
    .sidebar-toggle,
    .no-print,
    .command-palette-overlay,
    .header-breadcrumb,
    .alert,
    .dashboard-hero-actions,
    .dashboard-hero-geometry {
        display: none !important;
    }

    /* ── Layout reset ── */
    .app-main {
        margin-left: 0 !important;
    }
    .app-content {
        padding: 0 !important;
        max-width: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ── Page setup ── */
    @page {
        margin: 12mm 15mm;
        size: A4;
    }
    @page :first {
        margin-top: 10mm;
    }

    /* ── Cards ── */
    .card {
        border: none !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .card--elevated {
        border: none !important;
    }
    .card-header {
        background: #f5f5f5 !important;
    }
    .stat-card {
        border: 1px solid #ddd;
        box-shadow: none !important;
    }
    .stats-grid {
        break-inside: avoid;
    }

    /* ── Tables ── */
    table {
        break-inside: auto;
    }
    tr {
        break-inside: avoid;
    }
    thead {
        display: table-header-group;
    }
    table th {
        background: #333 !important;
        color: #fff !important;
    }

    /* ── Typography ── */
    .badge {
        border: 1px solid #999;
        background: transparent !important;
        color: #000 !important;
    }
    .badge--success {
        border-color: #16a34a !important;
        color: #16a34a !important;
    }
    .badge--danger {
        border-color: #dc2626 !important;
        color: #dc2626 !important;
    }
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
    .page-header {
        border-bottom: 2px solid #000;
        margin-bottom: 12pt;
        padding-bottom: 6pt;
    }
    .page-title {
        font-size: 16pt;
        color: #000 !important;
    }
    .page-subtitle {
        color: #555 !important;
    }
    .font-mono {
        font-family: 'Courier New', monospace;
    }

    /* ── Report-specific print ── */
    .report-card {
        max-width: none !important;
        border: none !important;
    }
    .report-card .card-body {
        padding: 0 !important;
    }
    .report-header {
        border-bottom: 2px solid #000 !important;
        padding-bottom: 10pt !important;
        margin-bottom: 12pt !important;
    }
    .report-company {
        color: #000 !important;
        font-size: 14pt !important;
    }
    .report-title {
        color: #333 !important;
    }
    .report-period {
        color: #555 !important;
    }
    .report-section {
        break-inside: avoid;
    }
    .report-section-title {
        color: #000 !important;
        font-weight: 700 !important;
    }
    .report-line {
        border-bottom: 1px dotted #ccc;
    }
    .report-line-code {
        color: #555 !important;
    }
    .report-line-name {
        color: #000 !important;
    }
    .report-line-amount {
        color: #000 !important;
        font-weight: 500 !important;
    }
    .report-subtotal {
        border-top: 1px solid #000 !important;
        color: #000 !important;
        font-weight: 700 !important;
    }
    .report-subtotal .amount {
        color: #000 !important;
    }
    .report-gross-line,
    .report-gross-line--positive,
    .report-gross-line--negative {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #999 !important;
        break-inside: avoid;
    }
    .report-net-line,
    .report-net-line--positive,
    .report-net-line--negative {
        background: #e8e8e8 !important;
        color: #000 !important;
        border: 2px solid #333 !important;
        break-inside: avoid;
    }
    .report-net-line .amount--large {
        font-size: 14pt !important;
    }
    .report-major-title {
        color: #000 !important;
        border-bottom-color: #000 !important;
    }
    .report-totals-row td {
        border-top: 2px solid #000 !important;
    }

    /* ── Aged analysis tables ── */
    .report-table th {
        background: #333 !important;
        color: #fff !important;
    }
    .report-table td {
        border-bottom: 1px solid #ddd !important;
        color: #000 !important;
    }
    .report-table tfoot td {
        border-top: 2px solid #000 !important;
        font-weight: 700 !important;
    }

    /* ── Dashboard hero (print as simple header) ── */
    .dashboard-hero {
        background: #4338CA !important;
        min-height: auto !important;
        padding: 16pt !important;
        border-radius: 0 !important;
    }

    /* ── Buttons: hide all except explicitly visible ── */
    .btn {
        display: none !important;
    }

    /* ── Utility ── */
    .print-only {
        display: block !important;
    }
    .text-muted {
        color: #666 !important;
    }
    .text-tertiary {
        color: #888 !important;
    }

    /* ── Grid layouts: flatten for print ── */
    .grid {
        display: block !important;
    }
    .grid > * {
        margin-bottom: 8pt;
    }
}


/* ─── 30. Dashboard Hero Banner ───────────────────────────────────── */

.dashboard-hero {
    position: relative;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 25%, #3730A3 50%, #4338CA 75%, #4F46E5 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-10);
    margin-bottom: var(--space-8);
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.dashboard-hero-content {
    position: relative;
    z-index: 2;
    flex: 1;
}

.dashboard-hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin-bottom: var(--space-2);
}

.dashboard-hero-subtitle {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    max-width: 480px;
}

.dashboard-hero-actions {
    position: relative;
    z-index: 2;
    display: flex;
    gap: var(--space-3);
    flex-shrink: 0;
}

.dashboard-hero .btn--hero {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 10px var(--space-5);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    font-size: var(--text-sm);
    cursor: pointer;
    white-space: nowrap;
}

.dashboard-hero .btn--hero:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.dashboard-hero .btn--hero-primary {
    background: #fff;
    color: #4338CA;
    border-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dashboard-hero .btn--hero-primary:hover {
    background: #F5F3FF;
    color: #3730A3;
    border-color: #F5F3FF;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* White geometric shapes */
.dashboard-hero-geometry {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.dashboard-hero-geometry svg {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Floating geometric elements */
.geo-shape {
    position: absolute;
    opacity: 0.07;
}

.geo-circle-1 {
    width: 300px;
    height: 300px;
    border: 2px solid #fff;
    border-radius: 50%;
    top: -80px;
    right: -40px;
}

.geo-circle-2 {
    width: 180px;
    height: 180px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    bottom: -60px;
    right: 120px;
}

.geo-circle-3 {
    width: 100px;
    height: 100px;
    border: 1px solid #fff;
    border-radius: 50%;
    top: 20px;
    right: 280px;
}

.geo-diamond {
    width: 80px;
    height: 80px;
    border: 1.5px solid #fff;
    transform: rotate(45deg);
    top: 30px;
    right: 180px;
    opacity: 0.06;
}

.geo-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 86px solid rgba(255, 255, 255, 0.05);
    bottom: -20px;
    left: 60%;
}

.geo-line-1 {
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    top: 40%;
    right: 5%;
    transform: rotate(-15deg);
}

.geo-line-2 {
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    bottom: 30%;
    right: 25%;
    transform: rotate(25deg);
}

.geo-dots {
    width: 120px;
    height: 80px;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 16px 16px;
    top: 20px;
    left: 55%;
}

.geo-square {
    width: 60px;
    height: 60px;
    border: 1px solid #fff;
    border-radius: 8px;
    transform: rotate(15deg);
    bottom: 15px;
    right: 35%;
    opacity: 0.05;
}

.geo-hex {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.04);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    top: 15px;
    left: 45%;
}

/* Gradient overlay for depth */
.dashboard-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.3) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-6);
        min-height: auto;
    }
    .dashboard-hero-title {
        font-size: 1.25rem;
    }
    .dashboard-hero-actions {
        flex-wrap: wrap;
    }
    .geo-circle-1,
    .geo-circle-2,
    .geo-dots {
        display: none;
    }
}

@media print {
    .dashboard-hero {
        background: #4338CA !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .dashboard-hero-geometry {
        display: none;
    }
}


/* ─── 31. Themed Scrollbars ──────────────────────────────────────── */

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--grey-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 4px;
    border: 2px solid var(--grey-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--grey-400);
}

::-webkit-scrollbar-corner {
    background: var(--grey-100);
}

/* Sidebar scrollbar - subtler */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Table containers */
.card-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.card-body::-webkit-scrollbar-track {
    background: var(--grey-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card-body::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 3px;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--grey-300) var(--grey-100);
}

.sidebar-nav {
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ─── Dark mode scrollbars ─── */
.dark ::-webkit-scrollbar-track {
    background: var(--grey-900);
}

.dark ::-webkit-scrollbar-thumb {
    background: var(--grey-600);
    border-color: var(--grey-900);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--grey-500);
}

.dark ::-webkit-scrollbar-corner {
    background: var(--grey-900);
}

.dark .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.dark .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dark .card-body::-webkit-scrollbar-track {
    background: var(--grey-800);
}

.dark .card-body::-webkit-scrollbar-thumb {
    background: var(--grey-600);
}

.dark * {
    scrollbar-color: var(--grey-600) var(--grey-900);
}

.dark .sidebar-nav {
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}


/* ═══ Xero Migration Wizard ═══════════════════════════════════════ */

.xero-wizard-steps {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
    overflow-x: auto;
    padding-bottom: var(--space-2);
}

.xero-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    min-width: 80px;
    flex: 1;
    position: relative;
}

.xero-step::after {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(50% + 16px);
    right: calc(-50% + 16px);
    height: 2px;
    background: var(--border-default);
    z-index: 0;
}

.xero-step:last-child::after {
    display: none;
}

.xero-step--complete::after {
    background: var(--brand-500);
}

.xero-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--surface-secondary);
    color: var(--text-muted);
    border: 2px solid var(--border-default);
    position: relative;
    z-index: 1;
    transition: all 200ms ease;
}

.xero-step--active .xero-step-number {
    background: var(--brand-500);
    color: #fff;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.xero-step--complete .xero-step-number {
    background: var(--brand-500);
    color: #fff;
    border-color: var(--brand-500);
}

.xero-step-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.xero-step--active .xero-step-label {
    color: var(--brand-600);
    font-weight: 600;
}

.xero-step--complete .xero-step-label {
    color: var(--text-secondary);
}

/* Tenant selection card */
.xero-tenant-card {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color 150ms, background 150ms;
}

.xero-tenant-card:hover {
    border-color: var(--brand-300);
    background: var(--brand-50);
}

/* Mapping table */
.xero-mapping-table tbody tr {
    transition: background 150ms;
}

.xero-mapping-row--auto {
    background: transparent;
}

.xero-mapping-row--skip {
    opacity: 0.5;
    background: var(--surface-secondary);
}

.xero-mapping-row--manual {
    background: var(--warning-50);
}

/* Progress bars */
.xero-progress-bar {
    height: 6px;
    background: var(--surface-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.xero-progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 600ms ease;
    width: 0;
}

.xero-progress-bar-fill--active {
    background: var(--brand-500);
    animation: xero-progress-pulse 1.5s ease-in-out infinite;
}

.xero-progress-bar-fill--done {
    background: var(--success-500);
    width: 100%;
}

.xero-progress-bar-fill--error {
    background: var(--danger-500);
}

@keyframes xero-progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Import log */
.xero-log {
    max-height: 280px;
    overflow-y: auto;
    background: var(--grey-900);
    color: var(--grey-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.xero-log-entry {
    display: flex;
    gap: var(--space-2);
    padding: 1px 0;
}

.xero-log-entry--success {
    color: var(--success-400);
}

.xero-log-entry--error {
    color: var(--danger-400);
}

.xero-log-entry--warning {
    color: var(--warning-400);
}

.xero-log-entry--info {
    color: var(--grey-400);
}

/* Dark mode adjustments */
.dark .xero-step--active .xero-step-number {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.dark .xero-tenant-card:hover {
    background: rgba(79, 70, 229, 0.1);
}

.dark .xero-mapping-row--skip {
    background: var(--grey-800);
}

.dark .xero-mapping-row--manual {
    background: rgba(245, 158, 11, 0.1);
}

.dark .xero-log {
    background: var(--grey-950);
}

/* Guide layout */
.xero-guide-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .xero-guide-columns {
        grid-template-columns: 1fr;
    }
}

.xero-guide-col {
    min-width: 0;
}

.xero-guide-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-500);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.xero-guide-subheading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
}

.xero-guide-steps {
    padding-left: var(--space-5);
    margin: 0 0 var(--space-4) 0;
    line-height: 1.7;
    font-size: var(--text-sm);
}

.xero-guide-steps li {
    margin-bottom: var(--space-2);
}

.xero-guide-steps li ul {
    padding-left: var(--space-4);
    margin-top: var(--space-1);
}

.xero-guide-steps li ul li {
    list-style: disc;
    margin-bottom: var(--space-1);
}

.xero-guide-tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--warning-50);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--warning-400);
}

.dark .xero-guide-tip {
    background: rgba(245, 158, 11, 0.08);
}

/* Import dropzone */
.xero-import-dropzone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-10) var(--space-6);
    cursor: pointer;
    transition: all 200ms ease;
    background: var(--surface-primary);
}

.xero-import-dropzone:hover {
    border-color: var(--brand-400);
    background: var(--brand-50);
}

.xero-import-dropzone--active {
    border-color: var(--brand-500);
    background: var(--brand-50);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.xero-import-dropzone-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
    color: var(--text-muted);
    transition: all 200ms ease;
}

.xero-import-dropzone:hover .xero-import-dropzone-icon {
    background: var(--brand-100);
    color: var(--brand-600);
}

.xero-import-dropzone-icon--ready {
    background: var(--success-50) !important;
    color: var(--success-600) !important;
}

/* Import action button (used in guide) */
.xero-import-action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-lg);
    color: var(--brand-700);
    text-decoration: none;
    transition: all 150ms ease;
}

.xero-import-action-btn:hover {
    background: var(--brand-100);
    border-color: var(--brand-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.xero-import-action-btn strong {
    display: block;
    font-size: var(--text-sm);
    line-height: 1.3;
}

.xero-import-action-btn small {
    display: block;
    font-size: var(--text-xs);
    opacity: 0.7;
    font-weight: 400;
}

/* Import stats (results page) */
.xero-import-stat {
    text-align: center;
    min-width: 80px;
}

.xero-import-stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    line-height: 1;
    margin-bottom: var(--space-1);
    font-variant-numeric: tabular-nums;
}

.xero-import-stat-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Import inline select */
.xero-import-select {
    font-size: var(--text-xs);
    padding: 4px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    color: var(--text-primary);
    max-width: 160px;
    -webkit-appearance: none;
    appearance: none;
}

.dark .xero-import-select {
    background: var(--grey-800);
    border-color: var(--grey-600);
    color: var(--grey-100);
}

/* Invoice type toggle */
.xero-import-type-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    color: var(--text-secondary);
    background: var(--surface-primary);
}

.xero-import-type-btn:hover {
    border-color: var(--brand-300);
    color: var(--brand-600);
}

.xero-import-type-btn--active {
    background: var(--brand-50);
    border-color: var(--brand-400);
    color: var(--brand-700);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* Dark mode overrides */
.dark .xero-import-dropzone {
    background: var(--grey-900);
}

.dark .xero-import-dropzone:hover,
.dark .xero-import-dropzone--active {
    background: rgba(79, 70, 229, 0.08);
}

.dark .xero-import-action-btn {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.25);
    color: var(--brand-300);
}

.dark .xero-import-action-btn:hover {
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(79, 70, 229, 0.4);
}

.dark .xero-import-type-btn--active {
    background: rgba(79, 70, 229, 0.15);
    border-color: var(--brand-500);
    color: var(--brand-300);
}

.dark .xero-import-type-btn {
    background: var(--grey-800);
    border-color: var(--grey-600);
    color: var(--grey-300);
}
