/*
 * RELASIS Poli — sistem reka bentuk v2 (palet demo sementara, bukan kod korporat rasmi).
 * Arah: tenang dan tepat seperti pakaian seragam — kanvas neutral sejuk, navy sebagai sauh,
 * oren hanya untuk tindakan utama, emas sebagai "jalur pangkat" (chevron) yang digunakan jarang.
 * Tipografi selari MYDS (Malaysia Government Design System): Poppins untuk tajuk, Inter untuk teks.
 */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../lib/inter/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../lib/inter/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../lib/inter/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("../lib/inter/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap; src: url("../lib/poppins/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("../lib/poppins/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url("../lib/poppins/poppins-latin-700-normal.woff2") format("woff2"); }

:root {
  /* Jenama */
  --navy: #14263D;
  --navy-950: #0B1726;
  --navy-900: #0F1E33;
  --navy-800: #182C47;
  --navy-700: #213A5C;
  --navy-600: #2E4A70;
  --navy-100: #E6ECF3;
  --navy-50: #F3F6FA;
  --orange: #C65312;
  --orange-700: #A3430D;
  --orange-100: #FBEADF;
  --orange-50: #FEF5EF;
  --gold: #D6AC46;
  --gold-300: #E5C77E;
  --gold-100: #F8F0DA;
  /* Neutral sejuk */
  --surface: #FFFFFF;
  --bg: #F4F6F9;
  --line: #E3E8EF;
  --line-strong: #CBD3DD;
  --ink: #142033;
  --ink-2: #445266;
  --ink-3: #5D6B7E;
  /* Status */
  --success: #157347;
  --success-100: #E3F3EA;
  --danger: #B42318;
  --danger-100: #FDECEA;
  --warning: #8A5A00;
  --warning-100: #FDF2D8;
  --info: #1F5A8C;
  --info-100: #E4EEF8;
  /* Bentuk */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-1: 0 1px 2px rgba(15, 30, 51, .04), 0 1px 3px rgba(15, 30, 51, .04);
  --shadow-2: 0 6px 16px -6px rgba(15, 30, 51, .14), 0 2px 6px rgba(15, 30, 51, .05);
  --shadow-3: 0 18px 40px -12px rgba(15, 30, 51, .25);
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --focus: 0 0 0 3px rgba(198, 83, 18, .28);
  --font-head: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Bootstrap */
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-link-color: var(--navy-600);
  --bs-link-color-rgb: 46, 74, 112;
  --bs-link-hover-color: var(--orange-700);
  --bs-link-hover-color-rgb: 163, 67, 13;
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-primary: var(--orange);
  --bs-primary-rgb: 198, 83, 18;
}

html { font-size: 16px; }
body { font-family: var(--bs-body-font-family); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4 { font-family: var(--font-head); color: var(--navy); font-weight: 600; letter-spacing: -0.015em; }
h1, .h1 { font-size: 1.75rem; line-height: 1.25; }
h2, .h2 { font-size: 1.2rem; line-height: 1.35; }
h3, .h3 { font-size: 1.05rem; line-height: 1.4; }
h4, .h4 { font-size: .98rem; }
a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--gold-100); color: var(--navy); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; box-shadow: none; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: var(--focus); border-color: var(--orange); outline: none; }
.text-muted, .muted { color: var(--ink-3) !important; }
.small-note { font-size: .86rem; color: var(--ink-3); }
.visually-hidden-focusable:focus { position: fixed; top: 8px; left: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); }

/* ---------- Butang ---------- */
.btn { font-weight: 600; font-size: .94rem; border-radius: 10px; padding: .55rem 1rem; display: inline-flex; align-items: center; gap: .45rem; justify-content: center; min-height: 40px; transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.btn .bi { font-size: 1.02em; }
.btn-sm { padding: .32rem .7rem; font-size: .85rem; min-height: 32px; border-radius: var(--radius-sm); }
.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: var(--orange); --bs-btn-border-color: var(--orange); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--orange-700); --bs-btn-hover-border-color: var(--orange-700); --bs-btn-active-bg: var(--orange-700); --bs-btn-active-border-color: var(--orange-700); --bs-btn-disabled-bg: #D98B5F; --bs-btn-disabled-border-color: #D98B5F; box-shadow: 0 1px 2px rgba(163, 67, 13, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-navy { --bs-btn-color: #fff; --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: var(--navy-700); --bs-btn-hover-border-color: var(--navy-700); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--navy-800); --bs-btn-active-color: #fff; box-shadow: 0 1px 2px rgba(15, 30, 51, .2), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-outline-navy { --bs-btn-color: var(--navy); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--navy-50); --bs-btn-hover-color: var(--navy); --bs-btn-hover-border-color: var(--navy-600); --bs-btn-active-bg: var(--navy-100); --bs-btn-active-color: var(--navy); --bs-btn-active-border-color: var(--navy-600); background-color: var(--surface); box-shadow: var(--shadow-1); }
.btn-outline-navy:hover { background-color: var(--navy-50); }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: #93190F; --bs-btn-hover-border-color: #93190F; }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #F0C2BC; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); background-color: var(--surface); }
.btn-link { font-weight: 600; color: var(--navy-600); }

/* ---------- Kerangka ---------- */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%); color: #D3DCE7; display: flex; flex-direction: column; z-index: 1030; }
.sidebar .brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1.15rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-word { font-family: var(--font-head); font-weight: 600; font-size: 1.06rem; line-height: 1.15; letter-spacing: -.01em; }
.brand-word small { display: block; font-family: var(--bs-body-font-family); font-weight: 500; font-size: .74rem; color: #9DB0C5; letter-spacing: 0; margin-top: .1rem; }
.demo-tag { display: inline-block; font-family: var(--bs-body-font-family); font-size: .64rem; font-weight: 700; letter-spacing: .04em; background: rgba(214, 172, 70, .16); color: var(--gold-300); border: 1px solid rgba(214, 172, 70, .45); border-radius: 999px; padding: .02rem .42rem; margin-left: .3rem; vertical-align: 3px; }
.sidebar nav { padding: .75rem .75rem 1rem; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group-title { font-size: .74rem; font-weight: 600; color: #7F93AA; padding: 1.1rem .75rem .4rem; letter-spacing: .02em; }
.side-link { position: relative; display: flex; align-items: center; gap: .75rem; color: #C9D4E1; text-decoration: none; padding: .58rem .75rem; margin: 1px 0; border-radius: 10px; font-weight: 500; font-size: .93rem; transition: background-color .15s ease, color .15s ease; }
.side-link .bi { font-size: 1.08rem; width: 1.25rem; text-align: center; color: #8DA2BA; transition: color .15s ease; }
.side-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.side-link:hover .bi { color: #C9D4E1; }
.side-link.active { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; }
.side-link.active::before { content: ""; position: absolute; left: -.75rem; top: 50%; width: 4px; height: 20px; margin-top: -10px; border-radius: 0 4px 4px 0; background: var(--gold); }
.side-link.active .bi { color: var(--gold); }
.side-link .count { margin-left: auto; background: var(--orange); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; min-width: 1.35rem; padding: .1rem .42rem; text-align: center; }
.sidebar-foot { margin: 0 .75rem .75rem; padding: .75rem .85rem; border-radius: var(--radius); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); font-size: .78rem; line-height: 1.45; color: #8DA2BA; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: 0 2rem; min-height: var(--topbar-h); }
.topbar .context { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar .context-name { font-family: var(--font-head); font-weight: 600; font-size: .98rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.topbar .context-sub { font-size: .78rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: .35rem; }
.topbar .context-sub::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.topbar .spacer { flex: 1; }
.topbar .form-select-sm { min-height: 36px; border-radius: 10px; font-size: .86rem; padding-top: .3rem; padding-bottom: .3rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); background: none; border: 1px solid transparent; padding: .3rem .5rem .3rem .35rem; border-radius: 999px; transition: background-color .15s ease, border-color .15s ease; }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.user-chip .who { text-align: left; line-height: 1.2; font-weight: 600; font-size: .9rem; }
.user-chip .who small { display: block; color: var(--ink-3); font-size: .76rem; font-weight: 400; }
.dropdown-menu { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: .4rem; font-size: .92rem; min-width: 15rem; }
.dropdown-item { border-radius: var(--radius-sm); padding: .5rem .7rem; display: flex; align-items: center; gap: .55rem; color: var(--ink); }
.dropdown-item .bi { color: var(--ink-3); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--navy-50); color: var(--navy); }
.dropdown-divider { border-color: var(--line); margin: .35rem 0; }
.dropdown-menu form { margin: 0; }
.dropdown-menu button.dropdown-item { width: 100%; text-align: left; background: none; border: 0; }

.content { padding: 2rem 2rem 3rem; max-width: 1440px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head .lede { color: var(--ink-2); margin: .4rem 0 0; max-width: 68ch; font-size: .98rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page-actions form { margin: 0; }
.breadcrumbs { font-size: .84rem; margin-bottom: .5rem; color: var(--ink-3); }
.breadcrumbs a { color: var(--ink-3); text-decoration: none; }
.breadcrumbs a:hover { color: var(--navy); text-decoration: underline; }

/* ---------- Panel ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); min-height: 56px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.panel-head .small-note, .panel-head .small { font-size: .82rem; }
.panel-body { padding: 1.25rem; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--navy-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .panel + .panel { margin-top: 0; }
@media (max-width: 991.98px) { .grid-2, .grid-3, .grid-2-1 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- KPI: lajur sama lebar mengikut bilangan kad (simetri) ---------- */
.kpis { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpis:has(> :nth-child(2):last-child) { --n: 2; }
.kpis:has(> :nth-child(3):last-child) { --n: 3; }
.kpis:has(> :nth-child(5):last-child) { --n: 5; }
.kpis:has(> :nth-child(6):last-child) { --n: 6; }
.kpis:has(> :nth-child(7):last-child) { --n: 7; }
.kpis:has(> :nth-child(8)) { --n: 4; }
@media (max-width: 1279.98px) { .kpis:has(> :nth-child(6):last-child) { --n: 3; } .kpis:has(> :nth-child(7):last-child) { --n: 4; } }
@media (max-width: 1099.98px) { .kpis:has(> :nth-child(5):last-child) { --n: 3; } .kpis:has(> :nth-child(4):last-child) { --n: 2; } }
@media (max-width: 767.98px) { .kpis, .kpis:has(> *) { --n: 2; gap: .75rem; } }
.kpi { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.05rem 1.2rem 1.1rem; text-decoration: none; color: var(--ink); position: relative; box-shadow: var(--shadow-1); min-width: 0; transition: border-color .15s ease, box-shadow .15s ease; --tone: var(--navy-600); }
.kpi.tone-warn { --tone: var(--orange); }
.kpi.tone-gold { --tone: var(--gold); }
.kpi.tone-ok { --tone: var(--success); }
.kpi .kpi-label { order: 2; margin-top: .45rem; display: flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 500; color: var(--ink-2); line-height: 1.3; }
.kpi .kpi-label::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 3px; background: var(--tone); }
.kpi .kpi-value { order: 1; font-family: var(--font-head); font-size: 1.9rem; font-weight: 600; color: var(--navy); line-height: 1.15; padding-right: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .kpi-note { order: 3; font-size: .78rem; color: var(--ink-3); margin-top: .3rem; }
a.kpi::after { content: "\F138"; font-family: "bootstrap-icons"; position: absolute; top: 1rem; right: 1rem; font-size: .9rem; color: var(--line-strong); transition: color .15s ease, transform .15s ease; }
a.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
a.kpi:hover::after { color: var(--orange); transform: translateX(2px); }

/* ---------- Jadual ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { --bs-table-bg: transparent; margin: 0; font-size: .92rem; }
.table > :not(caption) > * > * { padding: .72rem 1rem; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .78rem; font-weight: 600; color: var(--ink-3); background: var(--navy-50); white-space: nowrap; letter-spacing: .01em; border-bottom: 1px solid var(--line); }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: #F8FAFC; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.row-link { font-weight: 600; color: var(--navy); text-decoration: none; }
.table a.row-link:hover { text-decoration: underline; color: var(--orange-700); }
.cell-sub { display: block; font-size: .8rem; color: var(--ink-3); margin-top: .05rem; }

/* Lencana status */
.badge-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; line-height: 1.35; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-success { background: var(--success-100); color: var(--success); }
.tone-danger { background: var(--danger-100); color: var(--danger); }
.tone-warning { background: var(--warning-100); color: var(--warning); }
.tone-info { background: var(--info-100); color: var(--info); }
.tone-neutral { background: #EEF1F5; color: var(--ink-2); }
.tag { display: inline-block; font-size: .76rem; background: var(--navy-50); color: var(--navy-700); border: 1px solid var(--navy-100); padding: .1rem .5rem; border-radius: var(--radius-xs); font-weight: 500; }

/* ---------- Borang ---------- */
.form-label { font-weight: 600; font-size: .88rem; color: var(--ink); margin-bottom: .35rem; }
.form-text { color: var(--ink-3); font-size: .8rem; }
.form-control, .form-select { border-color: var(--line-strong); border-radius: 10px; padding: .55rem .8rem; font-size: .96rem; min-height: 42px; background-color: var(--surface); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.form-control:hover, .form-select:hover { border-color: #AEB9C6; }
.form-control::placeholder { color: #8A96A5; }
.form-control[type="file"] { padding: .45rem .6rem; }
.form-control::file-selector-button { border: 0; border-radius: var(--radius-sm); background: var(--navy-50); color: var(--navy); font-weight: 600; padding: .35rem .8rem; margin: -.1rem .75rem -.1rem -.2rem; }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }
textarea.form-control { min-height: 96px; }
.form-select-sm, .form-control-sm { min-height: 34px; font-size: .86rem; border-radius: var(--radius-sm); }
.req::after { content: " *"; color: var(--danger); }
.is-invalid { border-color: var(--danger) !important; }
.invalid-feedback { display: block; color: var(--danger); font-size: .82rem; }
/* Penapis: grid lajur sama lebar supaya setiap baris sejajar */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .85rem 1rem; align-items: end; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.filter-bar .f { display: flex; flex-direction: column; min-width: 0; }
.filter-bar .f label { font-size: .76rem; font-weight: 600; color: var(--ink-3); margin-bottom: .3rem; }
.filter-bar .form-select, .filter-bar .form-control { font-size: .9rem; min-height: 38px; padding-top: .4rem; padding-bottom: .4rem; }
.filter-bar > .d-flex { grid-column: -3 / -1; justify-content: flex-end; }
.filter-bar > .d-flex .btn { min-height: 38px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-chip { display: inline-flex; gap: .35rem; align-items: center; font-size: .8rem; font-weight: 500; background: var(--gold-100); color: #5E4810; border: 1px solid #EEDDAE; border-radius: 999px; padding: .18rem .65rem; }

/* Mesej */
.alert { border-radius: var(--radius); border: 1px solid transparent; display: flex; gap: .65rem; align-items: flex-start; padding: .85rem 1rem; font-size: .94rem; }
.alert .bi { font-size: 1.1rem; line-height: 1.4; }
.alert-success { background: var(--success-100); color: #0F5434; border-color: #C2E3D0; }
.alert-danger { background: var(--danger-100); color: #8A1B12; border-color: #F4C7C2; }
.alert-warning { background: var(--warning-100); color: #6B4600; border-color: #F0DBA8; }
.alert-info { background: var(--info-100); color: #18466E; border-color: #C8DBEF; }

/* Keadaan kosong / ralat */
.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-2); }
.empty .bi { font-size: 1.6rem; color: var(--navy-600); display: inline-flex; width: 3.25rem; height: 3.25rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--navy-50); margin-bottom: .75rem; }
.empty h3 { font-size: 1.02rem; margin-bottom: .35rem; }
.skeleton { background: linear-gradient(90deg, #EEF1F5 25%, #F6F8FA 37%, #EEF1F5 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; border-radius: 6px; min-height: 1rem; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Avatar */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; font-family: var(--font-head); box-shadow: 0 0 0 2px var(--surface); }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar-md { width: 44px; height: 44px; font-size: .95rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.7rem; }
.avatar-fallback.hue-0 { background: #2E4A70; } .avatar-fallback.hue-1 { background: #7A5A1C; } .avatar-fallback.hue-2 { background: #A3430D; }
.avatar-fallback.hue-3 { background: #1F5A8C; } .avatar-fallback.hue-4 { background: #3B5B3F; } .avatar-fallback.hue-5 { background: #5A3E6B; }
.person { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.person .nm { font-weight: 600; color: var(--navy); }

/* Langkah wizard */
.steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.25rem; flex-wrap: wrap; counter-reset: st; }
.steps li { counter-increment: st; display: flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 500; color: var(--ink-3); padding: .35rem .85rem .35rem .4rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.steps li::before { content: counter(st); width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #EEF1F5; font-weight: 700; font-size: .76rem; }
.steps li.done { color: var(--success); }
.steps li.done::before { content: "\F26E"; font-family: "bootstrap-icons"; background: var(--success); color: #fff; }
.steps li.current { color: var(--navy); font-weight: 600; border-color: var(--navy); box-shadow: var(--shadow-1); }
.steps li.current::before { background: var(--navy); color: #fff; }

/* Tab: segmen di atas garis */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 1.25rem; scrollbar-width: thin; }
.tabs a { position: relative; padding: .7rem .95rem; color: var(--ink-3); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: color .15s ease, background-color .15s ease; }
.tabs a:hover { color: var(--navy); background: var(--navy-50); }
.tabs a.active { color: var(--navy); }
.tabs a.active::after { content: ""; position: absolute; left: .7rem; right: .7rem; bottom: -1px; height: 2px; border-radius: 2px; background: var(--orange); }

/* Senarai definisi */
.dl-grid { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .6rem 1rem; margin: 0; }
.dl-grid dt { font-weight: 500; color: var(--ink-3); font-size: .88rem; }
.dl-grid dd { margin: 0; }

/* Kalendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cal-dow { font-size: .76rem; font-weight: 600; color: var(--ink-3); padding: .55rem .6rem; background: var(--navy-50); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal > :nth-child(7n) { border-right: 0; }
.cal-day { min-height: 116px; padding: .4rem .45rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; }
.cal-day.other { background: #FAFBFC; }
.cal-day.other .cal-num { color: #A6B0BC; }
.cal-num { font-size: .8rem; font-weight: 600; color: var(--ink-2); display: inline-block; min-width: 1.65rem; height: 1.65rem; line-height: 1.65rem; text-align: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--orange); color: #fff; }
.cal-item { display: block; font-size: .74rem; font-weight: 500; line-height: 1.3; padding: .2rem .4rem; border-radius: var(--radius-xs); margin-top: .25rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.cal-item.k-published, .cal-item.k-ongoing { background: var(--info-100); color: #18466E; border-color: var(--info); }
.cal-item.k-completed, .cal-item.k-closed { background: var(--success-100); color: #0F5434; border-color: var(--success); }
.cal-item.k-draft, .cal-item.k-submitted { background: #EEF1F5; color: var(--ink-2); border-color: #8A96A5; }
.cal-item.k-cancelled { background: var(--danger-100); color: #8A1B12; border-color: var(--danger); text-decoration: line-through; }
.cal-item.k-deadline { background: var(--gold-100); color: #5E4810; border-color: var(--gold); }
.cal-item.k-duty { background: var(--orange-100); color: var(--orange-700); border-color: var(--orange); }
.legend { display: flex; flex-wrap: wrap; gap: .45rem 1rem; font-size: .8rem; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; background: var(--c); }
.agenda-day { padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.agenda-day h3 { font-size: .86rem; color: var(--ink-3); margin: 0 0 .4rem; }

/* Motif "jalur pangkat": chevron emas berlapis (SVG sebaris, tiada fail luar) */
.member-card, .auth-side { --chevrons: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240' fill='none' stroke='%23D6AC46' stroke-width='10' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M30 120 120 66 210 120' opacity='.9'/%3E%3Cpath d='M30 160 120 106 210 160' opacity='.55'/%3E%3Cpath d='M30 200 120 146 210 200' opacity='.3'/%3E%3C/svg%3E"); }

/* Kad keahlian pelajar */
.member-card { position: relative; background: radial-gradient(120% 140% at 100% 0%, var(--navy-700) 0%, var(--navy-900) 55%, var(--navy-950) 100%); color: #fff; border-radius: var(--radius-xl); padding: 1.25rem 1.3rem 1.1rem; overflow: hidden; box-shadow: var(--shadow-2); }
.member-card::after { content: ""; position: absolute; right: -36px; bottom: -48px; width: 190px; height: 190px; background: var(--chevrons) no-repeat center / contain; opacity: .22; pointer-events: none; }
.member-card .mc-top { display: flex; align-items: center; gap: .95rem; position: relative; z-index: 1; }
.member-card .mc-name { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.member-card .mc-meta { font-size: .84rem; color: #BFCCDB; }
.member-card .mc-rule { height: 2px; background: var(--gold); margin: 1rem 0 .75rem; width: 56px; border-radius: 2px; position: relative; z-index: 1; }
.member-card .mc-foot { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: #BFCCDB; position: relative; z-index: 1; }
.member-card .mc-foot strong { color: #fff; display: block; font-size: .95rem; }
.progress-thin { height: 6px; background: rgba(255, 255, 255, .16); border-radius: 999px; overflow: hidden; margin-top: .4rem; }
.progress-thin > span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.scan-cta { display: flex; align-items: center; gap: 1rem; background: var(--orange); color: #fff; border-radius: var(--radius-xl); padding: 1rem 1.2rem; text-decoration: none; font-family: var(--font-head); font-weight: 600; font-size: 1.08rem; margin-top: 1rem; box-shadow: 0 10px 24px -12px rgba(198, 83, 18, .7); }
.scan-cta:hover { background: var(--orange-700); color: #fff; }
.scan-cta .bi { font-size: 1.6rem; width: 3rem; height: 3rem; border-radius: 14px; background: rgba(255, 255, 255, .16); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.scan-cta small { display: block; font-family: var(--bs-body-font-family); font-weight: 500; font-size: .84rem; opacity: .9; }
.stat-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.stat-trio > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .85rem; box-shadow: var(--shadow-1); }
.stat-trio .v { font-family: var(--font-head); font-size: 1.4rem; font-weight: 600; color: var(--navy); line-height: 1.1; }
.stat-trio .l { font-size: .78rem; color: var(--ink-2); margin-top: .15rem; }

/* Senarai program */
.event-row { display: flex; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; transition: background-color .12s ease; }
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: #F8FAFC; }
.date-block { flex: none; width: 54px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.date-block .m { background: var(--navy-50); color: var(--orange-700); font-size: .7rem; font-weight: 700; padding: .15rem 0; letter-spacing: .03em; border-bottom: 1px solid var(--line); }
.date-block .dd { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; color: var(--navy); padding: .15rem 0 .2rem; }
.event-row .t { font-weight: 600; color: var(--navy); }
.event-row .s { font-size: .84rem; color: var(--ink-3); }

/* Operasi QR — skrin projektor */
.qr-stage { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.qr-board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 1.75rem; text-align: center; box-shadow: var(--shadow-1); }
.qr-board .sess-name { font-family: var(--font-head); font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 600; color: var(--navy); line-height: 1.15; margin-bottom: .25rem; }
.qr-board .sess-time { color: var(--ink-2); margin-bottom: 1.1rem; }
.qr-frame { display: inline-block; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: #fff; position: relative; box-shadow: var(--shadow-2); }
.qr-frame::before { content: ""; position: absolute; inset: -6px; border-radius: 22px; border: 2px solid var(--navy); pointer-events: none; }
.qr-frame img { width: min(340px, 70vw); height: auto; display: block; image-rendering: pixelated; }
.qr-frame.expired img { opacity: .15; filter: grayscale(1); }
.countdown { margin: 1.1rem auto 0; max-width: 340px; }
.countdown .bar { height: 6px; background: #EEF1F5; border-radius: 999px; overflow: hidden; }
.countdown .bar > span { display: block; height: 100%; background: var(--orange); border-radius: 999px; transition: width 1s linear; }
.countdown .lbl { font-size: .84rem; color: var(--ink-2); margin-top: .4rem; }
.live-count { font-family: var(--font-head); font-size: 2.6rem; font-weight: 600; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
@media (max-width: 991.98px) { .qr-stage { grid-template-columns: 1fr; } }

/* Imbas */
.scanner { position: relative; background: var(--navy-950); border-radius: var(--radius-xl); overflow: hidden; aspect-ratio: 1 / 1; max-width: 420px; margin: 0 auto; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .reticle { position: absolute; inset: 18%; border: 3px solid rgba(214, 172, 70, .95); border-radius: 18px; box-shadow: 0 0 0 999px rgba(11, 23, 38, .5); }
.receipt { border: 1px solid #BFE1CD; border-radius: var(--radius-xl); background: var(--surface); padding: 1.5rem 1.25rem; text-align: center; box-shadow: var(--shadow-2); }
.receipt .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--success); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: .7rem; box-shadow: 0 0 0 8px var(--success-100); }

/* Navigasi bawah mudah alih */
.bottom-nav { display: none; }
.mobile-top { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 999px rgba(11, 23, 38, .5); }
  .main { margin-left: 0; }
  .topbar { padding: 0 1rem; min-height: 58px; gap: .65rem; }
  .content { padding: 1.25rem 1rem 6.5rem; }
  h1, .h1 { font-size: 1.45rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: .75rem; right: .75rem; bottom: calc(.6rem + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border: 1px solid var(--line); border-radius: 20px; z-index: 1025; box-shadow: var(--shadow-3); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: .12rem; padding: .45rem 0 .5rem; font-size: .7rem; color: var(--ink-3); text-decoration: none; font-weight: 600; min-height: 58px; justify-content: center; }
  .bottom-nav a .bi { font-size: 1.22rem; }
  .bottom-nav a.active { color: var(--navy); }
  .bottom-nav a.active .bi { color: var(--orange); }
  .bottom-nav a.scan .bi { background: var(--orange); color: #fff; border-radius: 16px; width: 2.9rem; height: 2.9rem; display: inline-flex; align-items: center; justify-content: center; margin-top: -1.35rem; box-shadow: 0 8px 18px -8px rgba(198, 83, 18, .8), 0 0 0 4px var(--surface); }
  .user-chip .who { display: none; }
  .page-head { align-items: flex-start; }
  .filter-bar > .d-flex { grid-column: 1 / -1; }
}
@media (min-width: 992px) { .menu-toggle { display: none !important; } }

/* ---------- Halaman log masuk ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(400px, 1fr); background: var(--surface); }
.auth-side { position: relative; overflow: hidden; background: radial-gradient(90% 80% at 0% 0%, var(--navy-700) 0%, var(--navy-900) 50%, var(--navy-950) 100%); color: #CBD6E3; padding: 2.75rem 3.25rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.auth-side::after { content: ""; position: absolute; right: -90px; bottom: -110px; width: 520px; height: 520px; background: var(--chevrons) no-repeat center / contain; opacity: .16; pointer-events: none; }
.auth-side > * { position: relative; z-index: 1; }
.auth-side .brand-word { font-size: 1.15rem; }
.auth-side h1 { font-family: var(--font-head); color: #fff; font-size: clamp(2rem, 3.2vw, 2.9rem); font-weight: 600; line-height: 1.12; letter-spacing: -.025em; max-width: 15ch; margin-bottom: 1rem; }
.auth-side p { max-width: 44ch; color: #B9C7D7; font-size: 1.02rem; }
.auth-side .auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .65rem; max-width: 44ch; }
.auth-side .auth-points li { display: flex; gap: .7rem; align-items: center; color: #DCE4EE; font-size: .94rem; }
.auth-side .auth-points .bi { width: 2rem; height: 2rem; border-radius: 10px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); display: inline-flex; align-items: center; justify-content: center; color: var(--gold); flex: none; }
.auth-side .auth-foot { font-size: .8rem; color: #8DA2BA; margin: 0; }
.auth-form { background: var(--surface); padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.auth-form > div { max-width: 400px; width: 100%; margin: 0 auto; }
.auth-form h2 { font-family: var(--font-head); font-size: 1.65rem; font-weight: 600; margin-bottom: .35rem; }
.auth-form .form-control { min-height: 46px; }
.auth-form .btn { min-height: 46px; }
.auth-form details summary { cursor: pointer; color: var(--navy-600); font-weight: 600; font-size: .9rem; list-style: none; }
.auth-form details summary::-webkit-details-marker { display: none; }
.auth-form details summary::before { content: "\F285"; font-family: "bootstrap-icons"; font-size: .75rem; margin-right: .4rem; display: inline-block; transition: transform .15s ease; }
.auth-form details[open] summary::before { transform: rotate(90deg); }
.auth-note { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--navy-50); }
.auth-note .bi { color: var(--gold); }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 1.5rem 1.25rem 1.75rem; gap: 1.25rem; }
  .auth-side::after { width: 260px; height: 260px; right: -70px; bottom: -90px; }
  .auth-side h1 { font-size: 1.6rem; margin-bottom: 0; }
  .auth-side .hide-sm { display: none; }
  .auth-form { padding: 1.75rem 1.25rem 2.5rem; justify-content: flex-start; }
}

/* ---------- Utiliti ---------- */
.gap-2 { gap: .5rem; }
.stack > * + * { margin-top: 1.25rem; }
.mono { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace; font-size: .9em; }
.nowrap { white-space: nowrap; }
.code-display { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 1.55rem; letter-spacing: .08em; font-weight: 700; color: var(--navy); background: var(--gold-100); border: 1.5px dashed var(--gold); border-radius: var(--radius); padding: .6rem 1rem; display: inline-block; }
.chart-box { position: relative; height: 270px; }
.chart-box.tall { height: 330px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); }
.list-plain > li:last-child { border-bottom: 0; }
.action-item { display: flex; align-items: center; gap: .75rem; }
.action-item a { color: var(--navy); font-weight: 500; text-decoration: none; }
.action-item a:hover { color: var(--orange-700); text-decoration: underline; }
.action-item .bi { color: var(--orange); font-size: 1rem; width: 2rem; height: 2rem; border-radius: 10px; background: var(--orange-50); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.25rem; font-size: .86rem; color: var(--ink-2); flex-wrap: wrap; border-top: 1px solid var(--line); }
.diff-cell { background: var(--warning-100); }
.err-cell { background: var(--danger-100); }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; }
.thumb-grid figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.thumb-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.thumb-grid figcaption { font-size: .8rem; padding: .45rem .6rem; color: var(--ink-2); }
.grant-note { display: flex; gap: .65rem; align-items: flex-start; background: var(--gold-100); border: 1px solid #EEDDAE; border-radius: var(--radius); padding: .75rem .9rem; font-size: .9rem; color: #5E4810; }
.toolbar-inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sticky-context { position: sticky; top: var(--topbar-h); z-index: 5; background: var(--bg); padding: .5rem 0; }
details > summary { cursor: pointer; }
.panel > details > summary, details.panel > summary { list-style: none; padding: 1rem 1.25rem; font-family: var(--font-head); font-weight: 600; color: var(--navy); }
.panel > details > summary::-webkit-details-marker, details.panel > summary::-webkit-details-marker { display: none; }
.panel > details > summary::before, details.panel > summary::before { content: "\F285"; font-family: "bootstrap-icons"; font-size: .75rem; margin-right: .55rem; display: inline-block; transition: transform .15s ease; color: var(--ink-3); }
.panel > details[open] > summary::before, details.panel[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .sidebar, .topbar, .bottom-nav, .page-actions, .no-print { display: none !important; } .main { margin: 0; } .panel, .kpi { box-shadow: none; } }
@media (max-width: 991.98px) { .profile-photo { order: -1; } }
.member-card .avatar-lg { width: 76px; height: 76px; font-size: 1.4rem; box-shadow: 0 0 0 3px rgba(214, 172, 70, .55); }
