/* ═══════════════════════════════════════════════════════════
   Finance Portal — Premium Design System v2
   Award-winning UI with depth, motion & polish.
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────── */
:root {
    /* Brand */
    --primary:         #711510;
    --primary-dark:    #4e0e0b;
    --primary-light:   #9a3a35;
    --primary-rgb:     113, 21, 16;
    --accent:          #d4a843;
    --accent-light:    #f0d68a;
    --accent-rgb:      212, 168, 67;

    /* Neutrals */
    --bg:              #f0f2f5;
    --bg-alt:          #e8ecf1;
    --bg-card:         #ffffff;
    --bg-sidebar:      #1a1f2e;
    --bg-sidebar-hover:#252b3d;
    --bg-sidebar-active:#2d3548;
    --text:            #1e293b;
    --text-secondary:  #475569;
    --text-muted:      #94a3b8;
    --text-light:      #cbd5e1;
    --border:          #e2e8f0;
    --border-light:    #f1f5f9;
    --white:           #ffffff;

    /* Status colours */
    --success:         #059669;
    --success-light:   #d1fae5;
    --success-dark:    #047857;
    --warning:         #d97706;
    --warning-light:   #fef3c7;
    --warning-dark:    #b45309;
    --danger:          #dc2626;
    --danger-light:    #fee2e2;
    --danger-dark:     #b91c1c;
    --info:            #2563eb;
    --info-light:      #dbeafe;
    --info-dark:       #1d4ed8;

    /* Sizing */
    --sidebar-width:   264px;
    --header-height:   64px;
    --radius:          10px;
    --radius-sm:       6px;
    --radius-lg:       14px;
    --radius-xl:       20px;

    /* Depth: layered shadow system */
    --shadow-xs:       0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:       0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:       0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl:       0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-2xl:      0 25px 50px -12px rgba(0,0,0,0.18);
    --shadow-inner:    inset 0 2px 4px rgba(0,0,0,0.04);
    --shadow-glow:     0 0 20px rgba(var(--primary-rgb),0.15);
    --shadow-card:     0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);

    /* Transitions */
    --transition:      0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --bounce:          0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Subtle noise texture via SVG data URI */
    --pattern-dots: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='0.6' fill='%23000' fill-opacity='0.03'/%3E%3C/svg%3E");
    --pattern-grid: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40L40 0M-10 10L10 -10M30 50L50 30' stroke='%23000' stroke-opacity='0.02' stroke-width='1'/%3E%3C/svg%3E");
}

/* ── Reset & Base ────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background-image: var(--pattern-dots);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

::selection {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-dark);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ── Layout: App Shell ───────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    background-image: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 50%, rgba(0,0,0,0.1) 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

/* ── Unified sidebar header ─────────────────────── */
.sidebar-header {
    padding: 18px 20px 16px;
    background: var(--primary);
    border-bottom: 3px solid rgba(0,0,0,0.2);
}

.sidebar-wordmark {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.sidebar-wordmark-icon {
    font-size: 1.1rem;
    line-height: 1;
}
.sidebar-wordmark-text {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
}

.sidebar-identity {
    display: flex;
    align-items: center;
    gap: 11px;
}
.sidebar-initials {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}
.sidebar-identity-info {
    min-width: 0;
}
.sidebar-identity-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.sidebar-identity-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.45);
    text-transform: capitalize;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section {
    padding: 20px 22px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #64748b;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 22px;
    margin: 2px 10px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 450;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #e2e8f0;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    font-weight: 500;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-item .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
.top-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg-alt); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 450;
}

.breadcrumb a { color: var(--primary); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-light); font-size: 0.75rem; }

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    background: var(--white);
}
.user-menu:hover {
    background: var(--bg);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.user-info {
    line-height: 1.2;
}
.user-info .name { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.user-info .role { font-size: 0.7rem; color: var(--text-muted); font-weight: 450; }

/* ── Page content ────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 28px;
    max-width: 1440px;
    width: 100%;
    box-sizing: border-box;
}

.page-title {
    margin-bottom: 28px;
}

.page-title h1 {
    margin-bottom: 4px;
    font-size: 1.65rem;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.005), rgba(0,0,0,0.01));
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    background: #fafbfc;
}

/* ── Stat Cards (Dashboard) ──────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,0,0,0.015) 0%, transparent 70%);
    transform: translate(30%, -30%);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}
.stat-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15), inset 0 1px 2px rgba(255,255,255,0.2);
}
.stat-icon.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 4px 14px rgba(59,130,246,0.35); }
.stat-icon.green  { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 14px rgba(16,185,129,0.35); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 14px rgba(245,158,11,0.35); }
.stat-icon.red    { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 14px rgba(239,68,68,0.35); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); box-shadow: 0 4px 14px rgba(139,92,246,0.35); }
.stat-icon.maroon { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 4px 14px rgba(var(--primary-rgb),0.35); }

.stat-info { flex: 1; min-width: 0; }

.stat-info h4 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text);
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 450;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.87rem;
}

.data-table thead th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: all var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.025);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr.clickable {
    cursor: pointer;
}
.data-table tbody tr.clickable:hover {
    background: rgba(var(--primary-rgb), 0.04);
}
.data-table tbody tr.clickable:active {
    background: rgba(var(--primary-rgb), 0.07);
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.01);
}
.data-table tbody tr:nth-child(even):hover {
    background: rgba(var(--primary-rgb), 0.03);
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 380px;
    position: relative;
}

.table-search .form-control {
    padding-left: 38px;
    background: var(--bg);
    border-color: transparent;
}
.table-search .form-control:focus {
    background: var(--white);
    border-color: var(--primary);
}
.table-search::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 450;
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-buttons button {
    padding: 7px 13px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition);
    color: var(--text-secondary);
}
.pagination-buttons button:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}
.pagination-buttons button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pagination-buttons button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

label.required::after,
.form-group .required::after {
    content: " *";
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08), var(--shadow-sm);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--bg);
    border-color: var(--border-light);
    color: var(--text-muted);
    cursor: default;
}

.form-control::placeholder {
    color: var(--text-light);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 500;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Typeahead / Autocomplete ────────────────────────────── */
.typeahead-wrapper {
    position: relative;
}

.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 240px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}

.typeahead-dropdown.open {
    display: block;
}

.typeahead-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.86rem;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
}

.typeahead-item:last-child {
    border-bottom: none;
}

.typeahead-item:hover,
.typeahead-item.active {
    background: rgba(var(--primary-rgb), 0.08);
}

.typeahead-item .ta-value {
    font-weight: 600;
    color: var(--text);
}

.typeahead-item .ta-label {
    color: var(--text-secondary);
    margin-left: 6px;
    font-weight: 400;
}

.typeahead-empty {
    padding: 14px;
    color: var(--text-light);
    font-size: 0.84rem;
    text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #c49a35);
    color: #fff;
    box-shadow: 0 1px 3px rgba(var(--accent-rgb), 0.3);
}
.btn-accent:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 3px rgba(5,150,105,0.25);
}
.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(5,150,105,0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 1px 3px rgba(220,38,38,0.25);
}
.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(220,38,38,0.35);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
    box-shadow: 0 1px 3px rgba(217,119,6,0.25);
}
.btn-warning:hover:not(:disabled) {
    background: var(--warning-dark);
    box-shadow: 0 4px 12px rgba(217,119,6,0.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--white);
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--text-light);
    box-shadow: var(--shadow-sm);
}
.btn-outline::before { display: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-alt);
}
.btn-ghost::before { display: none; }

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 13px 30px;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-success { background: var(--success-light); color: var(--success-dark); border-color: rgba(5,150,105,0.15); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); border-color: rgba(217,119,6,0.15); }
.badge-danger  { background: var(--danger-light);  color: var(--danger-dark);  border-color: rgba(220,38,38,0.12); }
.badge-info    { background: var(--info-light);    color: var(--info-dark);    border-color: rgba(37,99,235,0.12); }
.badge-default { background: #f1f5f9; color: #475569; border-color: rgba(0,0,0,0.06); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 { font-size: 1.05rem; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0,0,0,0.01);
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px 14px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 460px;
    animation: toastIn 0.4s var(--bounce), toastOut 0.3s ease 4.7s forwards;
    pointer-events: auto;
    border-left: 4px solid;
    background: var(--white);
    color: var(--text);
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { background: var(--success-light); color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-error .toast-icon   { background: var(--danger-light); color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { background: var(--warning-light); color: var(--warning); }
.toast-info    { border-left-color: var(--info); }
.toast-info .toast-icon    { background: var(--info-light); color: var(--info); }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ── Loading ─────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-dark {
    border-color: var(--border);
    border-top-color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    border-radius: inherit;
}

.loading-overlay .loading-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Global full-screen loading overlay */
.loading-screen {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9999;
}
.loading-screen .spinner { width: 32px; height: 32px; border-width: 3px; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.empty-state h4 {
    color: var(--text);
    margin-bottom: 6px;
    font-size: 1rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 300px;
    margin: 0 auto;
}

/* ── Status Filter Buttons ────────────────────────────────── */
.status-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.status-filter-btn {
    padding: 7px 18px;
    font-size: 0.84rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.status-filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.04);
}
.status-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* ── Ledger Page (Old-Style Layout) ──────────────────────── */
.ledger-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.ledger-page-header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text);
    margin: 0;
}

.ledger-export-bar {
    margin-bottom: 16px;
}
.export-buttons {
    display: flex;
    gap: 0;
}
.export-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary-dark);
    cursor: pointer;
    transition: background var(--transition);
}
.export-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.export-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.export-btn:hover {
    background: var(--primary-dark);
}

.ledger-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 16px;
}
.entries-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.entries-control select {
    width: 70px;
    padding: 4px 8px;
    font-size: 0.85rem;
}
.search-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.search-control input {
    width: 200px;
    padding: 5px 10px;
    font-size: 0.85rem;
}

.form-control-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
    height: auto;
}

/* Ledger Table */
.ledger-table-wrap {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}
.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}
.ledger-table thead th {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    border-right: 1px solid rgba(255,255,255,0.15);
    white-space: nowrap;
    cursor: default;
    user-select: none;
}
.ledger-table thead th:last-child {
    border-right: none;
}
.ledger-table thead th.sortable {
    cursor: pointer;
}
.ledger-table thead th.sortable:hover {
    background: var(--primary-dark);
}
.sort-icon {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 4px;
}
.ledger-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    color: var(--text-secondary);
}
.ledger-table tbody tr:hover {
    background: #f9f9f9;
}
.ledger-table .number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ledger-table .action-cell {
    text-align: center;
    width: 60px;
}
.action-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

/* Ledger Pagination */
.ledger-pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.pagination-info {
    color: var(--text-muted);
}
.pagination-controls {
    display: flex;
    gap: 0;
}
.page-btn {
    padding: 6px 12px;
    font-size: 0.82rem;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-left: -1px;
}
.page-btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.page-btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.page-btn:hover:not(:disabled):not(.active) {
    background: #f0f0f0;
    color: var(--primary);
}
.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    z-index: 1;
}
.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Page Footer */
.page-footer {
    text-align: right;
    padding: 20px 0 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    margin-top: 28px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Overlay behind sidebar */
    .sidebar.open ~ .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-search {
        max-width: 100%;
    }

    .page-content { padding: 20px 16px; }
    .card-body { padding: 18px; }

    /* Ledger responsive */
    .ledger-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-control input {
        width: 160px;
    }
    .ledger-pagination-row {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .card-header { padding: 14px 18px; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px 12px;
    }

    .top-header { padding: 0 16px; }
    .user-info { display: none; }
}

/* ── Login Page ──────────────────────────────────────────── */
body.login-body {
    background: #0f1117;
    overflow: hidden;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* ---- Left panel (background image + branding) ---- */
.login-panel-left {
    flex: 1 1 55%;
    position: relative;
    background: url('/static/public/login.png') center center / cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100vh;
    overflow: hidden;
}

.login-panel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(10, 14, 26, 0.25) 0%,
        rgba(10, 14, 26, 0.55) 50%,
        rgba(10, 14, 26, 0.88) 100%
    );
    z-index: 0;
}

.login-panel-content {
    position: relative;
    z-index: 1;
    padding: 48px 52px;
    color: #fff;
}

.login-uni-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    padding: 6px;
    backdrop-filter: blur(6px);
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    display: block;
}

.login-uni-name {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.login-uni-tagline {
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent-light);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 32px;
}

.login-feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
}

.lf-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.login-panel-footer {
    position: relative;
    z-index: 1;
    padding: 20px 52px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}

/* ---- Right panel (form) ---- */
.login-panel-right {
    flex: 0 0 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 32px;
    min-height: 100vh;
    box-shadow: -8px 0 40px rgba(0,0,0,0.18);
}

.login-card {
    width: 100%;
    max-width: 360px;
    animation: floatUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes floatUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%  { transform: translateX(-7px); }
    50%  { transform: translateX(7px); }
    75%  { transform: translateX(-3px); }
}

.login-card-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.32);
    margin-bottom: 16px;
}

.login-card-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.login-card-header p {
    font-size: 0.86rem;
    color: var(--text-muted);
}

/* Icon-wrapped inputs */
.input-icon-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.form-control.with-icon {
    padding-left: 38px;
}

.pw-toggle {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.pw-toggle:hover { color: var(--primary); }

.login-submit-btn {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    height: 46px;
    transition: background var(--transition), box-shadow var(--transition), transform 0.1s;
}
.login-submit-btn:active { transform: scale(0.98); }

.login-card-links {
    text-align: center;
    margin-top: 20px;
}
.login-card-links a {
    font-size: 0.84rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.login-card-links a:hover { color: var(--primary); }

/* Responsive: stack panels on small screens */
@media (max-width: 820px) {
    .login-panel-left  { display: none; }
    .login-panel-right {
        flex: 1 1 100%;
        background: #fff;
        padding: 32px 24px;
    }
    body.login-body { background: #fff; overflow: auto; }
}

/* ── Utility ─────────────────────────────────────────────── */
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.p-0   { padding: 0; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.hidden { display: none !important; }
.relative { position: relative; }

/* ── Animated entrance for page sections ─────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Quick Action Grid (Dashboard) ───────────────────────── */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.quick-actions .btn {
    border-radius: 999px;
}

/* ── Dashboard Stats Bar (Old-Style) ─────────────────────── */
.dashboard-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.stat-box {
    flex: 1;
    min-width: 150px;
    padding: 20px 22px;
    text-align: left;
    border-right: 1px solid var(--border-light);
    transition: background var(--transition);
}
.stat-box:last-child {
    border-right: none;
}
.stat-box:hover {
    background: rgba(var(--primary-rgb), 0.02);
}

.stat-box-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #4a6fa5;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-box-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-box-value {
    font-size: 2rem;
    font-weight: 700;
    color: #4a6fa5;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* ── Reports List (Dashboard) ────────────────────────────── */
.reports-list {
    display: flex;
    flex-direction: column;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 450;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
}
.report-item:last-child {
    border-bottom: none;
}
.report-item:hover {
    background: rgba(var(--primary-rgb), 0.03);
    color: var(--primary);
}

.report-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.report-label {
    flex: 1;
}

/* ── Sidebar Welcome Section ─────────────────────────────── */
/* legacy welcome styles kept for compat but no longer rendered */
.sidebar-welcome { display: none; }

@media (max-width: 768px) {
    .dashboard-stats-bar {
        flex-direction: column;
    }
    .stat-box {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    .stat-box:last-child {
        border-bottom: none;
    }
}

@media (max-width: 1100px) {
    .dashboard-stats-bar {
        flex-wrap: wrap;
    }
    .stat-box {
        flex: 1 1 calc(33.33% - 1px);
        border-bottom: 1px solid var(--border-light);
    }
}


/* ═══════════════════════════════════════════════════════════
   SIDEBAR CHILDREN SUB-MENU
   ═══════════════════════════════════════════════════════════ */

.nav-parent {
    position: relative;
}

.nav-parent .nav-chevron {
    transition: transform 0.25s ease;
}

.nav-parent.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.12);
}

.nav-children.open {
    max-height: 300px;
}

.nav-child-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px 9px 48px;
    font-size: 0.82rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-child-item:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

.nav-child-item.active {
    color: #fff;
    background: rgba(113, 21, 16, 0.35);
    border-left-color: var(--primary);
}

.nav-child-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4a5568;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nav-child-item.active .nav-child-dot,
.nav-child-item:hover .nav-child-dot {
    background: var(--primary);
}


/* ═══════════════════════════════════════════════════════════
   RECEIPT DETAIL VIEW
   ═══════════════════════════════════════════════════════════ */

.receipt-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.receipt-btn-admit {
    background: #0d9488 !important;
    color: #fff !important;
    border: none;
    font-size: 0.82rem;
    padding: 8px 16px;
}

.receipt-btn-admit:hover {
    background: #0f766e !important;
}

.receipt-btn-post {
    background: #16a34a !important;
    color: #fff !important;
    border: none;
    font-size: 0.82rem;
    padding: 8px 16px;
}

.receipt-btn-post:hover {
    background: #15803d !important;
}

.receipt-btn-reject {
    background: #dc2626 !important;
    color: #fff !important;
    border: none;
    font-size: 0.82rem;
    padding: 8px 16px;
}

.receipt-btn-reject:hover {
    background: #b91c1c !important;
}

.receipt-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 16px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 28px 32px;
}

.receipt-section-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.receipt-section-title:first-child {
    margin-top: 0;
}

.receipt-field-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.receipt-field-row label {
    min-width: 140px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #4a5568;
    padding-top: 8px;
    flex-shrink: 0;
}

.receipt-field-row .form-control {
    flex: 1;
    font-size: 0.85rem;
    padding: 6px 10px;
}

.receipt-field-row .form-control:disabled {
    background: #f8fafc;
    color: #64748b;
    border-color: #e2e8f0;
    cursor: default;
}

.receipt-field-row textarea.form-control {
    resize: vertical;
}

.action-cell {
    white-space: nowrap;
}

.receipt-link-action {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.82rem;
}

.receipt-link-action:hover {
    text-decoration: underline;
}

.receipt-link-reject {
    color: #dc2626;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.82rem;
}

.receipt-link-reject:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .receipt-detail-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .receipt-field-row {
        flex-direction: column;
        gap: 4px;
    }
    .receipt-field-row label {
        min-width: unset;
        padding-top: 0;
    }
    .receipt-action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ═══════════════════════════════════════════════════════════
   DOCUMENT VIEWER OVERLAY
   ═══════════════════════════════════════════════════════════ */

.doc-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.doc-viewer-overlay.hidden {
    display: none;
}

.doc-viewer-panel {
    width: 92vw;
    height: 92vh;
    max-width: 1200px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.25s ease;
}

.doc-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.doc-viewer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.doc-viewer-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    text-decoration: none;
}

.doc-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.doc-viewer-btn.active {
    background: rgba(255, 255, 255, 0.45);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.doc-viewer-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #525659;
}

.doc-viewer-body > iframe {
    width: 100%;
    height: 100%;
    border: none;
    transition: transform 0.12s ease;
}

.doc-viewer-trap {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: none;
    display: none;
}

.doc-viewer-trap.active {
    display: block;
}

.doc-viewer-lens {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 0 0 2px rgba(113, 21, 16, 0.5),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 3;
    transform: translate(-50%, -50%);
    display: none;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 100%);
}

.doc-viewer-lens::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
    pointer-events: none;
}

.doc-link-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 3px 0;
    cursor: pointer;
    transition: color 0.15s;
}

.doc-link-item:hover {
    color: #000;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .doc-viewer-panel {
        width: 98vw;
        height: 96vh;
        border-radius: 8px;
    }
    .doc-viewer-lens {
        width: 140px;
        height: 140px;
    }
}
