/* Cautio intake admin. Uses the cautio.com.au design system: Poppins, navy and blue, orange accent, cream surfaces. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 300; font-display: swap; src: url("/assets/fonts/poppins-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/poppins-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #fff7e7;
  --surface: #ffffff;
  --ink: #0a1628;
  --muted: #64748b;
  --line: #e6dfd2;
  --accent: #066ca8;
  --accent-ink: #ffffff;
  --accent-soft: #eaf3f9;
  --ok: #0f5132;
  --ok-soft: #e7f7ee;
  --warn: #a8470f;
  --warn-soft: #fdeee4;
  --bad: #8a1c13;
  --bad-soft: #fdecea;
  --font-display: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 0.02em; color: #0d1b2b; }
.brand-sub { color: var(--muted); font-size: 15px; }
.top-spacer { flex: 1; }
.stamp { font-family: var(--font-mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

/* Shell */
.shell { max-width: 1120px; margin: 0 auto; padding: 24px 20px 120px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.shell.single { grid-template-columns: minmax(0, 1fr); padding-bottom: 48px; }

/* Rail */
.rail { position: sticky; top: 76px; display: grid; gap: 4px; }
.rail-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 6px 10px; font-weight: 600; }
.rail a { display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.rail a:hover { background: var(--accent-soft); }
.rail .num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); grid-row: span 2; }
.rail .title { font-weight: 600; font-size: 15px; }
.pill { justify-self: start; display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.pill.none { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.pill.part { background: var(--warn-soft); color: var(--warn); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.miss { background: var(--bad-soft); color: var(--bad); }

/* Main */
main { min-width: 0; }
.intro { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 28px; display: grid; gap: 12px; }
.intro h1 { font-size: 28px; }
.intro p { margin: 0; max-width: 65ch; color: var(--muted); }
.intro ul { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 2px; }
section.block { margin-bottom: 36px; scroll-margin-top: 84px; }
.block-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 18px; }
.block-head .num { font-family: var(--font-mono); color: var(--accent); font-size: 14px; }
.block-head h2 { font-size: 21px; }
.block-intro { color: var(--muted); margin: -6px 0 16px; max-width: 65ch; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; align-items: start; }
.field { display: grid; gap: 6px; grid-column: span 2; min-width: 0; align-content: start; }
.field.half { grid-column: span 1; }
.field[hidden] { display: none; }
.field > label, .field legend { font-weight: 600; font-size: 15px; padding: 0; }
.req { color: var(--accent); margin-left: 3px; }
.help { color: var(--muted); font-size: 14px; margin: -2px 0 2px; max-width: 65ch; }
fieldset.field { border: 0; margin: 0; padding: 0; }
input[type="text"], input[type="email"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid #94a3b8; border-radius: 10px; padding: 9px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .choices label { border-color: var(--bad); }
.err { color: var(--bad); font-size: 14px; display: none; margin: 0; }
.field.invalid .err { display: block; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choices label { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 15px; user-select: none; }
.choices label:hover { border-color: var(--accent); }
.choices input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choices input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Panels and buttons */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 16px; }
.panel h3 { font-size: 17px; }
.missing { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ok-note { color: var(--ok); font-weight: 600; margin: 0; }
.notice { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin: 0; max-width: 70ch; }
.notice.plain { border-top: 0; padding-top: 0; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { display: inline-block; border: 2px solid #0d1b2b; background: var(--surface); border-radius: 999px; padding: 9px 22px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); line-height: 1.4; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { border-color: var(--bad); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.status { font-size: 15px; margin: 0; }
.status.good { color: var(--ok); }
.status.bad { color: var(--bad); }
.confirm { display: none; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--bad-soft); border-radius: 6px; padding: 10px 12px; }
.confirm.show { display: flex; }
.done-panel { border-left: 4px solid var(--ok); }
.ref { font-family: var(--font-mono); font-size: 18px; background: var(--ok-soft); color: var(--ok); padding: 4px 10px; border-radius: 6px; justify-self: start; }
.is-hidden { display: none !important; }

/* Bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); }
.bar-inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.meter { flex: 1; min-width: 180px; display: grid; gap: 4px; }
.meter-text { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }
.saved { font-size: 13px; color: var(--muted); }

/* Admin */
.admin-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h1 { font-size: 26px; flex: 1; }
.login { max-width: 420px; margin: 48px auto; }
.login form { display: grid; gap: 12px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .org { font-weight: 600; }
.rid { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; padding: 5px 8px; }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.detail { display: grid; gap: 24px; }
.detail dl { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 8px 20px; margin: 0; }
.detail dt { color: var(--muted); font-size: 15px; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; }
.flash { padding: 10px 14px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); margin-bottom: 16px; }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
code.hash { display: block; font-family: var(--font-mono); font-size: 13px; background: var(--accent-soft); padding: 10px; border-radius: 6px; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .rail { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .rail-label { display: none; }
  .rail a { grid-template-columns: auto; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
  .rail .num { display: none; }
  .fields { grid-template-columns: 1fr; }
  .field.half { grid-column: span 2; }
  .detail dl { grid-template-columns: 1fr; }
  .detail dd { margin-bottom: 8px; }
}
@media (max-width: 420px) {
  .brand-sub, .stamp { display: none; }
  .intro, .panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .meter-fill { transition: none; }
}
.mt { margin-top: 16px; }
.detail { margin-top: 28px; }
