/* =====================================================================
   COMUPSYCARE - application stylesheet
   Universitas STRADA Indonesia

   01 TOKENS          11 TIMELINE
   02 BASE            12 STEPPER
   03 LAYOUT          13 FILTER BAR
   04 NAVIGATION      14 EMPTY / SKELETON
   05 CARD            15 MODAL / TOAST
   06 TABLE           16 CHART
   07 FORM            17 UTILITIES
   08 BUTTON          18 MOTION
   09 BADGE / STATUS  19 RESPONSIVE
   10 WIZARD          20 PRINT
   ===================================================================== */


/* ---------------------------------------------------------------------
   01 TOKENS
   ------------------------------------------------------------------ */
:root {
    --navy:        #0D2336;
    --navy-700:    #16324a;
    --navy-600:    #1e415e;
    --teal:        #0F766E;
    --teal-700:    #0b5f58;
    --teal-soft:   #E6F2F1;
    --bg:          #F5F7FA;
    --surface:     #FFFFFF;
    --border:      #E3E8EF;
    --border-strong:#CBD5E1;
    --text:        #1A2733;
    --muted:       #64748B;

    --risk-low:    #16A34A;
    --risk-mid:    #F59E0B;
    --risk-high:   #DC2626;
    --risk-critical: #4C0519;
    --risk-low-bg: #ECFDF3;
    --risk-mid-bg: #FFF7E6;
    --risk-high-bg:#FEF2F2;
    --info:        #0369A1;
    --info-bg:     #EFF6FF;

    --fs-12: 12px; --fs-13: 13px; --fs-15: 15px;
    --fs-18: 18px; --fs-22: 22px; --fs-28: 28px; --fs-34: 34px;

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;

    --r-card: 10px; --r-field: 8px; --r-pill: 999px;
    --shadow: 0 1px 2px rgba(13,35,54,.06), 0 4px 16px rgba(13,35,54,.05);

    --sidebar-w: 248px;
    --content-max: 1360px;
    --ease: cubic-bezier(.32,.72,.36,1);
}


/* ---------------------------------------------------------------------
   02 BASE
   ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: var(--fs-15);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: var(--fs-22); }
h2 { font-size: var(--fs-18); }
h3 { font-size: var(--fs-15); }
p  { margin: 0 0 var(--sp-3); }
a  { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-700); text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: 3px;
}

.u-num, .kpi-card__value, td.num, th.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }

::selection { background: var(--teal-soft); color: var(--navy); }


/* ---------------------------------------------------------------------
   03 LAYOUT
   ------------------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--navy);
    color: #cbd7e2;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.sidebar__brand {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__mark {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 8px; background: var(--teal);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: var(--fs-13); letter-spacing: .02em;
}
.brand-logo {
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 2px;
}
.sidebar__name { color: #fff; font-weight: 800; font-size: var(--fs-15); letter-spacing: .01em; }
.sidebar__sub  { color: #7f93a6; font-size: 11px; line-height: 1.35; }

.sidebar__nav { padding: var(--sp-3) var(--sp-2) var(--sp-6); flex: 1; }

.sidebar__foot {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: var(--fs-12); color: #7f93a6;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar__inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--sp-3) var(--sp-6);
    display: flex; align-items: center; gap: var(--sp-4);
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title p  { margin: 2px 0 0; font-size: var(--fs-13); color: var(--muted); }
.topbar__tools { display: flex; align-items: center; gap: var(--sp-2); }

.role-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: var(--r-pill);
    background: var(--teal-soft); color: var(--teal-700);
    font-size: var(--fs-12); font-weight: 600; white-space: nowrap;
}

.avatar {
    width: 36px; height: 36px; border-radius: var(--r-pill);
    background: var(--navy); color: #fff;
    display: grid; place-items: center;
    font-size: var(--fs-13); font-weight: 700;
}

.content {
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    padding: var(--sp-6);
    flex: 1;
}

.sidebar-toggle {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--r-field); color: var(--navy);
}

.scrim {
    display: none; position: fixed; inset: 0;
    background: rgba(13,35,54,.45); z-index: 45;
}
.scrim.is-open { display: block; }

.crumbs { font-size: var(--fs-12); color: var(--muted); margin-bottom: var(--sp-3); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; }
.crumbs li + li::before { content: '/'; margin-right: var(--sp-2); color: var(--border-strong); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--teal); }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--sp-4); margin-bottom: var(--sp-4);
}
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }


/* ---------------------------------------------------------------------
   04 NAVIGATION
   ------------------------------------------------------------------ */
.nav-group {
    margin: var(--sp-4) 0 var(--sp-1);
    padding: 0 var(--sp-3);
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #64798e;
}
.nav-list { list-style: none; margin: 0; padding: 0; }

.nav-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 9px var(--sp-3);
    margin: 1px 0;
    border-radius: var(--r-field);
    color: #cbd7e2; font-size: var(--fs-13); font-weight: 500;
    min-height: 40px;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item i { width: 18px; text-align: center; font-size: var(--fs-13); opacity: .85; }
.nav-item.is-active {
    background: var(--teal); color: #fff; font-weight: 600;
}
.nav-item.is-active i { opacity: 1; }


/* ---------------------------------------------------------------------
   05 CARD
   ------------------------------------------------------------------ */
.card-app {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow);
    margin-bottom: var(--sp-4);
}
.card-app__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
    border-bottom: 1px solid var(--border);
}
.card-app__head h2, .card-app__head h3 { margin: 0; }
.card-app__head p { margin: 2px 0 0; font-size: var(--fs-12); color: var(--muted); }
.card-app__body { padding: var(--sp-4); }
.card-app__body--flush { padding: 0; }
.card-app__foot {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border);
    background: #fbfcfd;
    border-radius: 0 0 var(--r-card) var(--r-card);
}

.kpi-grid {
    display: grid; gap: var(--sp-4);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: var(--sp-4);
}
.kpi-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-card); box-shadow: var(--shadow);
    padding: var(--sp-4);
    display: block; color: inherit;
    transition: border-color .15s var(--ease);
}
a.kpi-card:hover { border-color: var(--teal); text-decoration: none; color: inherit; }
.kpi-card__label {
    font-size: var(--fs-12); font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); margin: 0 0 var(--sp-2);
}
.kpi-card__value { font-size: var(--fs-34); font-weight: 800; line-height: 1.05; color: var(--navy); }
.kpi-card__meta  { font-size: var(--fs-12); color: var(--muted); margin-top: var(--sp-1); }

.stat-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: var(--sp-3) 0; }
.stat__label { font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat__value { font-size: var(--fs-28); font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat__meta  { font-size: var(--fs-12); color: var(--muted); }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-6); margin: 0; }
.dl-grid dt { font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dl-grid dd { margin: 2px 0 0; font-size: var(--fs-15); }
/* Single column: for long prose values that should not sit side by side. */
.dl-grid--1 { grid-template-columns: 1fr; gap: var(--sp-4); }

.note-banner {
    display: flex; gap: var(--sp-2); align-items: flex-start;
    background: var(--info-bg); border: 1px solid #cfe2f3;
    color: #0b4a6f; border-radius: var(--r-field);
    padding: var(--sp-3); font-size: var(--fs-13);
    margin-bottom: var(--sp-4);
}
.note-banner i { margin-top: 2px; }

.callout {
    border-left: 3px solid var(--teal);
    background: var(--teal-soft);
    padding: var(--sp-3);
    border-radius: 0 var(--r-field) var(--r-field) 0;
    font-size: var(--fs-13);
}
.callout--danger { border-left-color: var(--risk-high); background: var(--risk-high-bg); }
.callout--warn   { border-left-color: var(--risk-mid);  background: var(--risk-mid-bg); }


/* ---------------------------------------------------------------------
   06 TABLE
   ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }

.table-app { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.table-app th {
    position: sticky; top: 0; z-index: 2;
    background: #f8fafc;
    text-align: left;
    font-size: var(--fs-12); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    padding: 10px var(--sp-3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table-app td {
    padding: 10px var(--sp-3);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table-app tbody tr:hover { background: #fafbfc; }
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app .num { text-align: right; }
.table-app .actions { white-space: nowrap; text-align: right; }
.table-app__code { font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.table-app__sub  { font-size: var(--fs-12); color: var(--muted); }

.table-app--dense td, .table-app--dense th { padding: 7px var(--sp-3); }

.table-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-3); font-size: var(--fs-12); color: var(--muted);
}


/* ---------------------------------------------------------------------
   07 FORM
   ------------------------------------------------------------------ */
.form-section { margin-bottom: var(--sp-6); }
.form-section__title {
    font-size: var(--fs-13); font-weight: 700; color: var(--navy);
    padding-bottom: var(--sp-2); margin-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--1 { grid-template-columns: 1fr; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }

.field { display: block; }
.field__label {
    display: block;
    font-size: var(--fs-12); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); margin-bottom: 5px;
}
.field__label .req { color: var(--risk-high); margin-left: 2px; }
.field__hint { font-size: var(--fs-12); color: var(--muted); margin-top: 4px; }
.field__error { font-size: var(--fs-12); color: var(--risk-high); margin-top: 4px; font-weight: 500; }

.input, .select, .textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-field);
    background: var(--surface);
    font: inherit; font-size: var(--fs-15); color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 92px; resize: vertical; }
.select { appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15,118,110,.13);
}
.input:disabled, .select:disabled, .textarea:disabled { background: #f1f5f9; color: var(--muted); }
.is-invalid { border-color: var(--risk-high); }
.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

.choice-list { display: grid; gap: var(--sp-2); }
.choice {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: 11px var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-field);
    cursor: pointer; min-height: 44px;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice:hover { border-color: var(--border-strong); background: #fbfcfd; }
.choice input { margin-top: 3px; accent-color: var(--teal); width: 17px; height: 17px; flex: 0 0 17px; }
.choice__text { font-size: var(--fs-15); line-height: 1.45; }
.choice__meta { font-size: var(--fs-12); color: var(--muted); }
.choice.is-selected { border-color: var(--teal); background: var(--teal-soft); }

.choice-inline { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.choice-inline .choice { flex: 1 1 200px; }
/* Checklist chips: many short options that should not stretch to fill a row. */
.choice-inline--wrap .choice { flex: 0 1 auto; }

.form-actions {
    display: flex; gap: var(--sp-2); flex-wrap: wrap;
    padding-top: var(--sp-4); border-top: 1px solid var(--border);
    margin-top: var(--sp-4);
}
.form-actions--split { justify-content: space-between; }

.autosave-hint {
    font-size: var(--fs-12); color: var(--muted);
    display: inline-flex; align-items: center; gap: 6px;
}
.autosave-hint.is-saving { color: var(--teal); }
.autosave-hint.is-error  { color: var(--risk-high); }


/* ---------------------------------------------------------------------
   08 BUTTON
   ------------------------------------------------------------------ */
.btn-app, .btn.btn-app {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 44px; padding: 10px var(--sp-4);
    border-radius: var(--r-field);
    font-size: var(--fs-13); font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
    text-decoration: none;
}
.btn-app:hover { text-decoration: none; }
.btn-app:disabled, .btn-app.is-disabled { opacity: .55; pointer-events: none; }

.btn-primary, .btn.btn-primary {
    background: var(--teal); border-color: var(--teal); color: #fff;
}
.btn-primary:hover, .btn.btn-primary:hover { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }

.btn-ghost {
    background: var(--surface); border-color: var(--border-strong); color: var(--navy);
}
.btn-ghost:hover { background: #f8fafc; border-color: var(--muted); color: var(--navy); }

.btn-danger { background: var(--surface); border-color: #f0c2c2; color: var(--risk-high); }
.btn-danger:hover { background: var(--risk-high-bg); border-color: var(--risk-high); color: var(--risk-high); }

.btn-link { background: none; border: 0; color: var(--teal); padding: 6px 8px; min-height: 36px; font-weight: 600; }
.btn-link:hover { color: var(--teal-700); text-decoration: underline; }

.btn-sm { min-height: 34px; padding: 6px var(--sp-3); font-size: var(--fs-12); }
.btn-icon { width: 38px; min-height: 38px; padding: 0; }

.btn-group-app { display: inline-flex; gap: var(--sp-2); }


/* ---------------------------------------------------------------------
   09 BADGE / STATUS
   ------------------------------------------------------------------ */
.badge-risk {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: var(--r-pill);
    font-size: var(--fs-12); font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-risk--low  { background: var(--risk-low-bg);  color: #15803d; border-color: #bbf7d0; }
.badge-risk--mid  { background: var(--risk-mid-bg);  color: #b45309; border-color: #fde3b0; }
.badge-risk--high { background: var(--risk-high-bg); color: #b91c1c; border-color: #fbcfcf; }
.badge-risk--critical { background: #4C0519; color: #fff; border-color: #4C0519; }
.badge-risk--none { background: #f1f5f9; color: var(--muted); border-color: var(--border); }

.status-pill {
    display: inline-block;
    padding: 3px 9px; border-radius: var(--r-pill);
    font-size: var(--fs-12); font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
}
.status-pill--ok     { background: var(--risk-low-bg);  color: #15803d; border-color: #bbf7d0; }
.status-pill--info   { background: var(--info-bg);      color: var(--info); border-color: #cfe2f3; }
.status-pill--warn   { background: var(--risk-mid-bg);  color: #b45309; border-color: #fde3b0; }
.status-pill--danger { background: var(--risk-high-bg); color: #b91c1c; border-color: #fbcfcf; }
.status-pill--muted  { background: #f1f5f9; color: var(--muted); border-color: var(--border); }

.tag {
    display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0;
    border-radius: var(--r-pill); background: #f1f5f9;
    border: 1px solid var(--border);
    font-size: var(--fs-12); color: var(--text);
}
/* Unmet item in a checklist: present in the list, but not ticked. */
.tag--muted { background: transparent; color: var(--text-muted); border-style: dashed; }

.delta { font-size: var(--fs-12); font-weight: 600; white-space: nowrap; }
.delta--up   { color: #15803d; }
.delta--down { color: #b91c1c; }
.delta--flat { color: var(--muted); }

.bar-track { height: 8px; border-radius: var(--r-pill); background: #eef2f6; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: var(--r-pill); background: var(--teal); }
.bar-fill--low  { background: var(--risk-low); }
.bar-fill--mid  { background: var(--risk-mid); }
.bar-fill--high { background: var(--risk-high); }
.bar-fill--critical { background: #4C0519; }


/* ---------------------------------------------------------------------
   10 WIZARD
   ------------------------------------------------------------------ */
.wizard-head {
    padding: var(--sp-4) var(--sp-4) 0;
    border-bottom: 1px solid var(--border);
}
.wizard-progress {
    height: 3px; background: #eef2f6; border-radius: var(--r-pill);
    overflow: hidden; margin-bottom: var(--sp-3);
}
.wizard-progress__fill {
    height: 100%; background: var(--teal);
    transition: width .35s var(--ease);
}
.wizard-steps {
    display: flex; gap: var(--sp-1); list-style: none; margin: 0; padding: 0 0 var(--sp-2);
    overflow-x: auto;
}
.wizard-step {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: 9px var(--sp-3);
    border-radius: var(--r-field) var(--r-field) 0 0;
    font-size: var(--fs-13); color: var(--muted); white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.wizard-step__num {
    width: 22px; height: 22px; flex: 0 0 22px; border-radius: var(--r-pill);
    background: #eef2f6; color: var(--muted);
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.wizard-step.is-active { color: var(--navy); font-weight: 600; border-bottom-color: var(--teal); }
.wizard-step.is-active .wizard-step__num { background: var(--teal); color: #fff; }
.wizard-step.is-done .wizard-step__num { background: var(--risk-low-bg); color: #15803d; }
.wizard-step.is-done { color: var(--text); }

.wizard-body { padding: var(--sp-6) var(--sp-4); }


/* ---------------------------------------------------------------------
   11 TIMELINE
   ------------------------------------------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--sp-6); position: relative; }
.timeline::before {
    content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border);
}
.timeline__item { position: relative; padding: 0 0 var(--sp-6); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
    position: absolute; left: calc(var(--sp-6) * -1 + 4px); top: 4px;
    width: 12px; height: 12px; border-radius: var(--r-pill);
    background: var(--surface); border: 2px solid var(--border-strong);
}
.timeline__dot--done      { background: var(--risk-low);  border-color: var(--risk-low); }
.timeline__dot--scheduled { background: var(--surface);   border-color: var(--info); }
.timeline__dot--late      { background: var(--risk-high); border-color: var(--risk-high); }
.timeline__dot--cancel    { background: #cbd5e1; border-color: #cbd5e1; }
.timeline__time { font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline__title { font-weight: 600; font-size: var(--fs-15); margin: 2px 0; }
.timeline__meta { font-size: var(--fs-13); color: var(--muted); }
.timeline__body {
    margin-top: var(--sp-2); padding: var(--sp-3);
    background: #fafbfc; border: 1px solid var(--border);
    border-radius: var(--r-field); font-size: var(--fs-13);
}


/* ---------------------------------------------------------------------
   12 STEPPER
   ------------------------------------------------------------------ */
.stepper { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; gap: 2px; }
.stepper__item {
    flex: 1 1 0; min-width: 116px; text-align: center;
    padding: var(--sp-3) var(--sp-2);
    border-top: 3px solid var(--border);
    font-size: var(--fs-12); color: var(--muted);
}
.stepper__item.is-done   { border-top-color: var(--teal); color: var(--text); }
.stepper__item.is-active { border-top-color: var(--teal); color: var(--navy); font-weight: 700; }
.stepper__item.is-rejected { border-top-color: var(--risk-high); color: #b91c1c; font-weight: 700; }
.stepper__label { display: block; font-weight: inherit; }
.stepper__time  { display: block; font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }


/* ---------------------------------------------------------------------
   13 FILTER BAR
   ------------------------------------------------------------------ */
.filterbar {
    display: flex; flex-wrap: wrap; gap: var(--sp-3);
    align-items: flex-end;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow);
    margin-bottom: var(--sp-4);
}
.filterbar__group { flex: 1 1 180px; min-width: 0; }
.filterbar__group--grow { flex: 2 1 260px; }
.filterbar__actions { display: flex; gap: var(--sp-2); }


/* ---------------------------------------------------------------------
   14 EMPTY / SKELETON
   ------------------------------------------------------------------ */
.empty-state { text-align: center; padding: var(--sp-12) var(--sp-4); }
.empty-state__icon { font-size: 30px; color: var(--border-strong); margin-bottom: var(--sp-3); }
.empty-state__title { font-size: var(--fs-15); font-weight: 700; color: var(--navy); margin: 0 0 var(--sp-1); }
.empty-state__text { font-size: var(--fs-13); color: var(--muted); max-width: 460px; margin: 0 auto var(--sp-4); }

.skeleton {
    background: linear-gradient(90deg, #eef2f6 25%, #f6f8fa 37%, #eef2f6 63%);
    background-size: 400% 100%;
    animation: skeleton 1.2s ease-in-out infinite;
    border-radius: 6px;
}
.skeleton--row { height: 38px; margin-bottom: var(--sp-2); }
.skeleton--text { height: 12px; margin-bottom: var(--sp-2); }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }


/* ---------------------------------------------------------------------
   15 MODAL / TOAST / DROPDOWN
   ------------------------------------------------------------------ */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: 0 12px 40px rgba(13,35,54,.16);
}
.modal-header { border-bottom: 1px solid var(--border); padding: var(--sp-4); }
.modal-title  { font-size: var(--fs-18); font-weight: 700; }
.modal-body   { padding: var(--sp-4); }
.modal-footer { border-top: 1px solid var(--border); padding: var(--sp-3) var(--sp-4); gap: var(--sp-2); }

.swal2-popup { font-family: inherit !important; border-radius: var(--r-card) !important; }
.swal2-title { font-size: var(--fs-18) !important; font-weight: 700 !important; color: var(--navy) !important; }
.swal2-html-container { font-size: var(--fs-13) !important; color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--teal) !important; border-radius: var(--r-field) !important; font-weight: 600 !important; }
.swal2-styled.swal2-cancel  { background: var(--surface) !important; color: var(--navy) !important;
    border: 1px solid var(--border-strong) !important; border-radius: var(--r-field) !important; font-weight: 600 !important; }

.bell { position: relative; }
.bell__count {
    position: absolute; top: 2px; right: 2px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: var(--r-pill);
    background: var(--risk-high); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.notif-menu { width: 340px; max-width: calc(100vw - 24px); padding: 0; border: 1px solid var(--border);
    border-radius: var(--r-card); box-shadow: 0 12px 40px rgba(13,35,54,.16); }
.notif-menu__head { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; }
.notif-item { display: block; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
    color: inherit; font-size: var(--fs-13); }
.notif-item:hover { background: #fafbfc; text-decoration: none; color: inherit; }
.notif-item.is-unread { background: var(--teal-soft); }
.notif-item__title { font-weight: 600; }
.notif-item__meta  { font-size: var(--fs-12); color: var(--muted); margin-top: 2px; }

.flash {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-field);
    border: 1px solid transparent;
    font-size: var(--fs-13);
    margin-bottom: var(--sp-4);
}
.flash--success { background: var(--risk-low-bg);  border-color: #bbf7d0; color: #15803d; }
.flash--danger  { background: var(--risk-high-bg); border-color: #fbcfcf; color: #b91c1c; }
.flash--warning { background: var(--risk-mid-bg);  border-color: #fde3b0; color: #b45309; }
.flash--info    { background: var(--info-bg);      border-color: #cfe2f3; color: var(--info); }


/* ---------------------------------------------------------------------
   16 CHART
   ------------------------------------------------------------------ */
.chart-box { position: relative; height: 260px; }
.chart-box--tall { height: 320px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-3); font-size: var(--fs-12); }
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chart-legend__swatch { width: 10px; height: 10px; border-radius: 2px; }


/* ---------------------------------------------------------------------
   17 UTILITIES
   ------------------------------------------------------------------ */
.u-muted { color: var(--muted); }
.u-small { font-size: var(--fs-12); }
.u-strong { font-weight: 700; }
.u-right { text-align: right; }
.u-center { text-align: center; }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-mt-0 { margin-top: 0; } .u-mt-2 { margin-top: var(--sp-2); }
.u-mt-3 { margin-top: var(--sp-3); } .u-mt-4 { margin-top: var(--sp-4); }
.u-mb-0 { margin-bottom: 0; } .u-mb-2 { margin-bottom: var(--sp-2); }
.u-mb-3 { margin-bottom: var(--sp-3); } .u-mb-4 { margin-bottom: var(--sp-4); }
.u-flex { display: flex; } .u-gap-2 { gap: var(--sp-2); } .u-gap-3 { gap: var(--sp-3); }
.u-between { justify-content: space-between; } .u-items-center { align-items: center; }
.u-wrap { flex-wrap: wrap; }
.u-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-4); }
.u-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-4); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.mobile-only { display: none; }


/* ---------------------------------------------------------------------
   18 MOTION  - exactly three animations in the whole application
   ------------------------------------------------------------------ */
.fade-slide-up { animation: fadeSlideUp .2s var(--ease) both; }
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}


/* ---------------------------------------------------------------------
   19 RESPONSIVE
   ------------------------------------------------------------------ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 50;
        transform: translateX(-100%);
        transition: transform .2s var(--ease);
        box-shadow: 0 0 40px rgba(13,35,54,.28);
    }
    .sidebar.is-open { transform: none; }
    .sidebar-toggle { display: grid; place-items: center; }
    .content { padding: var(--sp-4); }
    .topbar__inner { padding: var(--sp-3) var(--sp-4); }
    .u-grid-2, .u-grid-3 { grid-template-columns: 1fr; }
    .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
}

@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }

    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
    .kpi-card { padding: var(--sp-3); }
    .kpi-card__value { font-size: var(--fs-28); }

    /* Main tables become stacked cards rather than a horizontal scroller. */
    .table-app--stack thead { display: none; }
    .table-app--stack, .table-app--stack tbody, .table-app--stack tr, .table-app--stack td { display: block; width: 100%; }
    .table-app--stack tr {
        border: 1px solid var(--border); border-radius: var(--r-field);
        padding: var(--sp-3); margin-bottom: var(--sp-3); background: var(--surface);
    }
    .table-app--stack td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: var(--sp-3); }
    .table-app--stack td::before {
        content: attr(data-label);
        font-size: var(--fs-12); font-weight: 600; text-transform: uppercase;
        letter-spacing: .04em; color: var(--muted); flex: 0 0 40%;
    }
    .table-app--stack td.actions { justify-content: flex-end; padding-top: var(--sp-3); }
    .table-app--stack td.actions::before { content: none; }
    .table-app--stack td.num { text-align: right; }

    .page-head { flex-direction: column; }
    .page-head__actions { width: 100%; }

    /* Primary action pinned to the bottom on small screens. */
    .sticky-actions {
        position: sticky; bottom: 0; z-index: 20;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: var(--sp-3) var(--sp-4);
        margin: var(--sp-4) calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
        display: flex; gap: var(--sp-2);
        box-shadow: 0 -4px 16px rgba(13,35,54,.06);
    }
    .sticky-actions .btn-app { flex: 1; }

    /* The wizard shows only the active step. */
    .wizard-steps .wizard-step { display: none; }
    .wizard-steps .wizard-step.is-active { display: flex; flex: 1; }
    .wizard-body { padding: var(--sp-4) var(--sp-3); }

    .stepper__item { min-width: 92px; font-size: 11px; }
    .filterbar { padding: var(--sp-3); }
    .filterbar__group { flex: 1 1 100%; }
    .filterbar__actions { width: 100%; }
    .filterbar__actions .btn-app { flex: 1; }
    .dl-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .content { padding: var(--sp-3); }
    .topbar__title h1 { font-size: var(--fs-18); }
    .role-chip { display: none; }
}


/* ---------------------------------------------------------------------
   20 PRINT  - used by the PDF export
   ------------------------------------------------------------------ */
@media print {
    .sidebar, .topbar__tools, .sidebar-toggle, .filterbar,
    .page-head__actions, .form-actions, .no-print { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .app-shell { display: block; }
    .content { max-width: none; padding: 0; }
    .card-app { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .table-app th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .badge-risk, .status-pill { border: 1px solid #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a[href]::after { content: ''; }
    .print-head { display: block !important; margin-bottom: 12pt; }
    @page { margin: 14mm; }
}
.print-head { display: none; }
