/* =============================================================================
   Kuvaly — Main Stylesheet
   Everything. One system.
   Font: Inter (loaded via <link> in header)
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap');

/* =============================================================================
   1. CSS VARIABLES
   ============================================================================= */

:root {
    /* Kuvaly brand palette — #0E8F3A green · #4F46E5 purple · #22D3EE cyan */
    --color-primary:    #0E8F3A;   /* brand green */
    --color-secondary:  #4F46E5;   /* brand purple */
    --color-accent:     #22D3EE;   /* brand cyan */

    /* Semantic colour aliases */
    --navy:       #111827;   /* sidebar / surface */
    --blue:       #0E8F3A;
    --blue-lt:    rgba(14,143,58,.15);
    --blue-md:    rgba(14,143,58,.28);
    --teal:       #0E8F3A;
    --teal-lt:    rgba(14,143,58,.15);
    --gold:       #B08D2A;
    --gold-lt:    rgba(176,141,42,.15);
    --red:        #C62828;
    --red-lt:     rgba(198,40,40,.15);
    --green:      #0E8F3A;
    --green-lt:   rgba(14,143,58,.15);
    --purple:     #4F46E5;
    --cyan:       #22D3EE;

    /* Greys — dark-theme scale (50 = darkest page bg, 800 = primary text) */
    --grey-50:    #0B0F1A;   /* page background */
    --grey-100:   #111827;   /* card / surface background */
    --grey-200:   #1F2937;   /* borders */
    --grey-400:   #9CA3AF;   /* muted / placeholder text */
    --grey-600:   #6B7280;   /* secondary text */
    --grey-800:   #F5F5F5;   /* primary text */
    --white:      #FFFFFF;

    /* Layout */
    --sidebar-width:  220px;
    --topbar-height:  56px;
    --radius:         10px;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.20);
    --shadow-md: 0 4px 16px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.28);
}


/* =============================================================================
   2. RESET & BASE
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { height: 100%; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    background: var(--grey-50);
    color: var(--grey-800);
    height: 100%;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol { list-style: none; }

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

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


/* =============================================================================
   3. PAGE LAYOUT
   ============================================================================= */

.page-wrapper {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: width .2s ease;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    background: var(--grey-100);
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    gap: 12px;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}


/* =============================================================================
   4. SIDEBAR
   ============================================================================= */

.sidebar-header {
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.firm-name {
    font-family: 'Inter', sans-serif;
    color: var(--white);
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.firm-sub {
    font-size: 10px;
    color: rgba(255,255,255,.35);
    margin-top: 2px;
}

.nav-section {
    padding-top: 10px;
}

.nav-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.30);
    padding: 10px 16px 4px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    color: rgba(255,255,255,.55);
    border-left: 2px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    cursor: pointer;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item svg,
.nav-item .nav-icon {
    flex-shrink: 0;
    opacity: .7;
}

.nav-item:hover {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.85);
}

.nav-item.active {
    background: rgba(14,143,58,.12);
    color: #6EDA8F;
    border-left-color: #0E8F3A;
    font-weight: 500;
}

.nav-item.active svg,
.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: var(--white);
    font-size: 9px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    flex-shrink: 0;
    line-height: 1.4;
}

.nav-badge.amber {
    background: var(--gold);
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    overflow: hidden;
    flex: 1;
}

.sidebar-footer .user-name {
    font-size: 12px;
    color: rgba(255,255,255,.80);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-role {
    font-size: 10px;
    color: rgba(255,255,255,.35);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), #0a6828);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}


/* =============================================================================
   5. TOPBAR
   ============================================================================= */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--grey-400);
}

.breadcrumb .sep { opacity: .5; }

.breadcrumb .current {
    color: var(--grey-800);   /* #F5F5F5 in dark theme */
    font-weight: 500;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* =============================================================================
   6. BUTTONS
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
    line-height: 1.4;
    text-decoration: none;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
    border-color: var(--blue);
}
.btn-primary:hover:not(:disabled) {
    background: #0b7a30;
    border-color: #0b7a30;
}

.btn-secondary {
    background: var(--grey-100);
    color: var(--grey-800);
    border-color: var(--grey-200);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--grey-200);
}

.btn-ghost {
    background: transparent;
    color: var(--grey-600);
    border-color: var(--grey-200);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--grey-100);
    color: var(--grey-800);
}

.btn-danger {
    background: var(--red-lt);
    color: var(--red);
    border-color: #f5c6c2;
}
.btn-danger:hover:not(:disabled) {
    background: #fad5d2;
}

.btn-success {
    background: var(--green-lt);
    color: var(--green);
    border-color: rgba(14,143,58,.30);
}
.btn-success:hover:not(:disabled) {
    background: rgba(14,143,58,.25);
}

.btn-tertiary {
    background: rgba(79,70,229,.18);
    color: #818CF8;
    border-color: rgba(79,70,229,.35);
}
.btn-tertiary:hover:not(:disabled) {
    background: rgba(79,70,229,.28);
    color: #A5B4FC;
}

.btn-sm {
    padding: 4px 9px;
    font-size: 11px;
}

.btn-lg {
    padding: 9px 18px;
    font-size: 13px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--grey-200);
    background: var(--grey-100);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--grey-600);
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.icon-btn:hover {
    background: var(--grey-100);
    color: var(--grey-800);
}


/* =============================================================================
   7. STATUS PILLS
   ============================================================================= */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Active */
.pill-active {
    background: var(--green-lt);
    color: var(--green);
}
.pill-active .pill-dot { background: var(--green); }

/* On hold */
.pill-hold {
    background: var(--gold-lt);
    color: var(--gold);
}
.pill-hold .pill-dot { background: var(--gold); }

/* Under review */
.pill-review {
    background: var(--blue-lt);
    color: var(--blue);
}
.pill-review .pill-dot { background: var(--blue); }

/* Draft */
.pill-draft {
    background: var(--grey-200);
    color: var(--grey-400);
}
.pill-draft .pill-dot { background: var(--grey-400); }

/* Critical */
.pill-critical {
    background: var(--red-lt);
    color: var(--red);
}
.pill-critical .pill-dot { background: var(--red); }

/* Executed */
.pill-executed {
    background: rgba(255,255,255,.10);
    color: var(--grey-800);
    border: 1px solid var(--grey-200);
}
.pill-executed .pill-dot { background: var(--cyan); }

/* Closed / Archived */
.pill-closed {
    background: var(--grey-200);
    color: var(--grey-600);
}
.pill-closed .pill-dot { background: var(--grey-400); }


/* =============================================================================
   8. CARDS
   ============================================================================= */

.card {
    background: var(--grey-100);
    border-radius: var(--radius);
    border: 1px solid var(--grey-200);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-title {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--grey-800);
    line-height: 1.3;
}

.card-body { padding: 14px 16px; }

.card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--grey-200);
    background: var(--grey-50);
    border-radius: 0 0 var(--radius) var(--radius);
}

.card-action {
    font-size: 11px;
    color: var(--blue);
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}
.card-action:hover { text-decoration: underline; }


/* =============================================================================
   9. FORM ELEMENTS
   ============================================================================= */

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--grey-600);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: var(--grey-50);
    color: var(--grey-800);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(14,143,58,.12);
}

.form-control::placeholder { color: var(--grey-400); }

/* Tell the browser this is a dark-theme input so native date/time pickers
   render their calendar icon and popup in light colours. */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
    color-scheme: dark;
}

.form-control:disabled {
    background: var(--grey-50);
    color: var(--grey-400);
    cursor: not-allowed;
}

.form-select {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: var(--grey-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--grey-800);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.form-select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(14,143,58,.12);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
    cursor: pointer;
    flex-shrink: 0;
}

.form-hint {
    font-size: 11px;
    color: var(--grey-400);
    margin-top: 4px;
}

.form-error {
    font-size: 11px;
    color: var(--red);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}


/* =============================================================================
   10. DATA DISPLAY ROWS
   ============================================================================= */

.data-row {
    display: flex;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid var(--grey-200);
    gap: 12px;
}

.data-row:last-child { border-bottom: none; }

.data-label {
    font-size: 11px;
    color: var(--grey-400);
    width: 110px;
    flex-shrink: 0;
    line-height: 1.5;
}

.data-value {
    font-size: 12.5px;
    color: var(--grey-800);  /* #F5F5F5 in dark theme */
    flex: 1;
    line-height: 1.5;
}

.data-value.mono {
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
}

.data-value.link {
    color: var(--blue);
    cursor: pointer;
}
.data-value.link:hover { text-decoration: underline; }


/* =============================================================================
   11. STAT TILES
   ============================================================================= */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-tile {
    background: var(--grey-100);
    border-radius: var(--radius);
    border: 1px solid var(--grey-200);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 10.5px;
    color: var(--grey-400);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    color: var(--grey-800);
    line-height: 1.2;
}

.stat-sub {
    font-size: 10.5px;
    color: var(--grey-400);
    margin-top: 3px;
}

.stat-sub.up    { color: var(--green); }
.stat-sub.down  { color: var(--red); }
.stat-sub.warn  { color: var(--gold); }


/* =============================================================================
   12. TABLES
   ============================================================================= */

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

.data-table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--grey-400);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--grey-200);
    background: var(--grey-50);
    white-space: nowrap;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--grey-200);
    font-size: 12.5px;
    color: var(--grey-800);
    vertical-align: middle;
}

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

.data-table tbody tr:hover td { background: rgba(255,255,255,.03); }

.data-table .amount {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.data-table .ref {
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
    color: var(--grey-600);
}

.table-wrap {
    border-radius: var(--radius);
    border: 1px solid var(--grey-200);
    overflow: hidden;
    background: var(--grey-100);
    box-shadow: var(--shadow-sm);
}


/* =============================================================================
   13. ALERT BARS
   ============================================================================= */

.alert-bar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    margin-bottom: 12px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-bar.warning {
    background: var(--gold-lt);
    color: var(--gold);
    border-color: #e8d28a;
}

.alert-bar.danger {
    background: var(--red-lt);
    color: var(--red);
    border-color: #f0b8b3;
}

.alert-bar.info {
    background: var(--blue-lt);
    color: var(--blue);
    border-color: var(--blue-md);
}

.alert-bar.success {
    background: var(--green-lt);
    color: var(--green);
    border-color: #A5D6B5;
}

.alert-bar .alert-icon { flex-shrink: 0; margin-top: 1px; }


/* =============================================================================
   14. TIMELINE
   ============================================================================= */

.timeline { padding: 4px 0; }

.timeline-item {
    display: flex;
    gap: 10px;
    padding-bottom: 14px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue-md);
    flex-shrink: 0;
    margin-top: 4px;
}

.timeline-dot.green  { background: var(--green); }
.timeline-dot.red    { background: var(--red); }
.timeline-dot.gold   { background: var(--gold); }
.timeline-dot.navy   { background: var(--navy); }

.timeline-connector {
    width: 1px;
    background: var(--grey-200);
    flex: 1;
    margin-top: 3px;
}

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

.timeline-text {
    font-size: 12px;
    color: var(--grey-800);
    line-height: 1.5;
}

.timeline-meta {
    font-size: 10.5px;
    color: var(--grey-400);
    margin-top: 1px;
}


/* =============================================================================
   15. SEARCH BOX
   ============================================================================= */

.search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 12px;
    color: var(--grey-600);
    cursor: text;
    min-width: 200px;
    transition: border-color .15s, box-shadow .15s;
}

.search-box:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(14,143,58,.15);
    background: var(--grey-100);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 12px;
    color: var(--grey-800);
    min-width: 0;
}

.search-box input::placeholder { color: var(--grey-400); }

.search-icon { color: var(--grey-400); flex-shrink: 0; }


/* =============================================================================
   16. MODALS
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.50);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--grey-100);
    border-radius: var(--radius);
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in .18s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    color: var(--grey-800);
}

.modal-close {
    cursor: pointer;
    color: var(--grey-400);
    transition: color .15s;
    line-height: 1;
    font-size: 18px;
    background: none;
    border: none;
    padding: 2px;
}
.modal-close:hover { color: var(--grey-800); }  /* #F5F5F5 */

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--grey-200);
}

.modal-lg  { width: 700px; }
.modal-sm  { width: 360px; }

/* modal-box: used in views as the inner box of a .modal-overlay */
.modal-box {
    background: var(--grey-100);
    border-radius: var(--radius);
    width: 500px;
    max-width: 90vw;
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in .18s ease;
    border: 1px solid var(--grey-200);
}


/* =============================================================================
   17. LOGIN PAGE
   ============================================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grey-50);
    padding: 20px;
}

.login-card {
    background: var(--grey-100);
    border-radius: var(--radius);
    padding: 40px;
    width: 400px;
    max-width: 100%;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--grey-200);
}

.login-logo {
    font-family: 'Inter', sans-serif;
    font-size: 36px;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1;
}

.login-subtitle {
    color: var(--grey-400);
    text-align: center;
    margin-bottom: 32px;
    font-size: 13px;
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
    font-size: 13px;
    margin-top: 4px;
}

.login-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--grey-400);
}

.login-footer a {
    color: var(--blue);
}
.login-footer a:hover { text-decoration: underline; }


/* =============================================================================
   18. FLASH MESSAGES
   ============================================================================= */

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.flash.success {
    background: var(--green-lt);
    color: var(--green);
    border-color: #A5D6B5;
}

.flash.error {
    background: var(--red-lt);
    color: var(--red);
    border-color: #f0b8b3;
}

.flash.warning {
    background: var(--gold-lt);
    color: var(--gold);
    border-color: #e8d28a;
}

.flash.info {
    background: var(--blue-lt);
    color: var(--blue);
    border-color: var(--blue-md);
}

.flash-icon { flex-shrink: 0; }

.flash-close {
    margin-left: auto;
    cursor: pointer;
    opacity: .6;
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}
.flash-close:hover { opacity: 1; }


/* =============================================================================
   19. UTILITY CLASSES
   ============================================================================= */

/* Flex */
.flex        { display: flex; }
.flex-1      { flex: 1; }
.flex-col    { flex-direction: column; }
.items-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; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* Spacing */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* Typography */
.text-xs     { font-size: 10.5px; }
.text-sm     { font-size: 12px; }
.text-muted  { color: var(--grey-400); }
.text-navy   { color: var(--grey-800); }
.text-blue   { color: var(--blue); }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-gold   { color: var(--gold); }
.text-bold   { font-weight: 600; }
.text-serif  { font-family: 'Inter', sans-serif; }
.text-mono   { font-family: 'Courier New', monospace; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Sizing */
.w-full { width: 100%; }

/* Visibility */
.hidden  { display: none; }
.visible { display: block; }

/* Section title */
.section-title {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--grey-800);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

/* Count badge */
.count-badge {
    font-family: 'Inter', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    background: var(--grey-200);
    color: var(--grey-400);
    padding: 1px 7px;
    border-radius: 10px;
    display: inline-block;
}

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--grey-200);
    margin: 16px 0;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.page-title {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    color: var(--grey-800);
    line-height: 1.2;
}


/* =============================================================================
   20. CUSTOM SCROLLBAR
   ============================================================================= */

::-webkit-scrollbar           { width: 5px; height: 5px; }
::-webkit-scrollbar-track     { background: transparent; }
::-webkit-scrollbar-thumb     { background: var(--grey-200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-400); }

* { scrollbar-width: thin; scrollbar-color: var(--grey-200) transparent; }


/* =============================================================================
   21. RESPONSIVE — Tablet (≤ 768px): sidebar collapses to icon rail
   ============================================================================= */

@media (max-width: 768px) {

    .sidebar {
        width: 48px;
    }

    .sidebar-header {
        padding: 12px 10px;
    }

    .firm-name,
    .firm-sub,
    .nav-label,
    .nav-badge,
    .sidebar-footer .user-info {
        display: none;
    }

    .nav-item {
        padding: 10px 0;
        justify-content: center;
        gap: 0;
    }

    .nav-item svg,
    .nav-item .nav-icon {
        opacity: .7;
    }

    .nav-item.active svg,
    .nav-item.active .nav-icon {
        opacity: 1;
    }

    .sidebar-footer {
        justify-content: center;
        padding: 12px 0;
    }

    .stat-grid  { grid-template-columns: repeat(2, 1fr); }
    .grid-4     { grid-template-columns: repeat(2, 1fr); }
    .grid-3     { grid-template-columns: repeat(2, 1fr); }
    .form-row   { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }

    .content { padding: 12px; }

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

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .grid-2    { grid-template-columns: 1fr; }
    .modal     { padding: 16px; }
}
