/* ==========================================================================
   Arbor design system — v1 (chosen 2026-09-02)
   Source of truth for tokens and component styles. Visual reference: design/ui-kit.html
   Markup reference: design/COMPONENTS.md · Rules: /CLAUDE.md
   Light mode = Sage (default). Dark mode = Moss, via [data-theme="dark"] on <html>
   or the OS preference when no data-theme is set. Toggle: design/arbor-theme.js
   Fonts: self-hosted below (latin and latin-ext, design/fonts, SIL Open Font License, see design/fonts/OFL.txt). No <link> to a
   font service: a third-party font request would send every visitor's IP address to that service.
   ========================================================================== */

/* ---------- fonts: Source Sans 3 and Source Serif 4, latin subset, variable ---------- */
@font-face {
  font-family:'Source Sans 3'; font-style:normal; font-weight:200 900; font-display:swap;
  src:url('./fonts/SourceSans3-latin-wght.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family:'Source Serif 4'; font-style:normal; font-weight:200 900; font-display:swap;
  src:url('./fonts/SourceSerif4-latin-opsz.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* latin-ext (Ł, ő, ș, ž, ...): the browser fetches these only when a name uses such a letter. */
@font-face {
  font-family:'Source Sans 3'; font-style:normal; font-weight:200 900; font-display:swap;
  src:url('./fonts/SourceSans3-latin-ext-wght.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family:'Source Serif 4'; font-style:normal; font-weight:200 900; font-display:swap;
  src:url('./fonts/SourceSerif4-latin-ext-opsz.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---------- tokens: Sage (light) ---------- */
:root {
  color-scheme: light;
  --paper:#E9EDDF; --surface:#FFFFFF; --surface2:#DCE3CA;
  --ink:#1C2116; --ink2:#3F4733; --muted:#5A624D;
  --border:#CBD3B4; --border2:#A5B08A; --side:#F6F8EF;
  --accent:#566C22; --accent-hover:#475B1C; --accent-active:#364515; --on-accent:#FFFFFF;
  --accent-soft:#CFDDA6; --accent-soft-ink:#33421A; --accent-tint:#E8EED3; --accent-line:#B1C388; --accent-2:#7A9436;
  --warn:#98462F; --warn-soft:#F3DED4; --on-warn:#FFFFFF;
  --info:#46637E; --info-soft:#DDE6EC;
  --ring:rgba(94,117,38,.28); --scrim:rgba(28,33,22,.45);
  --tip-bg:#1C2116; --tip-ink:#F5F7EC;
  /* on-accent as raw r,g,b channels, for rgba(var(--on-accent-rgb), alpha) washes on a solid accent
     surface (order 42 / review item 37) — e.g. the caregiver home's hero-tile badge and status lamp
     in web/src/styles/pages.css. Kept alongside --on-accent so both stay in sync per theme. */
  --on-accent-rgb:255,255,255;
  /* the caregiver home's clock-in lamp, lit (pages.css .cg-lamp.on) — a physical indicator-light
     colour, kept constant across both themes on purpose, not tied to the accent palette. */
  --lamp-on:#D6E39C; --lamp-on-line:#F5F7EC; --lamp-on-glow-rgb:214,227,156;
  --shadow:0 1px 2px rgba(28,33,22,.1);
  --shadow-md:0 8px 20px -8px rgba(28,33,22,.3), 0 1px 3px rgba(28,33,22,.14);
  --shadow-lg:0 16px 40px -16px rgba(28,33,22,.3), 0 1px 2px rgba(28,33,22,.07);

  /* shape (soft) */
  --r-sm:4px; --r-ctl:6px; --r-md:8px; --r-card:10px; --r-lg:12px; --r-pill:999px;
  /* density (comfortable) */
  --ctl:44px; --ctl-sm:36px; --ctl-lg:52px; --row:52px; --cell-y:14px; --nav-h:44px;
  /* type (classic) */
  --font-display:'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-ui:'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --w-display:500; --w-head:600;
}
/* ---------- tokens: Moss (dark) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:#0D0F0B; --surface:#1B2015; --surface2:#272C1E;
    --ink:#ECEADF; --ink2:#C6C5B7; --muted:#A3A594;
    --border:#4A513B; --border2:#5A6249; --side:#151911;
    --accent:#9BB24C; --accent-hover:#ABC25C; --accent-active:#BDD170; --on-accent:#15170F;
    --accent-soft:#2D361C; --accent-soft-ink:#D3E09E; --accent-tint:#27311B; --accent-line:#3F4B26; --accent-2:#8FA544;
    --warn:#DB9474; --warn-soft:#3A261E; --on-warn:#15170F;
    --info:#97B1CD; --info-soft:#1F2A36;
    --ring:rgba(155,178,76,.38); --scrim:rgba(0,0,0,.55);
    --tip-bg:#ECEADF; --tip-ink:#15170F;
    --on-accent-rgb:21,23,15;
    --shadow:0 1px 2px rgba(0,0,0,.5);
    --shadow-md:0 8px 20px -8px rgba(0,0,0,.8), 0 1px 3px rgba(0,0,0,.55);
    --shadow-lg:0 16px 40px -16px rgba(0,0,0,.7), 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:#0D0F0B; --surface:#1B2015; --surface2:#272C1E;
  --ink:#ECEADF; --ink2:#C6C5B7; --muted:#A3A594;
  --border:#4A513B; --border2:#5A6249; --side:#151911;
  --accent:#9BB24C; --accent-hover:#ABC25C; --accent-active:#BDD170; --on-accent:#15170F;
  --accent-soft:#2D361C; --accent-soft-ink:#D3E09E; --accent-tint:#27311B; --accent-line:#3F4B26; --accent-2:#8FA544;
  --warn:#DB9474; --warn-soft:#3A261E; --on-warn:#15170F;
  --info:#97B1CD; --info-soft:#1F2A36;
  --ring:rgba(155,178,76,.38); --scrim:rgba(0,0,0,.55);
  --tip-bg:#ECEADF; --tip-ink:#15170F;
  --on-accent-rgb:21,23,15;
  --shadow:0 1px 2px rgba(0,0,0,.5);
  --shadow-md:0 8px 20px -8px rgba(0,0,0,.8), 0 1px 3px rgba(0,0,0,.55);
  --shadow-lg:0 16px 40px -16px rgba(0,0,0,.7), 0 1px 2px rgba(0,0,0,.4);
}
/* optional: compact density on any subtree (or <html>) */
[data-density="compact"] { --ctl:38px; --ctl-sm:30px; --ctl-lg:46px; --row:44px; --cell-y:10px; --nav-h:38px; }

/* ---------- text size (per user, beside the appearance switch) ----------
   Four steps: A- / A / A+ / A++ (stored 0 / 1 / 2 / 3). Desktop and tablet render 100 / 125 / 150 / 175%, phones
   100 / 120 / 135 / 150% (A- is plain 100%, owner 2026-10-14). The whole page scales like browser zoom so proportions hold; when the effective width
   drops under 900px the layout switches to the phone arrangement (arbor-theme.js sets data-layout="narrow").
   The caregiver pages are built for phones and keep the larger 125 / 150 / 175 / 200% on any screen. */
html { --zoom:1.25; }
html[data-zoom="0"] { --zoom:1; }
html[data-zoom="2"] { --zoom:1.5; }
html[data-zoom="3"] { --zoom:1.75; }
@media (max-width: 639px) { html { --zoom:1.2; } html[data-zoom="0"] { --zoom:1; } html[data-zoom="2"] { --zoom:1.35; } html[data-zoom="3"] { --zoom:1.5; } }
@media (min-width: 640px) {
  html:has(.cg) { --zoom:1.5; } html[data-zoom="0"]:has(.cg) { --zoom:1.25; } html[data-zoom="2"]:has(.cg) { --zoom:1.75; } html[data-zoom="3"]:has(.cg) { --zoom:2; }
}
body { zoom:var(--zoom); }
.zoom-seg > button { font-weight:600; letter-spacing:.02em; }
.zoom-seg > button[data-arbor-zoom="0"] { font-size:.92em; }
.zoom-seg > button[data-arbor-zoom="2"] { font-size:1.08em; }
.zoom-seg > button[data-arbor-zoom="3"] { font-size:1.16em; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing:border-box; }
html { background:var(--paper); -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { margin:0; background:var(--paper); color:var(--ink); font-family:var(--font-ui); font-size:16px; line-height:24px; -webkit-font-smoothing:antialiased; }
a { color:var(--accent); } a:hover { color:var(--accent-hover); }
button, input, select, textarea { font-family:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.btn:focus-visible, .input:focus-visible, .check:focus-visible, .radio:focus-visible, .switch:focus-visible { outline:none; }
svg.i { width:18px; height:18px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
svg.i.sm { width:14px; height:14px; } svg.i.lg { width:24px; height:24px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition:none !important; animation:none !important; } }

/* terminology spans (filled by the terminology helper) never break text runs inside flex containers */
[data-term] { display:contents; }

/* ---------- type ---------- */
.t-display { font-family:var(--font-display); font-size:48px; line-height:52px; font-weight:var(--w-display); letter-spacing:-0.015em; text-wrap:balance; }
.t-title   { font-family:var(--font-display); font-size:28px; line-height:34px; font-weight:var(--w-head); }
.t-card    { font-family:var(--font-display); font-size:24px; line-height:30px; font-weight:var(--w-head); }
.t-section { font-size:17px; line-height:24px; font-weight:600; }
.t-body    { font-size:16px; line-height:24px; }
.t-body-lg { font-size:18px; line-height:28px; color:var(--ink2); }
.t-meta    { font-size:14px; line-height:20px; color:var(--muted); }
.t-th      { font-size:14px; line-height:18px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.t-mono    { font-family:var(--font-mono); font-size:15px; font-variant-numeric:tabular-nums; }
.t-eyebrow { font-size:14px; line-height:18px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--accent); }
.num       { font-variant-numeric:tabular-nums; }

/* ---------- layout helpers ---------- */
.row   { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.stack { display:flex; flex-direction:column; gap:8px; }
.cols  { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap:24px; }

/* ---------- buttons (solid) ---------- */
.btn { height:var(--ctl); padding:0 16px; border-radius:var(--r-ctl); font-size:16px; font-weight:500; line-height:1; display:inline-flex; align-items:center; justify-content:center; gap:8px; border:1px solid transparent; cursor:pointer; white-space:nowrap; text-decoration:none; transition:background-color .12s, border-color .12s, box-shadow .12s, color .12s; }
.btn:focus-visible { box-shadow:0 0 0 3px var(--ring); }
.btn:disabled, .btn.is-disabled { opacity:.45; cursor:not-allowed; pointer-events:none; }
.btn-primary { background:var(--accent); color:var(--on-accent); }
.btn-primary:hover { background:var(--accent-hover); }
.btn-primary:active { background:var(--accent-active); }
.btn-secondary { background:var(--surface); border-color:var(--border2); color:var(--ink); }
.btn-secondary:hover { background:var(--surface2); }
.btn-secondary:active { background:var(--border); }
.btn-ghost { background:transparent; color:var(--ink2); }
.btn-ghost:hover { background:var(--surface2); color:var(--ink); }
.btn-ghost:active { background:var(--border); }
.btn-danger { background:var(--surface); border-color:var(--warn); color:var(--warn); }
.btn-danger:hover { background:var(--warn); color:var(--on-warn); }
.btn-danger:active { background:var(--warn); color:var(--on-warn); filter:brightness(.9); }
.btn-link { height:auto; min-height:44px; display:inline-flex; align-items:center; padding:0 8px; background:none; color:var(--accent); border:0; border-radius:2px; }
.btn-link:hover { color:var(--accent-hover); text-decoration:underline; }
.btn-sm { height:var(--ctl-sm); padding:0 12px; font-size:15px; gap:6px; }
.btn-lg { height:var(--ctl-lg); padding:0 20px; font-size:17px; }
.btn-icon { width:var(--ctl); padding:0; }
.btn-icon.btn-sm { width:var(--ctl-sm); }
.spin { animation:spin 1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ---------- inputs (filled) ---------- */
.field { display:flex; flex-direction:column; gap:6px; min-width:0; }
/* Form rhythm, one rule for every form: 20px between fields (so a label never reads as belonging to the
   input above it), 24px above the submit button, 8px between radio/checkbox items (.stack). useForm's
   formProps() puts data-dirty on each form, which is what this selects; a hand-built form adds .form. */
.form, form[data-dirty] { display:flex; flex-direction:column; gap:20px; }
.form > .btn[type="submit"], form[data-dirty] > .btn[type="submit"] { margin-top:4px; align-self:flex-start; }
.label { font-size:15px; font-weight:500; color:var(--ink); display:flex; gap:4px; }
.label .req { color:var(--warn); }
.label .optional { color:var(--muted); font-weight:400; }
.input { height:var(--ctl); width:100%; padding:0 12px; border:1.5px solid var(--border2); border-radius:var(--r-ctl); background:var(--surface2); color:var(--ink); font-size:16px; transition:border-color .12s, box-shadow .12s, background-color .12s; }
.input::placeholder { color:var(--muted); }
.input:hover { border-color:var(--muted); }
.input:focus { outline:none; border-color:var(--accent); background:var(--surface); box-shadow:0 0 0 3px var(--ring); }
.input:disabled { background:transparent; border:1.5px dashed var(--border2); color:var(--muted); cursor:not-allowed; }
.input.is-error { border-color:var(--warn); }
.input.is-error:focus { box-shadow:0 0 0 3px var(--warn-soft); }
textarea.input { height:auto; min-height:104px; padding:10px 12px; line-height:20px; resize:vertical; }
select.input { appearance:none; -webkit-appearance:none; cursor:pointer; padding-right:40px; }
/* A drawn chevron (two gradient triangles in a token colour) so a select reads as a menu, not a text box. */
select.input, select.input:hover, select.input:focus { background-image:linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position:calc(100% - 21px) 50%, calc(100% - 15px) 50%; background-size:6px 6px, 6px 6px; background-repeat:no-repeat; }
.help { font-size:14px; line-height:20px; color:var(--muted); }
.help.err { color:var(--warn); display:flex; align-items:center; gap:4px; }
.iw { position:relative; }
.iw > svg.i { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--muted); pointer-events:none; }
.iw > .input { padding-left:36px; }
.iw.trail > svg.i { left:auto; right:10px; }
.iw.trail > .input { padding-left:12px; padding-right:36px; }
.search { display:flex; align-items:center; gap:10px; height:var(--ctl); padding:0 12px; background:var(--surface2); border:1px solid var(--border2); border-radius:var(--r-ctl); color:var(--muted); }

/* ---------- selection controls ---------- */
.check, .radio { appearance:none; -webkit-appearance:none; width:22px; height:22px; margin:0; flex-shrink:0; border:1px solid var(--border2); border-radius:var(--r-sm); background:var(--surface); display:inline-grid; place-content:center; cursor:pointer; transition:background-color .12s, border-color .12s, box-shadow .12s; }
.radio { border-radius:999px; }
.check:hover, .radio:hover { border-color:var(--muted); }
.check:focus-visible, .radio:focus-visible, .switch:focus-visible { box-shadow:0 0 0 3px var(--ring); border-color:var(--accent); }
.check:checked, .check:indeterminate, .radio:checked { background:var(--accent); border-color:var(--accent); }
.check::before { content:""; width:13px; height:13px; background:var(--on-accent); transform:scale(0); transition:transform .1s; -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center/contain no-repeat; mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center/contain no-repeat; }
.check:checked::before { transform:scale(1); }
.check:indeterminate::before { transform:scale(1); -webkit-mask:none; mask:none; width:12px; height:2px; border-radius:1px; }
.radio::before { content:""; width:10px; height:10px; border-radius:999px; background:var(--on-accent); transform:scale(0); transition:transform .1s; }
.radio:checked::before { transform:scale(1); }
.check:disabled, .radio:disabled, .switch:disabled { opacity:.45; cursor:not-allowed; }
.choice { display:flex; align-items:center; gap:12px; font-size:16px; cursor:pointer; min-height:28px; }
.choice.desc { align-items:flex-start; }
.choice .txt { display:flex; flex-direction:column; gap:2px; }
.choice .txt span:last-child { font-size:14px; color:var(--muted); }
.switch { appearance:none; -webkit-appearance:none; width:44px; height:24px; margin:0; border-radius:999px; background:var(--border2); border:1px solid transparent; position:relative; cursor:pointer; flex-shrink:0; transition:background-color .15s; }
.switch::before { content:""; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:999px; background:#FFFFFF; box-shadow:0 1px 2px rgba(0,0,0,.25); transition:transform .15s; }
.switch:checked { background:var(--accent); }
.switch:checked::before { transform:translateX(20px); }
.checklist { background:var(--surface); box-shadow:var(--shadow-md); border-radius:var(--r-md); overflow:hidden; }
.checklist .head { display:flex; align-items:center; gap:12px; height:48px; padding:0 16px; background:var(--surface2); font-size:15px; font-weight:600; }
.checklist .head .cnt { margin-left:auto; font-weight:500; color:var(--muted); }
.checklist .item { display:flex; align-items:center; gap:12px; min-height:var(--row); padding:0 14px; border-top:1px solid var(--border); cursor:pointer; }
.checklist .item:first-child { border-top:0; }
.checklist .item:hover { background:var(--surface2); }
.checklist .item .t { flex-grow:1; }
.checklist .item.done .t { color:var(--muted); text-decoration:line-through; }
.checklist .item .m { font-size:14px; color:var(--muted); }

/* ---------- choice chips: pick any / pick one (aria-pressed marks the picked ones; .is-big for the caregiver app) ---------- */
.choice-chips { display:flex; flex-wrap:wrap; gap:8px; }
.choice-chip { min-height:44px; padding:0 16px; display:inline-flex; align-items:center; gap:8px; font:inherit; font-size:16px; font-weight:500; text-align:left; color:var(--ink); background:var(--surface); border:1px solid var(--border2); border-radius:var(--r-pill); cursor:pointer; transition:background-color var(--dur-fast), border-color var(--dur-fast); }
.choice-chip:hover { background:var(--surface2); border-color:var(--muted); }
.choice-chip:focus-visible { outline:none; box-shadow:0 0 0 3px var(--ring); }
.choice-chip[aria-pressed="true"] { background:var(--accent-soft); border-color:var(--accent); color:var(--accent-soft-ink); font-weight:600; }
.choice-chip svg.i { color:var(--accent); flex-shrink:0; }
.choice-chips.is-big .choice-chip { min-height:64px; padding:0 20px; font-size:20px; border-radius:14px; }
.struck { text-decoration:line-through; color:var(--muted); }

/* ---------- tags & counts ---------- */
.tag { display:inline-flex; align-items:center; gap:5px; font-size:14px; font-weight:500; line-height:18px; padding:3px 10px; border-radius:var(--r-pill); background:var(--surface2); color:var(--ink2); white-space:nowrap; }
.tag-accent { background:var(--accent-soft); color:var(--accent-soft-ink); }
.tag-info { background:var(--info-soft); color:var(--info); }
.tag-warn { background:var(--warn-soft); color:var(--warn); }
.tag-outline { background:var(--surface); border:1px solid var(--border2); padding:1px 8px; }
.tag-dashed { background:transparent; border:1px dashed var(--border2); color:var(--muted); padding:1px 8px; }
.tag .dot { width:6px; height:6px; border-radius:999px; background:currentColor; }
.count { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 7px; border-radius:var(--r-pill); background:var(--accent-soft); color:var(--accent-soft-ink); font-size:14px; font-weight:600; }
.count.neutral { background:var(--surface2); color:var(--ink2); }
.count.warn { background:var(--warn); color:var(--on-warn); }
/* A row that is a whole-row button (the caregiver's "New for you" list): full width, left aligned, inherits type. */
.row-btn { width:100%; text-align:left; font-family:inherit; color:var(--ink); cursor:pointer; }
/* A small dot in the top-right corner of a position:relative box (a day with something new). Never the only signal: pair it with a word. */
.new-dot { position:absolute; top:5px; right:5px; width:10px; height:10px; border-radius:50%; background:var(--accent); border:2px solid var(--surface); }
/* calendar status marks: one shape per status so a tinted day never relies on colour alone;
   the same marks key the legend card below the month */
.cal-mark { display:inline-block; width:12px; height:12px; flex-shrink:0; box-sizing:border-box; }
.cal-mark[data-mark="you"] { border-radius:50%; background:var(--accent); }
.cal-mark[data-mark="live"] { background:var(--accent); transform:rotate(45deg) scale(.8); }
.cal-mark[data-mark="done"] { position:relative; }
.cal-mark[data-mark="done"]::after { content:""; position:absolute; left:3px; top:-1px; width:5px; height:10px; border:solid var(--ink2); border-width:0 3px 3px 0; transform:rotate(45deg); }
.cal-mark[data-mark="missed"] { background:var(--warn); clip-path:polygon(50% 0, 100% 100%, 0 100%); }
.cal-mark[data-mark="open"] { border-radius:50%; border:2px dashed var(--ink2); }
.cal-mark[data-mark="other"] { background:var(--info); border-radius:2px; }
.cal-legend { list-style:none; margin:0; padding:14px 16px; display:grid; grid-template-columns:repeat(auto-fit, minmax(110px, 1fr)); gap:12px 12px; background:var(--surface); border:1px solid var(--border2); border-radius:var(--r-card); font-size:16px; }
.cal-legend li { display:flex; align-items:center; gap:10px; }

/* ---------- feedback ---------- */
.alert { display:flex; flex-wrap:wrap; gap:12px; padding:12px 14px; border-radius:var(--r-md); border:1px solid transparent; background:var(--surface2); align-items:flex-start; }
/* An action beside the text never shrinks or clips its label; on a phone it wraps under the text instead. */
.alert > .btn { flex-shrink:0; }
.alert svg.i { margin-top:1px; }
.alert .b { flex-basis:12rem; display:flex; flex-direction:column; gap:2px; flex-grow:1; }
.alert .b strong { font-weight:600; }
.alert .b span { color:var(--ink2); }
.alert-info { background:var(--info-soft); } .alert-info svg.i { color:var(--info); }
.alert-success { background:var(--accent-soft); } .alert-success svg.i { color:var(--accent); }
.alert-warn { background:var(--warn-soft); } .alert-warn svg.i { color:var(--warn); }
.alert-critical { background:var(--warn-soft); border-color:var(--warn); } .alert-critical svg.i { color:var(--warn); }
.alert .close { margin-left:auto; background:none; border:0; color:var(--muted); cursor:pointer; padding:0; display:flex; }
.toast { display:inline-flex; align-items:center; gap:12px; padding:12px 14px; border-radius:var(--r-md); background:var(--tip-bg); color:var(--tip-ink); box-shadow:var(--shadow-lg); font-size:16px; }
.toast .act { color:var(--accent-2); font-weight:500; background:none; border:0; cursor:pointer; padding:0; font-size:16px; }
.banner { display:flex; align-items:center; gap:12px; padding:10px 16px; background:var(--accent-tint); border:1px solid var(--accent-line); border-radius:var(--r-md); }
.banner .b { flex-grow:1; }
.progress { height:6px; border-radius:999px; background:var(--surface2); overflow:hidden; width:100%; }
.progress > i { display:block; height:100%; background:var(--accent); border-radius:999px; }

/* ---------- navigation ---------- */
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
/* tabs wider than the screen scroll inside themselves; a soft fade on the clipped edge(s) hints at the rest (Tabs.tsx sets the data attributes) */
.tabs[data-fade-end="true"] { -webkit-mask-image:linear-gradient(to right, var(--ink) calc(100% - 36px), transparent); mask-image:linear-gradient(to right, var(--ink) calc(100% - 36px), transparent); }
.tabs[data-fade-start="true"] { -webkit-mask-image:linear-gradient(to left, var(--ink) calc(100% - 36px), transparent); mask-image:linear-gradient(to left, var(--ink) calc(100% - 36px), transparent); }
.tabs[data-fade-start="true"][data-fade-end="true"] { -webkit-mask-image:linear-gradient(to right, transparent, var(--ink) 36px, var(--ink) calc(100% - 36px), transparent); mask-image:linear-gradient(to right, transparent, var(--ink) 36px, var(--ink) calc(100% - 36px), transparent); }
.tab { height:44px; padding:0 14px; font-size:16px; font-weight:500; color:var(--ink2); background:none; border:0; border-bottom:2px solid transparent; margin-bottom:-1px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; text-decoration:none; flex:none; white-space:nowrap; }
.tab:hover { color:var(--ink); }
.tab.is-active { color:var(--accent-soft-ink); border-bottom-color:var(--accent); }
.tab.is-locked { color:var(--muted); }
.tab:focus-visible { outline:none; box-shadow:inset 0 0 0 2px var(--ring); border-radius:4px; }
.seg { display:inline-flex; height:var(--ctl); border:1px solid var(--border2); border-radius:var(--r-ctl); overflow:hidden; background:var(--surface); }
.seg > button { padding:0 16px; font-size:16px; font-weight:500; color:var(--ink2); background:var(--surface); border:0; border-right:1px solid var(--border2); cursor:pointer; }
.seg > button:last-child { border-right:0; }
.seg > button:hover { color:var(--ink); }
.seg > button.is-active { background:var(--accent-soft); color:var(--accent-soft-ink); font-weight:700; }
.seg.sm { height:var(--ctl-sm); } .seg.sm > button { padding:0 12px; font-size:14px; }
.seg.ghost { border-color:transparent; background:transparent; }
.seg.ghost > button { background:transparent; border-right-color:transparent; border-radius:var(--r-ctl); }
.seg.ghost > button.is-active { background:var(--accent-soft); }
.seg.pill { border-radius:999px; } .seg.pill > button.is-active { background:var(--ink); color:var(--paper); }
/* two page views (the page itself / Audit log) at the top left of the page; one long name shrinks with an ellipsis, never a wrapped button */
.seg.views { align-self:flex-start; max-width:100%; } .seg.views > button { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidenav { width:256px; background:var(--side); border-right:1px solid var(--border2); padding:12px; display:flex; flex-direction:column; gap:2px; }
.sidenav .brandrow { display:flex; align-items:center; gap:8px; padding:4px 10px 12px; color:var(--ink); font-family:var(--font-display); font-weight:var(--w-head); font-size:22px; }
.navitem { display:flex; align-items:center; gap:12px; height:var(--nav-h); padding:0 12px; border-radius:var(--r-ctl); font-size:16px; font-weight:500; color:var(--ink2); text-decoration:none; }
.navitem svg.i { color:var(--muted); }
.navitem:hover { background:var(--border); color:var(--ink); }
.navitem.is-active { background:var(--surface); color:var(--ink); font-weight:700; box-shadow:var(--shadow); }
.navitem.is-active svg.i { color:var(--accent); }
.navitem.is-locked { color:var(--muted); }
/* Sidebar sections (owner 2026-11-25): a quiet uppercase heading over each run of items; always shown, never collapsed. */
.navrun { display:flex; flex-direction:column; gap:2px; }
.navrun + .navrun { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.navgroup { padding:2px 12px 6px; font-size:14px; line-height:18px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.navitem .end { margin-left:auto; display:flex; align-items:center; }
.crumbs { display:flex; align-items:center; gap:6px; font-size:15px; color:var(--muted); }
.crumbs a { color:var(--muted); text-decoration:none; } .crumbs a:hover { color:var(--ink); }
.crumbs .cur { color:var(--ink); font-weight:500; }
.pager { display:flex; align-items:center; gap:4px; }
.pager > button { min-width:var(--ctl-sm); height:var(--ctl-sm); padding:0 8px; border-radius:var(--r-ctl); border:1px solid transparent; background:none; font-size:15px; font-weight:500; color:var(--ink2); cursor:pointer; font-variant-numeric:tabular-nums; }
.pager > button:hover { background:var(--surface2); }
.pager > button.is-active { background:var(--surface); border-color:var(--border2); color:var(--ink); }
.pager > button:disabled { opacity:.4; cursor:not-allowed; }
.pager .gap { color:var(--muted); padding:0 4px; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x:auto; }
table.tbl { width:100%; border-collapse:collapse; font-size:16px; }
.tbl th { background:var(--surface2); font-size:14px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--ink2); text-align:left; padding:10px 16px; white-space:nowrap; }
.tbl th .sort { display:inline-flex; align-items:center; gap:4px; cursor:pointer; }
.tbl th.sorted { color:var(--ink); }
.tbl td { padding:var(--cell-y) 16px; border-top:1px solid var(--border); height:var(--row); vertical-align:middle; }
.tbl tbody tr:hover td { background:var(--surface2); }
.tbl tbody tr.is-selected td { background:var(--accent-tint); }
.tbl tbody tr.is-current td { background:var(--accent-tint); box-shadow:inset 3px 0 0 var(--accent); }
.tbl td.num, .tbl th.num { text-align:right; font-variant-numeric:tabular-nums; }
.tbl td.muted { color:var(--muted); }
.tbl .name { font-weight:500; }
.tbl td .act { opacity:0; }
.tbl tbody tr:hover td .act, .tbl tbody tr.is-selected td .act, .tbl td .act:focus-visible { opacity:1; }
/* A row that opens its record (LinkRow): the whole row is the target, the name is the real link (keyboard,
   Ctrl-click) and a chevron at the end says the row opens, without needing hover. */
.tbl tbody tr.row-link { cursor:pointer; }
.tbl a.row-link-name { color:inherit; text-decoration:none; border-radius:var(--r-ctl); }
.tbl a.row-link-name:focus-visible { outline:none; box-shadow:0 0 0 3px var(--ring); }
.tbl td.row-link-go { width:48px; text-align:right; color:var(--muted); }
.tbl td.row-link-go .i { transform:rotate(-90deg); transition:transform var(--dur-fast) var(--ease-settle), color var(--dur-fast) var(--ease-settle); }
.tbl tbody tr.row-link:hover td.row-link-go, .tbl tbody tr.row-link:focus-within td.row-link-go { color:var(--accent); }
.tbl tbody tr.row-link:hover td.row-link-go .i { transform:translateX(3px) rotate(-90deg); }
/* Month calendar: a grid of days, not a list. No row tint — each day is its own target, and the day under the
   pointer or being pressed must look different from every other day (owner, 2026-10-14). */
.tbl.cal-grid tbody tr:hover td { background:transparent; }
.tbl.cal-grid td { padding:4px; vertical-align:top; }
.cal-day { width:100%; min-height:64px; display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:8px 10px; border:1px solid transparent; border-radius:var(--r-ctl); background:transparent; color:var(--ink2); font:inherit; text-align:left; cursor:pointer; transition:background-color var(--dur-fast) var(--ease-settle), border-color var(--dur-fast); }
.cal-day:hover { background:var(--accent-tint); border-color:var(--accent); color:var(--ink); }
.cal-day:active { background:var(--accent-soft); }
.cal-day:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--ring); }
.cal-counts { display:flex; flex-wrap:wrap; gap:4px; }
.cal-day-num { font-size:14px; line-height:20px; color:var(--muted); }
.cal-day.is-today { border-color:var(--accent-line); }
.cal-day.is-today .cal-day-num { color:var(--accent); font-weight:700; }
.cal-day.is-other-month { opacity:.45; }
.tbl-foot { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; font-size:15px; color:var(--muted); border-top:1px solid var(--border); }

/* Disclosure: a worded toggle that opens a region; the region is not rendered until opened. */
.disclosure { width:100%; height:var(--ctl); padding:0 20px; display:flex; align-items:center; gap:8px; border:0; background:transparent; color:var(--accent-soft-ink); font:inherit; font-size:16px; font-weight:500; text-align:left; cursor:pointer; transition:background-color var(--dur-fast) var(--ease-settle); }
.disclosure:hover { background:var(--accent-tint); }
.disclosure:focus-visible { outline:none; box-shadow:inset 0 0 0 3px var(--ring); }
.disclosure .i { transition:transform var(--dur) var(--ease-settle); }
.disclosure.is-open .i { transform:rotate(180deg); }

/* ---------- cards (elevated) ---------- */
.card { background:var(--surface); border:1px solid var(--border2); box-shadow:var(--shadow-md); border-radius:var(--r-card); overflow:hidden; display:flex; flex-direction:column; }
.card-head { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.card-head h3, .card-head .title { font-family:var(--font-display); font-size:20px; line-height:26px; font-weight:600; color:var(--ink); margin:0; }
.card-body { padding:20px; display:flex; flex-direction:column; gap:12px; }
.card.tint { background:var(--accent-tint); box-shadow:none; border-color:var(--accent-line); }
.stat { display:flex; flex-direction:column; gap:4px; padding:12px 20px; }
.stat .k { font-size:14px; color:var(--muted); }
.stat .v { font-family:var(--font-display); font-size:26px; line-height:30px; font-weight:var(--w-head); display:flex; align-items:baseline; gap:4px; font-variant-numeric:tabular-nums; }
.stat .v small { font-family:var(--font-ui); font-size:15px; color:var(--muted); font-weight:400; }
.stat-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); }
.stat-grid .stat { border-right:1px solid var(--border); }
.stat-grid .stat:last-child { border-right:0; }
.stat-grid + .stat-grid { border-top:1px solid var(--border); }
.list-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:12px 20px; border-top:1px solid var(--border); }
.list-row > .btn { margin-left:auto; flex-shrink:0; }
.list-row:first-child { border-top:0; }
.list-row .t { display:flex; flex-direction:column; gap:2px; flex-grow:1; min-width:0; }
.list-row .t span:first-child { font-weight:600; }
.list-row .t span:last-child { font-size:14px; font-weight:400; color:var(--muted); }
.list-row .t span:only-child { font-size:inherit; color:inherit; }
/* A row that needs action: a 3px clay edge and the words, no icon box repeated down the list. */
/* One tone system for status (owner 2026-11-25): clay "act" (needs someone to do something), slate "check" (paperwork or a
   look), olive "good" (in progress, paid), calm (nothing to say). Tone comes only from the mappings in
   lib/definitions/statuses.ts and flags.ts; a worded StatusTag always sits beside the colour, so colour is never alone.
   .tone-card is a small card (Today's attention items), .tone-edge adds the 4px edge to an existing card, list row, day
   card or table row. No tinted backgrounds: hover and selected tints stay reserved. */
.tone-act { --tone:var(--warn); }
.tone-check { --tone:var(--info); }
.tone-good { --tone:var(--accent); }
.tone-calm { --tone:var(--border2); }
.tone-list { display:flex; flex-direction:column; gap:10px; padding:16px 20px 20px; }
.tone-head { font-size:14px; line-height:18px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin-top:6px; }
.tone-head:first-child { margin-top:0; }
.tone-card { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:12px 16px 12px 14px; background:var(--surface); border:1px solid var(--border2); border-left:4px solid var(--tone, var(--border2)); border-radius:8px; box-shadow:var(--shadow); }
.tone-card > .btn { margin-left:auto; flex-shrink:0; }
.tone-card .t { display:flex; flex-direction:column; align-items:flex-start; gap:6px; flex:1 1 220px; min-width:0; }
.tone-edge { border-left:4px solid var(--tone, var(--border2)); }
.btn.tone-edge { border-left:4px solid var(--tone, var(--border2)); }
tr.tone-edge { border-left:0; }
tr.tone-edge > td:first-child { box-shadow:inset 4px 0 0 var(--tone, var(--border2)); }
/* A table row that opens its dialog when pressed anywhere; the "Change" word in it stays the keyboard path. */
tr.row-open { cursor:pointer; }
/* Dialog groups: a muted 13px heading under a divider; destructive actions sit apart in clay text. */
.dlg-section { display:flex; flex-direction:column; gap:8px; padding-top:16px; border-top:1px solid var(--border); }
.dlg-heading { font-size:13px; line-height:18px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
form > .dlg-section:first-child { border-top:0; padding-top:0; } /* the first section of a form (company settings) has nothing above it to divide from */
.btn-warn-text, .btn-warn-text:hover { color:var(--warn); }
.dlg-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; padding-top:4px; }
.dlg-foot .actions { padding-top:0; margin-left:auto; }
/* Plain "included / not included" line: a check or lock and the words, no pill. */
.check-text { display:inline-flex; align-items:center; gap:6px; color:var(--ink2); }
.check-text.is-on { color:var(--accent-soft-ink); font-weight:500; }
.check-text.is-off { color:var(--muted); }
/* A status in the words of a compact calendar card: clay text, never a pill per card. */
/* Phone: a calendar day is a real card with a heading row. */
.day-card { background:var(--surface); border:1px solid var(--border2); border-radius:var(--r-card); padding:16px; display:flex; flex-direction:column; gap:12px; }
.day-card-head { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.day-card-head .btn-link { padding:0; font-family:var(--font-display); font-size:18px; font-weight:600; }
/* Week board (a client's weekly schedule): seven plain days inside the one card, no per-day boxes. Under 900px (the board's own width) a day is one row (name, its times, Add); from 900px they are seven columns split by hairlines. */
.week-board { container-type:inline-size; }
.week-days { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.week-day { display:grid; grid-template-columns:104px minmax(0, 1fr) auto; align-items:center; gap:4px 12px; padding:8px 0; border-top:1px solid var(--border); border-radius:var(--r-ctl); }
.week-day:first-child { border-top:0; }
.week-day-head { display:flex; flex-direction:column; }
.week-day-name { font-size:14px; line-height:20px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.week-day-today { font-size:14px; line-height:20px; font-weight:600; color:var(--accent); }
.week-day.is-today .week-day-name { color:var(--accent); }
.week-slots { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:8px; }
.week-slots > .slot { flex:0 1 220px; min-width:0; }
.week-day .week-day-add { color:var(--muted); }
.week-day .week-day-add:hover, .week-day .week-day-add:focus-visible { color:var(--accent); }
.week-day.is-over { box-shadow:inset 0 0 0 2px var(--accent); }
.slot { list-style:none; margin:0; padding:0; }
.slot[draggable="true"] { cursor:grab; }
.slot.is-dragging { opacity:.45; }
.slot-chip { width:100%; min-height:44px; display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:8px 10px; text-align:left; font:inherit; font-size:16px; color:var(--ink); background:var(--surface2); border:1px solid var(--border2); border-radius:var(--r-ctl); cursor:pointer; transition:transform var(--dur) var(--ease-unfurl), box-shadow var(--dur) var(--ease-settle), border-color var(--dur-fast); }
.slot-chip:hover { transform:translateY(-2px); border-color:var(--accent); box-shadow:var(--shadow-md); }
.slot-time { font-weight:600; font-variant-numeric:tabular-nums; }
.slot-tags { display:flex; flex-wrap:wrap; gap:6px; }
.slot-tags:empty { display:none; }
/* Phone: the name and Add share a line, the times sit under them; an empty day stays one short line. */
@container (max-width:559px) {
  .week-day { grid-template-columns:minmax(0, 1fr) auto; }
  .week-day-head { flex-direction:row; align-items:baseline; gap:8px; }
  .week-day-body { grid-column:1 / -1; grid-row:2; }
  .week-day-body:empty { display:none; }
  .week-slots > .slot { flex:1 1 100%; }
}
@container (min-width:900px) {
  .week-days { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); }
  .week-day { display:flex; flex-direction:column; align-items:stretch; gap:8px; padding:2px 12px 4px; border-top:0; border-left:1px solid var(--border); border-radius:0; }
  .week-day:first-child { border-left:0; padding-left:0; }
  .week-day:last-child { padding-right:0; }
  .week-day-head { flex-direction:row; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:0 6px; }
  .week-day-body { flex:1; min-height:48px; }
  .week-slots { flex-direction:column; flex-wrap:nowrap; }
  .week-slots > .slot { flex:none; }
  .week-day .week-day-add { align-self:flex-start; }
}
/* "Add a time" dialog: seven day toggles in one .seg row, Start and End side by side (stacked under 400px), a worded Disclosure for the rest. */
.seg.days { display:flex; width:100%; }
.seg.days > button { flex:1 1 0; min-width:0; padding:0; }
.time-row { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
@media (max-width: 399px) { .time-row { grid-template-columns:minmax(0, 1fr); } }
.time-form .disclosure { padding:0; }
.list-row.hl { background:var(--accent-tint); }
.suggest { display:flex; flex-direction:column; }
.suggest-row { display:flex; flex-wrap:wrap; align-items:flex-start; gap:12px; padding:12px 0; border-top:1px solid var(--border); }
.suggest-row:first-child { border-top:0; }
.suggest-main { display:flex; flex-direction:column; gap:6px; flex:1 1 240px; min-width:0; }
.suggest-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.suggest-name { font-size:16px; font-weight:600; }
.suggest-notes { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; font-size:14px; line-height:20px; color:var(--ink2); }
.suggest-notes li { display:flex; align-items:flex-start; gap:6px; }
.suggest-notes li .i { margin-top:2px; flex-shrink:0; }
.suggest-more { align-self:flex-start; min-height:36px; padding:0; }
.suggest-notes .ok .i { color:var(--accent); }
.suggest-notes .warn { color:var(--warn); }
.suggest-row > .btn { flex-shrink:0; margin-left:auto; }
@media (max-width: 899px) { .suggest-row > .btn { width:100%; margin-left:0; } }
html[data-layout="narrow"] .suggest-row > .btn { width:100%; margin-left:0; }
.suggest-score { display:flex; align-items:center; gap:10px; font-size:14px; line-height:20px; color:var(--ink2); font-variant-numeric:tabular-nums; }
.suggest-score .progress { width:120px; flex:none; }
.suggest-row > .tag { flex-shrink:0; margin-left:auto; align-self:center; }
.sched { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.3fr); gap:24px; align-items:start; }
.sched-col { min-width:0; }
.sched-back { display:none; }
.sched-day { margin:0; padding:8px 20px; font-size:14px; line-height:20px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--ink2); background:var(--surface2); border-top:1px solid var(--border); }
.pick-list { list-style:none; margin:0; padding:0; }
.pick-row { display:flex; align-items:center; gap:8px; padding-right:12px; border-top:1px solid var(--border); }
.pick-main { flex:1; min-width:0; min-height:52px; display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; padding:10px 20px; text-align:left; font:inherit; font-size:16px; color:var(--ink); background:transparent; border:0; cursor:pointer; }
.pick-main:hover { background:var(--surface2); }
.pick-main:focus-visible { outline:none; box-shadow:inset 0 0 0 3px var(--ring); }
.pick-row.is-current { background:var(--accent-tint); box-shadow:inset 3px 0 0 var(--accent); }
.pick-row.is-current .pick-main:hover { background:transparent; }
.sched-clients .pick-main > :last-child { margin-left:auto; }
@media (max-width: 899px) {
  .sched { grid-template-columns:minmax(0, 1fr); }
  .sched-back { display:inline-flex; }
  .sched[data-step="clients"] > .sched-col:not(.sched-clients), .sched[data-step="times"] > .sched-col:not(.sched-times), .sched[data-step="matches"] > .sched-col:not(.sched-matches) { display:none; }
}
html[data-layout="narrow"] .sched { grid-template-columns:minmax(0, 1fr); }
html[data-layout="narrow"] .sched-back { display:inline-flex; }
html[data-layout="narrow"] .sched[data-step="clients"] > .sched-col:not(.sched-clients), html[data-layout="narrow"] .sched[data-step="times"] > .sched-col:not(.sched-times), html[data-layout="narrow"] .sched[data-step="matches"] > .sched-col:not(.sched-matches) { display:none; }
.iconbox { width:36px; height:36px; border-radius:var(--r-md); background:var(--accent-soft); color:var(--accent-soft-ink); display:grid; place-content:center; flex-shrink:0; }
.iconbox.warn { background:var(--warn-soft); color:var(--warn); }
.iconbox.info { background:var(--info-soft); color:var(--info); }
.iconbox.lg { width:44px; height:44px; }
.mod { display:flex; flex-direction:column; gap:12px; padding:20px; min-height:150px; }
.mod .top { display:flex; justify-content:space-between; align-items:flex-start; }
.mod .n { font-size:17px; font-weight:600; }
.mod .d { font-size:15px; line-height:22px; color:var(--ink2); flex-grow:1; }
.mod .ft { display:flex; justify-content:space-between; align-items:center; font-size:15px; color:var(--muted); }

/* ---------- overlays ---------- */
.menu { min-width:224px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-lg); padding:6px; display:flex; flex-direction:column; gap:1px; }
.menu-item { display:flex; align-items:center; gap:12px; height:44px; padding:0 12px; border-radius:var(--r-ctl); font-size:16px; color:var(--ink); cursor:pointer; background:none; border:0; text-align:left; width:100%; text-decoration:none; }
.menu-item:hover, .menu-item:focus-visible { background:var(--surface2); outline:none; }
.menu-item svg.i { color:var(--muted); }
.menu-item .kbd { margin-left:auto; font-family:var(--font-mono); font-size:14px; color:var(--muted); }
.menu-item.danger { color:var(--warn); } .menu-item.danger svg.i { color:var(--warn); }
.menu-sep { height:1px; background:var(--border); margin:5px 4px; }
.menu-label { font-size:14px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); padding:6px 10px 4px; }
.scrim { position:fixed; inset:0; background:var(--scrim); display:flex; align-items:center; justify-content:center; padding:24px; z-index:50; }
.dialog { width:480px; max-width:100%; max-height:calc(100dvh / var(--zoom, 1)); overflow-y:auto; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); box-shadow:var(--shadow-lg); padding:24px; display:flex; flex-direction:column; gap:16px; }
/* the title and a worded Close stay in view while a long dialog scrolls */
.dialog-head { position:sticky; top:-24px; z-index:1; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin:-24px -24px 0; padding:20px 24px 12px; background:var(--surface); border-bottom:1px solid var(--border); }
.dialog-head h3 { min-width:0; flex:1; } .dialog-close { flex-shrink:0; }
.dialog h3, .dialog .title { font-family:var(--font-display); font-size:26px; font-weight:var(--w-head); line-height:32px; margin:0; }
.dialog p { color:var(--ink2); margin:0; }
.dialog .actions { display:flex; justify-content:flex-end; gap:8px; padding-top:4px; }
/* a document viewer dialog: wider than a question dialog, with the file shown in a fixed-height frame (no layout shift) */
.dialog.dialog-wide { width:760px; }
.doc-preview { width:100%; height:min(60dvh, 560px); border:1px solid var(--border2); border-radius:var(--r-ctl); background:var(--surface2); display:flex; align-items:center; justify-content:center; text-align:center; padding:0; overflow:hidden; color:var(--ink2); }
.doc-preview iframe { width:100%; height:100%; border:0; background:var(--surface); }
.doc-preview img { max-width:100%; max-height:100%; object-fit:contain; }
.doc-preview .doc-note { padding:24px; }
/* a place to drop files: no frame at rest (its hint says files can be dropped), dashed accent while a file is held over it (a drag, never a hover) */
.dropzone { display:flex; flex-direction:column; gap:16px; padding:16px; border:2px dashed transparent; border-radius:var(--r-card); }
.dropzone.is-over { border-color:var(--accent); background:var(--accent-tint); }
.tip { display:inline-block; background:var(--tip-bg); color:var(--tip-ink); font-size:14px; line-height:20px; padding:6px 8px; border-radius:var(--r-ctl); position:relative; }
.tip::after { content:""; position:absolute; left:50%; bottom:-4px; width:8px; height:8px; background:var(--tip-bg); transform:translateX(-50%) rotate(45deg); }
.popover { width:280px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-lg); padding:16px; display:flex; flex-direction:column; gap:10px; }

/* ---------- misc ---------- */
/* one size scale by context: xs 32 chips and tight inline rows, 40 list rows, lg 48 card and dialog headers, xl 56 page headers */
.avatar { width:40px; height:40px; border-radius:999px; background:var(--accent-line); color:var(--accent-soft-ink); font-size:16px; font-weight:600; display:inline-grid; place-content:center; flex-shrink:0; }
.avatar.xs { width:32px; height:32px; font-size:14px; } .avatar.lg { width:48px; height:48px; font-size:16px; } .avatar.xl { width:56px; height:56px; font-size:18px; }
.avatar.online { position:relative; } .avatar.online::after { content:""; position:absolute; right:-1px; bottom:-1px; width:9px; height:9px; border-radius:999px; background:var(--accent); border:2px solid var(--surface); }
.avstack { display:flex; } .avstack .avatar { border:2px solid var(--surface); margin-left:-8px; } .avstack .avatar:first-child { margin-left:0; }
/* person label (photo + name + optional address) and person picker */
.avatar img { width:100%; height:100%; border-radius:999px; object-fit:cover; display:block; }
.person { display:inline-flex; align-items:center; gap:10px; min-width:0; max-width:100%; } .person-sm { gap:8px; } .person-lg { gap:12px; } .person-xl { gap:16px; }
.person-text { display:flex; flex-direction:column; min-width:0; line-height:1.3; }
.person-name { font-size:16px; font-weight:500; color:var(--ink); overflow-wrap:break-word; }
.card-head h3 .person-name, .dialog h3 .person-name, .page-head h1 .person-name { font:inherit; color:inherit; }
.card-head h3 .person-sub, .dialog h3 .person-sub, .page-head h1 .person-sub { font:400 14px/20px var(--font-ui); letter-spacing:0; } /* a person as a card, dialog or page title keeps the title look */
.person-sub { font-size:14px; line-height:20px; color:var(--muted); overflow-wrap:break-word; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.picker-trigger { display:flex; align-items:center; justify-content:space-between; gap:12px; height:auto; min-height:var(--ctl); padding-top:6px; padding-bottom:6px; text-align:left; cursor:pointer; }
.picker-trigger > svg.i { color:var(--muted); flex-shrink:0; }
.picker-value { display:flex; flex-direction:column; gap:6px; min-width:0; flex:1; }
.picker-placeholder { color:var(--muted); }
.picker-list { display:flex; flex-direction:column; gap:2px; overflow-y:auto; min-height:0; max-height:min(420px, 50dvh); }
.picker-row { display:flex; align-items:center; gap:12px; min-height:52px; padding:6px 12px; border-radius:var(--r-ctl); cursor:pointer; }
.picker-row .person { flex:1; }
.picker-row > svg.i { color:var(--accent); flex-shrink:0; margin-left:auto; }
.picker-row:hover, .picker-row.is-active { background:var(--surface2); }
.picker-row.is-active { box-shadow:inset 3px 0 0 var(--accent); }
.picker-row.is-selected { background:var(--accent-tint); }
.picker-row .check { pointer-events:none; }
.empty { display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; padding:40px 24px; border:1px dashed var(--border2); border-radius:var(--r-card); }
.empty svg.i { color:var(--muted); }
.empty h3 { font-family:var(--font-display); font-size:24px; font-weight:var(--w-head); margin:0; }
.empty p { color:var(--muted); max-width:320px; margin:0; }
.skel { background:linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%); background-size:200% 100%; animation:shimmer 1.4s linear infinite; border-radius:4px; height:12px; }
@keyframes shimmer { to { background-position:-200% 0; } }
.kv { display:grid; grid-template-columns:150px minmax(0,1fr); gap:8px 16px; font-size:16px; margin:0; }
.kv dt { color:var(--muted); } .kv dd { margin:0; }

/* ---------- app shell ---------- */
.shell { display:flex; min-height:100vh; background:var(--paper); }
.shell > .sidenav { flex-shrink:0; padding:20px 16px; }
.shell-main { flex-grow:1; display:flex; flex-direction:column; min-width:0; }
.topbar { height:56px; flex-shrink:0; background:var(--surface); border-bottom:1px solid var(--border2); display:flex; align-items:center; justify-content:space-between; padding:0 24px; gap:16px; }
.page { padding:28px 32px; display:flex; flex-direction:column; gap:24px; width:100%; max-width:1184px; } /* 1120px of content, left-aligned beside the sidebar: short eye travel on a wide screen */
.page-head { display:flex; align-items:flex-end; gap:16px; margin-bottom:8px; }
.page-title { min-width:0; } /* actions stay beside the title, not at the far edge */
.page-actions { justify-content:flex-end; }

/* ---------- mobile (phone and tablet browsers are first-class) ---------- */
.tabbar { display:none; }
@media (max-width: 899px) {
  .shell { flex-direction:column; min-height:calc(100dvh / var(--zoom, 1)); }
  .shell > .sidenav { display:none; }
  .shell-main { padding-bottom:calc(92px + env(safe-area-inset-bottom)); }
  .btn-sm, .seg.sm { height:var(--ctl); }
  .topbar { padding:0 16px; }
  .page { padding:16px; gap:16px; }
  /* phones: Refresh sits level with "Updated 2 min ago", the title below it, the page's actions in one row under that */
  .page-head { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; row-gap:8px; }
  .page-title { display:contents; } .page-title > .t-meta { grid-area:1 / 1; } .page-title > h1 { grid-area:2 / 1 / 3 / 3; } .page-actions { grid-area:3 / 1 / 4 / 3; justify-content:flex-start; } .page-refresh { grid-area:1 / 2; }
  .seg.views { display:flex; width:100%; } .seg.views > button { flex:1 1 0; }
  .cols { grid-template-columns:1fr; }
  .stat-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .dialog { width:100%; max-width:none; height:calc(100dvh / var(--zoom, 1)); border-radius:0; justify-content:flex-start; overflow-y:auto; }
  .shift-actions { flex-direction:column; align-items:stretch; }
  .scrim { padding:0; overflow:auto; }
  .picker-list { max-height:none; }
  .tabbar { position:fixed; left:0; right:0; bottom:0; z-index:40; display:grid; grid-template-columns:repeat(auto-fit, minmax(0,1fr)); height:calc(84px + env(safe-area-inset-bottom)); padding:6px 2px env(safe-area-inset-bottom); background:var(--surface); border-top:1px solid var(--border); }
  .tabbar a { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:48px; font-size:14px; font-weight:500; color:var(--muted); text-decoration:none; border-radius:var(--r-ctl); padding:0; }
  .tabbar a > .tab-label { max-width:100%; overflow-wrap:normal; letter-spacing:-.02em; word-break:normal; hyphens:none; text-align:center; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  .tabbar a svg.i { width:22px; height:22px; }
  .tabbar a.is-active { color:var(--ink); font-weight:600; }
  .tabbar a.is-active > .tab-label { font-weight:500; }
  .tabbar a.is-active svg.i { color:var(--accent-soft-ink); }
  .tabbar .tab-icon { position:relative; display:inline-flex; align-items:center; justify-content:center; padding:2px 14px; border-radius:999px; transition:background-color var(--dur-fast) var(--ease-settle); }
  .tabbar a.is-active .tab-icon { background:var(--accent-soft); }
  .tabbar .count { position:absolute; top:-10px; left:100%; margin-left:-12px; min-width:22px; height:22px; padding:0 6px; font-size:14px; }
  /* tables: stack rows as cards; a <td data-label="…"> shows its label */
  .tbl.tbl-stack, .tbl.tbl-stack thead, .tbl.tbl-stack tbody, .tbl.tbl-stack tr, .tbl.tbl-stack td { display:block; }
  .tbl.tbl-stack thead { display:none; }
  .tbl.tbl-stack tr { padding:8px 16px; border-top:1px solid var(--border); }
  .tbl.tbl-stack td { height:auto; padding:4px 0; border:0; display:flex; justify-content:space-between; gap:12px; }
  .tbl.tbl-stack td[data-label]::before { content:attr(data-label); font-size:14px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
  .tbl.tbl-stack td .act { opacity:1; }
  .tbl.tbl-stack tr.row-link { position:relative; padding-right:48px; }
  .tbl.tbl-stack td.row-link-go { position:absolute; right:12px; top:50%; transform:translateY(-50%); width:auto; padding:0; }
  .input { font-size:16px; } /* 16px stops iOS zooming into fields */
  .btn { min-height:44px; }
}
/* same phone arrangement when the text size makes a wide screen effectively narrow */
html[data-layout="narrow"] .shell { flex-direction:column; min-height:calc(100dvh / var(--zoom, 1)); }
html[data-layout="narrow"] .shell > .sidenav { display:none; }
html[data-layout="narrow"] .shell-main { padding-bottom:calc(92px + env(safe-area-inset-bottom)); }
html[data-layout="narrow"] .btn-sm, html[data-layout="narrow"] .seg.sm { height:var(--ctl); }
html[data-layout="narrow"] .topbar { padding:0 16px; }
html[data-layout="narrow"] .page { padding:16px; gap:16px; }
html[data-layout="narrow"] .page-head { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; row-gap:8px; }
html[data-layout="narrow"] .page-title { display:contents; } html[data-layout="narrow"] .page-title > .t-meta { grid-area:1 / 1; } html[data-layout="narrow"] .page-title > h1 { grid-area:2 / 1 / 3 / 3; } html[data-layout="narrow"] .page-actions { grid-area:3 / 1 / 4 / 3; justify-content:flex-start; } html[data-layout="narrow"] .page-refresh { grid-area:1 / 2; }
html[data-layout="narrow"] .seg.views { display:flex; width:100%; } html[data-layout="narrow"] .seg.views > button { flex:1 1 0; }
html[data-layout="narrow"] .cols { grid-template-columns:1fr; }
html[data-layout="narrow"] .stat-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
html[data-layout="narrow"] .dialog { width:100%; max-width:none; height:calc(100dvh / var(--zoom, 1)); border-radius:0; justify-content:flex-start; overflow-y:auto; }
html[data-layout="narrow"] .shift-actions { flex-direction:column; align-items:stretch; }
html[data-layout="narrow"] .scrim { padding:0; overflow:auto; }
html[data-layout="narrow"] .picker-list { max-height:none; }
html[data-layout="narrow"] .tabbar { position:fixed; left:0; right:0; bottom:0; z-index:40; display:grid; grid-template-columns:repeat(auto-fit, minmax(0,1fr)); height:calc(84px + env(safe-area-inset-bottom)); padding:6px 2px env(safe-area-inset-bottom); background:var(--surface); border-top:1px solid var(--border); }
html[data-layout="narrow"] .tabbar a { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:48px; font-size:14px; font-weight:500; color:var(--muted); text-decoration:none; border-radius:var(--r-ctl); padding:0; }
html[data-layout="narrow"] .tabbar a > .tab-label { max-width:100%; overflow-wrap:normal; letter-spacing:-.02em; word-break:normal; hyphens:none; text-align:center; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
html[data-layout="narrow"] .tabbar a svg.i { width:22px; height:22px; }
html[data-layout="narrow"] .tabbar a.is-active { color:var(--ink); font-weight:600; }
html[data-layout="narrow"] .tabbar a.is-active > .tab-label { font-weight:500; }
html[data-layout="narrow"] .tabbar a.is-active svg.i { color:var(--accent-soft-ink); }
html[data-layout="narrow"] .tabbar .tab-icon { position:relative; display:inline-flex; align-items:center; justify-content:center; padding:2px 14px; border-radius:999px; transition:background-color var(--dur-fast) var(--ease-settle); }
html[data-layout="narrow"] .tabbar a.is-active .tab-icon { background:var(--accent-soft); }
html[data-layout="narrow"] .tabbar .count { position:absolute; top:-10px; left:100%; margin-left:-12px; min-width:22px; height:22px; padding:0 6px; font-size:14px; }
html[data-layout="narrow"] .tbl.tbl-stack, html[data-layout="narrow"] .tbl.tbl-stack thead, html[data-layout="narrow"] .tbl.tbl-stack tbody, html[data-layout="narrow"] .tbl.tbl-stack tr, html[data-layout="narrow"] .tbl.tbl-stack td { display:block; }
html[data-layout="narrow"] .tbl.tbl-stack thead { display:none; }
html[data-layout="narrow"] .tbl.tbl-stack tr { padding:8px 16px; border-top:1px solid var(--border); }
html[data-layout="narrow"] .tbl.tbl-stack td { height:auto; padding:4px 0; border:0; display:flex; justify-content:space-between; gap:12px; }
html[data-layout="narrow"] .tbl.tbl-stack td[data-label]::before { content:attr(data-label); font-size:14px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
html[data-layout="narrow"] .tbl.tbl-stack td .act { opacity:1; }
html[data-layout="narrow"] .tbl.tbl-stack tr.row-link { position:relative; padding-right:48px; }
html[data-layout="narrow"] .tbl.tbl-stack td.row-link-go { position:absolute; right:12px; top:50%; transform:translateY(-50%); width:auto; padding:0; }
html[data-layout="narrow"] .input { font-size:16px; } /* 16px stops iOS zooming into fields */
html[data-layout="narrow"] .btn { min-height:44px; }

/* ---------- paper-style form (.sheet): a form filled in like a printed page ---------- */
/* One centred sheet on the page ground; a letterhead (new forms), numbered parts, ruled label|field cells, and a
   footer bar that sticks to the bottom of the screen and says whether anything is saved. */
.sheet-form[data-dirty] { gap:16px; width:100%; max-width:860px; margin-inline:auto; }
.sheet { background:var(--surface); border:1px solid var(--border2); box-shadow:var(--shadow-md); border-radius:var(--r-sm); overflow:hidden; }
.sheet-head { display:flex; flex-direction:column; gap:6px; padding:24px 20px 20px; border-bottom:3px double var(--border2); }
.sheet-org { font-family:var(--font-display); font-size:17px; line-height:24px; font-weight:600; color:var(--ink2); }
.sheet-title { font-family:var(--font-display); font-size:28px; line-height:34px; font-weight:600; color:var(--ink); margin:0; }
.sheet-date { font-size:16px; color:var(--ink2); }
.sheet-note { font-size:16px; line-height:24px; color:var(--ink2); margin:0; }
.sheet-note .req { color:var(--warn); }
.sheet-part + .sheet-part, .sheet-head + .sheet-part { border-top:0; }
.sheet-part-head { display:flex; align-items:center; gap:12px; padding:12px 20px; background:var(--surface2); border-top:1px solid var(--border2); border-bottom:1px solid var(--border2); }
.sheet-head + .sheet-part > .sheet-part-head { border-top:0; }
.sheet-num { flex:none; width:32px; height:32px; display:inline-grid; place-content:center; border-radius:999px; background:var(--accent-soft); color:var(--accent-soft-ink); font-weight:600; }
.sheet-part-head h3 { font-family:var(--font-display); font-size:20px; line-height:26px; font-weight:600; color:var(--ink); margin:0; }
.sheet-part-tags { margin-left:auto; display:flex; align-items:center; gap:8px; }
/* the 1px gaps over a border-coloured ground draw the ruling between boxes; each field is one ruled box
   (label top-left, control filling it). Controls are 100% of the box's inner width, so padding sits on the box, never as a margin on the control. */
.sheet-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:1px; background:var(--border); }
.sheet-grid > * { min-width:0; }
.sheet-grid > .field, .sheet-grid > .sheet-row { background:var(--surface); }
.sheet-grid > .field { padding:12px 16px 16px; gap:6px; scroll-margin-bottom:120px; }
.sheet-grid .field > .label { display:block; }
.sheet-grid .field > .label .optional { margin-left:4px; }
.sheet-grid .field > .input { max-width:100%; }
.sheet-row { padding:14px 16px; }
.sheet-row-flush { padding:0; }
.sheet-row-flush > .disclosure { padding-inline:16px; }
.sheet-row-flush [role="region"] > .sheet-grid { border-top:1px solid var(--border); }
.sheet-pairs > .field:last-child:nth-child(odd) { grid-column:1 / -1; }
.sheet-danger { padding:16px 20px; border-top:1px solid var(--border2); display:flex; }
.sheet-foot { position:sticky; bottom:16px; z-index:5; display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; padding:12px 16px; background:var(--surface); border:1px solid var(--border2); border-radius:var(--r-card); box-shadow:var(--shadow-md); }
.sheet-aside { width:100%; max-width:860px; margin-inline:auto; }
.sheet-status { font-size:16px; color:var(--ink2); }
.sheet-foot .summary { flex:1 1 220px; }
.sheet-foot-top { display:contents; }
.sheet-foot-top > .btn { order:2; margin-left:auto; }
.sheet-foot .summary { order:1; }
.sheet-foot-actions { order:3; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
/* two or three boxes per row once the effective width allows (the narrow arrangement stacks every box full width) */
@media (min-width: 900px) {
  html:not([data-layout="narrow"]) .sheet-head { padding:24px 32px 20px; }
  html:not([data-layout="narrow"]) .sheet-grid { grid-template-columns:repeat(12, minmax(0,1fr)); }
  html:not([data-layout="narrow"]) .sheet-grid > .field, html:not([data-layout="narrow"]) .sheet-grid > .sheet-row { grid-column:span 6; }
  html:not([data-layout="narrow"]) .sheet-grid > .sheet-w5 { grid-column:span 5; }
  html:not([data-layout="narrow"]) .sheet-grid > .sheet-w4 { grid-column:span 4; }
  html:not([data-layout="narrow"]) .sheet-grid > .sheet-w3 { grid-column:span 3; }
  html:not([data-layout="narrow"]) .sheet-grid > .sheet-full { grid-column:1 / -1; }
  html:not([data-layout="narrow"]) .sheet-pairs > .field:last-child:nth-child(odd) { grid-column:1 / -1; }
}
/* phones: two rows — the status with Cancel on the right, then the buttons side by side */
@media (max-width: 899px) {
  .sheet-form[data-dirty] { gap:12px; }
  .sheet-foot { bottom:calc(84px + env(safe-area-inset-bottom) + 8px); flex-direction:column; align-items:stretch; flex-wrap:nowrap; gap:4px; padding:4px 16px 12px; }
  .sheet-foot-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .sheet-foot-top > .btn { margin-left:0; }
  .sheet-status { font-size:14px; line-height:20px; }
  .sheet-foot .summary { flex:none; }
  .sheet-foot-actions { width:100%; flex-wrap:nowrap; justify-content:stretch; }
  .sheet-foot-actions > .btn { flex:1 1 0; min-height:44px; }
}
html[data-layout="narrow"] .sheet-form[data-dirty] { gap:12px; }
html[data-layout="narrow"] .sheet-foot { bottom:calc(84px + env(safe-area-inset-bottom) + 8px); flex-direction:column; align-items:stretch; flex-wrap:nowrap; gap:4px; padding:4px 16px 12px; }
html[data-layout="narrow"] .sheet-foot-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
html[data-layout="narrow"] .sheet-foot-top > .btn { margin-left:0; }
html[data-layout="narrow"] .sheet-status { font-size:14px; line-height:20px; }
html[data-layout="narrow"] .sheet-foot .summary { flex:none; }
html[data-layout="narrow"] .sheet-foot-actions { width:100%; flex-wrap:nowrap; justify-content:stretch; }
html[data-layout="narrow"] .sheet-foot-actions > .btn { flex:1 1 0; min-height:44px; }

/* ==========================================================================
   MOTION — "things grow". Arbor's motion borrows from how plants move: unfurl, settle, sway once, ripple out.
   Slow enough to notice, never slow enough to wait for. Four durations, four easings, nothing loops except loading.
   Reduced-motion turns all of it off (rule near the top of the file).
   ========================================================================== */
:root {
  --dur-fast:200ms;   /* hover, press, focus colour */
  --dur:380ms;        /* state changes: checks, pills, tabs, rows */
  --dur-slow:640ms;   /* arrivals: page sections, dialogs, form steps */
  --dur-grand:900ms;  /* signature moments: the leaf, a completed photo, an account created */
  --ease-unfurl:cubic-bezier(.16,1,.3,1);     /* fast start, long soft settle: things arriving */
  --ease-sway:cubic-bezier(.34,1.56,.64,1);   /* overshoot and return: confirmations */
  --ease-sink:cubic-bezier(.7,0,.84,0);       /* things leaving */
  --ease-settle:cubic-bezier(.22,1,.36,1);    /* colour and size changes */
}

/* ---- the leaf: grows from its stem on every page, rustles when you hover the brand ---- */
@keyframes leaf-grow { 0% { opacity:0; transform:scale(.4) rotate(-22deg); } 55% { opacity:1; transform:scale(1.12) rotate(4deg); } 100% { opacity:1; transform:scale(1) rotate(0); } }
@keyframes rustle { 0%,100% { transform:rotate(0); } 25% { transform:rotate(-9deg); } 50% { transform:rotate(7deg); } 75% { transform:rotate(-3deg); } }
.brand svg.i, .brandrow svg.i { transform-origin:22% 88%; animation:leaf-grow var(--dur-grand) var(--ease-sway) both; }
.brand:hover svg.i, .brandrow:hover svg.i { animation:rustle 700ms var(--ease-unfurl); }

/* ---- page arrival: sections unfurl from the top edge, one after another, then everything holds still ---- */
@keyframes unfurl { 0% { opacity:0; transform:translateY(18px) scale(.985); clip-path:inset(0 0 14% 0 round 10px); } 55% { clip-path:inset(0 0 0 0 round 10px); } 100% { opacity:1; transform:none; clip-path:inset(0 0 0 0 round 10px); } }
.page > * { animation:unfurl var(--dur-slow) var(--ease-unfurl) both; }
.page > :nth-child(2) { animation-delay:70ms; } .page > :nth-child(3) { animation-delay:140ms; } .page > :nth-child(4) { animation-delay:210ms; }
.page > :nth-child(5) { animation-delay:280ms; } .page > :nth-child(n+6) { animation-delay:350ms; }
.page > .banner { animation-name:drop-in; }

/* ---- buttons: lift on hover, give under the finger, and a soft ring spreads out from the press ---- */
.btn { position:relative; overflow:hidden; transition:background-color var(--dur-fast) var(--ease-settle), border-color var(--dur-fast), box-shadow var(--dur-fast) var(--ease-settle), color var(--dur-fast), transform var(--dur-fast) var(--ease-sway); }
.btn:not(.btn-link):not(:disabled):hover { transform:translateY(-1px); }
.btn:not(.btn-link):not(:disabled):active { transform:translateY(0) scale(.96); transition-duration:80ms; }
.btn-primary:not(:disabled):hover { box-shadow:0 6px 16px -6px var(--accent); }
.btn:not(.btn-link)::after { content:""; position:absolute; inset:0; border-radius:inherit; background:radial-gradient(circle, rgba(255,255,255,.45) 0 30%, transparent 31%); transform:scale(0); opacity:0; transition:transform 700ms var(--ease-unfurl), opacity 900ms ease-out; pointer-events:none; }
.btn:not(.btn-link):active::after { transform:scale(0); opacity:.6; transition:none; }
.btn:not(.btn-link):not(:active)::after { transform:scale(3.2); opacity:0; }
.btn svg.i { transition:transform var(--dur-fast) var(--ease-sway); }
.btn:hover svg.i:last-child:not(:first-child) { transform:translateX(3px); }
.btn-link { transition:color var(--dur-fast); }
.btn-link::after { content:""; display:block; height:1.5px; background:currentColor; transform:scaleX(0); transform-origin:left; transition:transform var(--dur) var(--ease-unfurl); }
.btn-link:hover { text-decoration:none; } .btn-link:hover::after { transform:scaleX(1); }

/* ---- inputs: the focus ring blooms outward and settles; an invalid field nudges twice and glows warm; the message grows down from under it ---- */
.input { transition:border-color var(--dur-fast), background-color var(--dur) var(--ease-settle), box-shadow var(--dur) var(--ease-settle); }
@keyframes bloom { 0% { box-shadow:0 0 0 0 var(--ring); } 60% { box-shadow:0 0 0 6px var(--ring); } 100% { box-shadow:0 0 0 3px var(--ring); } }
.input:focus { animation:bloom 480ms var(--ease-unfurl) both; }
@keyframes nudge { 0%,100% { transform:translateX(0); } 15% { transform:translateX(-8px); } 35% { transform:translateX(7px); } 55% { transform:translateX(-4px); } 75% { transform:translateX(2px); } }
@keyframes warn-bloom { 0% { box-shadow:0 0 0 0 var(--warn-soft); } 40% { box-shadow:0 0 0 10px var(--warn-soft); } 100% { box-shadow:0 0 0 3px var(--warn-soft); } }
.input.shake { animation:nudge 520ms var(--ease-unfurl), warn-bloom 800ms var(--ease-unfurl); }
.check.shake, .radio.shake { animation:nudge 520ms var(--ease-unfurl); }
@keyframes grow-down { 0% { opacity:0; transform:translateY(-8px); max-height:0; } 100% { opacity:1; transform:none; max-height:120px; } }
.help.err { overflow:hidden; animation:grow-down 480ms var(--ease-unfurl) both; }
.summary { animation:unfurl var(--dur-slow) var(--ease-unfurl) both; }
.label { transition:color var(--dur-fast); }
.field:focus-within > .label { color:var(--accent-soft-ink); }

/* ---- checks: the box fills from the bottom like water, then the mark springs in; the radio dot blooms; the switch knob swings with a little overshoot ---- */
.check { background-image:linear-gradient(var(--accent), var(--accent)); background-repeat:no-repeat; background-size:100% 0%; background-position:bottom; transition:background-size 360ms var(--ease-unfurl), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.check:checked, .check:indeterminate { background-color:var(--surface); background-image:linear-gradient(var(--accent), var(--accent)); background-size:100% 100%; }
.check::before { transition:transform var(--dur) var(--ease-sway); }
.check:checked::before, .check:indeterminate::before { transition-delay:140ms; }
.radio::before { transition:transform var(--dur) var(--ease-sway); }
.switch { transition:background-color var(--dur) var(--ease-settle); }
.switch::before { transition:transform var(--dur) var(--ease-sway); }
.switch:active::before { transform:scaleX(1.25); }
.switch:checked:active::before { transform:translateX(20px) scaleX(1.25); }

/* ---- checklist: a line is drawn through the finished task while the row glows once and settles ---- */
.checklist .item { transition:background-color var(--dur) var(--ease-settle); }
.checklist .item .t { position:relative; transition:color var(--dur-slow); }
.checklist .item .t::after { content:""; position:absolute; left:0; top:calc(50% - 1px); height:1.5px; width:0; background:var(--muted); transition:width var(--dur-slow) var(--ease-unfurl); }
.checklist .item.done .t { text-decoration:none; }
.checklist .item.done .t::after { width:100%; }
@keyframes glow-once { 0% { background-color:var(--accent-soft); } 100% { background-color:transparent; } }
.checklist .item.done { animation:glow-once 1400ms var(--ease-settle) both; }

/* ---- tags and counts: a new status sprouts from its stem with a small overshoot; a changed count swells and settles ---- */
.tag { transition:background-color var(--dur) var(--ease-settle), color var(--dur); }
@keyframes sprout { 0% { opacity:0; transform:scale(.3) rotate(-10deg); } 65% { opacity:1; transform:scale(1.08) rotate(2deg); } 100% { opacity:1; transform:scale(1) rotate(0); } }
.tag.is-new { transform-origin:left bottom; animation:sprout 560ms var(--ease-sway) both; }
@keyframes swell { 0% { transform:scale(1); } 35% { transform:scale(1.45); background-color:var(--accent); color:var(--on-accent); } 70% { transform:scale(.94); } 100% { transform:scale(1); } }
.count.is-bumped { animation:swell 700ms var(--ease-sway); }
.count { transition:background-color var(--dur), color var(--dur); }

/* ---- alerts, toasts, banners: an alert unfolds from its top edge; a critical one pulses twice; toasts rise and settle; the update banner drops in and bounces once ---- */
@keyframes unfold { 0% { opacity:0; transform:translateY(-6px); clip-path:inset(0 0 100% 0 round 8px); } 100% { opacity:1; transform:none; clip-path:inset(0 0 0 0 round 8px); } }
.alert { animation:unfold 520ms var(--ease-unfurl) both; }
@keyframes edge-pulse { 0% { box-shadow:0 0 0 0 var(--warn-soft); } 70% { box-shadow:0 0 0 10px transparent; } 100% { box-shadow:0 0 0 0 transparent; } }
.alert-critical { animation:unfold 520ms var(--ease-unfurl) both, edge-pulse 1100ms var(--ease-unfurl) 400ms 2; }
@keyframes toast-in { 0% { opacity:0; transform:translateY(28px) scale(.9); } 65% { opacity:1; transform:translateY(-4px) scale(1.02); } 100% { opacity:1; transform:none; } }
@keyframes toast-out { to { opacity:0; transform:translateY(16px) scale(.96); } }
.toast { animation:toast-in var(--dur-slow) var(--ease-unfurl) both; }
.toast svg.i { animation:sprout 480ms var(--ease-sway) 260ms both; }
.toast.is-leaving { animation:toast-out 320ms var(--ease-sink) both; }
@keyframes drop-in { 0% { opacity:0; transform:translateY(-22px); } 60% { opacity:1; transform:translateY(4px); } 100% { opacity:1; transform:none; } }
.banner { animation:drop-in var(--dur-slow) var(--ease-unfurl) both; }
.progress > i { transition:width var(--dur-grand) var(--ease-unfurl); }

/* ---- navigation: a green stem grows beside the active item and its icon rustles; hover eases items right; a locked item shakes its lock and dims ---- */
.navitem { position:relative; transition:background-color var(--dur-fast) var(--ease-settle), color var(--dur-fast), box-shadow var(--dur), transform var(--dur-fast) var(--ease-unfurl), opacity var(--dur); }
.navitem::before { content:""; position:absolute; left:0; top:50%; height:0; width:3px; border-radius:0 2px 2px 0; background:var(--accent); transform:translateY(-50%); transition:height var(--dur) var(--ease-unfurl); }
.navitem.is-active::before { height:100%; }
.navitem:not(.is-active):hover { transform:translateX(3px); }
.navitem svg.i { transition:color var(--dur-fast); }
.navitem.is-active svg.i { animation:rustle 700ms var(--ease-unfurl) 300ms 1; transform-origin:50% 60%; }
@keyframes lock-wiggle { 0%,100% { transform:rotate(0); } 20% { transform:rotate(-16deg); } 40% { transform:rotate(13deg); } 60% { transform:rotate(-9deg); } 80% { transform:rotate(5deg); } }
@keyframes dim-once { 0%,100% { opacity:1; } 40% { opacity:.55; } }
.navitem.is-locked.shake { animation:dim-once 600ms var(--ease-settle); }
.navitem.is-locked.shake .end svg.i, .tab.is-locked.shake svg.i { animation:lock-wiggle 620ms var(--ease-unfurl); transform-origin:50% 75%; }
.tabbar a { transition:color var(--dur-fast); }
.tabbar a svg.i { transition:transform var(--dur) var(--ease-sway), color var(--dur-fast); }
.tabbar a.is-active svg.i { transform:scale(1.1); }
.tabbar a:active svg.i { transform:scale(.85); }
.tab { position:relative; border-bottom-color:transparent !important; transition:color var(--dur-fast); }
.tab::after { content:""; position:absolute; left:8px; right:8px; bottom:0; height:2px; border-radius:2px; background:var(--accent); transform:scaleX(0); transition:transform var(--dur) var(--ease-sway); }
.tab.is-active::after { transform:scaleX(1); }
.seg > button { transition:background-color var(--dur-fast) var(--ease-settle), color var(--dur-fast); }
.pager > button { transition:background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease-sway); }
.pager > button:not(:disabled):active { transform:scale(.9); }

/* ---- sidebar: after the leaf grows, the items cascade in; a green stem slides between items as you move; the old view sinks out and the new one unfurls ---- */
.sidenav { position:relative; }
.sidenav .navitem { animation:item-in 480ms var(--ease-unfurl) both; }
.sidenav .navitem:nth-of-type(1) { animation-delay:220ms; } .sidenav .navitem:nth-of-type(2) { animation-delay:280ms; } .sidenav .navitem:nth-of-type(3) { animation-delay:340ms; }
.sidenav .navitem:nth-of-type(4) { animation-delay:400ms; } .sidenav .navitem:nth-of-type(5) { animation-delay:460ms; } .sidenav .navitem:nth-of-type(6) { animation-delay:520ms; }
.sidenav .navitem:nth-of-type(7) { animation-delay:580ms; } .sidenav .navitem:nth-of-type(8) { animation-delay:640ms; } .sidenav .navitem:nth-of-type(n+9) { animation-delay:700ms; }
.nav-marker { position:absolute; left:4px; top:0; width:3px; height:0; border-radius:2px; background:var(--accent); pointer-events:none; transition:top 460ms var(--ease-sway), height 420ms var(--ease-unfurl); }
.sidenav.has-marker .navitem::before { display:none; }
@keyframes view-out { to { opacity:0; transform:translateY(-12px) scale(.995); } }
.page.view-leave > * { animation:view-out 220ms var(--ease-sink) both; }

/* ---- tables: rows warm on hover; a new row slides in and glows until you've seen it ---- */
.tbl td { transition:background-color 240ms var(--ease-settle), box-shadow var(--dur); }
@keyframes row-in { 0% { opacity:0; transform:translateX(-14px); } 100% { opacity:1; transform:none; } }
@keyframes row-glow { 0% { background-color:var(--accent-soft); } 100% { background-color:transparent; } }
.tbl tbody tr.is-new td { animation:row-in var(--dur-slow) var(--ease-unfurl) both, row-glow 1800ms var(--ease-settle) 300ms both; }

/* ---- cards: clickable cards lift toward you; a highlighted row breathes once; icon boxes warm ---- */
.card { transition:box-shadow var(--dur) var(--ease-settle), background-color var(--dur-slow) var(--ease-settle), border-color var(--dur), transform var(--dur) var(--ease-unfurl); }
.mk-card, .pv, .vv { transition:transform var(--dur) var(--ease-unfurl), box-shadow var(--dur) var(--ease-settle); }
.mk-card:hover, .pv:hover, .vv:hover { transform:translateY(-4px); box-shadow:var(--shadow-lg); }
@keyframes breathe { 0% { background-color:var(--accent-soft); } 100% { background-color:var(--accent-tint); } }
.list-row.hl { animation:breathe 1200ms var(--ease-settle) both; }
.iconbox { transition:background-color var(--dur), color var(--dur), transform var(--dur) var(--ease-sway); }
.list-row:hover .iconbox { transform:scale(1.08); }

/* ---- menus, dialogs, popovers, tooltips: a menu unfolds from its anchor and its items follow one by one; a dialog rises through the scrim and settles ---- */
@keyframes menu-in { 0% { opacity:0; transform:scaleY(.8) translateY(-6px); } 100% { opacity:1; transform:none; } }
@keyframes item-in { 0% { opacity:0; transform:translateX(-6px); } 100% { opacity:1; transform:none; } }
.menu { transform-origin:top left; animation:menu-in var(--dur) var(--ease-unfurl) both; }
.menu > * { animation:item-in var(--dur) var(--ease-unfurl) both; }
.menu > :nth-child(2) { animation-delay:40ms; } .menu > :nth-child(3) { animation-delay:80ms; } .menu > :nth-child(4) { animation-delay:120ms; } .menu > :nth-child(5) { animation-delay:160ms; } .menu > :nth-child(6) { animation-delay:200ms; } .menu > :nth-child(n+7) { animation-delay:240ms; }
.menu-item { transition:background-color var(--dur-fast), padding-left var(--dur-fast) var(--ease-unfurl); }
.menu-item:hover { padding-left:14px; }
.popover { transform-origin:top center; animation:menu-in var(--dur) var(--ease-unfurl) both; }
@keyframes scrim-in { from { opacity:0; } to { opacity:1; } }
@keyframes dialog-in { 0% { opacity:0; transform:translateY(32px) scale(.96); } 70% { opacity:1; transform:translateY(-3px) scale(1.005); } 100% { opacity:1; transform:none; } }
.scrim { animation:scrim-in var(--dur) var(--ease-settle) both; }
.dialog { animation:dialog-in var(--dur-slow) var(--ease-unfurl) both; }
.dialog .actions > * { animation:item-in var(--dur) var(--ease-unfurl) 200ms both; }
.dialog .actions > :last-child { animation-delay:280ms; }
@keyframes tip-in { 0% { opacity:0; transform:translateY(4px) scale(.96); } 100% { opacity:1; transform:none; } }
.tip { animation:tip-in var(--dur-fast) var(--ease-unfurl) 350ms both; }

/* ---- photos and avatars: the ring sweeps closed around a new photo, then the photo springs into place ---- */
@property --sweep { syntax:'<angle>'; inherits:false; initial-value:0deg; }
@keyframes ring-sweep { to { --sweep:360deg; } }
@keyframes photo-in { 0% { opacity:0; transform:scale(.7); } 60% { opacity:1; transform:scale(1.05); } 100% { transform:scale(1); } }
.photo-circle { transition:border-color var(--dur-slow), box-shadow var(--dur-slow); }
.photo-circle.has-photo { border-color:transparent; background:conic-gradient(var(--accent) var(--sweep), var(--accent-line) 0); background-origin:border-box; animation:ring-sweep var(--dur-grand) var(--ease-unfurl) both; box-shadow:0 0 0 8px var(--accent-soft); }
.photo-circle img { animation:photo-in var(--dur-slow) var(--ease-sway) 260ms both; }
.avatar { transition:background-color var(--dur), transform var(--dur) var(--ease-sway); }
.avatar img { animation:photo-in var(--dur-slow) var(--ease-sway) both; }

/* ---- form steps: the finished step slides away, the next one arrives from the right (and the other way going back); the account-created mark ripples outward ---- */
@keyframes step-in { 0% { opacity:0; transform:translateX(40px) scale(.98); } 100% { opacity:1; transform:none; } }
@keyframes step-back { 0% { opacity:0; transform:translateX(-40px) scale(.98); } 100% { opacity:1; transform:none; } }
@keyframes step-out { to { opacity:0; transform:translateX(-32px) scale(.98); } }
@keyframes step-out-back { to { opacity:0; transform:translateX(32px) scale(.98); } }
.step-enter { animation:step-in var(--dur-slow) var(--ease-unfurl) both; }
.step-enter-back { animation:step-back var(--dur-slow) var(--ease-unfurl) both; }
.step-exit { animation:step-out 260ms var(--ease-sink) both; }
.step-exit-back { animation:step-out-back 260ms var(--ease-sink) both; }
@keyframes done-in { 0% { opacity:0; transform:scale(.5); } 60% { opacity:1; transform:scale(1.12); } 100% { transform:scale(1); } }
@keyframes ripple { 0% { box-shadow:0 0 0 0 var(--accent-soft), 0 0 0 0 var(--accent-line); } 100% { box-shadow:0 0 0 28px transparent, 0 0 0 56px transparent; } }
.done-mark { animation:done-in var(--dur-slow) var(--ease-sway) both, ripple 1300ms var(--ease-unfurl) 300ms 2; }

/* ---- appearance switch: the whole page crossfades between Sage and Moss ---- */
html.theme-changing, html.theme-changing * { transition:background-color 520ms var(--ease-settle), color 520ms var(--ease-settle), border-color 520ms var(--ease-settle), box-shadow 520ms var(--ease-settle) !important; }

/* ---- loading: the only motion that repeats. The spinner eases like a wheel, the skeleton breathes slowly ---- */
.spin { animation:spin 1.1s cubic-bezier(.45,.1,.55,.9) infinite; }
.skel { animation:shimmer 2.2s var(--ease-settle) infinite; }

/* ---- CODES (identity pass, 2026-11-30): a code read out or typed in is monospaced and spaced, never sized inline ---- */
.code-big { font-family:var(--font-mono); font-size:32px; font-weight:600; letter-spacing:.14em; line-height:1.2; font-variant-numeric:tabular-nums; }
.input.code { font-family:var(--font-mono); font-size:24px; letter-spacing:.14em; }

/* ---- CAREGIVER SIZE: the shared cards (email and phone, change password) inside the caregiver shell read at the caregiver
   app's size: 20px text including labels, help and errors, 64px controls. One set of overrides, no copied components. ---- */
.cg .card .label, .cg .card .help, .cg .card .t-meta, .cg .card .t-body, .cg .card .choice { font-size:20px; line-height:28px; }
.cg .card .input { height:64px; font-size:20px; }
.cg .card .input.code { font-size:24px; }
.cg .card .btn { min-height:64px; font-size:20px; }
