/* =============================================================
   ERP Cloud 365 — Premium Design System
   ============================================================= */:root {
    /* Brand - Modern Indigo & Cyber Blue */
    --brand-1: #6366f1;
    --brand-2: #8b5cf6;
    --brand-3: #06b6d4;
    --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    /* Surfaces - Light Theme Default */
    --bg:           #ffffff;
    --bg-elevated:  #ffffff;
    --bg-soft:      #f1f5f9;
    --surface:      #ffffff;
    --surface-2:    #f1f5f9;
    --hairline:     rgba(15, 23, 42, 0.08);
    --hairline-strong: rgba(15, 23, 42, 0.14);

    /* Text - High Contrast */
    --fg:        #0f172a;
    --fg-muted:  #475569;
    --fg-faint:  #94a3b8;

    /* Sidebar - Premium Light */
    --sidebar-bg:     #ffffff;
    --sidebar-fg:     #0f172a;
    --sidebar-muted:  #475569;
    --sidebar-faint:  #94a3b8;
    --sidebar-border: rgba(15, 23, 42, 0.08);
    --sidebar-active: #f1f5f9;
    --logo-gradient:  linear-gradient(90deg, #0f172a 30%, var(--brand-1));

    /* Accents */
    --accent:        #6366f1;
    --accent-soft:   rgba(99, 102, 241, 0.08);

    --success:    #10b981;
    --success-soft: rgba(16, 185, 129, 0.1);
    --danger:     #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.1);
    --warning:    #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.1);
    --info:       #0ea5e9;
    --info-soft:  rgba(14, 165, 233, 0.1);

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Effects */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
    --shadow:     none;
    --shadow-lg:  none;
    --shadow-premium: none;
    --blur:       none;

    --header-bg:     #ffffff;
    --header-fg:     #0f172a;
    --header-muted:  #64748b;
    --header-border: rgba(15, 23, 42, 0.08);

    --transition: 200ms ease;
    --sidebar-transition: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);
}

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

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--hairline-strong) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    display: inline-block;
    min-height: 1em;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--fg-faint);
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

/* Full Light Theme */
[data-theme="light"] {
    --bg:           #ffffff;
    --bg-elevated:  #ffffff;
    --bg-soft:      #f8fafc;
    --surface:      rgba(255, 255, 255, 0.95);
    --surface-2:    #f1f5f9;
    --hairline:     rgba(15, 23, 42, 0.08);
    --hairline-strong: rgba(15, 23, 42, 0.14);

    --fg:        #0f172a;
    --fg-muted:  #475569;
    --fg-faint:  #94a3b8;

    --sidebar-bg:     #ffffff;
    --sidebar-fg:     #0f172a;
    --sidebar-muted:  #475569;
    --sidebar-faint:  #94a3b8;
    --sidebar-border: rgba(15, 23, 42, 0.08);
    --sidebar-active: #f1f5f9;
    --logo-gradient:  linear-gradient(90deg, #0f172a 30%, var(--brand-1));

    --header-bg:     #ffffff;
    --header-fg:     #0f172a;
    --header-muted:  #64748b;
    --header-border: rgba(15, 23, 42, 0.08);

    --shadow:    0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.16);
}

/* Mixed Theme (User's "Dark"): Dark Sidebar, Light Content */
[data-theme="dark"] {
    --bg:           #ffffff;
    --bg-elevated:  #ffffff;
    --bg-soft:      #f8fafc;
    --surface:      rgba(255, 255, 255, 0.95);
    --surface-2:    #f1f5f9;
    --hairline:     rgba(15, 23, 42, 0.08);
    --hairline-strong: rgba(15, 23, 42, 0.14);

    --fg:        #0f172a;
    --fg-muted:  #475569;
    --fg-faint:  #94a3b8;

    --sidebar-bg:     #0b1020;
    --sidebar-fg:     #f1f5f9;
    --sidebar-muted:  #94a3b8;
    --sidebar-faint:  #94a3b8;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --sidebar-active: rgba(99, 102, 241, 0.28);
    --logo-gradient:  linear-gradient(90deg, #f1f5f9 30%, var(--brand-1));
    --header-bg:     #0b1020;
    --header-fg:     #f1f5f9;
    --header-muted:  #94a3b8;
    --header-border: rgba(255, 255, 255, 0.12);

    --shadow:    0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.16);
}

/* System/Night Theme: Full Dark */
[data-theme="system"] {
    --bg:           #0b1020;
    --bg-elevated:  #131a32;
    --bg-soft:      #1a2244;
    --surface:      rgba(22, 28, 56, 0.72);
    --surface-2:    rgba(28, 36, 70, 0.55);
    --hairline:     rgba(255, 255, 255, 0.08);
    --hairline-strong: rgba(255, 255, 255, 0.16);

    --fg:        #f1f5f9;
    --fg-muted:  #94a3b8;
    --fg-faint:  #64748b;

    --sidebar-bg:     #0b1020;
    --sidebar-fg:     #f1f5f9;
    --sidebar-muted:  #94a3b8;
    --sidebar-faint:  #94a3b8;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --sidebar-active: rgba(99, 102, 241, 0.28);
    --logo-gradient:  linear-gradient(90deg, #f1f5f9 30%, var(--brand-1));
    --header-bg:     #0b1020;
    --header-fg:     #f1f5f9;
    --header-muted:  #94a3b8;
    --header-border: rgba(255, 255, 255, 0.12);
}

/* ----- Reset & body ----- */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

::selection {
    background: var(--brand-1);
    color: white;
}

body {
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.fas, .far, .fab, .fa-solid, .fa-regular, .fa-brands {
    font-family: "Font Awesome 6 Free" !important;
}

[dir="rtl"] body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html { scroll-behavior: smooth; }

/* Aurora background - Disabled for Minimalist View */
body::before, body::after {
    display: none;
}

/* ----- Scrollbars ----- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover-disabled { background: var(--fg-faint); }

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

body.sidebar-collapsed .sidebar,
body.sidebar-collapsed .sidebar .nav-links {
    overflow: visible !important;
}

.sidebar .logo {
    height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar .logo span {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
    background: var(--logo-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.sidebar .logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.4));
}

.nav-links {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-thumb { background: var(--sidebar-faint); border-radius: 10px; }

.nav-group {
    margin-bottom: 0.5rem;
}

.nav-group-title {
    padding: 0.75rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--sidebar-muted);
}

.nav-group-title:hover {
    color: var(--sidebar-fg);
    background: rgba(255, 255, 255, 0.03);
}

/* Pagination */
.pagination-wrap {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

.btn-pagination {
    min-width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--hairline);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--fg-muted);
    cursor: pointer;
    transition: var(--transition);
}

.btn-pagination:hover-disabled {
    border-color: var(--brand-1);
    color: var(--brand-1);
}

.btn-pagination.active {
    background: var(--brand-1);
    border-color: var(--brand-1);
    color: white;
}

.group-title-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.725rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.group-title-content i {
    width: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.nav-group-title > .fa-chevron-down {
    font-size: 0.65rem;
    transition: transform var(--transition);
}

.nav-group.collapsed .fa-chevron-down {
    transform: rotate(-90deg);
}

.nav-sub-menu {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group.collapsed .nav-sub-menu {
    max-height: 0;
}

.nav-item {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    color: var(--sidebar-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
}

.nav-item:hover {
    color: var(--sidebar-fg);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--sidebar-fg);
    background: var(--sidebar-active);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--brand-1);
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 8px var(--brand-1);
}

.nav-group-title.active-parent {
    color: var(--brand-1);
    background: rgba(255, 255, 255, 0.02);
}

.nav-group-title.active-parent .group-icon {
    color: var(--brand-1);
    opacity: 1;
}

.nav-group:not(.collapsed) {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
}

.nav-sub-menu {
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    margin-left: 1.25rem;
}

/* Sidebar Toggle */
.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--sidebar-faint);
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: var(--sidebar-fg);
}

/* body.sidebar-collapsed support */
body.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

body.sidebar-collapsed .sidebar .logo span,
body.sidebar-collapsed .group-title-content span,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-group-title .fa-chevron-down,
body.sidebar-collapsed #pwa-install-container {
    display: none !important;
}

body.sidebar-collapsed .sidebar .logo {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .sidebar {
    overflow: visible !important;
}

body.sidebar-collapsed .nav-links {
    padding: 1.5rem 0.5rem;
    overflow: visible;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 1rem 0;
}

body.sidebar-collapsed .nav-group-title {
    justify-content: center;
}

body.sidebar-collapsed .group-title-content i {
    margin: 0;
    font-size: 1.1rem;
}

body.sidebar-collapsed .sidebar .sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 60px;
    background: var(--bg-elevated);
    border: 1px solid var(--hairline-strong);
    box-shadow: var(--shadow);
    z-index: 101;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    padding: 0;
    color: var(--fg);
    display: flex;
    justify-content: center;
    align-items: center;
}

body.sidebar-collapsed .sidebar .sidebar-toggle i {
    transform: rotate(180deg);
    font-size: 0.7rem;
}

body.sidebar-collapsed .sidebar .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
}

body.sidebar-collapsed .sidebar .nav-item i {
    font-size: 1.1rem;
}

body.sidebar-collapsed .sidebar .nav-group-title {
    justify-content: center;
    padding: 1rem 0 0.5rem;
}

body.sidebar-collapsed .sidebar .nav-sub-menu {
    position: absolute;
    left: 100%;
    top: 0;
    width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: 10px 10px 30px rgba(0,0,0,0.2);
    display: none !important;
    z-index: 9999;
    flex-direction: column;
    margin-left: 10px;
}

body.sidebar-collapsed .sidebar .nav-sub-menu .nav-item {
    display: flex !important;
    width: 100%;
    padding: 0.75rem 1rem;
    color: var(--fg);
    justify-content: flex-start;
    gap: 0.75rem;
}

body.sidebar-collapsed .sidebar .nav-sub-menu .nav-item span {
    display: inline !important;
    white-space: nowrap;
}

/* Invisible bridge to prevent hover loss when moving from icon to menu */
body.sidebar-collapsed .sidebar .nav-group::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 20px;
    height: 100%;
    z-index: 9998;
}

body.sidebar-collapsed .sidebar .nav-group {
    position: relative;
}
body.sidebar-collapsed .sidebar .nav-group:hover {
    z-index: 10000;
}

body.sidebar-collapsed .sidebar .nav-group:hover .nav-sub-menu {
    display: flex !important;
    max-height: none !important;
    overflow: visible !important;
}

.nav-group.collapsed .nav-sub-menu {
    max-height: 0;
    overflow: hidden;
    display: none;
}

.nav-group:not(.collapsed) .nav-sub-menu {
    max-height: 1000px;
    display: flex;
}

body.sidebar-collapsed .sidebar .nav-sub-menu .nav-item {
    justify-content: flex-start;
    padding: 0.625rem 0.875rem;
}

body.sidebar-collapsed .sidebar .nav-sub-menu .nav-item span {
    display: inline;
}

/* =============================================================
   Main Layout
   ============================================================= */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: var(--sidebar-transition);
    background: var(--bg);
    position: relative;
}

    header {
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--hairline-strong);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-company-badge {
    background: var(--brand-1-soft);
    color: var(--brand-1);
    padding: 0.5rem 1.1rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    border: 1px solid var(--brand-1-soft);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .header-company-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #a5a6ff;
}

.header-user-badge {
    background: var(--surface-2);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--brand-1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--hairline);
    transition: var(--transition);
}

.header-user-badge i {
    font-size: 1.1rem;
    color: var(--brand-1);
}

.header-user-badge:hover-disabled {
    background: var(--brand-1-soft);
    border-color: var(--brand-1-soft);
}

.header-title {
    display: flex;
    flex-direction: column;
}

.header-title h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--header-fg);
}

.header-title p {
    font-size: 0.8rem;
    color: var(--header-muted);
    margin-top: 1px;
}

.header-company-branding {
    display: none;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}
@media (min-width: 901px) {
    .header-company-branding.active {
        display: flex !important;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--header-fg);
}

.fy-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--hairline-strong);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    color: var(--brand-1);
    font-size: 0.85rem;
    font-weight: 600;
}

.fy-selector select {
    background: transparent;
    border: none;
    color: var(--fg);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding-right: 0.5rem;
}

.fy-selector select:focus {
    outline: none;
}

.header-actions .btn-ghost {
    color: var(--header-muted);
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.header-actions .btn-ghost i {
    font-size: 1.1rem;
}

.header-actions .btn-ghost:hover-disabled {
    color: var(--header-fg);
    background: var(--surface-2);
}

.header-actions .btn-icon {
    width: 40px;
    padding: 0;
}

#app-container {
    padding: calc(72px + 2rem) 2.5rem 2.5rem 2.5rem;
    max-width: 100%;
    margin: 0;
}

/* =============================================================
   Cards & Containers
   ============================================================= */
.card {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: none;
    margin-bottom: 1.5rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* =============================================================
   Stat cards
   ============================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--hairline);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover-disabled {
    transform: translateY(-2px);
    border-color: var(--brand-1);
}
.stat-card:hover-disabled::before { opacity: 1; }
.stat-card > * { position: relative; z-index: 1; }

.stat-card .label {
    color: var(--fg-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.stat-card .label i {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--brand-1);
    display: grid; place-items: center;
    font-size: 0.85rem;
}
.stat-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg);
}
.stat-card .value small {
    font-size: 0.85rem;
    color: var(--fg-muted);
    font-weight: 500;
    margin-left: 0.25rem;
}
.stat-card .trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--fg-muted);
}
.trend.up    { color: var(--success); }
.trend.down  { color: var(--danger); }

/* Variant tints for stat cards */
.stat-card.tint-success .label i { background: var(--success-soft); color: var(--success); }
.stat-card.tint-danger  .label i { background: var(--danger-soft);  color: var(--danger); }
.stat-card.tint-warning .label i { background: var(--warning-soft); color: var(--warning); }
.stat-card.tint-info    .label i { background: var(--info-soft);    color: var(--info); }

/* =============================================================
   Tables
   ============================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--fg-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06rem;
    border-bottom: 1px solid var(--hairline);
    background: var(--surface-2);
    position: sticky;
    top: 0;
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--hairline);
    color: var(--fg);
    vertical-align: middle;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover-disabled { background: var(--accent-soft); }
tr:last-child td { border-bottom: none; }

tfoot td, tfoot th {
    font-weight: 600;
    background: var(--surface-2);
    border-top: 2px solid var(--hairline-strong);
    border-bottom: none;
}

.table-responsive { overflow-x: auto; }

/* =============================================================
   Buttons
   ============================================================= */

.btn {
    height: 2.5rem;
    padding: 0 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--fg);
    white-space: nowrap;
}
.btn:hover-disabled {
    background: var(--bg-soft);
    border-color: var(--hairline-strong);
    transform: translateY(-1px);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--brand-grad);
    color: white;
    border: none;
    box-shadow: 0 4px 12px -3px var(--brand-1);
}
.btn-primary:hover-disabled {
    background: var(--brand-grad);
    color: white;
    filter: brightness(1.1);
}

.btn-success { background: var(--success); color: white; border: none; }
.btn-success:hover-disabled { filter: brightness(1.05); }
.btn-danger  { background: var(--danger);  color: white; border: none; }
.btn-danger:hover-disabled  { filter: brightness(1.05); }
.btn-warning { background: var(--warning); color: white; border: none; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--hairline);
}
.btn-ghost:hover-disabled { background: var(--accent-soft); }

.btn-icon {
    width: 2.5rem;
    padding: 0;
    justify-content: center;
}

.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { height: 3.25rem; padding: 0 1.75rem; font-size: 1rem; }

.btn-row {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

/* Action Button Variants */
.btn-action-view   { color: var(--info);   background: var(--info-soft); }
.btn-action-view:hover-disabled { background: var(--info); color: white; }

.btn-action-edit   { color: var(--brand-1); background: var(--accent-soft); }
.btn-action-edit:hover-disabled { background: var(--brand-1); color: white; }

.btn-action-delete { color: var(--danger);  background: var(--danger-soft); }
.btn-action-delete:hover-disabled { background: var(--danger); color: white; }

.btn-action-print  { color: var(--fg-muted); background: var(--hairline); }
.btn-action-print:hover-disabled { background: var(--fg); color: var(--bg); }

/* =============================================================
   Forms
   ============================================================= */

.form-group {
    margin-bottom: 1.25rem;
    display: flex; flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--fg-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    color: var(--fg);
    outline: none;
    font-size: 0.875rem;
    transition: all var(--transition);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea { background: white; }

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-1);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--bg-elevated);
}
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus { background: white; }

input[readonly] {
    background: var(--bg-soft);
    color: var(--fg-muted);
    cursor: default;
}

textarea { resize: vertical; min-height: 70px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 10px 6px;
    padding-right: 2rem;
}

/* =============================================================
   Badges
   ============================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04rem;
    background: var(--accent-soft);
    color: var(--brand-1);
}
.badge.success  { background: var(--success-soft); color: var(--success); }
.badge.danger   { background: var(--danger-soft);  color: var(--danger); }
.badge.warning  { background: var(--warning-soft); color: var(--warning); }
.badge.info     { background: var(--info-soft);    color: var(--info); }
.badge.primary  { background: var(--accent-soft);  color: var(--brand-1); }
.badge.muted    { background: var(--hairline);     color: var(--fg-muted); }

/* COA group-type tints */
.badge.asset     { background: var(--info-soft);    color: var(--info); }
.badge.liability { background: var(--warning-soft); color: var(--warning); }
.badge.equity    { background: var(--accent-soft);  color: var(--brand-1); }
.badge.revenue   { background: var(--success-soft); color: var(--success); }
.badge.expense   { background: var(--danger-soft);  color: var(--danger); }

/* =============================================================
   Utility
   ============================================================= */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.delivered { background: #dcfce7; color: #166534; }
.badge.invoiced { background: #dbeafe; color: #1e40af; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.completed { background: #f1f5f9; color: #475569; }
.badge.on-hold { background: #fef9c3; color: #854d0e; }

.flex   { display: flex; }
.between { justify-content: space-between; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.center { align-items: center; }
.end    { justify-content: flex-end; }
.right  { text-align: right; }
.muted  { color: var(--fg-muted); }
.mb-0   { margin-bottom: 0; }
.mt-1   { margin-top: 0.5rem; }
.mt-2   { margin-top: 1rem; }

.divider {
    height: 1px;
    background: var(--hairline);
    margin: 1rem 0;
    border: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fg-muted);
}
.empty-state i { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.4; }

/* Loading */
.loader {
    display: flex; align-items: center; justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--fg-muted);
}
.loader::before {
    content: '';
    width: 24px; height: 24px;
    border: 2px solid var(--hairline);
    border-top-color: var(--brand-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   Toast notifications
   ============================================================= */

#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--bg-elevated);
    color: var(--fg);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--hairline);
    border-left: 4px solid var(--brand-1);
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInToast 250ms cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .toast-icon { color: var(--brand-1); font-size: 1.1rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast .toast-close {
    margin-left: auto;
    cursor: pointer;
    color: var(--fg-muted);
    border: none; background: none;
    font-size: 1rem;
}
.toast.exit { animation: slideOutToast 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }

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

/* =============================================================
   Modals (dialog)
   ============================================================= */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(11, 16, 32, 0.65);
    backdrop-filter: blur(6px);
    display: grid; place-items: center;
    z-index: 500;
    animation: fadeIn 200ms;
}
.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 540px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* =============================================================
   Login screen
   ============================================================= */
/* =============================================================
   Login screen — Professional Light Layout
   ============================================================= */
.login-shell {
    position: fixed; inset: 0;
    display: flex;
    background: #f8fafc;
    z-index: 10000;
}

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-visual {
    flex: 1.2;
    position: relative;
    background: #6366f1 url('../img/login_bg.png') no-repeat center center;
    background-size: cover;
    display: flex;
    align-items: flex-end;
    padding: 4rem;
    overflow: hidden;
}

.login-visual::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.8) 100%);
}

.visual-content {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 540px;
}

.v-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 1.5rem;
}

.visual-content h2 {
    font-size: 3rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
}

.visual-content p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.login-content {
    flex: 1;
    background: #ffffff;
    display: grid;
    place-items: center;
    padding: 2rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    text-align: center;
}

.login-card .brand {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1.25rem;
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.login-card .subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

.login-card .form-group {
    text-align: left;
}

.login-card label {
    color: #475569;
    font-weight: 600;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon > i {
    position: absolute;
    left: 1.25rem;
    color: #94a3b8;
    font-size: 1rem;
    transition: color 0.3s;
    pointer-events: none;
    z-index: 2;
}

.input-with-icon input {
    padding-left: 3.25rem !important;
    height: 3.5rem;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    width: 100%;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

.input-with-icon input:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-with-icon input:focus + i {
    color: #6366f1;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #64748b;
}

.remember-me input {
    width: 16px; height: 16px;
    border-radius: 4px;
}

.forgot-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
}

.login-btn {
    width: 100%;
    height: 3.5rem;
    justify-content: center;
    font-size: 1rem;
    border-radius: 12px;
    gap: 0.75rem;
    background: #6366f1;
    color: white;
    font-weight: 700;
}

/* Mobile Responsiveness for Voucher Entry */
@media (max-width: 768px) {
    .voucher-header {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .voucher-line {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.5rem;
        background: var(--bg-soft);
        border: 1px solid var(--hairline);
        border-radius: var(--radius);
        margin-bottom: 1rem;
        position: relative;
    }

    .voucher-line > div {
        width: 100% !important;
        flex: none !important;
    }

    .voucher-line [data-key="action"] {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        width: auto !important;
    }

    /* Grid headers hide on mobile */
    .voucher-grid-header {
        display: none;
    }

    /* Add labels for mobile */
    .voucher-line > div::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--fg-faint);
        margin-bottom: 0.25rem;
    }
}

.login-error-box {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #fef2f2;
    color: #ef4444;
    font-size: 0.85rem;
    text-align: center;
    display: none;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.login-error-box.active {
    display: block;
    animation: shake 0.4s ease;
}

.login-footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
}

.footer-links {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-card .brand h2 {
    color: #0f172a;
    margin: 0.5rem 0 0.25rem;
    font-size: 1.85rem;
}

.login-card .brand-icon img {
    max-height: 80px;
    width: auto;
}

@media (max-width: 992px) {
    .login-visual { display: none; }
    .login-content { padding: 1rem; background: #f8fafc; }
    .login-card { padding: 2rem; background: #ffffff; border-radius: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
}

/* =============================================================
   Animations
   ============================================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 350ms ease forwards; }

/* =============================================================
   Report-specific styles (P&L, BS, CF)
   ============================================================= */
.ifrs-report {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: var(--blur);
}
.ifrs-report .report-head {
    text-align: center;
    border-bottom: 2px solid var(--hairline-strong);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.ifrs-report .report-head h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}
.ifrs-report .report-head .meta {
    color: var(--fg-muted);
    font-size: 0.875rem;
}

.ifrs-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    align-items: baseline;
}
.ifrs-line.section {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04rem;
    color: var(--fg-muted);
    font-size: 0.75rem;
    margin-top: 1rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--hairline);
}
.ifrs-line.subtotal {
    border-top: 1px solid var(--hairline-strong);
    border-bottom: 1px solid var(--hairline-strong);
    font-weight: 600;
    margin-top: 0.5rem;
}
.ifrs-line.total {
    border-top: 2px double var(--fg);
    border-bottom: 2px double var(--fg);
    font-weight: 800;
    font-size: 1.05rem;
    padding: 0.875rem 0;
    margin-top: 0.75rem;
}
.ifrs-line.indent { padding-left: 1.5rem; color: var(--fg-muted); }
.ifrs-line .amount { font-variant-numeric: tabular-nums; }
.amount.drillable, .drillable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: color 0.15s;
}
.amount.drillable:hover-disabled, .drillable:hover-disabled { color: var(--brand-1); }
.drilldown-panel {
    margin-top: 1.25rem;
    border-left: 4px solid var(--brand-1);
    animation: slideDown 0.2s ease-out;
}
.drilldown-panel .drilldown-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.drilldown-panel .drilldown-close {
    background: none; border: 0; cursor: pointer; color: var(--fg-muted);
    font-size: 1rem; padding: 0.25rem 0.5rem;
}
.drilldown-panel .drilldown-close:hover-disabled { color: var(--danger); }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   Print
   ============================================================= */
@media print {
    body, body::before, body::after { background: white !important; color: black !important; }
    body::before, body::after { display: none !important; }
    .sidebar, header, .btn, .header-actions, #toast-container { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .card, .ifrs-report {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        page-break-inside: avoid;
    }
    /* Reset table styles for general pages but NOT for the statement sheet */
    table:not(.statement-sheet table), 
    :not(.statement-sheet) > table th, 
    :not(.statement-sheet) > table td { border-color: #ccc !important; color: black !important; background: white !important; }
    :not(.statement-sheet) > table th { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; }
    .badge { border: 1px solid #999 !important; color: black !important; background: white !important; }
    .ifrs-line.total { border-color: black !important; }
    /* Apply black text globally EXCEPT inside statement sheets which use brand colors */
    *:not(.statement-sheet *) { color: black !important; }
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 1024px) {
    .main-content { padding: 1.5rem 1.5rem; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: inline-flex !important; }
}

.mobile-menu-btn { display: none; }

@media (max-width: 720px) {
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .header-title h1 { font-size: 1.25rem; }
    .main-content { padding: 1rem; }
    .card { padding: 1.25rem; }
    table { font-size: 0.8rem; }
    th, td { padding: 0.625rem; }
}

/* =============================================================
   Voucher Entry Pages — Receipt / Payment / JV / Sale / Purchase
   Light + gold-accent layout, scoped via .voucher-page wrapper.
   ============================================================= */
.voucher-page {
    --gold:        #b8985a;
    --gold-soft:   #d4b87a;
    --gold-faint:  #f7f1e3;
    --v-bg:        #f5f6f8;
    --v-card:      #ffffff;
    --v-fg:        #2c2c2c;
    --v-fg-muted:  #6b7280;
    --v-border:    #e5e7eb;
    --v-required:  #d33;

    background: var(--v-bg);
    color: var(--v-fg);
    margin: -2rem -2.5rem;
    padding: 2rem 2.5rem 8rem;
    min-height: calc(100vh - 2rem);
    display: block;
    overflow-y: auto;
}

/* Import Preview Stat Cards */
.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--hairline-strong);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}
.stat-card strong {
    font-size: 1.5rem;
    display: block;
}
.stat-card small {
    color: var(--fg-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.voucher-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.voucher-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold);
    font-size: 1.35rem;
    font-weight: 600;
}
.voucher-title .v-back {
    background: transparent;
    border: 0;
    color: var(--gold);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
}
.voucher-title .v-no-display {
    margin-left: 1rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.9rem;
    background: var(--gold-faint);
    color: var(--gold);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--gold-soft);
    font-weight: 700;
}
.voucher-title .v-back:hover-disabled { background: var(--gold-faint); border-radius: 50%; }

.voucher-breadcrumb {
    color: var(--v-fg-muted);
    font-size: 0.85rem;
}
.voucher-breadcrumb .crumb {
    color: var(--gold);
    text-decoration: none;
}
.voucher-breadcrumb .crumb-current {
    color: var(--v-fg-muted);
}
.voucher-breadcrumb .sep { margin: 0 0.4rem; color: var(--gold-soft); }

.voucher-card {
    background: var(--v-card);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid var(--v-border);
}

.voucher-grid-3 {
    display: grid;
    grid-template-columns: 0.5fr 0.75fr 1.75fr;
    gap: 1.5rem;
}

.voucher-grid-4 {
    display: grid;
    grid-template-columns: 0.5fr 0.75fr 0.75fr 2fr;
    gap: 1.5rem;
}

.voucher-field-checkbox {
    display: flex;
    align-items: center;
    padding-top: 0.5rem;
}
.voucher-field-checkbox label {
    margin: 0 !important;
    font-size: 0.9rem !important;
    color: var(--v-fg) !important;
}
.voucher-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.voucher-field { display: flex; flex-direction: column; gap: 0.5rem; }
.voucher-field label {
    color: var(--v-fg-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.voucher-field label .req { color: var(--v-required); margin-left: 2px; }

.voucher-input,
.voucher-select,
.voucher-textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--v-border);
    border-radius: 4px;
    background: var(--v-card);
    color: var(--v-fg);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.voucher-input:focus,
.voucher-select:focus,
.voucher-textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-faint);
}
.voucher-textarea { resize: vertical; min-height: 100px; }

/* Center alignment for line items to match headers */
.voucher-line .voucher-input,
.voucher-line .voucher-select,
.voucher-line .combobox-search {
    text-align: center;
}

/* Exception for description or long text if needed, but keeping it uniform for now as requested */

.voucher-input-icon {
    position: relative;
}
.voucher-input-icon .v-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 0.95rem;
    pointer-events: none;
}
.voucher-input-icon .voucher-input { padding-left: 2.25rem; }

.voucher-input-icon-right .v-icon-r {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 0.95rem;
    pointer-events: none;
}
.voucher-input-icon-right .voucher-input { padding-right: 2.25rem; }

/* Lines table */
.voucher-lines {
    display: grid;
    gap: 0.5rem;
}
.voucher-line {
    display: grid;
    gap: 0.5rem;
    align-items: center;
}
.voucher-line.header {
    color: var(--v-fg-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--v-border);
    margin-bottom: 0.5rem;
    text-align: center;
}
.divider { border: 0; border-top: 1px solid var(--v-border); margin: 1.5rem 0; }

/* Branding Uploads */
.brand-upload {
    border: 2px dashed var(--v-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: var(--v-card-alt);
    transition: all 0.2s ease;
}
.brand-upload:hover-disabled { border-color: var(--gold); background: var(--gold-faint); }
.brand-upload i { font-size: 2rem; color: var(--gold); }
.brand-preview { max-width: 100%; max-height: 120px; border-radius: 4px; box-shadow: var(--shadow-sm); }

.voucher-line.header .req { color: var(--v-required); margin-left: 2px; }

/* Receipt/Payment line: Account / Invoice / Description / Currency / Rate / Amount / AED Amount / Action */
.voucher-line.receipt-line {
    grid-template-columns: 2fr 1fr 2fr 1fr 0.4fr;
}
/* Journal line: Account / Description / Debit / Credit / Action */
.voucher-line.journal-line {
    grid-template-columns: 2fr 2fr 1fr 1fr 0.4fr;
}
.voucher-line.product-line {
    grid-template-columns: 2.5fr 0.6fr 1fr 1fr 1fr 1fr 0.4fr;
}
/* Metal Industry specific line: Item / Heat # / Coil # / Qty / Price / VAT Type / VAT Amount / Total / Action */
.voucher-line.metal-product-line {
    grid-template-columns: 2fr 1fr 1fr 0.6fr 1fr 1fr 1fr 1fr 0.4fr;
}
/* Expense line: Account / Note / Amount / VAT Type / VAT Amount / Action */
.voucher-line.expense-line {
    grid-template-columns: 2fr 1.5fr 1fr 1fr 0.8fr 0.4fr;
}
/* BOM line: Component / Qty / Action */
.voucher-line.bom-line {
    grid-template-columns: 3fr 1fr 0.5fr;
}

/* Voucher Preview Modal */
.voucher-preview { padding: 10px; color: var(--v-fg); }
.v-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; padding-bottom: 0.5rem; }
.v-company-details { flex: 1; text-align: left; }
.v-logo-wrap { text-align: right; }
.v-logo { max-height: 80px; max-width: 250px; object-fit: contain; }
.v-logo-placeholder { width: 50px; height: 50px; background: var(--v-card-alt); display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--gold); font-size: 1.5rem; }
.v-meta { text-align: right; }
.v-type-badge { font-size: 0.75rem; font-weight: 800; color: var(--gold); letter-spacing: 0.1em; }
.v-desc { margin-bottom: 1.5rem; padding: 1rem; background: var(--v-card-alt); border-radius: 8px; border-left: 4px solid var(--gold); }
.v-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.v-table th { text-align: left; background: var(--v-card-alt); padding: 12px; border-bottom: 2px solid var(--v-fg); font-size: 0.8rem; text-transform: uppercase; }
.v-table td { padding: 12px; border-bottom: 1px solid var(--v-border); }
.v-table tfoot td { font-weight: 700; background: var(--v-card-alt); border-top: 2px solid var(--v-fg); }
.v-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; margin-top: 3rem; }
.v-sig-line { border-top: 1px solid var(--v-fg); padding-top: 0.5rem; text-align: center; position: relative; font-size: 0.85rem; font-weight: 600; color: var(--v-fg-muted); }
.v-sig-img { position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%); max-height: 50px; pointer-events: none; }

.voucher-amount-display {
    text-align: center;
    color: var(--v-fg);
    font-weight: 500;
    padding: 0.65rem 0.5rem;
}

.voucher-rate {
    text-align: center;
    color: var(--v-fg);
    padding: 0.65rem 0.5rem;
    background: var(--gold-faint);
    border-radius: 4px;
    font-weight: 500;
}

.voucher-line-action {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    min-width: 60px;
}
.voucher-line-action button {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--gold);
    font-size: 1rem;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: background 150ms ease;
}
.voucher-line-action button:hover-disabled { background: var(--gold-faint); }
.voucher-line-action .remove { color: var(--v-required); }

.voucher-footer {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}
.voucher-total-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--v-border);
}
.voucher-total-label {
    color: var(--v-fg-muted);
    font-size: 0.95rem;
}
.voucher-total-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--v-fg);
}

.voucher-save-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}
.btn-save-pill {
    background: var(--gold-soft);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 0.7rem 2.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(184,152,90,0.25);
    transition: background 150ms ease, transform 100ms ease;
}
.btn-save-pill:hover-disabled { background: var(--gold); }
.btn-save-pill:active { transform: translateY(1px); }
.btn-save-pill:disabled { opacity: 0.6; cursor: not-allowed; }

/* List page header (matches voucher style for "New" button + breadcrumb) */
.voucher-list-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.btn-new-pill {
    background: var(--gold-soft, #d4b87a);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-new-pill:hover-disabled { background: var(--gold, #b8985a); }

/* Searchable combobox */
.voucher-combobox {
    position: relative;
    width: 100%;
}
.voucher-combobox .combobox-search {
    width: 100%;
    padding-right: 2rem;
}
.voucher-combobox::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold, #b8985a);
    font-size: 0.7rem;
    pointer-events: none;
}
.combobox-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--v-card, #fff);
    border: 1px solid var(--v-border, #e5e7eb);
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
}
.combobox-option,
.combobox-create,
.combobox-empty {
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    cursor: pointer;
    line-height: 1.3;
}
.combobox-option:hover-disabled {
    background: var(--gold-faint, #f7f1e3);
}
.combobox-create {
    border-top: 1px solid var(--v-border, #e5e7eb);
    color: var(--gold, #b8985a);
    font-weight: 500;
    background: var(--gold-faint, #f7f1e3);
}
.combobox-create:hover-disabled {
    background: #f0e6cf;
}
.combobox-empty {
    color: var(--v-fg-muted, #6b7280);
    cursor: default;
}

@media (max-width: 1100px) {
    .voucher-line.receipt-line,
    .voucher-line.journal-line,
    .voucher-line.product-line {
        grid-template-columns: 1fr;
    }
    .voucher-line.header { display: none; }
    .voucher-line { padding: 0.75rem; border: 1px solid var(--v-border); border-radius: 6px; }
    .voucher-grid-3, .voucher-grid-2, .voucher-footer { grid-template-columns: 1fr; }
}
/* =============================================================
   RTL Support (Arabic)
   ============================================================= */

[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--hairline);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .nav-item {
    gap: 0.75rem;
    flex-direction: row;
    justify-content: flex-start;
}

[dir="rtl"] .nav-item i {
    margin-right: 0;
    margin-left: 0.75rem;
}

[dir="rtl"] .nav-item.active::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
}

[dir="rtl"] .nav-group-title i {
    transform: rotate(0);
}

[dir="rtl"] .nav-group.collapsed .nav-group-title i {
    transform: rotate(90deg);
}

[dir="rtl"] th {
    text-align: right;
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn i {
    margin-left: 0.25rem;
    margin-right: 0;
}

[dir="rtl"] select {
    background-position: left 0.875rem center;
    padding-right: 0.875rem;
    padding-left: 2rem;
}

[dir="rtl"] #toast-container {
    right: auto;
    left: 1rem;
}

[dir="rtl"] .toast {
    flex-direction: row-reverse;
    border-left: 1px solid var(--hairline);
    border-right: 4px solid var(--brand-1);
}

[dir="rtl"] .toast.success { border-right-color: var(--success); }
[dir="rtl"] .toast.error   { border-right-color: var(--danger); }
[dir="rtl"] .toast.warning { border-right-color: var(--warning); }

[dir="rtl"] .toast .toast-close {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .stat-card .label {
    flex-direction: row-reverse;
}

[dir="rtl"] .stat-card .value small {
    margin-left: 0;
    margin-right: 0.25rem;
}

[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .login-card .brand i {
    box-shadow: 0 12px 32px -10px var(--brand-1);
}

/* RTL Sidebar and Main Content */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--sidebar-border);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] header {
    left: 0;
    right: var(--sidebar-width);
}

[dir="rtl"] body.sidebar-collapsed .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed-width);
}

[dir="rtl"] body.sidebar-collapsed header {
    left: 0;
    right: var(--sidebar-collapsed-width);
}

[dir="rtl"] body.sidebar-collapsed .sidebar .nav-sub-menu {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] body.sidebar-collapsed .sidebar .nav-group::after {
    left: auto;
    right: 100%;
}

[dir="rtl"] .nav-group-title i.fa-chevron-down {
    transform: rotate(0deg);
}
/* TABBED INTERFACE */
.setup-tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}
.tab-btn:hover-disabled {
    background: var(--accent-soft);
    color: var(--primary);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
    background: var(--primary-soft);
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
    animation: slideUp 0.3s ease-out;
}

/* ALERT BANNERS */
.alert-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--info-soft);
    border-left: 5px solid var(--info);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    color: var(--slate-700);
}
.alert-banner.urgent {
    background: #fff1f2;
    border-left-color: var(--danger);
    color: #991b1b;
}
.alert-banner i {
    font-size: 1.25rem;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

[dir="rtl"] .nav-group:not(.collapsed) .nav-group-title i.fa-chevron-down {
    transform: rotate(-180deg);
}

.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info) !important; }

/* =============================================================
   MOBILE RESPONSIVENESS (PHONES & TABLETS)
   ============================================================= */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 60px;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 2000;
        box-shadow: 20px 0 50px rgba(0,0,0,0.3);
        width: 280px !important;
        height: 100vh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        background: var(--sidebar-bg) !important;
        display: flex !important;
        flex-direction: column !important;
        transition: transform 0.3s ease !important;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    header {
        left: 0 !important;
        right: 0 !important;
        padding: 0.5rem 1rem;
        height: var(--header-height);
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    /* Style nav items as buttons */
    .nav-links {
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 0.5rem !important;
        overflow-y: auto !important;
    }

    .nav-group {
        margin-bottom: 0.5rem !important;
        width: 100% !important;
    }

    .nav-group-title {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: var(--surface-2) !important;
        border: 1px solid var(--hairline) !important;
        border-radius: var(--radius) !important;
        padding: 0.85rem 1rem !important;
        color: var(--fg) !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        cursor: pointer !important;
    }

    .nav-group-title:hover {
        background: var(--brand-1-soft) !important;
        color: var(--brand-1) !important;
    }

    .nav-sub-menu {
        display: none !important;
        flex-direction: column !important;
        gap: 0.25rem !important;
        padding-left: 1rem !important;
        margin-top: 0.25rem !important;
        border-left: 2px solid var(--hairline) !important;
    }

    .nav-group:not(.collapsed) .nav-sub-menu {
        display: flex !important;
    }

    .nav-item {
        display: flex !important;
        align-items: center !important;
        background: var(--bg-elevated) !important;
        border: 1px solid var(--hairline) !important;
        border-radius: var(--radius-sm) !important;
        padding: 0.75rem 1rem !important;
        color: var(--fg-muted) !important;
        font-size: 0.85rem !important;
        cursor: pointer !important;
    }

    .nav-item:hover, .nav-item.active {
        background: var(--brand-1) !important;
        color: white !important;
        border-color: var(--brand-1) !important;
    }

    .nav-item.active::before {
        display: none !important;
    }

    .sidebar .logo {
        display: flex !important;
        padding: 1rem !important;
        border-bottom: 1px solid var(--hairline) !important;
    }

    #app-container {
        padding: calc(var(--header-height) + 1rem) 1rem 1rem 1rem !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    header {
        left: 0 !important;
        right: 0 !important;
        padding: 0.5rem 1rem;
        height: var(--header-height);
    }

    /* Stack grids */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .card {
        padding: 1.25rem !important;
        border-radius: var(--radius) !important;
        margin-bottom: 1rem;
    }

    /* Modal adjustments */
    .modal {
        width: 95% !important;
        margin: 10px;
        max-height: 90vh;
        border-radius: var(--radius);
    }

    /* Form groups stacking */
    .flex.between, .flex.end {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .btn-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Table responsiveness */
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
        width: calc(100% + 2rem);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Document Designer */
    .designer-layout {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .page-title h1 { font-size: 1.1rem; }
    .page-title p { font-size: 0.75rem; }
    .header-actions { gap: 0.25rem; }
    
    .header-user-badge {
        padding: 0.25rem 0.5rem;
    }
    
    .card {
        padding: 1rem !important;
        border: none;
        border-radius: 0;
        margin: 0 -1rem 1rem -1rem;
        width: calc(100% + 2rem);
    }
    
    .tab-btn {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* RTL Mobile Overrides */
@media (max-width: 992px) {
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        left: auto;
        right: 0;
    }
    [dir="rtl"] .sidebar.open {
        transform: translateX(0);
    }
    [dir="rtl"] .main-content {
        margin-right: 0 !important;
    }
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
}

@media (max-width: 992px) {
    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }
}
/* =============================================================
   PRINT STYLES (Professional Statement of Account)
   ============================================================= */
.print-only {
    display: none !important;
}

@media print {
    @page { size: A4; margin: 15mm; }
    body { background: white !important; color: black !important; margin: 0; padding: 0; font-size: 11pt !important; line-height: 1.4; }
    /* Force browsers to render background colors & images in PDF/print */
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    .sidebar, .sidebar-overlay, header, .voucher-list-topbar, .flex.between, .btn-row, 
    #view-statement-btn, #stmt-export-btn, #stmt-print-btn, #stmt-search, .header-actions,
    .btn-icon, .btn-pagination, .pagination-wrap, .no-print, #ai-chat-container,
    #ai-chat-bubble, #ai-chat-window {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .card { border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
    .statement-header-summary { 
        display: none !important;
    }
    /* Use the designer-configured brand color (set as CSS variable by JS) */
    table { width: 100% !important; border-collapse: collapse !important; border: 1.5px solid var(--stmt-brand-color, #0f4c81) !important; }
    .statement-sheet th { background: var(--stmt-brand-color, #0f4c81) !important; color: #ffffff !important; border: 1px solid var(--stmt-brand-color, #0f4c81) !important; text-transform: uppercase; font-size: 10pt !important; font-weight: 700; }
    th { background: var(--stmt-brand-color, #0f4c81) !important; color: #ffffff !important; border: 1px solid #cbd5e1 !important; text-transform: uppercase; font-size: 10pt !important; font-weight: 700; }
    td { padding: 8px 10px !important; border: 1px solid #cbd5e1 !important; font-size: 11pt !important; }
    tr:nth-child(even) { background-color: #f8fafc !important; }
    .opening-row { background: #f1f5f9 !important; font-weight: 600 !important; }
    .right { text-align: right !important; }
    .muted { color: #64748b !important; }
    h3, .page-title { display: block !important; margin-bottom: 10px !important; font-size: 16pt !important; color: black !important; }
    /* Ensure inline-styled elements with brand color backgrounds render in PDF */
    .statement-sheet [style*="background"] {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    /* Table border uses brand color */
    .statement-sheet table { border-color: var(--stmt-brand-color, #0f4c81) !important; }
    /* Footer summary bar with brand color */
    .statement-sheet tfoot th { background: var(--stmt-brand-color, #0f4c81) !important; color: #ffffff !important; }
}


/* Role-based UI restrictions */
body.role-viewer .btn-primary, 
body.role-viewer .btn-new-pill,
body.role-viewer .btn-action-edit,
body.role-viewer .btn-action-delete,
body.role-viewer .btn-save,
body.role-viewer .btn-delete,
body.role-viewer .btn-edit {
    display: none !important;
}

/* =============================================================
   IFRS Reporting Styles (P&L, Balance Sheet, Cash Flow)
   ============================================================= */
.ifrs-report {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: var(--fg);
}

.report-head {
    text-align: center;
    margin-bottom: 2.5rem;
}

.report-head h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--brand-1);
}

.report-head .meta {
    color: var(--fg-muted);
    font-size: 0.95rem;
}

.ifrs-line {
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--hairline);
    font-size: 0.95rem;
    transition: background 0.2s;
}

.ifrs-line:hover-disabled {
    background: var(--surface-2);
}

.ifrs-line.section {
    background: var(--surface-2);
    font-weight: 800;
    margin-top: 1.5rem;
    border-bottom: 2px solid var(--fg);
}

.ifrs-line.subtotal {
    font-weight: 700;
    background: var(--bg-soft);
    border-top: 1px solid var(--hairline-strong);
    border-bottom: 1px solid var(--hairline-strong);
}

.ifrs-line.total {
    font-weight: 800;
    border-bottom: 4px double var(--brand-1);
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.ifrs-line.indent {
    padding-left: 2.5rem;
}

.ifrs-line .amount {
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Smooth Language Switching */
body {
    transition: opacity 0.3s ease;
}
body.lang-switching {
    opacity: 0;
}

/* Bottom Sheet for Mobile Filters */
@media (max-width: 992px) {

    .bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
        z-index: 2500;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding: 1.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }

    .bottom-sheet.open {
        transform: translateY(0);
    }

    .bottom-sheet-backdrop {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 2400;
        display: none;
        backdrop-filter: blur(2px);
    }

    .bottom-sheet-backdrop.open {
        display: block;
    }

}

.filter-trigger-btn {
    display: none;
}

.ifrs-line .drillable {
    cursor: pointer;
    color: var(--brand-1);
    text-decoration: underline dotted;
}

.ifrs-line .drillable:hover-disabled {
    background: var(--brand-1-soft);
    border-radius: 4px;
}

/* Comparative Specific Styles */
.comparative-line .amount {
    white-space: nowrap;
}

@media print {
    .ifrs-report {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}

 / *   I m p o r t   P r e v i e w   S t a t   C a r d s   * / 
 . s t a t - c a r d   { 
         b a c k g r o u n d :   v a r ( - - s u r f a c e - 2 ) ; 
         b o r d e r :   1 p x   s o l i d   v a r ( - - h a i r l i n e - s t r o n g ) ; 
         p a d d i n g :   1 r e m ; 
         b o r d e r - r a d i u s :   v a r ( - - r a d i u s ) ; 
         t e x t - a l i g n :   c e n t e r ; 
         t r a n s i t i o n :   v a r ( - - t r a n s i t i o n ) ; 
 } 
 . s t a t - c a r d   s t r o n g   { 
         f o n t - s i z e :   1 . 5 r e m ; 
         d i s p l a y :   b l o c k ; 
 } 
 . s t a t - c a r d   s m a l l   { 
         c o l o r :   v a r ( - - f g - m u t e d ) ; 
         f o n t - w e i g h t :   6 0 0 ; 
         t e x t - t r a n s f o r m :   u p p e r c a s e ; 
         f o n t - s i z e :   0 . 7 r e m ; 
         l e t t e r - s p a c i n g :   0 . 0 5 e m ; 
 } 
  
 
/* --- Searchable Select --- */
.searchable-select { position: relative; width: 100%; }
.ss-display { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.85rem; background: var(--bg-soft); border: 1px solid var(--hairline); border-radius: var(--radius); cursor: pointer; font-size: 0.875rem; transition: all 0.15s; color: var(--fg); }
[data-theme='light'] .ss-display { background: white; }
.ss-display:hover-disabled { border-color: var(--brand-1); }
.ss-display .fa-chevron-down { font-size: 0.75rem; color: var(--fg-muted); }
.ss-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 2000; background: var(--bg-elevated); border: 1px solid var(--hairline); border-radius: var(--radius); margin-top: 0.25rem; box-shadow: var(--shadow-lg); overflow: hidden; animation: fadeIn 150ms ease; }
[data-theme='light'] .ss-dropdown { background: white; }
.ss-search-wrap { padding: 0.5rem; background: var(--surface-2); border-bottom: 1px solid var(--hairline); }
.ss-search-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--hairline); border-radius: var(--radius-sm); font-size: 0.875rem; outline: none; background: var(--bg-soft); color: var(--fg); }
.ss-search-input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 2px var(--accent-soft); }
.ss-list { max-height: 250px; overflow-y: auto; }
.ss-item { padding: 0.75rem 1rem; cursor: pointer; font-size: 0.875rem; transition: background 0.15s; color: var(--fg); border-bottom: 1px solid var(--hairline); }
.ss-item:last-child { border-bottom: none; }
.ss-item:hover-disabled { background: var(--accent-soft); }
.ss-item.selected { background: var(--brand-grad); color: white; font-weight: 600; }
.ss-no-results { padding: 1rem; text-align: center; color: var(--fg-muted); font-size: 0.875rem; }

/* =============================================================
   Enterprise Setup Wizard
   ============================================================= */
.setup-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: 600px;
}

.setup-sidebar {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.setup-nav-item {
    display: flex;
    flex-direction: row !important; /* Ensure horizontal alignment */
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--fg-muted);
    font-weight: 500;
}

.setup-nav-item .icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.setup-nav-item .label {
    font-size: 0.95rem;
    white-space: nowrap;
}

.setup-nav-item:hover-disabled {
    background: var(--surface-2);
    color: var(--fg);
}

.setup-nav-item.active {
    background: var(--brand-grad);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.setup-nav-item.active .icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.setup-nav-item.completed {
    color: var(--success);
}

.setup-nav-item.completed::after {
    content: '\f058';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.9rem;
}

.setup-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.setup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    margin-top: auto;
}

@media (max-width: 992px) {
    .setup-layout {
        grid-template-columns: 1fr;
    }
    .setup-sidebar {
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
        position: static;
    }
    .setup-nav-item .label {
        display: none;
    }
}
