/* =====================================================================
   LigiLearn — Design System

   Poore product ka single source of truth: tokens + reusable components.
   Page-specific styles kabhi yahan nahi — /css/pages/<controller>-<action>.css me.

   Structure:
     1. Tokens (light + dark)
     2. Base / typography
     3. Buttons
     4. Forms
     5. Surfaces — card, panel, section
     6. Data table
     7. Status pills + badges
     8. Stat tiles
     9. Tabs, breadcrumb, pagination
    10. Modal + drawer
    11. Alerts, empty state, skeleton
    12. Utilities
   ===================================================================== */

/* =====================================================================
   1. TOKENS
   ===================================================================== */
:root {
    /* ---- brand ---- */
    --ll-indigo:      #4f46e5;
    --ll-indigo-600:  #4338ca;
    --ll-indigo-300:  #a5b4fc;
    --ll-cyan:        #06b6d4;
    --ll-amber:       #f59e0b;

    --ll-primary:       var(--ll-indigo);
    --ll-primary-hover: var(--ll-indigo-600);
    --ll-gradient:      linear-gradient(135deg, var(--ll-indigo) 0%, var(--ll-cyan) 100%);

    /* ---- status semantics (docs/06-Screens-UI.md §7.13) ---- */
    --ll-success: #059669;   /* Active / Paid / Present    */
    --ll-warning: #d97706;   /* Due / Pending              */
    --ll-danger:  #e11d48;   /* Overdue / Absent / Inactive */
    --ll-info:    #0284c7;   /* Info / Completed           */
    --ll-neutral: #64748b;   /* Draft / Archived           */

    /* Soft backgrounds — pills aur banners me flat color se behtar padhte hain */
    --ll-success-soft: #ecfdf5;
    --ll-warning-soft: #fffbeb;
    --ll-danger-soft:  #fff1f2;
    --ll-info-soft:    #f0f9ff;
    --ll-neutral-soft: #f1f5f9;
    --ll-primary-soft: #eef2ff;

    /* ---- surfaces ---- */
    --ll-bg:          #f6f7fb;
    --ll-surface:     #ffffff;
    --ll-surface-2:   #fbfcfe;   /* nested / striped */
    --ll-border:      #e5e8f0;
    --ll-border-soft: #eef1f7;

    --ll-ink:         #0b1020;
    --ll-ink-2:       #3b4256;
    --ll-ink-muted:   #6b7492;
    --ll-ink-faint:   #9aa2ba;

    /* ---- sidebar (hamesha dark — auth screen ke canvas se match karta hai) ---- */
    --ll-nav-bg:      #0b1020;
    --ll-nav-bg-2:    #11172c;
    --ll-nav-text:    #98a1bd;
    --ll-nav-text-on: #ffffff;
    --ll-nav-hover:   rgba(255, 255, 255, .06);
    --ll-nav-border:  rgba(255, 255, 255, .07);

    /* ---- metrics ---- */
    --ll-sidebar-w:      264px;
    --ll-sidebar-w-mini: 76px;
    --ll-topbar-h:       64px;

    --ll-radius-sm:  8px;
    --ll-radius:     12px;
    --ll-radius-lg:  16px;
    --ll-radius-xl:  22px;
    --ll-pill:       999px;

    --ll-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --ll-shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
    --ll-shadow:    0 4px 14px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .06);
    --ll-shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .20), 0 4px 12px -4px rgba(16, 24, 40, .08);

    --ll-ring: 0 0 0 3px rgba(79, 70, 229, .18);

    --ll-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --ll-font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

    --ll-ease: cubic-bezier(.4, 0, .2, 1);
}

/* Dark theme — data-theme attribute se toggle hota hai (site.js),
   aur user ne kuch choose na kiya ho to OS ki preference chalti hai. */
:root[data-theme="dark"] {
    --ll-bg:          #070b16;
    --ll-surface:     #0e1424;
    --ll-surface-2:   #131a2c;
    --ll-border:      #222a41;
    --ll-border-soft: #1a2135;

    --ll-ink:         #e8ebf5;
    --ll-ink-2:       #c2c8dc;
    --ll-ink-muted:   #8b94b0;
    --ll-ink-faint:   #6a7292;

    --ll-success-soft: #052e26;
    --ll-warning-soft: #2e2005;
    --ll-danger-soft:  #2e0a15;
    --ll-info-soft:    #04243a;
    --ll-neutral-soft: #171e30;
    --ll-primary-soft: #191a3d;

    --ll-nav-bg:   #070b16;
    --ll-nav-bg-2: #0c1120;

    --ll-shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --ll-shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --ll-shadow:    0 4px 14px -4px rgba(0, 0, 0, .55);
    --ll-shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ll-bg:          #070b16;
        --ll-surface:     #0e1424;
        --ll-surface-2:   #131a2c;
        --ll-border:      #222a41;
        --ll-border-soft: #1a2135;

        --ll-ink:         #e8ebf5;
        --ll-ink-2:       #c2c8dc;
        --ll-ink-muted:   #8b94b0;
        --ll-ink-faint:   #6a7292;

        --ll-success-soft: #052e26;
        --ll-warning-soft: #2e2005;
        --ll-danger-soft:  #2e0a15;
        --ll-info-soft:    #04243a;
        --ll-neutral-soft: #171e30;
        --ll-primary-soft: #191a3d;

        --ll-nav-bg:   #070b16;
        --ll-nav-bg-2: #0c1120;

        --ll-shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
        --ll-shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
        --ll-shadow:    0 4px 14px -4px rgba(0, 0, 0, .55);
        --ll-shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .7);
    }
}

/* =====================================================================
   2. BASE
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--ll-font);
    font-size: 14px;
    line-height: 1.55;
    background: var(--ll-bg);
    color: var(--ll-ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -.011em;
    color: var(--ll-ink);
}

h1 { font-size: 26px; } h2 { font-size: 22px; } h3 { font-size: 19px; }
h4 { font-size: 17px; } h5 { font-size: 15px; } h6 { font-size: 14px; }

a { color: var(--ll-primary); text-decoration: none; }
a:hover { color: var(--ll-primary-hover); text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--ll-border); margin: 20px 0; }

code, .mono { font-family: var(--ll-font-mono); font-size: .92em; }

::selection { background: rgba(79, 70, 229, .18); }

:focus-visible {
    outline: 2px solid var(--ll-primary);
    outline-offset: 2px;
}

/* Scrollbars — default Windows scrollbar dense screens par bhaddi lagti hai */
* { scrollbar-width: thin; scrollbar-color: var(--ll-border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--ll-border);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: var(--ll-pill);
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--ll-ink-faint); background-clip: content-box; }

/* Inline SVG icons — sab ek hi tarah size aur align hon */
.ico {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* =====================================================================
   3. BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: var(--ll-radius-sm);
    cursor: pointer;
    transition: background .16s var(--ll-ease), border-color .16s var(--ll-ease),
                color .16s var(--ll-ease), box-shadow .16s var(--ll-ease), transform .08s var(--ll-ease);
    text-decoration: none;
}

.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled,
.btn.is-busy {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--ll-gradient);
    color: #fff;
    box-shadow: 0 3px 10px -3px rgba(79, 70, 229, .55);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 6px 16px -4px rgba(79, 70, 229, .6); }

.btn-secondary {
    background: var(--ll-surface);
    border-color: var(--ll-border);
    color: var(--ll-ink-2);
    box-shadow: var(--ll-shadow-xs);
}
.btn-secondary:hover { background: var(--ll-surface-2); border-color: var(--ll-ink-faint); color: var(--ll-ink); }

/* Outlined primary — secondary call to action that still reads as "primary" (downloads, templates) */
.btn-outline-primary {
    background: transparent;
    border-color: var(--ll-primary);
    color: var(--ll-primary);
}
.btn-outline-primary:hover { background: var(--ll-primary-soft); color: var(--ll-primary-hover); border-color: var(--ll-primary-hover); }

.btn-ghost { background: transparent; color: var(--ll-ink-muted); }
.btn-ghost:hover { background: var(--ll-neutral-soft); color: var(--ll-ink); }

.btn-danger { background: var(--ll-danger); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(1.07); }

.btn-success { background: var(--ll-success); color: #fff; }
.btn-success:hover { color: #fff; filter: brightness(1.07); }

/* Inverse — for gradient / dark bands (CTA strips, hero overlays) */
.btn-inverse {
    background: #fff;
    color: var(--ll-indigo-600);
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .35);
}
.btn-inverse:hover { color: var(--ll-indigo-600); background: #f4f5ff; }

.btn-outline-inverse {
    background: transparent;
    border-color: rgba(255, 255, 255, .55);
    color: #fff;
}
.btn-outline-inverse:hover { background: rgba(255, 255, 255, .12); border-color: #fff; color: #fff; }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-xl { height: 52px; padding: 0 26px; font-size: 16px; border-radius: var(--ll-radius); gap: 9px; }

.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.btn-block { width: 100%; }

/* Button ka apna spinner — busy state par text ki jagah nahi, uske saath */
.btn .spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ll-spin .6s linear infinite;
}
.btn.is-busy .spinner { display: block; }
.btn.is-busy .btn-arrow { display: none; }

@keyframes ll-spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; gap: 6px; }

/* =====================================================================
   4. FORMS
   ===================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px 18px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

/* Fixed two-column variant — for paired fields (first/last name, email/mobile) */
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* Right-aligned action row under a form (Preview/Generate and similar pairs) —
   same shape as .modal-foot's button row, for forms that aren't in a modal. */
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; min-width: 0; }

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--ll-ink-2);
}
.field-label .req { color: var(--ll-danger); margin-left: 2px; }

.form-control,
.form-select,
textarea.form-control {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ll-ink);
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-sm);
    transition: border-color .15s var(--ll-ease), box-shadow .15s var(--ll-ease), background .15s var(--ll-ease);
}

textarea.form-control { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }

.form-control::placeholder { color: var(--ll-ink-faint); }

.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) { border-color: var(--ll-ink-faint); }

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--ll-primary);
    box-shadow: var(--ll-ring);
}

.form-control:disabled,
.form-select:disabled { background: var(--ll-neutral-soft); color: var(--ll-ink-muted); cursor: not-allowed; }

.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--ll-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(225, 29, 72, .16); }

.form-select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7492' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 15px;
}

/* Bigger click target for dropdowns that need more room — 5px taller, 5px more
   horizontal padding than a normal .form-control/.form-select. Shared so any
   page can opt a dropdown into it instead of a one-off page rule. */
.xl-dropdown {
    height: 45px;
    padding-left: 17px;
}

select.form-select.xl-dropdown { padding-right: 39px; }

.field-error { display: block; margin-top: 5px; font-size: 12px; color: var(--ll-danger); }
.field-hint  { display: block; margin-top: 5px; font-size: 12px; color: var(--ll-ink-muted); }

/* ---- input with fixed text prefix (e.g. "+91" before a mobile number) ---- */
.input-prefix { display: flex; align-items: stretch; }
.input-prefix .prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 11px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--ll-ink-muted);
    background: var(--ll-surface-2);
    border: 1px solid var(--ll-border);
    border-right: 0;
    border-radius: var(--ll-radius-sm) 0 0 var(--ll-radius-sm);
}
.input-prefix .form-control { border-radius: 0 var(--ll-radius-sm) var(--ll-radius-sm) 0; }

/* ---- input with leading icon ---- */
.input-icon { position: relative; }
.input-icon .ico {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ll-ink-faint);
    pointer-events: none;
}
.input-icon .form-control { padding-left: 38px; }

/* ---- checkbox / radio ---- */
.check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--ll-ink-2);
    user-select: none;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.check .box {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 1.5px solid var(--ll-border);
    border-radius: 5px;
    background: var(--ll-surface);
    transition: all .15s var(--ll-ease);
}
.check .box svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3.5; fill: none; opacity: 0; transform: scale(.5); transition: all .15s var(--ll-ease); }

.check input:checked + .box { background: var(--ll-primary); border-color: var(--ll-primary); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .box { box-shadow: var(--ll-ring); }
.check input:disabled + .box { opacity: .5; }

.check.radio .box { border-radius: 50%; }

/* ---- switch ---- */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 38px; height: 21px; flex: 0 0 auto;
    background: var(--ll-border);
    border-radius: var(--ll-pill);
    position: relative;
    transition: background .18s var(--ll-ease);
}
.switch .track::after {
    content: '';
    position: absolute; top: 2.5px; left: 2.5px;
    width: 16px; height: 16px;
    background: #fff; border-radius: 50%;
    box-shadow: var(--ll-shadow-xs);
    transition: transform .18s var(--ll-ease);
}
.switch input:checked + .track { background: var(--ll-primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ll-ring); }

/* ---- filter bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 16px;
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius);
    box-shadow: var(--ll-shadow-xs);
    margin-bottom: 16px;
}
.filter-bar .field { min-width: 165px; flex: 0 1 190px; }
.filter-bar .filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* =====================================================================
   5. SURFACES
   ===================================================================== */
.card {
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-lg);
    box-shadow: var(--ll-shadow-sm);
}

.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--ll-border-soft);
}
.card-head h3, .card-head h4, .card-head h5 { margin: 0; }
.card-head .card-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-sub { font-size: 12.5px; color: var(--ll-ink-muted); margin-top: 2px; }

.card-body { padding: 18px; }
.card-body.is-flush { padding: 0; }

.card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-top: 1px solid var(--ll-border-soft);
    background: var(--ll-surface-2);
    border-radius: 0 0 var(--ll-radius-lg) var(--ll-radius-lg);
}
.card-foot .foot-actions { margin-left: auto; display: flex; gap: 8px; }

.form-section + .form-section { margin-top: 22px; }
.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--ll-border-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ll-ink-muted);
}

/* =====================================================================
   6. DATA TABLE
   ===================================================================== */
.table-wrap {
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-lg);
    background: var(--ll-surface);
    box-shadow: var(--ll-shadow-sm);
    overflow: hidden;
}

/* Wide tables page ko horizontally scroll na karayein — apne andar scroll karein */
.table-scroll { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 11px 14px;
    text-align: left;
    white-space: nowrap;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ll-ink-muted);
    background: var(--ll-surface-2);
    border-bottom: 1px solid var(--ll-border);
}

.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ll-border-soft);
    color: var(--ll-ink-2);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ll-ease); }
.table tbody tr:hover td { background: var(--ll-primary-soft); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

.table .cell-strong { font-weight: 600; color: var(--ll-ink); }
.table .cell-sub { display: block; font-size: 12px; color: var(--ll-ink-muted); }

.table-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-top: 1px solid var(--ll-border);
    background: var(--ll-surface-2);
    font-size: 12.5px;
    color: var(--ll-ink-muted);
}
.table-foot .pager { margin-left: auto; }

/* Row actions default me halke rehte hain, hover par ubhar aate hain —
   dense tables padhne me aasan rehti hain */
.row-actions { display: inline-flex; gap: 4px; opacity: .55; transition: opacity .14s var(--ll-ease); }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }

/* Editable bulk-entry grids (Bulk Periods, Bulk Timetable Entries, Copy Fee
   Structure, ...): "+"/trash are the primary, always-needed row actions —
   .row-actions' hover-to-reveal fade is wrong here, so these grids use this
   always-visible wrapper instead. */
.bulk-row-actions { display: inline-flex; gap: 6px; }

.btn-icon.is-danger { color: var(--ll-danger); border-color: var(--ll-danger-soft); }
.btn-icon.is-danger:hover { background: var(--ll-danger-soft); }

/* =====================================================================
   7. STATUS PILLS + BADGES
   ===================================================================== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .01em;
    border-radius: var(--ll-pill);
    white-space: nowrap;
}
.pill::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.pill-success { background: var(--ll-success-soft); color: var(--ll-success); }
.pill-warning { background: var(--ll-warning-soft); color: var(--ll-warning); }
.pill-danger  { background: var(--ll-danger-soft);  color: var(--ll-danger); }
.pill-info    { background: var(--ll-info-soft);    color: var(--ll-info); }
.pill-neutral { background: var(--ll-neutral-soft); color: var(--ll-neutral); }
.pill-primary { background: var(--ll-primary-soft); color: var(--ll-primary); }

.badge-count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--ll-danger);
    border-radius: var(--ll-pill);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 27px;
    padding: 0 5px 0 11px;
    font-size: 12.5px;
    background: var(--ll-neutral-soft);
    color: var(--ll-ink-2);
    border-radius: var(--ll-pill);
}
.chip button {
    display: grid; place-items: center;
    width: 18px; height: 18px;
    border: 0; background: transparent;
    color: var(--ll-ink-muted);
    cursor: pointer; border-radius: 50%;
}
.chip button:hover { background: rgba(0, 0, 0, .07); color: var(--ll-ink); }

/* ---- avatar ---- */
.avatar {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--ll-gradient);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 27px; height: 27px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

/* =====================================================================
   8. STAT TILES
   ===================================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    position: relative;
    padding: 16px 18px;
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-lg);
    box-shadow: var(--ll-shadow-sm);
    overflow: hidden;
    transition: box-shadow .18s var(--ll-ease), transform .18s var(--ll-ease);
}
.stat:hover { box-shadow: var(--ll-shadow); transform: translateY(-1px); }

/* Accent bar — har tile ko uska semantic color deta hai bina shor machaye */
.stat::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--ll-primary);
}
.stat.is-success::before { background: var(--ll-success); }
.stat.is-warning::before { background: var(--ll-warning); }
.stat.is-danger::before  { background: var(--ll-danger); }
.stat.is-info::before    { background: var(--ll-info); }

.stat-top { display: flex; align-items: center; gap: 10px; }

.stat-icon {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: var(--ll-radius-sm);
    background: var(--ll-primary-soft);
    color: var(--ll-primary);
}
.stat.is-success .stat-icon { background: var(--ll-success-soft); color: var(--ll-success); }
.stat.is-warning .stat-icon { background: var(--ll-warning-soft); color: var(--ll-warning); }
.stat.is-danger  .stat-icon { background: var(--ll-danger-soft);  color: var(--ll-danger); }
.stat.is-info    .stat-icon { background: var(--ll-info-soft);    color: var(--ll-info); }

.stat-label {
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ll-ink-muted);
}
.stat-value {
    margin-top: 8px;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--ll-ink);
}
.stat-sub { margin-top: 4px; font-size: 12px; color: var(--ll-ink-muted); }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.trend.up   { color: var(--ll-success); }
.trend.down { color: var(--ll-danger); }

/* =====================================================================
   9. TABS / BREADCRUMB / PAGINATION
   ===================================================================== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--ll-border);
    margin-bottom: 18px;
    overflow-x: auto;
}
.tab {
    position: relative;
    padding: 10px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ll-ink-muted);
    background: none;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s var(--ll-ease);
}
.tab::after {
    content: '';
    position: absolute;
    left: 12px; right: 12px; bottom: -1px;
    height: 2px;
    background: var(--ll-gradient);
    border-radius: 2px 2px 0 0;
    opacity: 0;
    transition: opacity .18s var(--ll-ease);
}
.tab:hover { color: var(--ll-ink); }
.tab.is-active { color: var(--ll-primary); }
.tab.is-active::after { opacity: 1; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ll-ink-muted); }
.crumbs a { color: var(--ll-ink-muted); }
.crumbs a:hover { color: var(--ll-primary); text-decoration: none; }
.crumbs .sep { color: var(--ll-ink-faint); }
.crumbs .current { color: var(--ll-ink-2); font-weight: 600; }

.pager { display: inline-flex; gap: 4px; }
.pager button {
    min-width: 31px; height: 31px;
    padding: 0 8px;
    font: inherit; font-size: 12.5px; font-weight: 600;
    color: var(--ll-ink-2);
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: 7px;
    cursor: pointer;
    transition: all .14s var(--ll-ease);
}
.pager button:hover:not(:disabled) { border-color: var(--ll-primary); color: var(--ll-primary); }
.pager button.is-active { background: var(--ll-primary); border-color: var(--ll-primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* =====================================================================
   10. MODAL + DRAWER
   ===================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: none;
    background: rgba(11, 16, 32, .5);
    backdrop-filter: blur(3px);
}
.modal-backdrop.is-open { display: block; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: flex-start;
    justify-content: center;
    /* Top padding clears the fixed topbar (--ll-topbar-h) — a tall modal must
       never render its header underneath/behind it. */
    padding: calc(var(--ll-topbar-h) + 16px) 16px 40px;
    overflow-y: auto;
}
.modal.is-open { display: flex; }

.modal-box {
    width: 100%;
    max-width: 560px;
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-lg);
    box-shadow: var(--ll-shadow-lg);
    animation: ll-modal-in .2s var(--ll-ease);
}
/* margin:auto centres a short dialog vertically and still lets a tall one
   scroll from its top edge (align-items:center would clip the top). */
.modal-box { margin: auto; }
.modal-box.is-lg { max-width: 820px; }
.modal-box.is-xl { max-width: 900px; }
.modal-box.is-sm { max-width: 420px; }

/* ---- credentials grid: generated ids + one-time passwords after a save ---- */
.credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    margin: 0;
}
.credentials-grid .credential { min-width: 0; }
.credentials-grid .credential.is-wide { grid-column: 1 / -1; }
.credentials-grid dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ll-ink-muted);
}
.credentials-grid dd { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; min-width: 0; }
.credentials-grid dd code {
    display: inline-block;
    max-width: 100%;
    padding: 7px 11px;
    font-size: 14px;
    letter-spacing: .04em;
    color: var(--ll-ink);
    background: var(--ll-neutral-soft);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}
.credentials-grid .credential.is-secret dd code {
    font-size: 15px;
    letter-spacing: .08em;
    color: var(--ll-primary);
    background: var(--ll-primary-soft);
    border-color: color-mix(in srgb, var(--ll-primary) 30%, var(--ll-border));
}
@media (max-width: 480px) { .credentials-grid { grid-template-columns: 1fr; } }

@keyframes ll-modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.modal-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--ll-border-soft);
}
.modal-head h4 { margin: 0; }
.modal-head .btn-close-x { margin-left: auto; }

.modal-body { padding: 18px; }
.modal-foot {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 14px 18px;
    border-top: 1px solid var(--ll-border-soft);
    background: var(--ll-surface-2);
    border-radius: 0 0 var(--ll-radius-lg) var(--ll-radius-lg);
}

.btn-close-x {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border: 0; background: transparent;
    color: var(--ll-ink-muted);
    border-radius: 7px; cursor: pointer;
}
.btn-close-x:hover { background: var(--ll-neutral-soft); color: var(--ll-ink); }

/* Drawer — filters aur detail panes ke liye modal se behtar,
   kyunki background context dikhta rehta hai */
.drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 1050;
    width: min(460px, 100vw);
    background: var(--ll-surface);
    border-left: 1px solid var(--ll-border);
    box-shadow: var(--ll-shadow-lg);
    transform: translateX(100%);
    transition: transform .25s var(--ll-ease);
    display: flex;
    flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer .drawer-body { flex: 1; overflow-y: auto; padding: 18px; }

/* =====================================================================
   11. ALERTS / EMPTY / SKELETON / LOADER
   ===================================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--ll-radius);
    font-size: 13.5px;
    border: 1px solid transparent;
}
.alert .ico { margin-top: 1px; }

.alert-info    { background: var(--ll-info-soft);    color: var(--ll-info);    border-color: rgba(2, 132, 199, .18); }
.alert-success { background: var(--ll-success-soft); color: var(--ll-success); border-color: rgba(5, 150, 105, .18); }
.alert-warning { background: var(--ll-warning-soft); color: var(--ll-warning); border-color: rgba(217, 119, 6, .2); }
.alert-danger  { background: var(--ll-danger-soft);  color: var(--ll-danger);  border-color: rgba(225, 29, 72, .18); }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 20px;
    text-align: center;
    color: var(--ll-ink-muted);
}
.empty-state .empty-icon {
    display: grid; place-items: center;
    width: 56px; height: 56px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--ll-neutral-soft);
    color: var(--ll-ink-faint);
}
.empty-state h4 { color: var(--ll-ink-2); }
.empty-state p { margin: 0; max-width: 380px; font-size: 13.5px; }

/* Skeleton — spinner se behtar hai, kyunki layout shift nahi hota */
.skeleton {
    background: linear-gradient(90deg,
        var(--ll-neutral-soft) 25%,
        var(--ll-border-soft) 37%,
        var(--ll-neutral-soft) 63%);
    background-size: 400% 100%;
    animation: ll-shimmer 1.3s ease-in-out infinite;
    border-radius: 6px;
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line:last-child { width: 60%; margin-bottom: 0; }

@keyframes ll-shimmer {
    from { background-position: 100% 50%; }
    to   { background-position: 0 50%; }
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    place-items: center;
    background: rgba(246, 247, 251, .6);
    backdrop-filter: blur(2px);
}
.app-loader.is-visible { display: grid; }
.app-loader .spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--ll-border);
    border-top-color: var(--ll-primary);
    border-radius: 50%;
    animation: ll-spin .7s linear infinite;
}
:root[data-theme="dark"] .app-loader { background: rgba(7, 11, 22, .65); }

.progress {
    height: 7px;
    background: var(--ll-neutral-soft);
    border-radius: var(--ll-pill);
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--ll-gradient);
    border-radius: var(--ll-pill);
    transition: width .4s var(--ll-ease);
}

/* =====================================================================
   13. WIZARD + UPLOAD COMPONENTS
   Shared by every multi-step / import screen (students import, future
   bulk imports). Page files only lay these out; they never restyle them.
   ===================================================================== */

/* ---- icon tile (tinted rounded square, used in card heads and page titles) ---- */
.icon-tile {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--ll-primary-soft);
    color: var(--ll-primary);
}
.icon-tile .ico { width: 22px; height: 22px; }
.icon-tile.is-success { background: var(--ll-success-soft); color: var(--ll-success); }
.icon-tile.is-warning { background: var(--ll-warning-soft); color: var(--ll-warning); }
.icon-tile.is-info    { background: var(--ll-info-soft);    color: var(--ll-info); }
.icon-tile.is-danger  { background: var(--ll-danger-soft);  color: var(--ll-danger); }
.icon-tile.is-gradient { background: var(--ll-gradient); color: #fff; box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .6); }
.icon-tile.is-sm { width: 38px; height: 38px; border-radius: 11px; }
.icon-tile.is-sm .ico { width: 18px; height: 18px; }
.icon-tile.is-lg { width: 56px; height: 56px; border-radius: 16px; }
.icon-tile.is-lg .ico { width: 26px; height: 26px; }

/* ---- page title with a leading icon ---- */
.page-title-row { display: flex; align-items: center; gap: 14px; }

/* ---- card head with icon + title + description ---- */
.card-head.is-titled { align-items: flex-start; padding: 20px 20px 6px; border-bottom: 0; }
.card-head.is-titled h4 { font-size: 16.5px; }
.card-head.is-titled .card-sub { margin-top: 3px; line-height: 1.5; }

/* ---- "Optional" tag on a field label ---- */
.field-label .optional-tag {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ll-ink-faint);
}
.field-label:has(.optional-tag) { display: flex; align-items: center; gap: 6px; }

/* ---- stepper ---- */
.stepper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 14px 20px;
    background: var(--ll-surface);
    border: 1px solid var(--ll-border);
    border-radius: var(--ll-radius-lg);
    box-shadow: var(--ll-shadow-sm);
}
.stepper .step { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 180px; }
.stepper .step-number {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    color: var(--ll-ink-muted);
    background: var(--ll-neutral-soft);
    border: 1px solid var(--ll-border);
    transition: all .18s var(--ll-ease);
}
.stepper .step-number .ico { width: 16px; height: 16px; display: none; }
.stepper .step-label small {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ll-ink-faint);
}
.stepper .step-label span { font-size: 14px; font-weight: 600; color: var(--ll-ink-muted); }
.stepper .step.is-active .step-number { background: var(--ll-gradient); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .8); }
.stepper .step.is-active .step-label span { color: var(--ll-ink); }
.stepper .step.is-done .step-number { background: var(--ll-success-soft); border-color: transparent; color: var(--ll-success); }
.stepper .step.is-done .step-number .ico { display: block; }
.stepper .step.is-done .step-number .step-digit { display: none; }
.stepper .step.is-done .step-label span { color: var(--ll-ink-2); }
.stepper .step-line { flex: 0 0 46px; height: 1px; margin: 0 10px; background: var(--ll-border); }

/* ---- dropzone ---- */
.dropzone {
    display: block;
    padding: 34px 24px;
    text-align: center;
    cursor: pointer;
    border: 1.6px dashed var(--ll-border);
    border-radius: var(--ll-radius);
    background: linear-gradient(180deg, var(--ll-primary-soft), transparent 70%);
    transition: border-color .18s var(--ll-ease), background .18s var(--ll-ease), transform .12s var(--ll-ease);
}
.dropzone:hover,
.dropzone.is-dragging { border-color: var(--ll-primary); }
.dropzone.is-dragging { transform: scale(1.005); background: var(--ll-primary-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--ll-success); background: var(--ll-success-soft); }
.dropzone.is-invalid { border-color: var(--ll-danger); background: var(--ll-danger-soft); }
.dropzone .icon-tile { margin: 0 auto 14px; background: var(--ll-surface); border: 1px solid var(--ll-border); }
.dropzone.has-file .icon-tile { color: var(--ll-success); border-color: transparent; }
.dropzone-title { display: block; font-size: 15px; font-weight: 600; color: var(--ll-ink); }
.dropzone-title b { color: var(--ll-primary); font-weight: 700; }
.dropzone-title .file-name { color: var(--ll-success); }
.dropzone-sub { display: block; margin-top: 5px; font-size: 12.5px; color: var(--ll-ink-muted); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ---- limit badge (e.g. "Max 500 rows · .xlsx only") ---- */
.limit-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    font-size: 12.5px;
    color: var(--ll-ink-muted);
    background: var(--ll-surface-2);
    border: 1px solid var(--ll-border);
    border-radius: 9px;
}
.limit-badge .ico { width: 15px; height: 15px; }

/* ---- column chips (required / optional file columns) ---- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list .chip { height: 30px; padding: 0 12px; gap: 7px; font-weight: 600; background: var(--ll-surface-2); border: 1px solid var(--ll-border); color: var(--ll-ink); }
.chip-list .chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ll-primary); }
.chip-list .chip.is-optional { color: var(--ll-ink-muted); }
.chip-list .chip.is-optional::before { background: var(--ll-ink-faint); }
.chip-list .chip em { font-style: normal; opacity: .7; }

/* ---- summary list (key / value rows) ---- */
.summary-list { display: flex; flex-direction: column; }
.summary-list .summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--ll-border-soft);
}
.summary-list .summary-row:last-child { border-bottom: 0; }
.summary-list .summary-key { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ll-ink-muted); }
.summary-list .summary-key .ico { width: 15px; height: 15px; }
.summary-list .summary-value { font-size: 13.5px; font-weight: 600; text-align: right; color: var(--ll-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.summary-list .summary-value.is-empty { font-weight: 500; font-style: italic; color: var(--ll-ink-faint); }

/* ---- checklist (readiness ticks) ---- */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist .checklist-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ll-ink-muted); }
.checklist .checklist-box {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 6px;
    border: 1.5px solid var(--ll-border);
    color: transparent;
    transition: all .18s var(--ll-ease);
}
.checklist .checklist-box .ico { width: 12px; height: 12px; stroke-width: 3; }
.checklist .checklist-item.is-done { color: var(--ll-ink); }
.checklist .checklist-item.is-done .checklist-box { background: var(--ll-success-soft); border-color: var(--ll-success); color: var(--ll-success); }

/* =====================================================================
   12. UTILITIES
   ===================================================================== */
.u-row      { display: flex; align-items: center; gap: 10px; }
.u-between  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.u-col      { display: flex; flex-direction: column; gap: 6px; }
.u-wrap     { flex-wrap: wrap; }
.u-grow     { flex: 1 1 auto; min-width: 0; }
.u-right    { margin-left: auto; }

.u-muted    { color: var(--ll-ink-muted); }
.u-faint    { color: var(--ll-ink-faint); }
.u-strong   { font-weight: 650; color: var(--ll-ink); }
.u-sm       { font-size: 12.5px; }
.u-xs       { font-size: 11.5px; }
.u-num      { font-variant-numeric: tabular-nums; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-center   { text-align: center; }
.u-nowrap   { white-space: nowrap; }

.u-mt-0 { margin-top: 0; }   .u-mt-1 { margin-top: 8px; }  .u-mt-2 { margin-top: 16px; } .u-mt-3 { margin-top: 24px; }
.u-mb-0 { margin-bottom: 0; } .u-mb-1 { margin-bottom: 8px; } .u-mb-2 { margin-bottom: 16px; } .u-mb-3 { margin-bottom: 24px; }

.u-hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
