/* ============================================================================
 * ProBuhalterija savitarna — profesionalus dizaino sistema
 *
 * Inspiracija: Stripe Dashboard, Linear, Xero, Pennylane, FreshBooks
 *
 * Principai:
 *   1. 4px spacing grid (4/8/12/16/24/32/48/64)
 *   2. Typography scale: 11/12/13/14/16/20/24/32 (proportional)
 *   3. Spalvos: 90% neutralios, akcentai tik CTA
 *   4. Sluoksniuoti šešėliai (3 lygiai elevation)
 *   5. Mikro-animacijos (150-250ms ease-out)
 *   6. SVG ikonos (1.5px stroke, niekados emoji)
 *
 * Brand spalvos LIKO TOS PAČIOS — pakeitėm tik naudojimo discipliną.
 * ============================================================================ */

:root {
    /* === BRAND === */
    --navy:        #1b4a5a;
    --navy-700:    #143845;
    --navy-500:    #2c6479;
    --navy-100:    #e6edf0;
    --navy-50:     #f3f6f8;

    --gold:        #c4a96a;
    --gold-700:    #a88c4f;
    --gold-100:    #f5ecd5;
    --gold-50:     #fdf8ec;

    /* === NEUTRALS (proper scale) === */
    --gray-0:      #ffffff;
    --gray-50:     #fafbfc;
    --gray-100:    #f4f6f8;
    --gray-200:    #e8ecef;
    --gray-300:    #d3dade;
    --gray-400:    #9ba5ac;
    --gray-500:    #6b7780;
    --gray-600:    #4a555c;
    --gray-700:    #2d3338;
    --gray-900:    #15181b;

    /* === SEMANTIC === */
    --success:     #16a34a;
    --success-bg:  #ecfdf3;
    --success-fg:  #027a48;

    --warning:     #d97706;
    --warning-bg:  #fef6e7;
    --warning-fg:  #92400e;

    --danger:      #dc2626;
    --danger-bg:   #fef2f2;
    --danger-fg:   #991b1b;

    --info:        #2563eb;
    --info-bg:     #eff6ff;
    --info-fg:     #1e40af;

    /* === FUNCTIONAL === */
    --bg:          var(--gray-50);
    --card:        var(--gray-0);
    --border:      var(--gray-200);
    --border-strong: var(--gray-300);
    --text:        var(--gray-700);
    --text-strong: var(--gray-900);
    --text-muted:  var(--gray-500);
    --text-subtle: var(--gray-400);

    /* === SPACING (4px grid) === */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* === RADII === */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-pill: 999px;

    /* === SHADOWS (elevation system) === */
    --sh-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --sh-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --sh-md: 0 4px 8px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --sh-lg: 0 12px 24px -6px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
    --sh-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.18);
    --sh-focus: 0 0 0 3px rgba(27, 74, 90, 0.12);
    --sh-focus-gold: 0 0 0 3px rgba(196, 169, 106, 0.18);

    /* === TRANSITIONS === */
    --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-spring: 280ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* === TYPOGRAPHY === */
    --ff-sans: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --ff-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

    --fs-xxs: 11px;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 20px;
    --fs-3xl: 24px;
    --fs-4xl: 32px;

    --lh-tight: 1.25;
    --lh-snug: 1.4;
    --lh-base: 1.55;
    --lh-relaxed: 1.65;

    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semi: 600;
    --fw-bold: 700;

    /* === LAYOUT === */
    --sidebar-w: 248px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--ff-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    color: var(--text);
    background: var(--bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
}

h1, h2, h3, h4, h5, h6 { margin: 0; line-height: var(--lh-tight); color: var(--text-strong); font-weight: var(--fw-semi); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

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

code {
    font-family: var(--ff-mono);
    font-size: 0.9em;
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: var(--r-xs);
    color: var(--text-strong);
}

/* === ICONS (SVG inline) === */
.icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -2px;
}
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* === LAYOUT === */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    background: var(--gray-0);
    border-right: 1px solid var(--border);
    padding: var(--sp-6) 0 var(--sp-4);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
/* Compact monogram + wordmark — Linear/Stripe style */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-1) var(--sp-5) var(--sp-5);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-2);
    text-decoration: none;
    color: var(--text-strong);
    transition: opacity var(--t-fast);
}
.sidebar-brand:hover { opacity: 0.85; text-decoration: none; color: var(--text-strong); }
.sidebar-brand-mark {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    object-fit: contain;
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
    min-width: 0;
}
.sidebar-brand-name {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.sidebar-brand-product {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: var(--text-strong);
    letter-spacing: -0.2px;
}

.sidebar-version {
    font-size: 10px;
    color: var(--text-subtle);
    letter-spacing: 0.4px;
    font-family: var(--ff-mono);
}

.sidebar-nav { padding: var(--sp-2) var(--sp-3); flex: 1; }
.sidebar-nav li { margin-bottom: 1px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    color: var(--text);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    transition: all var(--t-fast);
    position: relative;
}
.sidebar-nav a:hover {
    background: var(--gray-100);
    color: var(--text-strong);
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--navy-50);
    color: var(--navy);
    font-weight: var(--fw-semi);
}
.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--gold);
    border-radius: 2px;
}
.sidebar-nav .nav-icon {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: color var(--t-fast);
}
.sidebar-nav a:hover .nav-icon, .sidebar-nav a.active .nav-icon { color: currentColor; }
.sidebar-nav .nav-section {
    padding: var(--sp-5) var(--sp-3) var(--sp-2);
    font-size: 10px;
    font-weight: var(--fw-bold);
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-nav .nav-section:first-child { padding-top: var(--sp-2); }

.sidebar-footer {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-xxs);
    color: var(--text-muted);
}

/* === MAIN === */
.main {
    padding: var(--sp-6) var(--sp-8) var(--sp-12);
    min-width: 0;
    max-width: 1440px;
}

/* === TOPBAR === */
.topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-8);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--border);
}
.topbar-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text-strong);
    letter-spacing: -0.5px;
    margin: 0;
    flex-shrink: 0;
}
.topbar-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.topbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 var(--sp-4) 0 var(--sp-10);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--gray-0);
    color: var(--text);
    transition: all var(--t-fast);
}
.topbar-search input:hover { border-color: var(--border-strong); }
.topbar-search input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: var(--sh-focus);
}
.topbar-search input::placeholder { color: var(--text-subtle); }
.topbar-search .search-icon {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
.topbar-search .kbd {
    position: absolute;
    right: var(--sp-2);
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-family: var(--ff-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--gray-50);
}
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* === ICON BUTTON === */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--gray-0);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
    transition: all var(--t-fast);
}
.icon-btn:hover {
    background: var(--gray-100);
    color: var(--text-strong);
    border-color: var(--border-strong);
}
.icon-btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--gray-0);
}

/* === PROFILE === */
.profile-menu { position: relative; }
.profile-trigger {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 4px 10px 4px 4px;
    background: var(--gray-0);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--t-fast);
    color: var(--text);
}
.profile-trigger:hover { background: var(--gray-100); border-color: var(--border-strong); }
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-500));
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--fw-bold);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}
.avatar.gold { background: linear-gradient(135deg, var(--gold), var(--gold-700)); color: var(--navy); }
.avatar.lg { width: 40px; height: 40px; font-size: var(--fs-base); }
.avatar.sm { width: 24px; height: 24px; font-size: var(--fs-xxs); }
.profile-name { font-size: var(--fs-sm); font-weight: var(--fw-semi); line-height: 1.1; }
.profile-role { font-size: var(--fs-xxs); color: var(--text-muted); margin-top: 1px; }

/* === DROPDOWN === */
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--gray-0);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    min-width: 220px;
    box-shadow: var(--sh-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast);
    z-index: 100;
}
.dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.dropdown a, .dropdown button {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    padding: var(--sp-2) var(--sp-4);
    color: var(--text);
    border: none;
    background: none;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background var(--t-fast);
}
.dropdown a:hover, .dropdown button:hover {
    background: var(--gray-100);
    color: var(--text-strong);
    text-decoration: none;
}
.dropdown .icon { color: var(--text-muted); }
.dropdown .divider { height: 1px; background: var(--border); margin: var(--sp-1) 0; }
.dropdown .danger { color: var(--danger); }
.dropdown .danger:hover { background: var(--danger-bg); }

.dropdown-wide {
    width: 380px;
    max-height: 440px;
    overflow-y: auto;
}
.dropdown-header {
    padding: var(--sp-4) var(--sp-4) var(--sp-2);
    font-size: var(--fs-xxs);
    font-weight: var(--fw-semi);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
}
.notif-item {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--t-fast);
    color: var(--text);
}
.notif-item:hover { background: var(--gray-100); text-decoration: none; }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    background: var(--navy-50);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notif-icon.warn { background: var(--warning-bg); color: var(--warning-fg); }
.notif-icon.error { background: var(--danger-bg); color: var(--danger-fg); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: var(--fw-semi); font-size: var(--fs-sm); margin-bottom: 2px; color: var(--text-strong); }
.notif-body { font-size: var(--fs-xs); color: var(--text-muted); line-height: var(--lh-snug); }
.notif-time { font-size: var(--fs-xxs); color: var(--text-subtle); margin-top: 4px; }

/* === CARDS === */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    box-shadow: var(--sh-xs);
    margin-bottom: var(--sp-5);
    transition: box-shadow var(--t-base);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: calc(var(--sp-6) * -1) calc(var(--sp-6) * -1) var(--sp-5);
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    color: var(--text-strong);
    margin: 0;
    line-height: 1.2;
}
.card-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 4px; }

.card-compact { padding: var(--sp-4) var(--sp-5); }

/* === GRID === */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* === KPI STAT === */
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--sh-xs);
    transition: all var(--t-base);
}
.stat:hover { box-shadow: var(--sh-sm); border-color: var(--border-strong); }
.stat-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}
.stat-value {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text-strong);
    line-height: 1.1;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.stat-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: var(--sp-2);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}
.stat-meta.up { color: var(--success-fg); }
.stat-meta.down { color: var(--danger-fg); }
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    background: var(--navy-50);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-3);
}
.stat-icon.success { background: var(--success-bg); color: var(--success-fg); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning-fg); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger-fg); }
.stat-icon.gold { background: var(--gold-50); color: var(--gold-700); }

/* Rich stat — su ikonų stulpeliu kairėje ir tikslesniu trend rodikliu */
.stat-rich {
    display: flex;
    gap: var(--sp-4);
    align-items: flex-start;
}
.stat-rich .stat-icon { margin-bottom: 0; flex-shrink: 0; }
.stat-icon-navy { background: var(--navy-50); color: var(--navy); }
.stat-icon-danger { background: var(--danger-bg); color: var(--danger-fg); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning-fg); }
.stat-icon-gold { background: var(--gold-50); color: var(--gold-700); }
.stat-icon-info { background: var(--info-bg); color: var(--info-fg); }
.stat-icon-success { background: var(--success-bg); color: var(--success-fg); }
.stat-rich .stat-icon { width: 44px; height: 44px; }
.stat-body { flex: 1; min-width: 0; }
.stat-rich .stat-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    margin-bottom: 4px;
}
.stat-rich .stat-value { font-size: var(--fs-2xl); }
.stat-trend {
    margin-top: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.trend-up { color: var(--success-fg); font-weight: var(--fw-semi); display: inline-flex; align-items: center; gap: 2px; }
.trend-down { color: var(--danger-fg); font-weight: var(--fw-semi); display: inline-flex; align-items: center; gap: 2px; }
.stat-alert { background: var(--danger-bg); border-color: rgba(220, 38, 38, 0.2); }
.stat-alert .stat-value { color: var(--danger-fg); }

/* „Reikia dėmesio" chips */
.attention-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: var(--gray-0);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    color: var(--text-strong);
    font-size: var(--fs-sm);
    text-decoration: none;
    transition: all var(--t-fast);
}
.attention-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--sh-sm);
    text-decoration: none;
}
.attention-chip-danger { border-color: rgba(220, 38, 38, 0.3); color: var(--danger-fg); }
.attention-chip-danger:hover { background: var(--danger-bg); color: var(--danger-fg); }
.attention-chip-warning { border-color: rgba(217, 119, 6, 0.3); color: var(--warning-fg); }
.attention-chip-warning:hover { background: var(--warning-bg); color: var(--warning-fg); }
.attention-chip-info { border-color: rgba(37, 99, 235, 0.3); color: var(--info-fg); }
.attention-chip-info:hover { background: var(--info-bg); color: var(--info-fg); }

/* === KLIENTO PORTALO PRADŽIA === */
/* Sveikinimo kortelė — be akcentinio fono, neutralios spalvos */
.portal-hero {
    padding: var(--sp-2) 0 var(--sp-5);
    margin-bottom: var(--sp-2);
}
.portal-hero-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text-strong);
    margin: 0 0 var(--sp-2);
    letter-spacing: -0.5px;
}
.portal-hero-sub {
    font-size: var(--fs-base);
    color: var(--text);
}
.portal-hero-sub .muted { color: var(--text-muted); margin-left: var(--sp-2); }

.section-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semi);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 var(--sp-4);
}

/* Modulių grid — didelės kortelės su ikonomis */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}
.module-card {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-5);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-xs);
    color: var(--text-strong);
    text-decoration: none;
    transition: all var(--t-base);
    position: relative;
}
.module-card:hover {
    border-color: var(--navy-100);
    box-shadow: var(--sh-md);
    text-decoration: none;
    color: var(--text-strong);
    transform: translateY(-2px);
}
.module-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    background: var(--gray-100);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.module-card-navy .module-card-icon { background: var(--navy-50); color: var(--navy); }
.module-card-gold .module-card-icon { background: var(--gold-50); color: var(--gold-700); }
.module-card-attention { border-color: rgba(217, 119, 6, 0.3); background: var(--warning-bg); }
.module-card-attention .module-card-icon { background: rgba(217, 119, 6, 0.15); color: var(--warning-fg); }
.module-card-body { flex: 1; min-width: 0; }
.module-card-title {
    font-size: var(--fs-base);
    font-weight: var(--fw-semi);
    color: var(--text-strong);
    margin-bottom: 2px;
    line-height: 1.3;
}
.module-card-desc {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    line-height: 1.4;
}
.module-card-arrow {
    color: var(--text-subtle);
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.module-card:hover .module-card-arrow {
    color: var(--navy);
    transform: translateX(2px);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-4);
    height: 38px;
    background: var(--navy);
    color: var(--gray-0);
    border: 1px solid var(--navy);
    border-radius: var(--r-md);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    box-shadow: var(--sh-xs);
}
.btn:hover {
    background: var(--navy-700);
    border-color: var(--navy-700);
    color: var(--gray-0);
    text-decoration: none;
    box-shadow: var(--sh-sm);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    background: var(--gray-0);
    color: var(--text-strong);
    border-color: var(--border);
    box-shadow: var(--sh-xs);
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text-strong);
    border-color: var(--border-strong);
}

.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-700); border-color: var(--gold-700); color: var(--gray-0); }

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

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-link {
    background: none;
    border: none;
    color: var(--navy);
    height: auto;
    padding: 0;
    box-shadow: none;
}
.btn-link:hover { background: none; color: var(--navy-700); text-decoration: underline; }

.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-base); }
.btn-xl { height: 48px; padding: 0 var(--sp-6); font-size: var(--fs-md); }

.btn-block { display: flex; width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn + .btn { border-left: 0; }

/* === FORMS === */
.field { margin-bottom: var(--sp-4); }
.field-row { display: flex; gap: var(--sp-4); }
.field-row .field { flex: 1; }
.field-label {
    display: block;
    margin-bottom: var(--sp-2);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--text-strong);
}
.field-label .required { color: var(--danger); margin-left: 2px; }

/* Auto-styling of plain <label>/<input> inside .field (no need for .field-label / .input classes) */
.field > label {
    display: block;
    margin-bottom: var(--sp-2);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--text-strong);
}
.field > label[for] + small,
.field > small {
    display: block;
    margin-top: var(--sp-1);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.field > input[type="text"],
.field > input[type="email"],
.field > input[type="password"],
.field > input[type="number"],
.field > input[type="tel"],
.field > input[type="url"],
.field > input[type="date"],
.field > input[type="search"],
.field > input[type="file"],
.field > select,
.field > textarea,
.field > div > input[type="text"],
.field > div > input[type="email"],
.field > div > input[type="number"],
.field > div > input[type="date"],
.field > div > select {
    width: 100%;
    height: 38px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--gray-0);
    color: var(--text-strong);
    font-family: inherit;
    font-size: var(--fs-base);
    transition: all var(--t-fast);
    box-shadow: var(--sh-xs);
    box-sizing: border-box;
}
.field > input:hover, .field > select:hover, .field > textarea:hover { border-color: var(--border-strong); }
.field > input:focus, .field > select:focus, .field > textarea:focus,
.field > div > input:focus, .field > div > select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: var(--sh-focus);
}
.field > input::placeholder, .field > textarea::placeholder { color: var(--text-subtle); }
.field > textarea {
    height: auto;
    min-height: 80px;
    padding: var(--sp-3);
    resize: vertical;
    line-height: var(--lh-base);
}
.field > input[type="file"] {
    height: auto;
    padding: var(--sp-2) var(--sp-3);
    line-height: 1.4;
}
.field > input[type="checkbox"],
.field > input[type="radio"] {
    width: auto;
    height: auto;
    margin-right: var(--sp-2);
    accent-color: var(--navy);
}
.field label.checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: var(--fw-medium);
    cursor: pointer;
}
.field label.checkbox input {
    width: auto;
    height: auto;
    margin: 0;
    accent-color: var(--navy);
}

/* Form grid layout (2-column responsive) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--sp-4);
}
.form-grid .field.full {
    grid-column: 1 / -1;
}
@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Form-actions row (Cancel + Save buttons) */
.form-actions {
    display: flex;
    gap: var(--sp-2);
    justify-content: flex-end;
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
}
.field-help {
    margin-top: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.field-error {
    margin-top: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--danger-fg);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.input, .select, .textarea {
    width: 100%;
    height: 38px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--gray-0);
    color: var(--text-strong);
    transition: all var(--t-fast);
    box-shadow: var(--sh-xs);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: var(--sh-focus);
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.textarea { padding: var(--sp-3); height: auto; min-height: 80px; resize: vertical; line-height: var(--lh-base); }
.input:disabled, .select:disabled, .textarea:disabled {
    background: var(--gray-100);
    color: var(--text-muted);
    cursor: not-allowed;
}

.field.error .input, .field.error .select, .field.error .textarea {
    border-color: var(--danger);
}
.field.error .input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .input:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group .input + .input { border-left: 0; }

/* Backwards compat */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
    display: block;
    margin-bottom: var(--sp-2);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--text-strong);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    height: 38px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--gray-0);
    color: var(--text-strong);
    transition: all var(--t-fast);
    font-family: inherit;
    font-size: var(--fs-base);
    box-shadow: var(--sh-xs);
}
.form-group textarea { padding: var(--sp-3); height: auto; min-height: 80px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: var(--sh-focus);
}

/* === TABLES === */
table.list {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}
table.list th, table.list td {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.list th {
    background: var(--gray-50);
    font-weight: var(--fw-semi);
    font-size: var(--fs-xxs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    user-select: none;
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
}
table.list th:first-child { border-top-left-radius: var(--r-md); }
table.list th:last-child { border-top-right-radius: var(--r-md); }
table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr { transition: background var(--t-fast); }
table.list tbody tr:hover { background: var(--gray-50); }
table.list td { font-size: var(--fs-sm); color: var(--text); }
table.list td a { color: var(--navy); font-weight: var(--fw-medium); }
table.list .num, table.list .right { text-align: right; font-variant-numeric: tabular-nums; }
table.list th.sortable { cursor: pointer; transition: background var(--t-fast); }
table.list th.sortable:hover { background: var(--gray-100); color: var(--text-strong); }
table.list th.sortable::after { content: " ⇅"; opacity: 0.3; font-size: 9px; margin-left: 2px; }
table.list th.sortable.sort-asc::after { content: " ↑"; opacity: 1; color: var(--navy); }
table.list th.sortable.sort-desc::after { content: " ↓"; opacity: 1; color: var(--navy); }

/* Wrap table in card-like container */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--sh-xs);
}
.table-wrap table.list th { border-radius: 0; }

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-2);
    border-radius: var(--r-pill);
    font-size: var(--fs-xxs);
    font-weight: var(--fw-semi);
    line-height: 1.4;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg); color: var(--danger-fg); }
.badge-info    { background: var(--info-bg); color: var(--info-fg); }
.badge-muted   { background: var(--gray-100); color: var(--text-muted); }
.badge-navy    { background: var(--navy-50); color: var(--navy); }
.badge-gold    { background: var(--gold-50); color: var(--gold-700); }

/* === FILTER CHIPS === */
.chips {
    display: inline-flex;
    background: var(--gray-100);
    padding: 3px;
    border-radius: var(--r-md);
    gap: 2px;
}
.chip {
    padding: 6px var(--sp-3);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    border: none;
    background: none;
    white-space: nowrap;
}
.chip:hover { color: var(--text-strong); text-decoration: none; }
.chip.active {
    background: var(--gray-0);
    color: var(--text-strong);
    box-shadow: var(--sh-xs);
}

/* === LOGIN === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    background:
        radial-gradient(ellipse at top left, var(--navy-100) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, var(--gold-100) 0%, transparent 50%),
        var(--bg);
}
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-10) var(--sp-8);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--sh-xl);
}
.login-header { text-align: center; margin-bottom: var(--sp-8); }
.login-logo-img {
    height: 80px;
    width: auto;
    max-width: 240px;
    display: block;
    margin: 0 auto var(--sp-4);
    object-fit: contain;
}
.login-brand-tag {
    display: inline-block;
    font-size: var(--fs-xxs);
    font-weight: var(--fw-semi);
    color: var(--gold-700);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 3px var(--sp-3);
    background: var(--gold-50);
    border-radius: var(--r-xs);
    margin-bottom: var(--sp-3);
}
.login-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }
.login-form .field { margin-bottom: var(--sp-4); }
.login-form .input { height: 42px; }
.login-form .btn { height: 44px; width: 100%; font-size: var(--fs-base); margin-top: var(--sp-2); }
.login-footer {
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    line-height: var(--lh-relaxed);
}
.login-footer code {
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: var(--r-xs);
    font-family: var(--ff-mono);
    font-size: 11px;
    color: var(--text-strong);
}

/* === ALERTS === */
.alert {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-4);
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    border: 1px solid transparent;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-content { flex: 1; }
.alert-error { background: var(--danger-bg); color: var(--danger-fg); border-color: rgba(220, 38, 38, 0.2); }
.alert-info  { background: var(--info-bg); color: var(--info-fg); border-color: rgba(37, 99, 235, 0.2); }
.alert-success { background: var(--success-bg); color: var(--success-fg); border-color: rgba(22, 163, 74, 0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: rgba(217, 119, 6, 0.2); }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    color: var(--text-muted);
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--r-xl);
    background: var(--gray-100);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-4);
}
.empty-state h3 {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    color: var(--text-strong);
    margin: 0 0 var(--sp-2);
}
.empty-state p {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto var(--sp-5);
    line-height: var(--lh-relaxed);
}

/* === TOASTS === */
#toast-container {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    pointer-events: none;
    max-width: 400px;
}
.toast {
    background: var(--gray-0);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    min-width: 280px;
    box-shadow: var(--sh-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    pointer-events: auto;
    animation: toast-in var(--t-spring);
    border-left: 3px solid var(--navy);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.fade-out { animation: toast-out var(--t-base) forwards; }
.toast-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.toast.success .toast-icon-wrap { background: var(--success-bg); color: var(--success-fg); }
.toast.error .toast-icon-wrap { background: var(--danger-bg); color: var(--danger-fg); }
.toast.warning .toast-icon-wrap { background: var(--warning-bg); color: var(--warning-fg); }
.toast.info .toast-icon-wrap { background: var(--info-bg); color: var(--info-fg); }
.toast-text {
    flex: 1;
    font-size: var(--fs-sm);
    color: var(--text-strong);
    line-height: var(--lh-snug);
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    border-radius: var(--r-xs);
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.toast-close:hover { background: var(--gray-100); color: var(--text-strong); }
@keyframes toast-in {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
    to { transform: translateX(110%); opacity: 0; }
}

/* === STATUS TIMELINE === */
.timeline {
    display: flex;
    align-items: flex-start;
    padding: var(--sp-2) 0;
    gap: 0;
}
.timeline-step {
    flex: 1;
    text-align: center;
    position: relative;
    color: var(--text-muted);
}
.timeline-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 18px;
    left: calc(50% + 22px);
    right: calc(-50% + 22px);
    height: 2px;
    background: var(--border);
    z-index: 0;
    transition: background var(--t-base);
}
.timeline-step.done:not(:last-child)::after { background: var(--success); }
.timeline-step .dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-0);
    border: 2px solid var(--border);
    color: var(--text-subtle);
    margin: 0 auto var(--sp-2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: all var(--t-base);
}
.timeline-step.done .dot {
    background: var(--success);
    border-color: var(--success);
    color: var(--gray-0);
    box-shadow: 0 0 0 4px var(--success-bg);
}
.timeline-step.active .dot {
    background: var(--gray-0);
    border-color: var(--navy);
    color: var(--navy);
    box-shadow: 0 0 0 4px var(--navy-50);
}
.timeline-step.done, .timeline-step.active { color: var(--text-strong); }
.timeline-step .label { font-size: var(--fs-xs); font-weight: var(--fw-semi); }
.timeline-step .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* === ACTIVITY LOG === */
.activity-log { padding: 0; }
.activity-item {
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: var(--sp-3);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:first-child { padding-top: 0; }
.activity-content { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.activity-text { color: var(--text); line-height: var(--lh-snug); }
.activity-text strong { color: var(--text-strong); font-weight: var(--fw-semi); }
.activity-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.activity-meta::before { content: "·"; }
.activity-meta:first-child::before { content: ""; }

/* === BULK BAR === */
.bulk-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    background: var(--navy);
    color: var(--gray-0);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-4);
    box-shadow: var(--sh-md);
}
.bulk-bar.active { display: flex; }
.bulk-bar .btn { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.bulk-bar .btn:hover { background: var(--gold-700); border-color: var(--gold-700); }

/* === INVOICE DOCUMENT (PDF-style) === */
.invoice-document {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-12) var(--sp-12);
    max-width: 920px;
    margin: 0 auto;
    box-shadow: var(--sh-lg);
}
.invoice-doc-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--sp-10);
    padding-bottom: var(--sp-8);
    border-bottom: 2px solid var(--navy);
    margin-bottom: var(--sp-8);
}
.invoice-doc-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--navy);
    letter-spacing: 1.5px;
    margin: 0;
    line-height: 1;
}
.invoice-doc-number {
    font-size: var(--fs-xl);
    color: var(--gold-700);
    font-weight: var(--fw-bold);
    margin-top: var(--sp-2);
    font-variant-numeric: tabular-nums;
}
.invoice-doc-meta {
    text-align: right;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    line-height: var(--lh-relaxed);
}
.invoice-doc-meta strong { color: var(--text-strong); font-weight: var(--fw-semi); }
.invoice-doc-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-10);
    margin-bottom: var(--sp-8);
}
.invoice-doc-party h4 {
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 0 0 var(--sp-3);
    font-weight: var(--fw-semi);
}
.invoice-doc-party .name { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-strong); }
.invoice-doc-party .details { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-3); line-height: var(--lh-relaxed); }

.invoice-doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--sp-6);
    font-size: var(--fs-sm);
}
.invoice-doc-table th {
    background: var(--navy);
    color: var(--gray-0);
    text-align: left;
    padding: var(--sp-3) var(--sp-3);
    font-size: var(--fs-xxs);
    font-weight: var(--fw-semi);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.invoice-doc-table th.right { text-align: right; }
.invoice-doc-table th:first-child { border-top-left-radius: var(--r-sm); }
.invoice-doc-table th:last-child { border-top-right-radius: var(--r-sm); }
.invoice-doc-table td {
    padding: var(--sp-3);
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.invoice-doc-table td.right { text-align: right; }
.invoice-doc-table tr:nth-child(even) td { background: var(--gray-50); }

.invoice-doc-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--sp-6);
}
.invoice-doc-totals table { min-width: 320px; }
.invoice-doc-totals tr td {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}
.invoice-doc-totals tr.grand td {
    border-top: 2px solid var(--navy);
    background: var(--gray-50);
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: var(--navy);
    padding: var(--sp-3);
}

.invoice-doc-footer {
    border-top: 1px solid var(--border);
    padding-top: var(--sp-4);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    text-align: center;
    margin-top: var(--sp-6);
}

/* Responsive — collapse parties on mobile + reduce padding */
@media (max-width: 900px) {
    .invoice-document { padding: var(--sp-6) var(--sp-5); }
    .invoice-doc-header { grid-template-columns: 1fr; gap: var(--sp-5); }
    .invoice-doc-meta { text-align: left; }
    .invoice-doc-parties { grid-template-columns: 1fr !important; }
    .invoice-doc-table { font-size: var(--fs-xs); }
    .invoice-doc-table th, .invoice-doc-table td { padding: var(--sp-2); }
    .invoice-doc-totals table { min-width: 100%; }
}

/* === MODAL === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    animation: fade-in var(--t-base);
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--card);
    border-radius: var(--r-xl);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--sh-xl);
    display: flex;
    flex-direction: column;
    animation: modal-in var(--t-spring);
}
.modal-header {
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: var(--sp-6); overflow-y: auto; }
.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
    background: var(--gray-50);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
    from { transform: translateY(8px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* === LOADER === */
.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loader-lg { width: 24px; height: 24px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading state on buttons — pridėk klasę `is-loading` arba data-loading,
   ir tekstas pasislepia, vietoje rodomas sukantis loader. */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    color: var(--gray-0);
}
.btn-ghost.is-loading::after, .btn-gold.is-loading::after { color: var(--navy); }

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
    background-size: 200% 100%;
    animation: skeleton 1.4s ease infinite;
    border-radius: var(--r-sm);
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === PAY SECTION (portal) === */
.pay-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-500) 100%);
    color: var(--gray-0);
    text-align: center;
    padding: var(--sp-10) var(--sp-6);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    position: relative;
    overflow: hidden;
}
.pay-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top right, rgba(196, 169, 106, 0.2) 0%, transparent 60%);
    pointer-events: none;
}
.pay-hero h2 { color: var(--gray-0); font-size: var(--fs-xl); font-weight: var(--fw-medium); margin-bottom: var(--sp-2); }
.pay-hero .amount {
    font-size: 48px;
    font-weight: var(--fw-bold);
    color: var(--gold);
    margin: var(--sp-3) 0;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}
.pay-hero .due { font-size: var(--fs-sm); opacity: 0.85; margin-bottom: var(--sp-5); }
.pay-hero .pay-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; position: relative; }

/* === DEMO BANNER === */
.demo-banner {
    background: linear-gradient(90deg, var(--gold-700), var(--gold));
    color: var(--navy);
    padding: 6px var(--sp-4);
    text-align: center;
    font-size: var(--fs-xxs);
    font-weight: var(--fw-semi);
    letter-spacing: 0.5px;
}

/* === DROP ZONE === */
.dropzone {
    display: block;
    border: 2px dashed var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-12) var(--sp-6);
    text-align: center;
    background: var(--gray-50);
    cursor: pointer;
    transition: all var(--t-fast);
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--gold);
    background: var(--gold-50);
}
.dropzone-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--r-lg);
    background: var(--gray-0);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-4);
    box-shadow: var(--sh-sm);
}
.dropzone-text { font-weight: var(--fw-semi); color: var(--text-strong); margin-bottom: var(--sp-1); }
.dropzone-hint { font-size: var(--fs-xs); color: var(--text-muted); }

/* === MOBILE RESPONSIVE === */
/* Burger toggle button — hidden by default, shown < 900px */
.burger-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--gray-0);
    color: var(--text-strong);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--t-fast);
}
.burger-btn:hover { background: var(--gray-100); border-color: var(--border-strong); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 150;
    animation: fade-in var(--t-base);
}
.sidebar-overlay.show { display: block; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 160;
        transform: translateX(-100%);
        transition: transform var(--t-base);
        box-shadow: var(--sh-xl);
    }
    .sidebar.open { transform: translateX(0); }
    .main { padding: var(--sp-4) var(--sp-4) var(--sp-12); }
    .burger-btn { display: inline-flex; }

    /* Topbar — compact */
    .topbar { gap: var(--sp-2); margin-bottom: var(--sp-5); padding-bottom: var(--sp-4); flex-wrap: wrap; }
    .topbar-title { font-size: var(--fs-2xl); }
    .topbar-search { order: 99; flex-basis: 100%; max-width: 100%; }

    /* Page-head — stack vertically */
    .page-head { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
    .page-actions { flex-wrap: wrap; width: 100%; }
    .page-actions .btn { font-size: var(--fs-xs); }

    /* Tables — horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tbl { min-width: 640px; }

    /* Cards 2-col → 1-col */
    .cols-2 { grid-template-columns: 1fr !important; }

    /* Stats grid */
    .stats { grid-template-columns: repeat(2, 1fr) !important; }

    /* Modals — full screen on mobile */
    .modal-backdrop { padding: 0; }
    .modal {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }
    .modal-header, .modal-body, .modal-footer { padding-left: var(--sp-4); padding-right: var(--sp-4); }

    /* Toasts — wider on mobile */
    #toast-container {
        top: var(--sp-3);
        right: var(--sp-3);
        left: var(--sp-3);
        max-width: none;
    }
    .toast { min-width: 0; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr !important; }
    .topbar-title { font-size: var(--fs-xl); }
    .main { padding: var(--sp-3) var(--sp-3) var(--sp-10); }
}

/* === PRINT === */
@media print {
    body { background: var(--gray-0); }
    .demo-banner, .sidebar, .topbar, .activity-log, .bulk-bar,
    #toast-container, .btn, .icon-btn, .timeline, .modal-backdrop { display: none !important; }
    .app-shell { display: block; }
    .main { padding: 0; max-width: 100%; }
    .invoice-document { box-shadow: none; border: none; max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: none; padding: 0; margin: 0; }
}

/* === UTILITIES === */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }

.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-muted { color: var(--text-muted); }
.text-strong { color: var(--text-strong); font-weight: var(--fw-semi); }
.text-success { color: var(--success-fg); }
.text-danger { color: var(--danger-fg); }
.text-warning { color: var(--warning-fg); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }

.hide { display: none !important; }
@media (max-width: 900px) { .hide-mobile { display: none !important; } }

/* ============================================================================
 * BACKWARDS-COMPAT ALIASES — kad esami šablonai veiktų, kol Fazė 2 perdaro juos
 * pagal naują dizaino sistemą. Šitą bloką galim ištrinti, kai visi šablonai
 * migruoti į naują class kalbą.
 * ============================================================================ */

/* ─── Page header (.page-head + .page-title + .page-subtitle + .page-actions) ─── */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.page-title { font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--text-strong); margin: 0; line-height: var(--lh-tight); }
.page-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-1); }
.page-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

/* ─── Tables: .tbl → naudokim tuos pačius stilius kaip .list ─── */
.tbl, table.tbl {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
}
.tbl thead th {
  background: var(--gray-50); padding: var(--sp-3) var(--sp-4);
  text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-semi);
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td {
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); color: var(--text);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--gray-50); }
.tbl-tight thead th { padding: var(--sp-2) var(--sp-3); font-size: 10px; }
.tbl-tight tbody td { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }
.table-wrap { background: var(--card); border-radius: var(--r-md); }

/* ─── Detalių grid (label | reikšmė vienoje eilutėje) ─── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: var(--sp-2) var(--sp-3);
  margin: 0;
  font-size: var(--fs-sm);
}
.detail-grid dt {
  color: var(--text-muted);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: var(--fs-xs);
  align-self: center;
  margin: 0;
}
.detail-grid dd {
  color: var(--text);
  margin: 0;
  word-break: break-word;
  align-self: center;
}
.detail-grid dd code {
  background: var(--gray-50, #f7f8f9);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* ─── Buttons aliases ─── */
.btn-primary { background: var(--navy); color: var(--gray-0); border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn-lg { padding: var(--sp-3) var(--sp-5); font-size: var(--fs-md); }

/* ─── Pills (statusai, žymos) ─── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px var(--sp-2); font-size: var(--fs-xs);
  font-weight: var(--fw-semi); border-radius: var(--r-pill); line-height: 1.4;
  background: var(--gray-100); color: var(--text); white-space: nowrap;
}
.pill .icon { stroke-width: 2; }
.pill-active, .pill-success, .pill-approved, .pill-green, .pill-finalized,
.pill-paid { background: var(--success-bg); color: var(--success-fg); }
.pill-paused, .pill-pending, .pill-draft, .pill-gold, .pill-warn,
.pill-in_review { background: var(--warning-bg); color: var(--warning-fg); }
.pill-archived, .pill-cancelled, .pill-rejected, .pill-red, .pill-error,
.pill-overdue { background: var(--danger-bg); color: var(--danger-fg); }
.pill-escalated, .pill-low { background: var(--info-bg); color: var(--info-fg); }
.pill-gray, .pill-todo, .pill-archived { background: var(--gray-100); color: var(--text-muted); }
.pill-normal { background: var(--gray-100); color: var(--text); }
.pill-high { background: var(--warning-bg); color: var(--warning-fg); }
.pill-urgent { background: var(--danger-bg); color: var(--danger-fg); }

/* ─── Empty state aliases ─── */
.empty {
  padding: var(--sp-12) var(--sp-6); text-align: center;
  color: var(--text-muted); font-size: var(--fs-sm); background: var(--card);
  border-radius: var(--r-md);
}

/* ─── Forms (.form-row + tweaks) ─── */
.form-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 140px; }

/* ─── Stats grid (dashboard senas) ─── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-5);
}
.stat-label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--text-strong); margin-top: var(--sp-2); line-height: 1; }
.stat-value.gold { color: var(--gold-700); }

/* ─── Layout helpers ─── */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }
.muted { color: var(--text-muted); }
.gold { color: var(--gold-700); }

/* ─── Toolbar (filters/search nad sąrašu) ─── */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); }
.tabs a {
  padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); }

/* ─── Card padding helper ─── */
.card-pad { padding: var(--sp-5); }

/* ─── Old nav (klientų portalui, prieš migraciją) ─── */
.nav {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-6); display: flex; justify-content: space-between;
  align-items: center; gap: var(--sp-4);
}
.nav-brand { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: var(--text-strong); }
.nav-logo { height: 32px; }
.nav-brand-section { font-weight: var(--fw-bold); }
.nav-user { display: flex; gap: var(--sp-4); align-items: center; font-size: var(--fs-sm); }
.nav-user a { color: var(--text-muted); text-decoration: none; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); }
.nav-user a:hover { color: var(--text); }
.nav-user a.active { color: var(--navy); font-weight: var(--fw-semi); }
.nav-user-email { color: var(--text-subtle); font-size: var(--fs-xs); }
.nav-badge { background: var(--danger); color: var(--gray-0); padding: 2px 6px; border-radius: var(--r-pill); font-size: 10px; }

/* ─── Sitefoot (kliento portalo footer) ─── */
.sitefoot { padding: var(--sp-6) var(--sp-8); border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-xs); text-align: center; }
.sitefoot-inner { max-width: 1440px; margin: 0 auto; }

/* ─── Login puslapis ─── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
  background:
    radial-gradient(ellipse 800px 600px at top left, rgba(27, 74, 90, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 800px 600px at bottom right, rgba(196, 169, 106, 0.10) 0%, transparent 60%),
    var(--bg);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(27, 74, 90, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 74, 90, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: var(--sp-10) var(--sp-8) var(--sp-8);
  width: 100%; max-width: 440px; box-shadow: var(--sh-xl);
  position: relative; z-index: 1;
  animation: login-in var(--t-slow) ease-out;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-header { text-align: center; margin-bottom: var(--sp-7); }
.login-logo { max-width: 64px; height: auto; margin-bottom: var(--sp-4); border-radius: var(--r-md); }
.login-header h1 {
  font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--text-strong);
  margin: 0 0 var(--sp-1); line-height: 1.2; letter-spacing: -0.5px;
}
.login-header .subtitle {
  font-size: var(--fs-sm); color: var(--text-muted); margin: 0;
}
.login-error {
  background: var(--danger-bg); color: var(--danger-fg);
  border: 1px solid rgba(220, 38, 38, 0.2); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); font-size: var(--fs-sm);
  display: flex; gap: var(--sp-2); align-items: flex-start;
}
.login-input-wrap { position: relative; }
.login-input-wrap .input-icon {
  position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; width: 16px; height: 16px;
}
.login-input-wrap input { padding-left: var(--sp-9) !important; }
.btn-block { width: 100%; justify-content: center; height: 44px; font-size: var(--fs-base); }
.login-extra {
  text-align: center; margin-top: var(--sp-5); font-size: var(--fs-sm);
}
.login-extra a { color: var(--navy); }
.login-extra a:hover { color: var(--navy-700); text-decoration: underline; }

.divider {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-4); color: var(--text-muted); font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 1px; font-weight: var(--fw-medium);
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.oauth-btns { display: flex; flex-direction: column; gap: var(--sp-2); }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 44px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-strong);
  text-decoration: none; background: var(--card); transition: all var(--t-fast);
}
.oauth-btn:hover {
  background: var(--gray-50); border-color: var(--border-strong);
  color: var(--text-strong); transform: translateY(-1px); box-shadow: var(--sh-sm);
}

/* Login-only sitefoot — minimalus */
.login-page + .sitefoot, .login-page ~ .sitefoot {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1;
  background: transparent; border-top: none;
}
