/* Phone first. Everything here assumes a thumb on a 390px screen and then
   lets the layout breathe on a laptop, rather than the other way round. */
:root {
  --ink: #16181d;
  --ink-soft: #4a5160;
  --ink-faint: #767f91;
  --paper: #ffffff;
  --sunk: #f4f6f9;
  --line: #dfe4ec;
  --brand: #1f5f4f;
  --brand-wash: #e8f2ee;
  --warn: #8a5300;
  --good: #1f6b3a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef1f6; --ink-soft: #b4bccb; --ink-faint: #8891a3;
    --paper: #14161a; --sunk: #1c1f25; --line: #2b3038;
    --brand: #6cc0a5; --brand-wash: #17322b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 16px 48px;
  background: var(--paper); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 46rem; margin: 0 auto; }
.bar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 46rem; margin: 0 auto; padding: 14px 0 10px;
  border-bottom: 1px solid var(--line);
}
.mark { font-weight: 650; letter-spacing: .01em; }
.who { color: var(--ink-faint); font-size: 14px; }
.crumb { max-width: 46rem; margin: 10px auto 0; font-size: 14px; }
.crumb a, a { color: var(--brand); }
h1 { font-size: 24px; line-height: 1.25; text-wrap: balance; margin: 18px 0 8px; }
h2 { font-size: 17px; line-height: 1.3; text-wrap: balance; margin: 0 0 6px; }
.why { color: var(--ink-soft); font-size: 14px; margin: 0 0 10px; }
.fine { color: var(--ink-faint); font-size: 13px; }
.tag { font-size: 11px; color: var(--ink-faint); border: 1px solid var(--line);
       border-radius: 99px; padding: 1px 7px; vertical-align: 2px; font-weight: 500; }
.notice { background: var(--brand-wash); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.error { color: #9b1c1c; background: #fdeaea; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .error { color: #ffb4b4; background: #3a1c1c; }
}

/* A question. One card, generous tap targets, never a dense form row. */
.q { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 14px 0; background: var(--paper); }
input[type=text], input[type=password], textarea, select, .ask-note {
  width: 100%; min-width: 0; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
label { display: block; margin: 0 0 10px; font-size: 14px; color: var(--ink-soft); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick, .mini label {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 99px; padding: 9px 14px;
  font-size: 15px; color: var(--ink); margin: 0;
}
.pick:has(input:checked), .mini label:has(input:checked) {
  border-color: var(--brand); background: var(--brand-wash); font-weight: 600;
}
button, .btn {
  display: inline-block; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 18px; cursor: pointer; text-decoration: none;
}
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 14px 0; }
.out { max-width: 46rem; margin: 28px auto 0; }
.out button { background: transparent; color: var(--ink-faint); border: 1px solid var(--line); font-weight: 500; }
.qr { display: block; margin: 14px 0; border-radius: 8px; }

/* The section list on the landing page. */
.sections { list-style: none; padding: 0; margin: 16px 0; }
.sections li { margin: 0 0 10px; }
.sections a {
  display: block; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; text-decoration: none; color: var(--ink);
}
.sec-title { display: block; font-weight: 600; }
.sec-meta { display: block; font-size: 13px; color: var(--ink-faint); margin: 2px 0 8px; }
.bar-track { display: block; height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); }

/* The review screen. */
.rule { background: var(--brand-wash); border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 12px 0; }
.score { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
.score-n { display: block; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); }
.score-l { display: block; font-size: 13px; color: var(--ink-faint); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; }
.tab { flex: 0 0 auto; font-size: 13px; text-decoration: none; color: var(--ink-soft);
       border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; }
.tab.on { border-color: var(--brand); background: var(--brand-wash); color: var(--ink); font-weight: 600; }
.chip { font-size: 13px; text-decoration: none; color: var(--ink-soft);
        border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; }
.chip.on { border-color: var(--brand); background: var(--brand-wash); font-weight: 600; }
.accept { margin: 12px 0; }
.accept button { background: var(--ink); }
.cluster { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; }
.cluster header { display: block; margin-bottom: 8px; }
.c-name { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.c-meta { display: block; font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px;
        padding: 8px; background: var(--sunk); border-radius: 8px; }
.bulk-btn { background: transparent; color: var(--ink); border: 1px solid var(--line);
            padding: 7px 12px; font-size: 14px; font-weight: 500; }
.mini { display: flex; flex-wrap: wrap; gap: 6px; }
.mini .ask-note { flex: 1 1 100%; }

/* Tables become stacked blocks on a phone: a 5-column grid at 390px is a
   horizontal scrollbar nobody finds. */
.scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.rows .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rows .desc { color: var(--ink-soft); overflow-wrap: anywhere; }
.rows .date { display: block; font-size: 12px; color: var(--ink-faint); }
@media (max-width: 639px) {
  .rows, .rows tbody, .rows tr, .rows td { display: block; width: 100%; }
  .rows tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .rows td { border: 0; padding: 2px 0; }
  .grid:not(.rows) td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint);
  }
}

.drop { display: block; border: 2px dashed var(--line); border-radius: 12px;
        padding: 18px 14px; text-align: center; color: var(--ink-soft); margin: 10px 0; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { border-color: var(--brand); }
.files { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.files li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.up-status { font-size: 13px; color: var(--ink-faint); min-height: 1em; margin: 4px 0; }
.or { color: var(--ink-faint); font-size: 13px; margin: 10px 0 4px; }
.done { margin: 24px 0 0; }

/* The save flag sits still and only announces itself when it changes. */
.saved-flag {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper); color: var(--good);
  font-size: 13px; font-weight: 600; padding: 6px 0; margin: 0;
  opacity: 0; transition: opacity .18s;
}
.saved-flag.show { opacity: 1; }
.saved-flag.fail { color: #9b1c1c; }
@media (prefers-reduced-motion: reduce) { .saved-flag { transition: none; } }

/* The one-tap banner. Quiet, but the button reads as the easy thing it is. */
.quick {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--brand-wash); border-radius: 10px; padding: 12px 14px; margin: 12px 0;
  font-size: 14px;
}
.quick button { padding: 10px 14px; font-size: 14px; }

/* Progress bar widths as classes, not an inline style attribute.
   The content security policy is style-src 'self' with no 'unsafe-inline', so
   a style="width:42%" attribute silently does not apply and the bar renders
   empty. The tempting fix is to add 'unsafe-inline' to style-src; the next
   hand then slips it onto script-src, and the escaping tests become the only
   thing standing between a stored payload and execution. Twenty-one classes
   are cheaper than that conversation. Five-percent steps: this is a bar, not
   a readout. */
.bar-fill.pct-0 { width: 0%; }
.bar-fill.pct-5 { width: 5%; }
.bar-fill.pct-10 { width: 10%; }
.bar-fill.pct-15 { width: 15%; }
.bar-fill.pct-20 { width: 20%; }
.bar-fill.pct-25 { width: 25%; }
.bar-fill.pct-30 { width: 30%; }
.bar-fill.pct-35 { width: 35%; }
.bar-fill.pct-40 { width: 40%; }
.bar-fill.pct-45 { width: 45%; }
.bar-fill.pct-50 { width: 50%; }
.bar-fill.pct-55 { width: 55%; }
.bar-fill.pct-60 { width: 60%; }
.bar-fill.pct-65 { width: 65%; }
.bar-fill.pct-70 { width: 70%; }
.bar-fill.pct-75 { width: 75%; }
.bar-fill.pct-80 { width: 80%; }
.bar-fill.pct-85 { width: 85%; }
.bar-fill.pct-90 { width: 90%; }
.bar-fill.pct-95 { width: 95%; }
.bar-fill.pct-100 { width: 100%; }
