/* NDIS Practice Platform — one stylesheet, token-driven, light/dark aware. */
:root {
  --ink: #17252b; --muted: #5e6e72; --line: #dce3e1; --paper: #f4f7f6; --surface: #ffffff;
  --primary: #2e6b5a; --primary-ink: #ffffff; --primary-soft: #e3efea;
  --flag: #d9a21b; --flag-soft: #fbf2d9; --bad: #b23a2f; --bad-soft: #f8e4e1; --ok: #2e6b5a; --ok-soft: #e3efea;
  --info-soft: #e5ecf3; --radius-s: 4px; --radius-m: 8px;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4ecea; --muted: #9fb0ad; --line: #2c3b3e; --paper: #111a1c; --surface: #172326;
    --primary: #6fb7a0; --primary-ink: #0d1a17; --primary-soft: #1d3530;
    --flag: #e9b949; --flag-soft: #3a3118; --bad: #ef8a7f; --bad-soft: #3d2220; --ok: #6fb7a0; --ok-soft: #1d3530;
    --info-soft: #1e2b36; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; margin-top: 1.25rem; }
p { margin: 0 0 1rem; max-width: 72ch; }
small, .muted { color: var(--muted); }
code { font-size: .9em; }

/* Shell: sidebar grouped by journey */
.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; font-size: 1.05rem; display: block; color: var(--ink); text-decoration: none; margin-bottom: 1.5rem; }
.brand span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.side nav p { font-size: .8rem; color: var(--muted); margin: 1.25rem 0 .25rem .5rem; }
.side nav a { display: flex; justify-content: space-between; padding: .4rem .5rem; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; }
.side nav a:hover { background: var(--paper); }
.side nav a[aria-current] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.side nav a .count { background: var(--flag); color: #1e1a0c; border-radius: 99px; padding: 0 .5rem; font-size: .8rem; font-weight: 700; }
.side form { margin-top: 2rem; }
.whoami { font-size: .85rem; color: var(--muted); margin-top: 2rem; }
main { padding: 1.75rem 2rem 4rem; max-width: 80rem; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Flash */
.flash { padding: .75rem 1rem; border-radius: var(--radius-s); margin-bottom: 1rem; border-left: 4px solid var(--ok); background: var(--ok-soft); }
.flash-error { border-color: var(--bad); background: var(--bad-soft); }
.flash-warn { border-color: var(--flag); background: var(--flag-soft); }

/* Panels: plain sections separated by space, not boxed cards everywhere */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

/* Attention: the one loud device. Wattle strip = someone needs to act. */
.attention { border-left: 4px solid var(--flag); background: var(--flag-soft); }
tr.attention td:first-child { box-shadow: inset 4px 0 0 var(--flag); }
tr.breach td:first-child { box-shadow: inset 4px 0 0 var(--bad); }

/* Figures */
.figures { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-bottom: 1rem; }
.figure b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.figure span { color: var(--muted); font-size: .9rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 700; font-size: .85rem; color: var(--muted); padding: .5rem .75rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: color-mix(in srgb, var(--paper) 60%, transparent); }
.empty { color: var(--muted); padding: 1rem 0; }

/* Pills */
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .82rem; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--flag-soft); color: color-mix(in srgb, var(--flag) 55%, var(--ink)); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-muted { border-color: var(--line); color: var(--muted); }
.pill-info { background: var(--info-soft); }

/* Forms */
label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .25rem; }
label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 400; margin-right: 1rem; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
textarea { min-height: 8rem; }
textarea.long { min-height: 24rem; line-height: 1.6; }
.field { margin-bottom: 1rem; }
.fields { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.field-error { color: var(--bad); font-size: .88rem; margin: .25rem 0 0; }
.hint { color: var(--muted); font-size: .88rem; margin: .25rem 0 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 700; padding: .5rem 1rem; border-radius: var(--radius-s);
  border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--primary); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-small { padding: .2rem .6rem; font-size: .88rem; }
form.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 11rem; }

/* Checklist (referral verification) */
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; columns: 2 16rem; }
.checklist li { break-inside: avoid; padding: .3rem 0; }

/* Availability slots */
.slots { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 1rem; }
.slot { font: inherit; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); cursor: pointer; }
.slot[aria-pressed=true] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.avail-list h4 { margin: .75rem 0 0; }

/* Week view */
.week { display: grid; grid-template-columns: repeat(7, minmax(9rem, 1fr)); gap: .5rem; overflow-x: auto; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); min-height: 12rem; padding: .5rem; }
.day h3 { font-size: .9rem; margin: 0 0 .5rem; color: var(--muted); }
.day.today h3 { color: var(--primary); }
.appt { display: block; text-decoration: none; color: var(--ink); border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius-s); padding: .35rem .5rem; margin-bottom: .4rem; font-size: .88rem; }
.appt.unbillable { border-color: var(--muted); background: var(--paper); }
.appt.cancelled { opacity: .55; text-decoration: line-through; }
.appt.note-due { border-color: var(--flag); }

/* Score bar */
.score { display: inline-flex; align-items: center; gap: .5rem; }

dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.prose { white-space: pre-wrap; max-width: 75ch; }
details summary { cursor: pointer; font-weight: 700; margin-bottom: .5rem; }

/* Login */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login { width: min(26rem, 100%); }
.login h1 { font-size: 1.5rem; }

@media (max-width: 52rem) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  .side nav p { display: none; }
  main { padding: 1.25rem 1rem 3rem; }
  .week { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .actions, form { display: none !important; } .shell { display: block; } }
/* No inline styles anywhere (CSP forbids them), so small utilities live here. */
label.plain { font-weight: 400; display: inline; }
.spaced { margin-top: 1rem; }
meter { width: 5rem; height: .6rem; }
meter::-webkit-meter-bar { background: var(--line); border: 0; border-radius: 99px; }
meter::-webkit-meter-optimum-value { background: var(--primary); border-radius: 99px; }
meter::-moz-meter-bar { background: var(--primary); }
.panel > :last-child { margin-bottom: 0; }
.attention .pill-warn, tr.attention .pill-warn { border-color: var(--flag); }
.auth-links { margin-top: 1.25rem; font-size: .95rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pending { padding: 1rem 0; border-top: 1px solid var(--line); }
.pending h3 { margin-top: 0; }
