/* Stable Hand. Read outdoors, in rain and low sun, with gloves on: big targets, strong contrast,
   one-handed reach. Dim theme follows the phone for the 6am round. */
:root {
  --bg: #F3F0E8;
  --surface: #FFFFFF;
  --surface-2: #F9F7F2;
  --ink: #16201A;
  --muted: #5E6A63;
  --line: #E2DCCE;
  --line-strong: #CFC6B2;
  --brand: #1D4A34;
  --brand-2: #2A6848;
  --brand-ink: #FFFFFF;
  --brass: #C7A15A;
  --ok: #24803F;
  --ok-bg: #E4F3E7;
  --ok-line: #B6DDBF;
  --warn: #935F00;
  --warn-strong: #D18A00;
  --warn-bg: #FFF3D4;
  --warn-line: #F0D08A;
  --bad: #B3261E;
  --bad-bg: #FDE6E3;
  --bad-line: #F2B6AF;
  --focus: #7CC79A;
  --shadow: 0 1px 2px rgba(22, 32, 26, .06), 0 4px 14px rgba(22, 32, 26, .06);
  --shadow-lg: 0 10px 30px rgba(22, 32, 26, .14);
  --radius: 16px;
  --tap: 54px;
  --bar-h: 58px;
  --tabs-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1411;
    --surface: #17201B;
    --surface-2: #1C2721;
    --ink: #E8EEE9;
    --muted: #9BA9A1;
    --line: #2A3730;
    --line-strong: #3A4A41;
    --brand: #173B29;
    --brand-2: #3E9166;
    --brass: #D8B46E;
    --ok: #63C982;
    --ok-bg: #16301F;
    --ok-line: #2A5A39;
    --warn: #F3BC57;
    --warn-strong: #E0A22F;
    --warn-bg: #33270C;
    --warn-line: #5C4613;
    --bad: #FF8A7E;
    --bad-bg: #3A1714;
    --bad-line: #6B2A24;
    --focus: #3E9166;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
main { max-width: 700px; margin: 0 auto; padding: 18px 16px 28px; }
main.wide { max-width: 1120px; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: 0 0 .2em; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 1.1rem; margin: 0 0 .7em; letter-spacing: -.01em; font-weight: 750; display: flex; align-items: center; gap: 8px; }
a { color: var(--brand-2); }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }
.i { width: 1.15em; height: 1.15em; stroke-width: 2; flex: none; vertical-align: -.2em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Top bar and tabs ---------------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  min-height: var(--bar-h); padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 750; min-width: 0; }
.brand img { border-radius: 9px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 2px; margin-left: 14px; }
.nav a { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sync {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  font-size: .82rem; font-weight: 700; background: rgba(255,255,255,.12); color: #fff; white-space: nowrap;
}
.sync.waiting { background: var(--warn-strong); color: #1d1300; }
.sync.offline { background: #5b6660; }
.sync.error { background: var(--bad); color: #fff; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; }
.iconbtn:hover { background: rgba(255,255,255,.18); }
.iconbtn.bell { position: relative; }
.dotcount { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--brand); }
ul.plain li.unread b { color: var(--ink); }
ul.plain li.unread { background: color-mix(in srgb, var(--ok-bg) 40%, transparent); }
.me { font-size: .9rem; color: rgba(255,255,255,.8); font-weight: 600; }

.tabs { display: none; }
@media (max-width: 460px) {
  .sync span { display: none; }
  .sync { padding: 8px; }
  form[data-signout] { display: none; }
}
@media (max-width: 760px) {
  body.has-tabs { --tabs-h: 66px; }
  .nav { display: none; }
  .me { display: none; }
  .tabs {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabs a { display: grid; place-items: center; align-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 700; }
  .tabs a .i { width: 24px; height: 24px; }
  .tabs a.on { color: var(--brand-2); }
}

/* ---- Building blocks ----------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 0 auto; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); margin-bottom: 16px; }
.grid2 > .card { margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 18px;
  border-radius: 13px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-2) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { min-height: 60px; font-size: 1.08rem; border-radius: 16px; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 11px; }
.btn.link, button.link { border: 0; background: none; color: var(--brand-2); text-decoration: underline; text-underline-offset: 3px; padding: 6px; min-height: 0; font: inherit; cursor: pointer; box-shadow: none; }
.btn:disabled { opacity: .6; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select {
  font: inherit; padding: 13px 14px; border: 1.5px solid var(--line-strong); border-radius: 13px; background: var(--surface); color: var(--ink); width: 100%;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, textarea:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); border-color: var(--brand-2); }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline input { width: auto; flex: 1 1 180px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 14px; margin: 0 0 16px; font-weight: 650; border: 1px solid transparent; }
.flash.good { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--warn-strong); color: #1d1300; font-size: .8rem; font-weight: 800; }
.badge.urgent { background: var(--bad); color: #fff; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.pagehead p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; font-weight: 800; color: var(--muted); margin: 0 0 4px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
ul.plain li:last-child { border-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .84rem; font-weight: 650; background: var(--surface-2); border: 1px solid var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }

.avatar { width: var(--s, 56px); height: var(--s, 56px); border-radius: calc(var(--s, 56px) * .29); object-fit: cover; flex: none; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }

/* ---- Sign-in ------------------------------------------------------------------------------- */
body.auth { min-height: 100dvh; background-attachment: fixed; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand-2) 28%, transparent), transparent), var(--bg); }
body.auth main { padding-top: max(7vh, 24px); }
.hero { text-align: center; margin-bottom: 22px; }
.hero img { border-radius: 20px; box-shadow: var(--shadow-lg); }
.hero h1 { margin-top: 14px; font-size: 2rem; }
.hero p { margin: 4px 0 0; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: .85rem; margin: 22px 0 14px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.people { display: grid; gap: 10px; margin: 16px 0; }
.person { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.1rem; box-shadow: var(--shadow); }
.person:active { transform: scale(.99); }
.initials { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-2); color: #fff; font-weight: 800; font-size: 1rem; flex: none; }
input.code { font-size: 1.7rem; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 800; }
.pindots { display: flex; justify-content: center; gap: 16px; margin: 6px 0 4px; }
.pindots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background .1s, transform .1s; }
.pindots span.on { background: var(--brand-2); border-color: var(--brand-2); transform: scale(1.1); }
.pindots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key { min-height: 70px; font-size: 1.7rem; font-weight: 650; border-radius: 20px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; }
.key:active { background: var(--surface-2); transform: scale(.97); }
.key.blank { visibility: hidden; }
form[data-pinpad] input.pin { position: absolute; opacity: 0; pointer-events: none; height: 1px; width: 1px; }

/* ---- Today ---------------------------------------------------------------------------------- */
.todayhead { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; }
.todayhead h1 { margin: 0; }
.todayhead p { margin: 2px 0 0; }
.ring { position: relative; width: 76px; height: 76px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--ok); transition: stroke-dashoffset .6s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.1rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; }
.segmented a, .segmented button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 0; background: none;
  color: var(--muted); font: inherit; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; font-size: .95rem;
}
.segmented .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented small { font-weight: 600; opacity: .7; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .segmented:first-child { flex: 1; }
.viewtoggle { flex: none; }
.viewtoggle button { padding: 9px 11px; }
@media (max-width: 440px) { .toolbar .segmented small { display: none; } }

.horselist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.horselist > li > a {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; min-height: 82px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .08s ease;
}
.horselist > li > a:active { transform: scale(.99); }
.horselist > li.todo > a { border-color: var(--line-strong); }
.horselist > li.done > a { border-color: var(--ok-line); }
.horselist > li.done.concern > a { border-color: var(--warn-line); background: color-mix(in srgb, var(--warn-bg) 55%, var(--surface)); }
.horselist > li.urgent > a { border-color: var(--bad-line); background: color-mix(in srgb, var(--bad-bg) 60%, var(--surface)); }
.horselist > li.queued > a { border-style: dashed; border-color: var(--ok); }
.who { display: grid; gap: 1px; flex: 1; min-width: 0; }
.who b { font-size: 1.14rem; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 8px; }
.box { color: var(--muted); font-weight: 650; font-size: .85rem; }
.status { display: block; font-weight: 650; color: var(--muted); font-size: .9rem; line-height: 1.35; }
.status .i { margin-right: 4px; }
.status .detail { font-weight: 500; white-space: nowrap; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.status.todo { color: var(--brand-2); }
.watch { display: block; color: var(--warn); font-weight: 650; font-size: .86rem; line-height: 1.35; }
.watch .i { margin-right: 4px; }
.chev { color: var(--muted); }
.dot { position: absolute; top: 9px; left: 56px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn-strong); }
.dot.bad { background: var(--bad); }
.dot.todo { background: var(--line-strong); }
.flagcount { margin-left: auto; }

/* Whole-yard grid, like the whiteboard in the tack room. */
.horselist.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.horselist.grid > li > a { flex-direction: column; align-items: center; text-align: center; padding: 16px 10px 14px; gap: 8px; min-height: 0; }
.horselist.grid .avatar { --s: 72px !important; width: 72px; height: 72px; border-radius: 21px; }
.horselist.grid .who { justify-items: center; }
.horselist.grid .who b { justify-content: center; flex-direction: column; align-items: center; gap: 0; }
.horselist.grid .status { text-align: center; font-size: .82rem; }
.horselist.grid .status .detail, .horselist.grid .watch, .horselist.grid .chev { display: none; }
.horselist.grid .dot { top: 12px; left: calc(50% + 24px); }
.horselist.grid .flagcount { position: absolute; top: 10px; right: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px); opacity: 0;
  z-index: 40; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 18px;
  background: #16201A; color: #fff; box-shadow: var(--shadow-lg); font-weight: 650; width: max-content; max-width: calc(100vw - 24px);
  transition: transform .25s ease, opacity .25s ease; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast .i { color: #7CDB98; }
.toast .btn { min-height: 40px; padding: 6px 14px; background: #24803F; border-color: #24803F; color: #fff; }
.urgentmsg { animation: pulse 1.2s ease 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 25%, transparent); } }

/* ---- The check ---------------------------------------------------------------------------- */
body.checkpage { --tabs-h: 0px; }
body.checkpage .tabs { display: none; }
body.checkpage main { padding-bottom: 140px; }
.horsehead { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.horsehead h1 { margin: 0; }
.horsehead p { margin: 2px 0 0; }
.back { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); flex: none; }
.watchbox { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; font-weight: 600; }
.flagline { display: flex; gap: 10px; align-items: center; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 14px; padding: 11px 14px; margin: 0 0 8px; font-weight: 750; }
.flagline.urgent { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
details { margin: 0 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
details summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; gap: 8px; align-items: center; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "›"; margin-left: auto; font-size: 1.4rem; line-height: 1; color: var(--muted); transition: transform .15s; }
details[open] summary::after { transform: rotate(90deg); }
.btn.allnormal { margin: 14px 0 6px; background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--ok) 35%, transparent); }
.btn.allnormal.done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); box-shadow: none; }
fieldset.item { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 14px 16px; margin: 0 0 12px; box-shadow: var(--shadow); transition: border-color .15s, background .15s; }
fieldset.item.answered { border-color: var(--ok-line); }
fieldset.item.problem { border-color: var(--warn-line); background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface)); }
fieldset.item.urgent { border-color: var(--bad-line); background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
fieldset.item.missing { border-color: var(--bad); }
fieldset.item legend { float: left; width: 100%; padding: 0; margin: 0; }
fieldset.item legend + * { clear: both; }
.itemhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.itemhead .ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); color: var(--brand-2); border: 1px solid var(--line); flex: none; }
.itemhead .ic .i { width: 21px; height: 21px; }
.itemhead b { font-size: 1.12rem; letter-spacing: -.01em; }
.itemhead small { color: var(--muted); font-weight: 500; }
.itemhead .tick { margin-left: auto; color: var(--ok); opacity: 0; transition: opacity .15s; }
fieldset.item.answered .tick { opacity: 1; }
.lasttime { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 7px 11px; border-radius: 10px; font-size: .88rem; font-weight: 650; background: var(--warn-bg); color: var(--warn); }
.lasttime.lvl2 { background: var(--bad-bg); color: var(--bad); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.choice { position: relative; display: block; font-weight: 650; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: var(--tap); padding: 8px 10px;
  border: 1.5px solid var(--line-strong); border-radius: 13px; background: var(--surface); cursor: pointer; line-height: 1.2;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
}
.choice span:active { transform: scale(.97); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice.lvl0 input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.choice.lvl1 input:checked + span { background: var(--warn-strong); border-color: var(--warn-strong); color: #1d1300; }
.choice.lvl2 span { border-color: var(--bad-line); }
.choice.lvl2 input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.inline-choices { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; }
.inline-choices .choice { flex: 1; }
.hint { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; color: var(--warn); font-weight: 650; font-size: .92rem; }
.temprow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
input.temp { font-size: 1.5rem; font-weight: 750; max-width: 170px; text-align: center; font-variant-numeric: tabular-nums; }
.photo-btn { font-size: 1.02rem; border-style: dashed; }
.previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.previews:empty { display: none; }
.pv { position: relative; }
.pv img { width: 92px; height: 92px; object-fit: cover; border-radius: 14px; display: block; }
.pv button { position: absolute; top: -8px; right: -8px; width: 30px; height: 30px; border-radius: 15px; border: 2px solid var(--surface); background: var(--bad); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 10px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.savebar > * { max-width: 668px; margin-left: auto; margin-right: auto; }
.savebar .meter { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: .8rem; font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; }
.savebar .meter div { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.savebar .meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .25s ease; }
.missing { color: var(--bad); font-weight: 750; margin: 0 auto 8px; }
.given { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 8px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: .92rem; }
.med { padding: 10px 0; border-top: 1px solid var(--line); }
.med:first-of-type { border-top: 0; padding-top: 0; }
.medname { margin: 0 0 8px; }
.medreason { margin-top: 8px; }
fieldset.item.meds { border-color: #B8C7E8; }
.medsdue { color: var(--brand-2); }
.board td { font-size: .9rem; } .board td div { margin: 2px 0; }
.medline { color: var(--brand-2); }
.watchtxt { color: var(--warn); }
.noscreen { display: none; }
@media print { .noscreen { display: block; } }

/* Check summaries */
.concerns { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.concerns li { padding: 3px 10px; border-radius: 999px; font-size: .86rem; border: 1px solid transparent; }
.concerns .lvl0 { background: var(--ok-bg); color: var(--ok); }
.concerns .lvl1 { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.concerns .lvl2 { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.allok { display: flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 650; margin: 4px 0; }
.note { font-style: italic; margin: 6px 0; color: var(--muted); }
table.answers { border-collapse: collapse; width: 100%; margin: 12px 0; }
table.answers th, table.answers td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); }
table.answers th { font-weight: 650; color: var(--muted); width: 40%; }
table.answers tr.lvl1 td { color: var(--warn); font-weight: 750; }
table.answers tr.lvl2 td { color: var(--bad); font-weight: 750; }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery img { width: 130px; height: 130px; object-fit: cover; border-radius: 14px; display: block; }
.seal { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.seal .i { color: var(--ok); }

/* ---- Dashboard ----------------------------------------------------------------------------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); margin: 0; }
.stat .ring { width: 60px; height: 60px; }
.stat .ring b { font-size: .9rem; }
.stat p { margin: 0; }
.stat .big { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); color: var(--brand-2); flex: none; }
.stat .ic .i { width: 28px; height: 28px; }
.stat.alert .ic { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.flag { border: 1px solid var(--warn-line); border-left: 5px solid var(--warn-strong); padding: 12px 14px; margin: 0 0 12px; background: color-mix(in srgb, var(--warn-bg) 50%, var(--surface)); border-radius: 12px; }
.flag.urgent { border-color: var(--bad-line); border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-bg) 60%, var(--surface)); }
.flag.closed { border-color: var(--line); border-left-color: var(--line-strong); background: var(--surface-2); color: var(--muted); }
.flag header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flag header a { color: inherit; }
.flag p { margin: 6px 0 10px; }
.flag form input { padding: 10px 12px; }
.flag .btn { min-height: 42px; }
.empty { display: flex; gap: 12px; align-items: center; color: var(--muted); padding: 8px 0; margin: 0; }
.empty .i { width: 28px; height: 28px; color: var(--ok); }
.mini { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mini:last-child { border-bottom: 0; }
.mini > div { flex: 1; min-width: 0; }
.mini a { font-weight: 750; color: var(--ink); text-decoration: none; }
.empty .i-circle-dashed { color: var(--muted); }
.steps { padding-left: 1.2em; }
.steps li { margin: 8px 0; }
.setup ol { list-style: none; padding: 0; margin: 0; }
.setup li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.setup li:last-child { border-bottom: 0; }
.setup .tick { flex: none; width: 24px; height: 24px; color: var(--muted); margin-top: 1px; }
.setup li.done .tick { color: var(--ok); }
.setup li.done:not(:nth-child(2)) > div { color: var(--muted); }
ol.timeline { list-style: none; padding: 0; margin: 0; }
ol.timeline > li { position: relative; padding: 10px 0 12px 22px; border-bottom: 1px solid var(--line); }
ol.timeline > li:last-child { border-bottom: 0; }
ol.timeline > li::before { content: ""; position: absolute; left: 4px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
ol.timeline > li.concern::before { background: var(--warn-strong); }
ol.timeline > li > a { font-weight: 750; color: var(--ink); text-decoration: none; }
.spark { width: 100%; height: auto; max-height: 170px; }
.spark .line { fill: none; stroke: var(--brand-2); stroke-width: 2.5; }
.spark .area { fill: color-mix(in srgb, var(--brand-2) 12%, transparent); }
.spark .pt { fill: var(--surface); stroke: var(--brand-2); stroke-width: 2; }
.spark .hot { fill: var(--bad); stroke: var(--bad); }
.spark .limit { stroke: var(--bad); stroke-dasharray: 4 4; stroke-width: 1.5; }
.spark .lbl { font-size: 11px; fill: var(--muted); }
.spark .lbl.strong { fill: var(--ink); font-weight: 800; font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.list th, table.list td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.off td { color: var(--muted); }
.persona { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.persona .initials { width: 36px; height: 36px; font-size: .85rem; }
input.pinsmall { width: 110px !important; flex: none !important; }
.roundrow { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.roundrow.off { opacity: .55; }
.sharebox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sharebox input { flex: 1 1 260px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
@media (max-width: 700px) {
  table.list thead { display: none; }
  table.list tr { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.list td { border: 0; padding: 0; }
}

/* ---- Owner page ---------------------------------------------------------------------------- */
.ownerhead { display: flex; gap: 16px; align-items: center; margin: 8px 0 18px; }
.ownerhead h1 { margin: 0; }
.ownerhead p { margin: 2px 0 0; }
.dayhead { font-weight: 800; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; margin: 30px 0 10px; }
.footer a { color: inherit; }

/* ---- Care record (screen and print) -------------------------------------------------------- */
.filters { margin-bottom: 16px; }
.filters label { display: flex; align-items: center; gap: 6px; }
.doc { background: var(--surface); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.doc header p { margin: 2px 0; }
table.rec { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 16px 0; }
table.rec th, table.rec td { border: 1px solid var(--line-strong); padding: 5px 7px; text-align: left; vertical-align: top; }
table.rec th { background: var(--surface-2); }
table.rec td.lvl1 { background: var(--warn-bg); font-weight: 750; }
table.rec td.lvl2 { background: var(--bad-bg); font-weight: 750; color: var(--bad); }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root { color-scheme: light; --surface: #fff; --surface-2: #f2f2f2; --ink: #000; --line-strong: #bbb; --warn-bg: #fff3d4; --bad-bg: #fde6e3; --bad: #b3261e; }
  body { background: #fff; color: #000; font-size: 11px; padding: 0; }
  .bar, .tabs, .toast, .noprint, .flash { display: none !important; }
  main, main.wide { max-width: none; padding: 0; }
  .doc { border: 0; padding: 0; background: #fff; }
  table.rec { font-size: 9.5px; }
  table.rec small, table.rec .small, .doc .small { font-size: inherit; }
  table.rec tr { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.healthgrid td, .healthgrid th { white-space: nowrap; font-size: .9rem; }
.healthgrid .chip { font-size: .78rem; }

/* Door signs: two per A4 page when printed. */
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.sign { background: #fff; color: #16201A; border: 2px solid #16201A; border-radius: 18px; padding: 22px 20px 16px; text-align: center; break-inside: avoid; }
.sign-yard { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: #5E6A63; }
.sign-name { display: block; font-size: 2.4rem; margin: 4px 0 0; letter-spacing: -.02em; }
.sign-box { margin: 0 0 10px; font-weight: 700; color: #5E6A63; }
.sign-qr svg { width: 100%; max-width: 230px; height: auto; display: block; margin: 0 auto; }
.sign-how { font-weight: 800; margin: 10px 0 6px; }
.sign-brand { margin: 0; font-size: .8rem; color: #5E6A63; display: flex; align-items: center; justify-content: center; gap: 6px; }
@media print {
  .signs { grid-template-columns: 1fr 1fr; gap: 10mm; }
  .sign { padding: 8mm; }
  .sign-qr svg { max-width: 60mm; }
}
.atbox { color: var(--ok); font-weight: 700; }

/* Emergency */
.embanner { display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin: 0 0 14px; border-radius: 16px; background: var(--bad); color: #fff; text-decoration: none; font-weight: 600; box-shadow: 0 6px 18px color-mix(in srgb, var(--bad) 35%, transparent); animation: pulse 1.6s ease infinite; }
.embanner .i { width: 24px; height: 24px; }
.embanner .chev { margin-left: auto; color: #fff; }
.emstart { border-color: var(--bad-line); }
.emstart summary { color: var(--bad); }
.btn.emgo { background: var(--bad); border-color: var(--bad); color: #fff; }
body.emergency .bar { background: #6E1712; }
.emhead { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.emhead h1 { margin: 0; color: var(--bad); }
.calls { display: grid; gap: 10px; margin-bottom: 14px; }
.btn.call { background: var(--bad); border-color: var(--bad); color: #fff; font-size: 1.2rem; min-height: 68px; }
.evbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.evbtns .btn.done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); opacity: 1; }
.vitals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.vitals input { font-size: 1.3rem; font-weight: 750; text-align: center; }
.vitals small { color: var(--muted); font-weight: 500; }
.nextobs { margin-left: auto; font-size: .9rem; font-weight: 700; color: var(--muted); }
.nextobs.due { color: var(--bad); }

/* Jobs, handover, rota */
.onrota { margin: -6px 0 12px; }
.handover { border-color: #B8C7E8; background: color-mix(in srgb, #E7EEFB 50%, var(--surface)); }
.handovernote { background: color-mix(in srgb, #E7EEFB 70%, var(--surface)); color: var(--ink); border-color: #B8C7E8; }
.jobs h2 small { margin-left: auto; font-weight: 700; }
.job { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); font-weight: 650; cursor: pointer; }
.job input { width: 26px; height: 26px; accent-color: var(--ok); flex: none; }
.job span { flex: 1; }
.job input:checked + span { color: var(--muted); text-decoration: line-through; }
.passon { display: flex; gap: 10px; align-items: center; font-weight: 600; margin-top: 10px; }
.passon input { width: 22px; height: 22px; accent-color: var(--brand-2); }
.rotagrid td { text-align: center; }
.rotagrid input { width: 22px; height: 22px; accent-color: var(--brand-2); }

.ownerrow { margin: 0 0 10px; }
.ownerrow summary { gap: 12px; }
.ownerrow.off { opacity: .6; }
.pricegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pricegrid input { max-width: 120px; }
.jobs .job form { margin-left: auto; }
