/* ==========================================================================
   Citizens 360: the shared stylesheet (written by part F; nobody else edits it)

   Mobile first. System fonts only, no libraries, no pictures, no web fonts.
   Buttons and fields are at least 44px tall. Inputs are 16px so iPhones do not zoom.
   Need something that is not here? Put it in a stylesheet of your own, loaded in
   {% block head %}, and leave this file alone.

   COLOURS (CSS variables): --green --green-2 --green-soft --ink --muted --line --bg --card
     --warn --warn-soft --bad --bad-soft --info --info-soft --urgent --radius
     and for convenience --ok --ok-soft --field (input borders) --focus --tap (44px)

   PAGE FRAME (templates/base.html and templates/console/base.html)
     .skip  .site-head  .brand  .brand-mark  .brand-name  .site-tools  .who  .lang-form
     .flash  .site-foot  body.console-page  .console  .sidebar (a, a.active, .menu-head,
     .count)  .console-main  .pager  .toasts  .toast (.ok .success .warn .bad .error .info)

   LAYOUT
     .wrap      page width (main_class default).  .narrow  a readable column; may sit on the
                same element as .wrap, or inside it
     .stack     children one under another with a gap (.tight / .loose for smaller / larger)
     .row       side by side, wraps on a phone.  .spread  ends pushed apart (also wraps)
     .grid      auto columns; .grid.two / .three / .four fix the number on wider screens
     .page-head <div class="page-head"><h1>Title</h1><div class="row">buttons</div></div>
     .right .center .nowrap .hidden .sr-only .grow .mt .mb .m0 .break

   BOXES
     .card .panel   white boxes (add .soft .ok .warn .bad .info .urgent); <a class="card"> is a link
     .tile          <a class="tile" href="..."><strong>Health centre</strong><small>Clinics</small></a>
                    also <button class="tile">; add .active for the one chosen
     .stat          <div class="stat"><span class="num">12</span><span class="label">Open</span></div>
                    (a <strong> also works for the number; the number always shows first)
     .kv            <dl class="kv"><dt>Status</dt><dd>Open</dd> ...</dl>
     .timeline      <ul class="timeline"><li><time>12 Nov, 09:30</time> What happened</li></ul>
     .map           <div class="map"><iframe ...></iframe></div>  (or a note / link inside)
     .photos        <div class="photos"><img class="photo-thumb" src="..." alt="..."></div>
                    (or <a class="photo-thumb"><img ...></a>)
     .ai            <div class="ai"><span class="ai-label">AI suggestion: a person decides</span> ...</div>
     .bar-row       <div class="bar-row"><span>Health</span><div class="bar" style="width:40%"></div><b>12</b></div>
                    (the width is a percentage of the bar's own track; .bar also takes .warn .bad .info .muted)
     details.action <details class="action"><summary>Close issue</summary>
                    <form method="post"> reason field, button </form></details>  (.danger for red)

   BUTTONS   .btn  with  .primary .secondary .danger .ghost  and  .small .large .block
   FORMS     .field (label above input)  .help  .error  .inline-form  form.inline  .check
             <div class="field"><label for="x">Name</label><input id="x"><p class="help">..</p>
             <p class="error">..</p></div>   (a Django errorlist is styled too)
             <label class="check"><input type="checkbox"> I agree</label>
   STATUS    .badge with .ok .warn .bad .info .muted .urgent   (<span class="badge {{ s|badge }}">)
             .pill (a small label or filter chip; add .active)  .count (a number in a circle)
   NOTICES   .alert with .ok .warn .bad .info  (and Django's .success .warning .error)
   TABLES    <div class="table-wrap"><table class="table"> ... </table></div>  (td.num / .right)
   TABS      .tabs holds .tab links, the current one .active:
             <nav class="tabs"><a class="tab active" href="...">One</a><a class="tab" ...>Two</a></nav>
   TEXT      .muted .small .mono .lead

   SIGN-IN, LANDING AND PLAIN PAGES (part F)
     .hero .cta .steps .demo .legal .btn.large
   ========================================================================== */

/* ---- 1. Colours and sizes ------------------------------------------------ */
:root {
  --green: #0F5132;
  --green-2: #157347;
  --green-soft: #e7f3ec;
  --ink: #1b1f23;
  --muted: #5d6872;
  --line: #dde3e7;
  --bg: #f5f7f6;
  --card: #fff;
  --warn: #7a4f00;
  --warn-soft: #fff3cd;
  --bad: #9c1f1b;
  --bad-soft: #fce4e3;
  --info: #0a4f96;
  --info-soft: #e3effb;
  --urgent: #b02a37;
  --radius: 12px;

  --ok: #0F5132;
  --ok-soft: #e7f3ec;
  --ok-line: #b7d6c4;
  --warn-line: #ecd48a;
  --bad-line: #efb3b1;
  --info-line: #b6d0ee;
  --neutral-soft: #eceff1;
  --neutral-ink: #4a545c;
  --neutral-line: #d5dbe0;
  --field: #6b7780;
  --focus: #0a4f96;
  --tap: 44px;
  --gl: 1rem;
  --gr: 1rem;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
/* Phones with a notch: keep the text clear of it when turned sideways. */
@supports (padding: max(1px, 2px)) {
  :root {
    --gl: max(1rem, env(safe-area-inset-left, 0px));
    --gr: max(1rem, env(safe-area-inset-right, 0px));
  }
}

/* ---- 2. Basics ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
/* Keep the footer at the bottom of a short page (only pages that have a footer). */
body:has(> .site-foot) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body:has(> .site-foot) > main,
body:has(> .site-foot) > .console { flex: 1 0 auto; }

h1, h2, h3, h4 { margin: 0 0 .5rem; color: var(--ink); font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.625rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: 1rem; }
@media (min-width: 700px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
}
p, ul, ol, dl, pre, blockquote, figure { margin: 0 0 .75rem; }
ul, ol { padding-left: 1.25rem; }
hr { margin: 1.25rem 0; border: 0; border-top: 1px solid var(--line); }
img, video { max-width: 100%; height: auto; }
strong, b { font-weight: 700; }
small { font-size: .875rem; }
blockquote { margin-left: 0; padding-left: 1rem; border-left: 4px solid var(--line); color: var(--muted); }
code, kbd, samp, pre { font-family: var(--mono); }
code, kbd, samp { padding: .1em .35em; border-radius: 4px; background: #eef2f0; font-size: .9em; }
pre { overflow: auto; padding: .75rem 1rem; border-radius: 8px; background: #eef2f0; font-size: .875rem; }

a { color: var(--green-2); text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--green); }

/* A clear outline for anyone using a keyboard or a switch. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.site-head :focus-visible { outline-color: #fff; }

/* ---- 3. Layout ------------------------------------------------------------ */
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 1rem var(--gr) 2rem var(--gl); }
.narrow { width: 100%; max-width: 36rem; margin-left: auto; margin-right: auto; }
/* A page that forgets .stack still gets an even rhythm. */
main.wrap > * + *, .console-main > * + * { margin-top: 1rem; }

.stack { --gap: 1rem; }
.stack.tight { --gap: .5rem; }
.stack.loose { --gap: 1.75rem; }
.stack > * + * { margin-top: var(--gap); }
.stack > h2 + *, .stack > h3 + *, .stack > h4 + * { margin-top: .5rem; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.row.top { align-items: flex-start; }
.row.tight { gap: .35rem .5rem; }
.row > .field { flex: 1 1 12rem; min-width: 0; margin-bottom: 0; }
.row > input, .row > select { width: auto; flex: 1 1 10rem; min-width: 0; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }

.grid { --gap: 1rem; display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@supports (width: min(16rem, 100%)) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); }
}
.grid > * { min-width: 0; }
.grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
.grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) {
  .grid.two, .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 1rem; }
.page-head > :first-child { min-width: 0; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }

.right { margin-left: auto; text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.grow { flex: 1 1 auto; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.m0 { margin: 0; }
.break { overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.small { font-size: .875rem; line-height: 1.45; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.lead { font-size: 1.125rem; line-height: 1.5; color: var(--muted); max-width: 40rem; }

/* ---- 4. The page frame (header, notices, footer) ---------------------------- */
.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 2000;
  padding: .65rem 1rem; border-radius: 8px; background: #fff; color: var(--green);
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: .5rem; }

.site-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem;
  padding: .4rem var(--gr) .4rem var(--gl);
  background: var(--green); color: #fff;
}
@supports (padding: calc(1px + env(safe-area-inset-top, 0px))) {
  .site-head { padding-top: calc(.4rem + env(safe-area-inset-top, 0px)); }
}
.brand { display: inline-flex; align-items: center; gap: .55rem; min-height: var(--tap); color: #fff; font-size: 1.15rem; font-weight: 700; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: #fff; color: var(--green); font-size: .8rem; font-weight: 800; letter-spacing: -.03em;
}
.brand-name { line-height: 1.1; }

.site-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem .6rem; }
.site-tools form { margin: 0; }
.lang-form { display: flex; align-items: center; margin: 0; }
.site-tools select {
  width: auto; min-height: var(--tap); padding: .4rem .6rem;
  border: 1px solid rgba(255, 255, 255, .6); border-radius: 8px;
  background-color: rgba(255, 255, 255, .12); color: #fff; font-size: 1rem;
}
.site-tools select option { background: #fff; color: var(--ink); }
.site-tools .btn.ghost { border-color: rgba(255, 255, 255, .6); color: #fff; }
.site-tools .btn.ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.who {
  max-width: 9rem; overflow: hidden; color: #fff; font-weight: 600;
  text-decoration: none; text-overflow: ellipsis; white-space: nowrap;
}
.who:hover { color: #fff; text-decoration: underline; }
@media (min-width: 600px) { .who { max-width: 16rem; } }

.flash { padding-top: .75rem; padding-bottom: 0; }
.flash .alert { margin: 0 0 .5rem; }

.site-foot {
  margin-top: 2rem; padding: 1.25rem var(--gr) 1.25rem var(--gl);
  border-top: 1px solid var(--line); background: #fff;
  color: var(--muted); font-size: .875rem; text-align: center;
}
@supports (padding: calc(1px + env(safe-area-inset-bottom, 0px))) {
  .site-foot { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
}
.site-foot p { margin: .25rem 0; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--green); }

/* ---- 5. The console (a menu strip on a phone, a column on a laptop) --------- */
body.console-page { background: var(--bg); }
.console { display: block; width: 100%; }
.sidebar {
  display: flex; align-items: center; gap: .25rem; overflow-x: auto;
  padding: .4rem var(--gr) .4rem var(--gl);
  background: #fff; border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.sidebar a {
  flex: none; display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 .9rem; border-radius: 999px;
  color: var(--ink); font-size: .9375rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.sidebar a:hover { background: var(--green-soft); color: var(--green); }
.sidebar a.active { background: var(--green); color: #fff; }
.sidebar .menu-head {
  flex: none; margin-left: .5rem; padding: 0 .25rem 0 .75rem; border-left: 2px solid var(--line);
  color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.sidebar .menu-head:first-child { margin-left: 0; padding-left: .25rem; border-left: 0; }
.count {
  display: inline-block; min-width: 1.4rem; margin-left: .4rem; padding: 0 .4rem; border-radius: 999px;
  background: var(--urgent); color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.4rem; text-align: center;
}
.sidebar a.active .count { background: #fff; color: var(--green); }
.console-main { min-width: 0; padding: 1rem var(--gr) 2rem var(--gl); }

@media (min-width: 900px) {
  .console { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); }
  /* The white column runs the full height; the menu inside it stays in view as you scroll. */
  .console::before { content: ""; grid-column: 1; grid-row: 1; background: #fff; border-right: 1px solid var(--line); }
  .sidebar {
    grid-column: 1; grid-row: 1; position: sticky; top: 0; align-self: start;
    max-height: 100vh; max-height: 100dvh; flex-direction: column; align-items: stretch; gap: .1rem;
    overflow-x: hidden; overflow-y: auto; padding: 1rem .75rem 2rem;
    background: transparent; border-bottom: 0;
  }
  .sidebar a {
    display: flex; align-items: center; justify-content: space-between; min-height: 40px;
    padding: .3rem .75rem; border-radius: 8px; white-space: normal;
  }
  .sidebar .menu-head { margin: 1.1rem 0 .2rem; padding: 0 .75rem; border-left: 0; white-space: normal; }
  .sidebar .menu-head:first-child { margin-top: 0; padding-left: .75rem; }
  .console-main { grid-column: 2; grid-row: 1; max-width: 84rem; padding: 1.5rem 2rem 3rem; }
}

/* ---- 6. Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .5rem 1.1rem;
  border: 1px solid var(--field); border-radius: 10px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f0f4f2; border-color: var(--green-2); color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #0b3f27; border-color: #0b3f27; color: #fff; }
.btn.secondary { background: var(--green-soft); border-color: var(--ok-line); color: var(--green); }
.btn.secondary:hover { background: #d4eadc; border-color: var(--green-2); color: var(--green); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #7d1815; border-color: #7d1815; color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--green); }
.btn.ghost:hover { background: var(--green-soft); border-color: var(--ok-line); color: var(--green); }
/* Small means smaller type and padding: it is still 44px tall, so it can be tapped. */
.btn.small { padding: .3rem .8rem; font-size: .9rem; }
.btn.large { min-height: 56px; padding: .75rem 1.5rem; font-size: 1.125rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
a.btn.disabled, a.btn[aria-disabled="true"] { pointer-events: none; }

/* ---- 7. Forms ------------------------------------------------------------------ */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  display: block; width: 100%; min-height: var(--tap); padding: .55rem .75rem;
  border: 1px solid var(--field); border-radius: 10px; background: #fff; color: var(--ink);
  font-size: 1rem; line-height: 1.4;
}
@supports (font-size: max(16px, 1rem)) {
  input, select, textarea { font-size: max(16px, 1rem); }
}
textarea { min-height: 4.5rem; resize: vertical; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="checkbox"], input[type="radio"] {
  display: inline-block; flex: none; width: 1.35rem; height: 1.35rem; min-height: 0; padding: 0;
  accent-color: var(--green); vertical-align: middle;
}
input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--green); }
input[type="file"] { padding: .5rem; background: #fff; }
input[type="file"]::file-selector-button {
  margin-right: .75rem; padding: .45rem .9rem; border: 1px solid var(--ok-line); border-radius: 8px;
  background: var(--green-soft); color: var(--green); font: inherit; font-weight: 600; cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button {
  margin-right: .75rem; padding: .45rem .9rem; border: 1px solid var(--ok-line); border-radius: 8px;
  background: var(--green-soft); color: var(--green); font: inherit; font-weight: 600; cursor: pointer;
}
input[type="submit"], input[type="button"], input[type="reset"] { width: auto; cursor: pointer; }
input[type="hidden"] { display: none; }
::placeholder { color: #6b7780; opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
input:disabled, select:disabled, textarea:disabled { background: #eef1f0; color: var(--muted); cursor: not-allowed; }
input[readonly], textarea[readonly] { background: #f3f6f5; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"],
.field.error input, .field.error select, .field.error textarea,
.field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad);
}

.field { min-width: 0; margin: 0 0 1rem; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; margin: 0 0 .35rem; font-weight: 600; }
.field.error > label, .field.has-error > label { color: var(--bad); }
.help { display: block; margin: .3rem 0 0; color: var(--muted); font-size: .875rem; line-height: 1.4; }
/* Error text under a field (the .error on a box, alert or toast is set further down). */
p.error, span.error, small.error, strong.error, label.error, li.error, .errorlist,
div.error:not(.field):not(.alert):not(.toast):not(.card):not(.panel) {
  display: block; margin: .3rem 0 0; color: var(--bad); font-size: .875rem; font-weight: 600; line-height: 1.4;
}
.errorlist { margin-top: 0; margin-bottom: .5rem; padding: 0; list-style: none; }
.field.error > .help { color: var(--muted); }

.check, .field > label.check {
  display: flex; align-items: flex-start; gap: .6rem; min-height: var(--tap); margin: 0; padding: .4rem 0;
  font-weight: 400; line-height: 1.4; cursor: pointer;
}
.check input { margin-top: .1rem; }
.field input[type="checkbox"], .field input[type="radio"] { margin: 0 .5rem 0 0; }

/* Newer browsers only: a label that wraps a checkbox looks like .check without the class. */
.field > label:has(> input[type="checkbox"]), .field > label:has(> input[type="radio"]) {
  display: flex; align-items: flex-start; gap: .6rem; min-height: var(--tap); padding: .4rem 0; font-weight: 400; cursor: pointer;
}
.field > label:has(> input[type="checkbox"]) > input, .field > label:has(> input[type="radio"]) > input { margin: .1rem 0 0; }

fieldset { min-width: 0; margin: 0 0 1rem; padding: .75rem 1rem 1rem; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 .4rem; font-weight: 700; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin: 0; }
.inline-form > .field { flex: 1 1 12rem; margin: 0; }
.inline-form > input, .inline-form > select { width: auto; flex: 1 1 10rem; min-width: 0; }
.inline-form > textarea { flex: 1 1 14rem; }
.inline-form > .btn { flex: none; }
form.inline { display: inline-block; margin: 0; }
form.inline .btn { vertical-align: middle; }

/* ---- 8. Boxes --------------------------------------------------------------------- */
.card, .panel {
  min-width: 0; padding: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.card { box-shadow: var(--shadow); }
.card > :first-child, .panel > :first-child { margin-top: 0; }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
@media (min-width: 700px) { .card, .panel { padding: 1.25rem; } }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--green-2); color: inherit; }
.card.soft, .panel.soft { background: var(--green-soft); border-color: var(--ok-line); }
.card.ok, .panel.ok { background: var(--ok-soft); border-color: var(--ok-line); border-left: 5px solid var(--green-2); }
.card.warn, .panel.warn { background: var(--warn-soft); border-color: var(--warn-line); border-left: 5px solid #e0a800; }
.card.bad, .panel.bad { background: var(--bad-soft); border-color: var(--bad-line); border-left: 5px solid var(--bad); }
.card.info, .panel.info { background: var(--info-soft); border-color: var(--info-line); border-left: 5px solid var(--info); }
.card.urgent, .panel.urgent { border-color: var(--bad-line); border-left: 5px solid var(--urgent); }

/* A big tappable choice. */
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .2rem;
  min-height: 5rem; padding: 1rem 1.1rem;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); color: var(--ink);
  font: inherit; font-size: 1.0625rem; font-weight: 700; line-height: 1.3; text-align: left; text-decoration: none;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: background-color .15s, border-color .15s;
}
button.tile { width: 100%; }
.row > .tile { flex: 1 1 12rem; width: auto; }
.tile small, .tile .sub, .tile .muted { color: var(--muted); font-size: .875rem; font-weight: 400; }
.tile .icon { font-size: 1.75rem; line-height: 1; }
.tile:hover { background: var(--green-soft); border-color: var(--green-2); color: var(--ink); }
.tile.active, .tile.selected, .tile[aria-pressed="true"], .tile[aria-checked="true"], .tile[aria-current="true"], .tile[aria-current="page"] {
  background: var(--green-soft); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green);
}

/* A number with a label under it. */
.stat {
  display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-width: 0; padding: .85rem 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--muted); font-size: .875rem; line-height: 1.3;
}
a.stat { text-decoration: none; }
a.stat:hover { border-color: var(--green-2); color: var(--muted); }
.stat .num, .stat .number, .stat .n, .stat .value, .stat .big,
.stat .stat-num, .stat .stat-number, .stat .stat-value, .stat > strong, .stat > b {
  order: -1; color: var(--green); font-size: 1.875rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat.warn .num, .stat.warn .number, .stat.warn .n, .stat.warn .value, .stat.warn > strong, .stat.warn > b { color: var(--warn); }
.stat.bad .num, .stat.bad .number, .stat.bad .n, .stat.bad .value, .stat.bad > strong, .stat.bad > b,
.stat.urgent .num, .stat.urgent .number, .stat.urgent .n, .stat.urgent .value, .stat.urgent > strong, .stat.urgent > b { color: var(--urgent); }
.stat.info .num, .stat.info .number, .stat.info .n, .stat.info .value, .stat.info > strong, .stat.info > b { color: var(--info); }

.stat.warn { border-left: 4px solid #e0a800; }
.stat.bad, .stat.urgent { border-left: 4px solid var(--urgent); }
.stat.info { border-left: 4px solid var(--info); }

/* Labels and their values. */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; }
.kv > div { display: contents; }
.kv dt {
  margin: 0; padding: .65rem 0 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .875rem; font-weight: 600;
}
.kv dd { margin: 0; padding: .1rem 0 .65rem; min-width: 0; }
.kv > dt:first-child, .kv > div:first-child > dt { padding-top: 0; border-top: 0; }
@media (min-width: 640px) {
  .kv { grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr); }
  .kv dt { padding: .65rem 1rem .65rem 0; font-size: .9375rem; }
  .kv dd { padding: .65rem 0; border-top: 1px solid var(--line); }
  .kv > dt:first-child, .kv > div:first-child > dt { padding-top: 0; }
  .kv > dt:first-child + dd, .kv > div:first-child > dd { padding-top: 0; border-top: 0; }
  /* .kv.stacked: in a narrow column (three side by side), keep each label above its value. */
  .kv.stacked { grid-template-columns: minmax(0, 1fr); }
  .kv.stacked dt { padding: .65rem 0 0; font-size: .875rem; }
  .kv.stacked dd { padding: .1rem 0 .65rem; border-top: 0; }
  .kv.stacked > dt:first-child { padding-top: 0; }
}

/* Dated entries, oldest or newest first as the page decides. */
.timeline { margin: 0 0 0 .5rem; padding: 0; list-style: none; border-left: 2px solid var(--line); }
.timeline > li { position: relative; margin: 0; padding: 0 0 1.1rem 1.25rem; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -7px; top: .45em; width: 12px; height: 12px;
  border-radius: 50%; background: var(--green-2); box-shadow: 0 0 0 3px #fff;
}
.timeline > li.ok::before { background: var(--green-2); }
.timeline > li.warn::before { background: #e0a800; }
.timeline > li.bad::before { background: var(--bad); }
.timeline > li.info::before { background: var(--info); }
.timeline > li.muted::before { background: var(--neutral-line); }
.timeline time, .timeline .when { display: block; color: var(--muted); font-size: .8125rem; }

.map {
  display: flex; align-items: center; justify-content: center; min-height: 14rem; overflow: hidden;
  background: var(--green-soft); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); text-align: center;
}
.map iframe, .map img { display: block; width: 100%; height: 100%; min-height: 14rem; border: 0; }
.map > p, .map > .note { margin: 0; padding: 1rem; }

/* AI output is always set apart and labelled: a machine suggests, a person decides. */
.ai {
  padding: .85rem 1rem; background: var(--info-soft);
  border: 1px dashed #7fa7d6; border-radius: var(--radius); color: var(--ink);
}
.ai-label {
  display: inline-block; margin: 0 0 .5rem; padding: .1rem .65rem;
  border: 1px solid var(--info-line); border-radius: 999px; background: #fff;
  color: var(--info); font-size: .8125rem; font-weight: 700; line-height: 1.5;
}
.ai > :last-child { margin-bottom: 0; }

.photos { display: flex; flex-wrap: wrap; gap: .5rem; }
.photo-thumb {
  display: block; width: 6rem; height: 6rem; overflow: hidden; object-fit: cover;
  background: #e9eeeb; border: 1px solid var(--line); border-radius: 8px;
}
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
a.photo-thumb:hover { border-color: var(--green-2); }
@media (min-width: 900px) { .photo-thumb { width: 7.5rem; height: 7.5rem; } }

/* A bar chart made of rows: a label, a track with a coloured bar, and a figure. */
.bar-row {
  display: grid; grid-template-columns: minmax(5.5rem, 10rem) minmax(0, 1fr) auto;
  align-items: center; gap: .25rem .75rem; padding: .3rem 0; font-size: .9375rem;
}
.bar-row::before { content: ""; grid-column: 2; grid-row: 1; height: .9rem; border-radius: 999px; background: #e6ece9; }
.bar-row > :first-child { grid-column: 1; grid-row: 1; min-width: 0; }
.bar-row > .bar-track, .bar-row > .track { grid-column: 2; grid-row: 1; height: .9rem; border-radius: 999px; background: #e6ece9; overflow: hidden; }
.bar-row > .bar-value, .bar-row > .value, .bar-row > .num { grid-column: 3; grid-row: 1; min-width: 2rem; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.bar {
  display: block; grid-column: 2; grid-row: 1; justify-self: start; min-width: 4px; max-width: 100%; height: .9rem;
  border-radius: 999px; background: var(--green-2);
}
.bar-track > .bar, .track > .bar { height: 100%; }
.bar.warn { background: #d99a00; }
.bar.bad { background: var(--bad); }
.bar.info { background: var(--info); }
.bar.muted { background: #8d99a1; }

/* An action that needs a reason: it opens in place, no script needed. */
details.action { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
details.action > summary {
  display: flex; align-items: center; gap: .6rem; min-height: var(--tap); padding: .4rem 1rem;
  border-radius: 10px; color: var(--green); font-weight: 600; list-style: none; cursor: pointer;
}
details.action > summary::-webkit-details-marker { display: none; }
details.action > summary::marker { content: ""; }
details.action > summary::before {
  content: ""; flex: none; width: .5rem; height: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
details.action[open] > summary::before { transform: rotate(45deg); }
details.action[open] { flex: 1 1 100%; }
details.action[open] > summary { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
details.action > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details.action > summary + * { margin-top: 1rem; }
details.action > :last-child:not(summary) { margin-bottom: 1rem; }
details.action.danger > summary { color: var(--bad); }

/* ---- 9. Status, notices, tables, tabs ---------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .6rem; vertical-align: middle;
  border: 1px solid var(--neutral-line); border-radius: 999px; background: var(--neutral-soft); color: var(--neutral-ink);
  font-size: .8125rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.badge.info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.badge.muted { background: var(--neutral-soft); border-color: var(--neutral-line); color: var(--neutral-ink); }
.badge.urgent { background: var(--urgent); border-color: var(--urgent); color: #fff; }

.pill {
  display: inline-flex; align-items: center; padding: .1rem .7rem; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink);
  font-size: .8125rem; line-height: 1.6; text-decoration: none;
}
a.pill, button.pill { min-height: var(--tap); font: inherit; font-size: .875rem; cursor: pointer; }
a.pill:hover, button.pill:hover { border-color: var(--green-2); color: var(--green); }
.pill.active, a.pill.active:hover, button.pill.active:hover { background: var(--green); border-color: var(--green); color: #fff; }

.alert {
  margin: 0 0 1rem; padding: .75rem 1rem;
  background: var(--info-soft); border: 1px solid var(--info-line); border-left: 5px solid var(--info);
  border-radius: 10px; color: var(--info);
}
.alert > :last-child { margin-bottom: 0; }
.alert a { color: inherit; font-weight: 700; }
.alert.ok, .alert.success { background: var(--ok-soft); border-color: var(--ok-line); border-left-color: var(--green-2); color: var(--ok); }
.alert.warn, .alert.warning { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: #e0a800; color: var(--warn); }
.alert.bad, .alert.error { background: var(--bad-soft); border-color: var(--bad-line); border-left-color: var(--bad); color: var(--bad); }
.alert.info, .alert.debug { background: var(--info-soft); border-color: var(--info-line); border-left-color: var(--info); color: var(--info); }

.table-wrap {
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9375rem; }
.table th, .table td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f1f5f3; color: var(--muted); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f9fbfa; }
.table th.num, .table td.num, .table th.right, .table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table caption { padding: .65rem .75rem; color: var(--muted); font-size: .875rem; text-align: left; }

.tabs {
  display: flex; gap: .25rem; margin: 0 0 1rem; overflow-x: auto;
  border-bottom: 2px solid var(--line); -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tab {
  flex: none; display: inline-flex; align-items: center; min-height: var(--tap); margin-bottom: -2px; padding: 0 1rem;
  border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted);
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.tab:hover { background: rgba(15, 81, 50, .06); color: var(--ink); }
.tab.active, .tab[aria-selected="true"], .tab[aria-current="page"] { border-bottom-color: var(--green); color: var(--green); }
.tab .count { background: #e6ece9; color: var(--ink); }
.tab.active .count, .tab[aria-selected="true"] .count { background: var(--green); color: #fff; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem; margin-top: 1rem; }
.pager > span { text-align: center; }

.toasts {
  position: fixed; left: 0; right: 0; bottom: 1rem; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 0 1rem; pointer-events: none;
}
@supports (bottom: max(1rem, env(safe-area-inset-bottom, 0px))) {
  .toasts { bottom: max(1rem, env(safe-area-inset-bottom, 0px)); }
}
.toast {
  max-width: 28rem; padding: .75rem 1rem; border-radius: 10px;
  background: var(--ink); color: #fff; box-shadow: 0 4px 16px rgba(16, 24, 32, .25);
  pointer-events: auto; animation: toast-in .2s ease-out;
}
.toast.ok, .toast.success { background: var(--green); }
.toast.warn, .toast.warning { background: var(--warn); }
.toast.bad, .toast.error { background: var(--bad); }
.toast.info { background: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }

/* ---- 10. Sign-in, landing and plain pages ------------------------------------------- */
.hero { padding: .5rem 0 0; }
.hero h1 { max-width: 30rem; font-size: 1.875rem; line-height: 1.2; }
@media (min-width: 700px) { .hero h1 { font-size: 2.5rem; } }
.cta { display: flex; flex-direction: column; gap: .75rem; }
.cta .btn { width: 100%; }
@media (min-width: 640px) {
  .cta { flex-direction: row; flex-wrap: wrap; }
  .cta .btn { width: auto; }
}
.steps { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative; min-height: 4.5rem; padding: 1rem 1rem 1rem 4rem; counter-increment: step;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.steps > li::before {
  content: counter(step); position: absolute; left: 1rem; top: 1rem;
  display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
  border-radius: 50%; background: var(--green); color: #fff; font-weight: 700;
}
.steps h3 { margin: 0 0 .25rem; }
.steps p { margin: 0; color: var(--muted); }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.demo { border: 2px dashed #e0a800; background: var(--warn-soft); }
/* The strip at the top of every page of a demonstration copy put online. */
.demo-strip { background: var(--warn-soft); border-bottom: 2px dashed #e0a800; color: var(--warn); font-size: .9rem; line-height: 1.35; padding: .45rem 1rem; text-align: center; }
.legal h2 { margin-top: 1.5rem; }
.legal h2:first-child { margin-top: 0; }
.legal li { margin-bottom: .35rem; }

/* ---- 11. Reduced motion, high contrast, print ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .badge, .pill, .card, .panel, .stat, .tile, .alert, .ai, .toast, details.action { border: 1px solid CanvasText; }
  .bar, .bar-row::before { background: Highlight; forced-color-adjust: none; }
  .bar-row::before { background: GrayText; }
}

@page { margin: 15mm; }
@media print {
  body, body:has(> .site-foot) { display: block; min-height: 0; background: #fff; color: #000; font-size: 11pt; }
  .skip, .site-head, .sidebar, .site-foot, .toasts, .pager, .tabs, .lang-form, form.inline,
  .btn, button, details.action, noscript { display: none !important; }
  .console { display: block; }
  .console::before { display: none; }
  .wrap, .console-main { max-width: none; padding: 0; }
  .card, .panel, .stat, .ai, .alert, .table-wrap { background: #fff; border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  .badge, .pill { background: #fff !important; border: 1px solid #666; color: #000 !important; }
  .table-wrap { overflow: visible; }
  .table th { background: #eee; color: #000; }
  .table thead { display: table-header-group; }
  .table tr { break-inside: avoid; }
  .photo-thumb { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  h1, h2, h3 { break-after: avoid; }
}
