/* ==========================================================================
   DDE 20th Anniversary Programme Tracker — design system
   Tokens → base → layout → components → page modules → print
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;

  --bg: #eaf3fe;
  --page-bg: linear-gradient(160deg, #f4f9ff 0%, #e6f1fd 35%, #d6e8fb 70%, #c9e0f8 100%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;

  --brand: #13365c;
  --brand-600: #1d4f86;
  --brand-500: #2563a8;
  --brand-50: #eef4fb;
  --accent: #b8892b;
  --accent-600: #9a7020;
  --accent-50: #fbf4e4;

  --ns: #94a3b8;
  --ip: #2563eb;
  --ar: #d97706;
  --done: #16a34a;
  --bad: #dc2626;
  --ns-bg: #f1f5f9;  --ns-tx: #475569;
  --ip-bg: #eff6ff;  --ip-tx: #1d4ed8;
  --ar-bg: #fffbeb;  --ar-tx: #b45309;
  --done-bg: #f0fdf4; --done-tx: #15803d;
  --bad-bg: #fef2f2; --bad-tx: #b91c1c;

  --sidebar-bg: #0b2240;
  --sidebar-bg-2: #0f2c52;
  --sidebar-tx: #c7d4e6;
  --sidebar-tx-strong: #ffffff;
  --sidebar-muted: #7f95b3;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --ring: 0 0 0 3px rgba(37, 99, 168, .25);

  --sidebar-w: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: linear-gradient(160deg, #0b1220 0%, #0e1b30 55%, #11233e 100%);
  --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --surface-3: #18233a;
    --border: #1f2c44; --border-strong: #2c3c5a;
    --text: #e8edf5; --text-2: #c3cddc; --muted: #8a99b2;
    --brand: #8fb6e8; --brand-600: #78a6e0; --brand-500: #6b9ee0; --brand-50: #14233b;
    --accent: #d9b25f; --accent-600: #e6c47a; --accent-50: #2a2416;
    --ns-bg: #1b2538; --ns-tx: #a7b3c6; --ip-bg: #13254a; --ip-tx: #8ab4ff;
    --ar-bg: #2c2110; --ar-tx: #f5b453; --done-bg: #0f2a1b; --done-tx: #5fd38a;
    --bad-bg: #2d1416; --bad-tx: #ff8a8a;
    --sidebar-bg: #070e1a; --sidebar-bg-2: #0c1628;
    --shadow: none; --shadow-sm: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page-bg: linear-gradient(160deg, #0b1220 0%, #0e1b30 55%, #11233e 100%);
  --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --surface-3: #18233a;
  --border: #1f2c44; --border-strong: #2c3c5a;
  --text: #e8edf5; --text-2: #c3cddc; --muted: #8a99b2;
  --brand: #8fb6e8; --brand-600: #78a6e0; --brand-500: #6b9ee0; --brand-50: #14233b;
  --accent: #d9b25f; --accent-600: #e6c47a; --accent-50: #2a2416;
  --ns-bg: #1b2538; --ns-tx: #a7b3c6; --ip-bg: #13254a; --ip-tx: #8ab4ff;
  --ar-bg: #2c2110; --ar-tx: #f5b453; --done-bg: #0f2a1b; --done-tx: #5fd38a;
  --bad-bg: #2d1416; --bad-tx: #ff8a8a;
  --sidebar-bg: #070e1a; --sidebar-bg-2: #0c1628;
  --shadow: none; --shadow-sm: none;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text);
  background: var(--page-bg, var(--bg)) fixed; background-color: var(--bg);
  font: 14px/1.55 var(--font-sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font: 600 26px/1.2 var(--font-serif); letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--muted); }
code { font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-tx); display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
/* University of Ghana crest. The PNG is 320×320 with the shield + motto ribbon in the top
   ~240px and the wordmark below; this crops to the crest only (no second image to maintain).
   It sits on a white tile because the navy shield would vanish on the navy sidebar. */
.crest {
  --size: 44px;
  width: var(--size); height: var(--size); flex: none; border-radius: 12px;
  background: #fff url("../images/university-of-ghana-logo.png") 50% 4% / 120% no-repeat;
  box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 0 0 1px rgba(184,137,43,.35);
}
.crest.sm { --size: 34px; border-radius: 9px; }
.crest.lg { --size: 64px; border-radius: 16px; }
.logo-full { display: block; width: 112px; height: auto; background: #fff; border-radius: 16px; padding: 6px; }
.brand-title { font-weight: 600; font-size: 14px; line-height: 1.25; color: #fff; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); }

.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; font-weight: 600;
  color: var(--sidebar-muted); padding: 16px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-tx); font-weight: 500; font-size: 13.5px; position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-link .badge { margin-left: auto; }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { font-size: 11.5px; color: var(--sidebar-muted); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127,127,127,.14); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn, .topbar-crest { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; height: 38px; background: var(--surface); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.countdown-chip {
  display: flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-50); color: var(--accent-600); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.countdown-chip b { font-size: 15px; font-weight: 700; }

.content { padding: 26px 28px 56px; width: 100%; max-width: 1440px; }
.page-header {
  display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-header .eyebrow { margin-bottom: 4px; }
.page-header p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer-note { margin-top: 32px; color: var(--muted); font-size: 12px; }

.scrim { display: none; }

/* ---------- grid helpers ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.span-2 { grid-column: span 2; }
.grid-map { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.stack-y > * + * { margin-top: 16px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); min-width: 0;
}
.card-body { padding: 18px 20px; }
.card-header {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px 0;
}
.card-header + .card-body { padding-top: 12px; }
.card-header p, .card-sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card-flush { padding: 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow.gold { color: var(--accent-600); }

/* KPI tiles */
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.kpi .value { font: 700 28px/1.1 var(--font-sans); letter-spacing: -.02em; margin: 8px 0 4px; }
.kpi .value small { font-size: 15px; font-weight: 500; }
.kpi .note { font-size: 12px; color: var(--muted); }
.kpi .progress, .kpi .stack { margin-top: 10px; }
/* Alert tiles (e.g. items overdue, high risks): light tint, coloured edge, readable text.
   Uses the same tokens as the pills, so contrast holds in both light and dark themes. */
.kpi.tone-bad, .kpi.tone-ar { position: relative; overflow: hidden; }
.kpi.tone-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.kpi.tone-ar { background: var(--ar-bg); border-color: color-mix(in srgb, var(--ar) 40%, transparent); }
.kpi.tone-bad::before, .kpi.tone-ar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi.tone-bad::before { background: var(--bad); }
.kpi.tone-ar::before { background: var(--ar); }
.kpi.tone-bad .label, .kpi.tone-bad .note { color: var(--bad-tx); }
.kpi.tone-ar .label, .kpi.tone-ar .note { color: var(--ar-tx); }
.kpi.tone-bad .value { color: var(--bad-tx); }
.kpi.tone-ar .value { color: var(--ar-tx); }
.kpi.tone-bad .label, .kpi.tone-ar .label { font-weight: 600; }
a.kpi.tone-bad:hover, a.kpi.tone-ar:hover { filter: brightness(.98); }
.kpi-ring { display: flex; gap: 14px; align-items: center; }
.ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--brand-500); stroke-linecap: round; transition: stroke-dashoffset .8s ease; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font: 500 13.5px/1 var(--font-sans);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-gold:hover { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--bad-tx); }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: transparent; color: var(--bad-tx); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:root[data-theme="dark"] .btn-primary, :root:not([data-theme="light"]) .btn-primary { color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { background: #1d4f86; border-color: #1d4f86; }
}
:root[data-theme="dark"] .btn-primary { background: #1d4f86; border-color: #1d4f86; }

/* ---------- pills & badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ns { background: var(--ns-bg); color: var(--ns-tx); }
.pill-ip { background: var(--ip-bg); color: var(--ip-tx); }
.pill-ar { background: var(--ar-bg); color: var(--ar-tx); }
.pill-done { background: var(--done-bg); color: var(--done-tx); }
.pill-bad { background: var(--bad-bg); color: var(--bad-tx); }
.pill-gold { background: var(--accent-50); color: var(--accent-600); }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--accent); color: #fff;
}
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.prio-High { color: var(--bad-tx); font-weight: 600; }
.prio-Medium { color: var(--text-2); }
.prio-Low { color: var(--muted); }
.rag { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rag-bad { background: var(--bad); } .rag-ar { background: var(--ar); } .rag-done { background: var(--done); }

/* ---------- progress, stacks ---------- */
.progress { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-500); border-radius: inherit; transition: width .6s ease; }
.progress.done > span { background: var(--done); }
.progress.bad > span { background: var(--bad); }
.progress.gold > span { background: var(--accent); }
.progress.ip > span { background: var(--ip); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row .progress { flex: 1; }
.progress-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.stack { display: flex; height: 7px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack i { display: block; height: 100%; }
.seg-ns { background: var(--ns); } .seg-ip { background: var(--ip); } .seg-ar { background: var(--ar); } .seg-done { background: var(--done); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- avatar & people ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 7px; vertical-align: middle; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border);
  color: inherit;
}
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { text-decoration: none; background: var(--surface-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; color: var(--text); }
.list-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .aside { text-align: right; font-size: 12.5px; white-space: nowrap; }
.list-item .team-dot { margin-top: 6px; }
.empty {
  padding: 22px; text-align: center; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .row-actions { white-space: nowrap; text-align: right; }
.table .row-actions .btn { visibility: hidden; }
.table tr:hover .row-actions .btn, .table .row-actions .btn:focus { visibility: visible; }
@media (hover: none) { .table .row-actions .btn { visibility: visible; } }
.table a.row-link { color: var(--text); font-weight: 500; }
.table .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.th-sort { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.th-sort:hover { color: var(--text); text-decoration: none; }
.th-sort.active { color: var(--brand-500); }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius-lg); }

/* ---------- forms ---------- */
.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 14px var(--font-sans);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.field input:not(.input):not([type=checkbox]):not([type=radio]):not([type=range]) {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 14px var(--font-sans);
}
.textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.5; }
.select-multiple { height: auto; padding: 6px; }
select.input { padding-right: 30px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select.select-multiple { background-image: none; padding-right: 6px; }
input[type="file"].input { padding: 6px; height: auto; }
input[type="range"] { width: 100%; accent-color: var(--brand-500); }
.checkbox { width: 16px; height: 16px; accent-color: var(--brand-500); }
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .error, .errorlist { color: var(--bad-tx); font-size: 12.5px; margin: 6px 0 0; padding: 0; list-style: none; }
.field.has-error .input { border-color: var(--bad); }
.field-check { display: flex; gap: 10px; align-items: flex-start; }
.field-check label { margin: 0; font-weight: 500; }
.field .required { color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .field.full { grid-column: 1 / -1; }
.fieldset { padding: 20px 22px 6px; border-bottom: 1px solid var(--border); }
.fieldset:last-of-type { border-bottom: 0; }
.fieldset legend, .fieldset-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.form-actions .spacer { flex: 1; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segmented label {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; margin: 0;
  border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); background: var(--surface); text-align: center;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .dot { width: 8px; height: 8px; border-radius: 50%; }
.segmented label:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); color: var(--text); box-shadow: inset 0 0 0 1px var(--brand-500); }
.segmented label:has(input:focus-visible) { box-shadow: var(--ring); }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row output { min-width: 46px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 140px; height: 34px; font-size: 13px; }
.filters .search-input { flex: 1; min-width: 200px; }
.filter-flag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--accent-600); font-weight: 600; }

/* ---------- alerts / messages ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; color: var(--text-2);
}
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand-500) 25%, transparent); }
.alert-gold { background: var(--accent-50); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.alert-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad-tx); }
.alert-ok { background: var(--done-bg); border-color: color-mix(in srgb, var(--done) 30%, transparent); color: var(--done-tx); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .25s ease;
}
.toast.success .icon { color: #4ade80; } .toast.error .icon { color: #f87171; } .toast.info .icon { color: #93c5fd; }
.toast .close { margin-left: auto; color: #94a3b8; background: none; border: 0; cursor: pointer; padding: 0 0 0 8px; font-size: 16px; line-height: 1; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pagination .pages { display: flex; gap: 6px; }

/* ---------- definition list ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ========================================================================
   Page modules
   ======================================================================== */

/* greeting / hero */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 24px 26px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2563a8 0%, #13365c 45%, #0b2240 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "20"; position: absolute; right: 18px; bottom: -42px; font: 700 180px/1 var(--font-serif);
  color: rgba(255,255,255,.06); pointer-events: none;
}
.hero h1 { color: #fff; font-size: 24px; }
.hero p { color: #c9d7ea; margin: 6px 0 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.countdown div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 10px 6px; text-align: center; }
.countdown b { display: block; font: 700 28px/1.1 var(--font-sans); font-variant-numeric: tabular-nums; color: #fff; }
.countdown span { font-size: 11px; color: #a9bdd8; text-transform: uppercase; letter-spacing: .06em; }
.countdown-title { font-size: 12.5px; color: #c9d7ea; margin-bottom: 8px; }
.countdown-title b { color: var(--accent); }
.key-dates { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.key-dates span { font-size: 12px; background: rgba(255,255,255,.08); border-radius: 999px; padding: 4px 10px; color: #dbe6f5; }
.key-dates b { color: #fff; }

/* banner of approved photos */
.banner { position: relative; overflow: hidden; border-radius: var(--radius-lg); height: 150px; background: var(--surface-3); }
.banner-track { display: flex; gap: 6px; height: 100%; width: max-content; animation: banner var(--dur, 60s) linear infinite; }
.banner:hover .banner-track { animation-play-state: paused; }
.banner-tile { position: relative; height: 100%; width: 220px; flex: none; }
.banner-tile img { width: 100%; height: 100%; object-fit: cover; }
.banner-tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font-size: 11.5px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); }
@keyframes banner { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .banner-track { animation: none; } }

/* memory card */
.memory { display: flex; gap: 14px; }
.memory img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; flex: none; }
.memory-year { width: 96px; height: 96px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-50); color: var(--accent-600); font: 700 26px/1 var(--font-serif); }
.memory h3 { font: 600 16px/1.3 var(--font-serif); margin: 2px 0 4px; }
.memory .text { font-size: 13.5px; color: var(--text-2); }

/* committee progress rows */
.team-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 48px; gap: 14px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border); color: inherit; }
.team-row:last-child { border-bottom: 0; }
a.team-row:hover { text-decoration: none; background: var(--surface-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.team-row .name { font-weight: 500; display: flex; align-items: center; }
.team-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.team-row .bars { display: flex; flex-direction: column; gap: 6px; }
.team-row .pct { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* gates */
.gate-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 48px; gap: 14px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border); color: inherit; }
.gate-row:last-child { border-bottom: 0; }
a.gate-row:hover { text-decoration: none; }
.gate-date { font-size: 12px; color: var(--muted); line-height: 1.3; }
.gate-date b { display: block; font-size: 13px; color: var(--text); }
.gate-name { font-weight: 500; margin-bottom: 6px; }

/* pulse chart */
.pulse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: center; }
.pulse-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pulse-stats b { display: block; font-size: 20px; }
.pulse-stats span { font-size: 12px; color: var(--muted); }

/* spotlight */
.spotlight { background: linear-gradient(140deg, var(--accent-50), var(--surface) 70%); }
.spotlight h2 { font: 600 18px/1.3 var(--font-serif); }

/* risk heat map */
.heat { display: grid; grid-template-columns: 90px repeat(3, 1fr); gap: 6px; }
.heat .axis { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.25; }
.heat .cell { aspect-ratio: 1.6; border-radius: 10px; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: rgba(0,0,0,.65); }
.heat a.cell:hover { text-decoration: none; outline: 2px solid var(--text); }
.heat .h1 { background: #d1fae5; } .heat .h2 { background: #fef3c7; } .heat .h3 { background: #fed7aa; } .heat .h4 { background: #fecaca; }
:root[data-theme="dark"] .heat .cell { filter: saturate(.8) brightness(.8); }

/* timeline */
.timeline { overflow-x: auto; }
.tl-inner { min-width: 980px; }
.tl-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.tl-head { position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border); }
.tl-months { display: grid; font-size: 11.5px; color: var(--muted); }
.tl-months div { padding: 8px 6px; border-left: 1px solid var(--border); }
.tl-phases { position: relative; height: 28px; margin-bottom: 6px; }
.tl-phase { position: absolute; top: 2px; height: 22px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--surface); }
.tl-group { padding: 10px 14px 6px; font-weight: 600; font-size: 12.5px; background: var(--surface-2); border-bottom: 1px solid var(--border); grid-column: 1 / -1; }
.tl-label { padding: 7px 14px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border); color: var(--text); }
.tl-label:hover { text-decoration: none; color: var(--brand-500); }
.tl-track { position: relative; border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px); background-size: calc(100% / var(--months)) 100%; }
.tl-bar { position: absolute; top: 8px; height: 14px; border-radius: 4px; }
.tl-point { position: absolute; top: 8px; width: 13px; height: 13px; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; }
/* Status fills for timeline bars, diamonds and legend swatches only. Scoped so they don't
   paint other elements that use the same tone-* names (e.g. alert KPI cards). */
:is(.tl-bar, .tl-point, .legend i).tone-ns { background: var(--ns); }
:is(.tl-bar, .tl-point, .legend i).tone-ip { background: var(--ip); }
:is(.tl-bar, .tl-point, .legend i).tone-ar { background: var(--ar); }
:is(.tl-bar, .tl-point, .legend i).tone-done { background: var(--done); }
:is(.tl-bar, .tl-point, .legend i).tone-bad { background: var(--bad); }

/* map */
.map svg { width: 100%; height: auto; max-height: 460px; }
.map .ghana { fill: var(--brand-50); stroke: var(--brand-500); stroke-width: 1.2; }
.map .pt circle.core { stroke: #fff; stroke-width: 2; }
.map .pt.none circle.core { fill: #fff; stroke: #8aa4bf; }
.map .pt.sched circle.core { fill: #2563eb; }
.map .pt.held circle.core { fill: #e0a526; }
.map .pt.held circle.halo { fill: #e0a526; opacity: .35; animation: halo 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.map .pt text { font-size: 11px; font-weight: 600; fill: var(--text-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.map a:hover text { fill: var(--brand-500); }
@keyframes halo { from { transform: scale(1); opacity: .5; } to { transform: scale(2.6); opacity: 0; } }

/* directory */
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member:last-child { border-bottom: 0; }
.member .who { flex: 1; min-width: 0; }
.member .who small { display: block; }
.role { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.role-L, .role-C { background: var(--brand-50); color: var(--brand-500); }
.role-S { background: var(--accent-50); color: var(--accent-600); }
.matrix td.c { text-align: center; font-weight: 700; }
.matrix td.c-L { color: var(--brand-500); background: var(--brand-50); }
.matrix td.c-M { color: var(--text-2); }

/* governance org chart */
.org { display: flex; flex-direction: column; align-items: center; gap: 0; }
.org .box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; text-align: center; font-size: 13px; min-width: 200px; }
.org .box b { display: block; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.org .box.head { border-top: 3px solid var(--accent); }
.org .box.sec { background: var(--accent-50); }
.org .line { width: 2px; height: 18px; background: var(--border-strong); }
.org .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.org .team-box { min-width: 150px; border-top: 3px solid var(--c, var(--border)); }
.routine { counter-reset: r; list-style: none; padding: 0; margin: 0; }
.routine li { counter-increment: r; position: relative; padding: 0 0 14px 40px; }
.routine li::before { content: counter(r); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand-500); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.routine b { display: block; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.photo-card { overflow: hidden; }
.photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photo-card .card-body { padding: 12px 14px; }

/* item detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.history { position: relative; }
.history-item { position: relative; padding: 0 0 16px 22px; }
.history-item::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.history-item:last-child::before { display: none; }
.history-item::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-500); }
.history-item .when { font-size: 12px; color: var(--muted); }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 120% at 0% 0%, #2563a8 0%, #13365c 50%, #0b2240 100%); }
.auth-art::after { content: "20"; position: absolute; right: -20px; bottom: -90px; font: 700 420px/1 var(--font-serif); color: rgba(255,255,255,.05); }
.auth-art h1 { color: #fff; font-size: 38px; max-width: 520px; }
.auth-art p { color: #c9d7ea; max-width: 460px; font-size: 15px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font: 600 24px/1.2 var(--font-serif); margin-bottom: 6px; }

/* error pages */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.error-page .code { font: 700 72px/1 var(--font-serif); color: var(--accent); }

/* celebration */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid, .grid-map { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn, .topbar-crest { display: inline-grid; }
  .content { padding: 20px 16px 48px; }
  .hero-grid, .pulse { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .countdown-chip { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 22px; }
  .team-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .team-row .bars { grid-column: 1 / -1; grid-row: 2; }
  .countdown b { font-size: 22px; }
}

/* ---------- print (leadership pack) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .toasts, .filters { display: none !important; }
  .app { display: block; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #d0d7e2; break-inside: avoid; }
  .table tr:hover td { background: none; }
  a { color: inherit; }
}

/* permission grid (roles) */
.table th.c, .table td.c { text-align: center; width: 84px; }
.perm-grid .checkbox { width: 18px; height: 18px; cursor: pointer; }
.perm-grid .checkbox:disabled { cursor: not-allowed; opacity: .45; }

/* ==========================================================================
   Live layer (overview): status chip, heartbeat, change highlights
   ========================================================================== */
.live-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px 4px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.1); color: #dbe6f5; border: 1px solid rgba(255,255,255,.2);
}
.live-chip.on-light { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.live-chip[data-state="live"].on-light { background: var(--done-bg); color: var(--done-tx); border-color: transparent; }
.live-chip[data-state="stale"].on-light { background: var(--ar-bg); color: var(--ar-tx); border-color: transparent; }
.live-chip[data-state="ended"].on-light { background: var(--bad-bg); color: var(--bad-tx); border-color: transparent; }
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex: none; }
.live-chip[data-state="live"] .pulse-dot { background: #22c55e; }
.live-chip[data-state="live"] .pulse-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: #22c55e;
  animation: live-ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
.live-chip[data-state="stale"] .pulse-dot { background: #f59e0b; }
.live-chip[data-state="ended"] .pulse-dot { background: #ef4444; }
@keyframes live-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

/* heartbeat (ECG) */
.ecg-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.ecg-base { stroke: var(--border-strong); stroke-dasharray: 3 4; }
.ecg { fill: none; stroke: var(--brand-500); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.ecg-glow { fill: none; stroke: var(--brand-500); stroke-width: 8; opacity: .14; stroke-linejoin: round; }
.ecg-draw { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: ecg-draw 2.4s ease-out forwards; }
@keyframes ecg-draw { to { stroke-dashoffset: 0; } }
.ecg-beat { fill: var(--accent); filter: drop-shadow(0 0 4px var(--accent)); }
.ecg-label { font-size: 10.5px; fill: var(--muted); }
.ecg-hit { fill: transparent; }
.ecg-hit:hover { fill: var(--brand-500); fill-opacity: .07; }

/* something another member just changed */
@keyframes live-flash {
  0%   { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent); background-color: var(--accent-50); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.flash { animation: live-flash 3s ease-out; border-radius: 10px; }
.newdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  margin-right: 7px; vertical-align: middle; animation: newdot 2s ease-in-out infinite; }
@keyframes newdot { 50% { opacity: .35; } }

/* cards read better on the gradient with a touch more lift */
.card { box-shadow: var(--shadow), 0 6px 18px rgba(29, 79, 134, .05); }

@media (prefers-reduced-motion: reduce) {
  .ecg-draw { animation: none; stroke-dashoffset: 0; }
  .ecg-beat, .live-chip .pulse-dot::after { display: none; }
  .flash, .newdot { animation: none; }
  .flash { outline: 2px solid var(--accent); }
}
@media print { .live-chip { display: none !important; } body { background: #fff; } }


/* ==========================================================================
   Evidence: upload area, previews, gallery
   ========================================================================== */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 20px 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2);
  text-align: center; cursor: pointer; color: var(--text-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone:focus-within { box-shadow: var(--ring); }
.dropzone small { color: var(--muted); font-size: 11.5px; }
.dropzone u { color: var(--brand-500); }
.dropzone-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-500); margin-bottom: 4px; }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone.has-files { padding: 12px 16px; }

.file-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.file-previews:empty { display: none; }
.file-previews .error { grid-column: 1 / -1; margin: 0; }
.file-preview { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.file-thumb { display: grid; place-items: center; width: 100%; height: 92px; object-fit: cover; background: var(--surface-3); }
.file-meta { padding: 6px 8px; display: flex; flex-direction: column; min-width: 0; }
.file-meta .name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { color: var(--muted); font-size: 11px; }
.file-remove { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(15, 23, 42, .7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.file-remove:hover { background: var(--bad); }

.file-badge { display: inline-grid; place-items: center; min-width: 46px; height: 30px; padding: 0 8px; border-radius: 6px;
  font: 700 11.5px/1 var(--font-sans); letter-spacing: .04em; color: #fff; background: var(--muted); }
.file-badge.kind-pdf { background: #dc2626; }
.file-badge.kind-document { background: #2563eb; }
.file-badge.kind-video { background: #7c3aed; }
.file-badge.kind-image { background: #0f766e; }
.file-thumb.file-badge { height: 92px; border-radius: 0; font-size: 15px; }

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.evidence-tile { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface);
  display: flex; flex-direction: column; }
.evidence-thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0;
  background: var(--surface-3); cursor: zoom-in; overflow: hidden; }
.evidence-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.evidence-thumb:hover img { transform: scale(1.03); }
video.evidence-thumb { cursor: default; background: #000; object-fit: contain; }
.evidence-doc { cursor: pointer; }
.evidence-doc .file-badge { min-width: 64px; height: 42px; font-size: 15px; }
.evidence-tile figcaption { padding: 9px 11px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.evidence-tile .name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evidence-tile .meta { font-size: 11.5px; color: var(--muted); }
.tile-actions { display: flex; gap: 4px; margin: 4px -6px 0; }
.tile-actions form { margin: 0; }

.attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 8px 3px 3px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.attach-chip:hover { text-decoration: none; border-color: var(--brand-500); }
.attach-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }
.attach-chip .file-badge { min-width: 34px; height: 24px; font-size: 9.5px; padding: 0 5px; }
.attach-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.upload-progress { flex: 1; display: flex; align-items: center; gap: 10px; }
.upload-progress .progress { flex: 1; }
.upload-progress small { color: var(--muted); white-space: nowrap; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(8, 15, 30, .82); }
.lightbox img { display: block; max-width: 94vw; max-height: 86vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox-caption { color: #e2e8f0; text-align: center; margin: 10px 0 0; font-size: 13px; }
.lightbox-close { position: absolute; top: -14px; right: -14px; background: #fff; color: #0f172a; border-radius: 50%; box-shadow: var(--shadow-lg); }
