/* Evidence Tracker */
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 1000; font-style: normal; font-display: swap;
}

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #0f1d2b;
  --ink-2: #3d4b5a;
  --muted: #6a7785;
  --line: #e3e8ed;
  --line-2: #eef1f4;
  --brand: #0f2a3d;
  --brand-ink: #ffffff;
  --accent: #0e7c66;

  --ok: #12805c;      --ok-bg: #e6f5ee;      --ok-line: #9fd8bf;
  --wait: #a35a00;    --wait-bg: #fdf3e2;    --wait-line: #f1c98a;
  --fix: #b42318;     --fix-bg: #fdecea;     --fix-line: #f3b4ad;
  --none: #6a7785;    --none-bg: #eef1f4;    --none-line: #d6dde4;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 29, 43, .04), 0 2px 8px rgba(15, 29, 43, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141c; --surface: #111d27; --surface-2: #0e1922; --ink: #e8eef3; --ink-2: #c1ccd6; --muted: #8b99a6;
    --line: #213140; --line-2: #1a2834; --brand: #0b1f2d; --accent: #3cc4a3;
    --ok: #4cc79a; --ok-bg: #11302a; --ok-line: #1f5a48;
    --wait: #f0b45c; --wait-bg: #33260f; --wait-line: #5e4719;
    --fix: #f48a7f; --fix-bg: #3a1a18; --fix-line: #6b2c27;
    --none: #8b99a6; --none-bg: #1a2834; --none-line: #2a3b4a;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: clip; font-feature-settings: "tnum" 1;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* Top bar */
.topbar { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; color: #7fe3c6; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .1); color: inherit; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255, 255, 255, .18); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

/* Hero */
.hero { background: var(--brand); color: var(--brand-ink); margin: 0 calc(50% - 50vw); padding: 8px 16px 64px; }
.hero-inner { max-width: 728px; margin: 0 auto; }
.hero-eyebrow { font-size: 13px; color: #9fb4c4; font-weight: 500; letter-spacing: .02em; }
.hero h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 6px; }
.hero p { color: #c3d2dd; font-size: 15px; max-width: 520px; }

/* Stage medals: one colour per stage */
.medal { --m: #6a7785; width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.45), transparent 55%), var(--m);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.medal-lg { width: 40px; height: 40px; font-size: 16px; }
.m-blue { --m: #2563eb; } .m-bronze { --m: #a8642f; } .m-silver { --m: #8a949e; }
.m-gold { --m: #c99a1a; } .m-platinum { --m: #5f8293; } .m-diamond { --m: #149bb8; }

/* Journey strip in the header */
.journey { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 20px; position: relative; }
.journey::before { content: ""; position: absolute; left: 8%; right: 8%; top: 17px; height: 2px; background: rgba(255,255,255,.14); }
.journey li { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.journey .medal { width: 36px; height: 36px; font-size: 14px; outline: 3px solid var(--brand); }
.j-name { font-size: 12px; color: #c3d2dd; }
.j-todo .medal { filter: grayscale(1); opacity: .45; }
.j-todo .j-name { color: #7f95a6; }
.j-pending .medal { box-shadow: 0 0 0 2px var(--brand), 0 0 0 4px #f0b45c; }
.j-rejected .medal { box-shadow: 0 0 0 2px var(--brand), 0 0 0 4px #f48a7f; }
.j-done::after { content: "✓"; position: absolute; top: -4px; left: calc(50% + 9px); width: 16px; height: 16px; border-radius: 50%;
  background: #22c38e; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; outline: 2px solid var(--brand); }

/* Programme tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; max-width: 760px; margin: 16px auto 0; scrollbar-width: none; }
.tab { border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #c3d2dd; padding: 6px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.tab[aria-selected="true"] { background: #fff; color: var(--brand); border-color: #fff; font-weight: 600; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: -44px; position: relative; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat-eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-num { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.wait { background: var(--wait); } .dot.fix { background: var(--fix); }

/* Section headings */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 2px 10px; }
.section-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.section-head span { font-size: 13px; color: var(--muted); }

/* Needs attention */
.attention { background: var(--surface); border: 1px solid var(--fix-line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.attention-head { background: var(--fix-bg); color: var(--fix); padding: 10px 16px; font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.attention-item { padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.attention-item .files { margin-top: 10px; }
.attention-item + .attention-item { border-top: 1px solid var(--line-2); }
.attention-item h3 { font-size: 15px; font-weight: 600; }
.crumb { font-size: 13px; color: var(--muted); }
.note { margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--fix); border-radius: 0 8px 8px 0; font-size: 14px; color: var(--ink-2); }
.note-by { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; font-weight: 500; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.btn-wa { background: #1fa855; color: #fff; }
.btn-wa:hover { background: #188f47; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Stage cards */
.stages { display: flex; flex-direction: column; gap: 10px; }
.stage, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card { padding: 4px 16px; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.stage > summary { padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.stage > summary .medal, .stage > summary .chev { margin-top: 2px; }
.stage-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; display: flex; gap: 8px; align-items: baseline; }
.stage-no { font-size: 12px; font-weight: 500; color: var(--muted); }
.stage-sub { font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.stage-meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.chev { color: var(--muted); transition: transform .2s; flex: none; }
details[open] > summary .chev { transform: rotate(180deg); }
.stage-body { border-top: 1px solid var(--line-2); padding: 4px 16px 16px; }
.sub-head { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; display: flex; justify-content: space-between; }
.sub-head span { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Indicators */
.inds { list-style: none; display: flex; flex-direction: column; }
.ind { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.ind:last-child { border-bottom: 0; }
.ind-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ind-label { font-size: 14px; font-weight: 500; line-height: 1.35; }
.ind-num { font-size: 16px; font-weight: 600; white-space: nowrap; }
.ind-num small { font-size: 13px; color: var(--muted); font-weight: 500; }
.ind-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bar { height: 6px; background: var(--line-2); border-radius: 99px; margin-top: 7px; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > b { display: block; height: 100%; background: var(--wait); opacity: .7; }
.bar-full > i { background: var(--ok); }
.ind-yesno { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.yn { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.yn-done { background: var(--ok-bg); color: var(--ok); } .yn-wait { background: var(--wait-bg); color: var(--wait); } .yn-todo { background: var(--none-bg); color: var(--none); }

/* Monthly reports */
.reports { display: flex; flex-direction: column; gap: 8px; }
.report { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.report > summary, .summary-row { padding: 10px 12px; display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.summary-row { grid-template-columns: 1fr auto; }
.report-flat { margin: 8px 0; }
.report-flat .note { margin: 0 12px 12px; }
.report-month { font-weight: 600; font-size: 15px; white-space: nowrap; }
.report-meta { font-size: 12px; color: var(--muted); }
.report-body { padding: 0 12px 14px; border-top: 1px solid var(--line-2); }
.report-body h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th, .kv td { padding: 7px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.kv th { text-align: left; font-weight: 500; padding-right: 12px; }
.kv td { text-align: right; font-weight: 600; white-space: nowrap; }
.kv td small { font-weight: 400; color: var(--muted); }
.how { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.summary dt { font-size: 13px; color: var(--muted); margin-top: 8px; }
.summary dd { font-size: 14px; color: var(--ink-2); white-space: pre-line; }

/* Evidence files */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 4px; }
.file { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 6px; position: relative; }
.file:hover { border-color: var(--accent); }
.file .thumb { width: 100%; height: 64px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-name { font-size: 12px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.file-flag { position: absolute; top: 10px; left: 10px; font-size: 10px; font-weight: 700; background: var(--fix); color: #fff; padding: 1px 6px; border-radius: 99px; }

.stage-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0 2px; }
.stage-cta span { font-size: 13px; color: var(--muted); }
.empty { padding: 12px 0 0; font-size: 14px; color: var(--ink-2); }
.empty ul { margin: 8px 0 14px 18px; color: var(--muted); font-size: 13px; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid; }
.chip svg { width: 12px; height: 12px; }
.chip.approved { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.chip.pending { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-line); }
.chip.rejected { color: var(--fix); background: var(--fix-bg); border-color: var(--fix-line); }
.chip.not_started, .chip.none { color: var(--none); background: var(--none-bg); border-color: var(--none-line); }

/* Footer, notices, states */
.footer { margin-top: 28px; text-align: center; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.banner { margin-top: 12px; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--wait-bg); color: var(--wait); border: 1px solid var(--wait-line); }
.state { text-align: center; padding: 72px 16px; }
.state-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.state h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.state p { color: var(--muted); max-width: 360px; margin: 0 auto 16px; }

/* Loading */
.skeleton { padding-top: 24px; }
.sk { background: linear-gradient(90deg, var(--line-2), var(--line), var(--line-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
.sk-title { height: 28px; width: 55%; } .sk-line { height: 14px; width: 35%; margin-top: 10px; }
.sk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.sk-tile { height: 78px; } .sk-card { height: 84px; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(5, 12, 18, .92); display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 16px; color: #fff; }
.viewer-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-close { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.viewer-body { flex: 1; display: grid; place-items: center; padding: 0 12px 16px; min-height: 0; }
.viewer-body img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 8px; }

@media (max-width: 420px) {
  .hero h1 { font-size: 23px; }
  .journey .medal { width: 32px; height: 32px; font-size: 13px; }
  .journey::before { top: 15px; }
  .j-name { font-size: 11px; }
  .stat { padding: 12px; } .stat-num { font-size: 24px; }
  .stat-label { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
