/* PetSpace design system: "paw height". Tokens, shell, component kit. Binding brief: docs/BRAND.md. Kit docs: docs/UI.md.
   Ink = seen or measured. Dashed = suggested. Hatched = cannot be verified. Ultramarine is the only filled accent, and it belongs to the
   dock's one primary action. A colour on a tag only ever means risk. Page CSS lives in css/<page>.css and uses these tokens only. */

:root {
  color-scheme: light;
  /* surfaces and text */
  --bg: #F2F3FA; --surface: #FFFFFF; --ink: #161A33; --muted: #5F6685; --line: #D8DBEC;
  /* brand: ultramarine, the only filled accent */
  --brand: #3A3DF0; --brand-ink: #2A2DB8; --brand-fg: #FFFFFF; --brand-soft: #E6E7FD;
  /* risk and state (a tag's colour only ever means risk) */
  --ok: #1D8A5A; --warn: #B8770B; --bad: #D0381F; --note: #6A7192;
  --ok-ink: #11633F; --warn-ink: #7A4F05; --bad-ink: #A52A14; --note-ink: #4C5373;
  --ok-soft: #DDF1E8; --warn-soft: #F7EACB; --bad-soft: #FADDD6; --note-soft: #E8EAF4;
  --ok-fg: #FFFFFF; --warn-fg: #161A33; --bad-fg: #FFFFFF; --note-fg: #FFFFFF; /* text on a filled tag of that colour */
  /* data colours: fixed meaning everywhere (safety, enrichment, access, zones, calm) */
  --d-safety: #3A3DF0; --d-safety-ink: #2A2DB8; --d-safety-soft: #E6E7FD;
  --d-enrich: #E0A100; --d-enrich-ink: #7A5700; --d-enrich-soft: #F9ECC4;
  --d-access: #8A4FD0; --d-access-ink: #6A34AB; --d-access-soft: #EEE2FA;
  --d-zones: #2E9E6E; --d-zones-ink: #17694A; --d-zones-soft: #DAF0E6;
  --d-calm: #3C9FD8; --d-calm-ink: #1D6A99; --d-calm-soft: #DCEEF9;
  /* secondary neutrals */
  --ink-2: #3A4066; --faint: #8187A7; --surface-2: #E9EBF6; --line-2: #8D93B4; --dot: #D8DBEC; --rule: #D8DBEC;
  --hatch: color-mix(in srgb, var(--ink) 22%, transparent);
  --scrim: rgba(14, 16, 32, .5);
  /* type: system stack, rounded display, tabular numerals, mono for the ruler */
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: var(--display); --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --fs-2xs: .6875rem; --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-2xl: 2.125rem; --fs-3xl: clamp(2.2rem, 5vw, 3.4rem);
  /* geometry: 6 px corners, 1 px hairlines, no shadows */
  --r-sm: 4px; --r: 6px; --r-lg: 10px; --radius: var(--r); --radius-sm: var(--r-sm);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --shadow: none; --shadow-pop: 0 0 0 1px var(--line-2), 0 18px 40px -18px rgba(14, 16, 32, .45);
  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1); --t-fast: 120ms; --t: 220ms; --t-slow: 900ms;
  /* layout */
  --eye-w: 280px; --page: 1080px; --strip-h: 56px; --dock-h: 64px; --tb-h: var(--strip-h);
  /* legacy dimension names kept until every page CSS stops using them (map onto the data colours) */
  --c-light: var(--d-enrich); --c-light-ink: var(--d-enrich-ink); --c-light-soft: var(--d-enrich-soft);
  --c-colour: var(--d-access); --c-colour-ink: var(--d-access-ink); --c-colour-soft: var(--d-access-soft);
  --c-layout: var(--d-safety); --c-layout-ink: var(--d-safety-ink); --c-layout-soft: var(--d-safety-soft);
  --c-calm: var(--d-calm); --c-calm-ink: var(--d-calm-ink); --c-calm-soft: var(--d-calm-soft);
  --c-comfort: var(--d-zones); --c-comfort-ink: var(--d-zones-ink); --c-comfort-soft: var(--d-zones-soft);
}
[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* dark tokens, written twice: OS preference until the toggle stores html[data-theme] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1020; --surface: #171A2E; --ink: #EDEFFF; --muted: #9AA1C4; --line: #2B2F4D;
    --brand: #8F96FF; --brand-ink: #B2B7FF; --brand-fg: #0E1020; --brand-soft: #23275A;
    --ok: #58C896; --warn: #E5AC4A; --bad: #F08670; --note: #A4AACB;
    --ok-ink: #8AE0B8; --warn-ink: #F0C679; --bad-ink: #F7AA98; --note-ink: #C3C8E2;
    --ok-soft: #12302A; --warn-soft: #33280F; --bad-soft: #3B1E19; --note-soft: #232744;
    --ok-fg: #0E1020; --warn-fg: #0E1020; --bad-fg: #0E1020; --note-fg: #0E1020;
    --d-safety: #8F96FF; --d-safety-ink: #B2B7FF; --d-safety-soft: #23275A;
    --d-enrich: #F2C14E; --d-enrich-ink: #F6D480; --d-enrich-soft: #33290F;
    --d-access: #B98CF0; --d-access-ink: #D0AEF6; --d-access-soft: #2E1F45;
    --d-zones: #6FD3A4; --d-zones-ink: #9BE3C1; --d-zones-soft: #14302A;
    --d-calm: #7CC4EE; --d-calm-ink: #A5D8F4; --d-calm-soft: #14283A;
    --ink-2: #CBD0EC; --faint: #6E749A; --surface-2: #1E2240; --line-2: #5A6094; --dot: #2B2F4D; --rule: #2B2F4D;
    --scrim: rgba(0, 0, 0, .62); --shadow-pop: 0 0 0 1px var(--line-2), 0 18px 40px -18px rgba(0, 0, 0, .8);
  }
}
[data-theme="dark"] {
  --bg: #0E1020; --surface: #171A2E; --ink: #EDEFFF; --muted: #9AA1C4; --line: #2B2F4D;
  --brand: #8F96FF; --brand-ink: #B2B7FF; --brand-fg: #0E1020; --brand-soft: #23275A;
  --ok: #58C896; --warn: #E5AC4A; --bad: #F08670; --note: #A4AACB;
  --ok-ink: #8AE0B8; --warn-ink: #F0C679; --bad-ink: #F7AA98; --note-ink: #C3C8E2;
  --ok-soft: #12302A; --warn-soft: #33280F; --bad-soft: #3B1E19; --note-soft: #232744;
  --ok-fg: #0E1020; --warn-fg: #0E1020; --bad-fg: #0E1020; --note-fg: #0E1020;
  --d-safety: #8F96FF; --d-safety-ink: #B2B7FF; --d-safety-soft: #23275A;
  --d-enrich: #F2C14E; --d-enrich-ink: #F6D480; --d-enrich-soft: #33290F;
  --d-access: #B98CF0; --d-access-ink: #D0AEF6; --d-access-soft: #2E1F45;
  --d-zones: #6FD3A4; --d-zones-ink: #9BE3C1; --d-zones-soft: #14302A;
  --d-calm: #7CC4EE; --d-calm-ink: #A5D8F4; --d-calm-soft: #14283A;
  --ink-2: #CBD0EC; --faint: #6E749A; --surface-2: #1E2240; --line-2: #5A6094; --dot: #2B2F4D; --rule: #2B2F4D;
  --scrim: rgba(0, 0, 0, .62); --shadow-pop: 0 0 0 1px var(--line-2), 0 18px 40px -18px rgba(0, 0, 0, .8);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--strip-h) + 20px); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font: 400 var(--fs-md)/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 800; line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); letter-spacing: -.015em; } h4 { font-size: var(--fs-md); font-family: var(--sans); font-weight: 700; letter-spacing: 0; }
h1 em, h2 em, .wm em { font-style: normal; color: var(--brand-ink); }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-4) 0; }
code, kbd, samp { font-family: var(--mono); font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 .3em; }
::selection { background: var(--brand); color: var(--brand-fg); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .grow { flex: 1 1 0; min-width: 0; } .nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; }
.stack { display: grid; gap: var(--s-5); } .stack.sm { gap: var(--s-3); } .stack.lg { gap: var(--s-6); }
.grid { display: grid; gap: var(--s-4); } .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }
/* the small mono label that sits above things */
.eyebrow, .sheet-label, .k { font: 600 var(--fs-2xs)/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* two-layer focus ring: a gap of page colour, then ultramarine; clear on every surface */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); border-radius: var(--r-sm); }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-radius: var(--r); }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 300; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r); }
.skip-link:focus { top: 10px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- the brand strip: mark, space switcher, theme, account. The foot of the strip is a ruler. ---------- */
.strip { position: sticky; top: 0; z-index: 40; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3); }
.strip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px; pointer-events: none; background:
  repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 10px) left bottom / 100% 4px no-repeat,
  repeating-linear-gradient(90deg, var(--ink-2) 0 1px, transparent 1px 50px) left bottom / 100% 8px no-repeat,
  linear-gradient(var(--line), var(--line)) left bottom / 100% 1px no-repeat; }
.strip-in { display: flex; align-items: center; gap: var(--s-3); max-width: calc(var(--page) + 40px); height: var(--strip-h); margin: 0 auto; padding: 0 20px 4px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 30px; height: 30px; border-radius: 8px; }
.wm { font: 800 1.15rem/1 var(--display); letter-spacing: -.03em; white-space: nowrap; }
.space-switch { position: relative; min-width: 0; }
.space-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 600 var(--fs-sm)/1 var(--sans); cursor: pointer; }
.space-btn:hover { border-color: var(--ink); }
.space-btn .sp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-btn .i { width: 15px; height: 15px; color: var(--muted); }
.strip-act { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.wallet-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); text-decoration: none; font: 600 var(--fs-xs)/1 var(--mono); white-space: nowrap; }
.wallet-chip:hover { border-color: var(--ink); text-decoration: none; }
.wallet-chip .i { width: 14px; height: 14px; color: var(--brand-ink); }
.wallet-chip.low { border-color: var(--warn); } .wallet-chip.low .i { color: var(--warn); }
.wallet-chip .wl { color: var(--muted); font-weight: 500; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); border-color: var(--line-2); color: var(--ink); } .icon-btn.sm { width: 32px; height: 32px; }
.user-menu { position: relative; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font: 700 var(--fs-xs)/1 var(--mono); cursor: pointer; }
.avatar:hover { background: var(--ink); color: var(--bg); }
/* popovers: account menu, space list, More */
.pop { position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 240px; max-width: min(320px, calc(100vw - 24px)); padding: 6px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.pop.left { right: auto; left: 0; }
.pop .who { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; } .pop .who b { font-weight: 700; } .pop .who span { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; color: var(--ink); font: 500 var(--fs-md)/1.2 var(--sans); text-align: left; text-decoration: none; cursor: pointer; }
.pop a:hover, .pop button:hover { background: var(--surface-2); text-decoration: none; }
.pop button[aria-checked="true"], .pop a[aria-current="page"] { color: var(--brand-ink); font-weight: 700; }
.pop button[aria-checked="true"]::after { content: ""; width: 6px; height: 11px; margin-left: auto; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(40deg) translate(-2px, -2px); }
.pop hr { margin: 4px 0; }
.pop .pop-h { padding: 8px 10px 4px; }

/* ---------- the page ---------- */
.main { position: relative; max-width: calc(var(--page) + 40px); margin: 0 auto; padding: var(--s-6) 20px var(--s-6); min-height: calc(100vh - var(--strip-h) - 120px); outline: none; }
#app > * { animation: blur-in .5s var(--ease) both; }
#app.settled > * { animation: none; }
#app > *:nth-child(2) { animation-delay: 60ms; } #app > *:nth-child(3) { animation-delay: 120ms; } #app > *:nth-child(4) { animation-delay: 180ms; } #app > *:nth-child(n+5) { animation-delay: 240ms; }
@keyframes blur-in { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4) var(--s-5); flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-head h1 { max-width: 18ch; } .page-head .sub { margin-top: 8px; color: var(--muted); max-width: 60ch; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 8px; align-items: center; font: 600 var(--fs-2xs)/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; } .crumbs a { color: var(--muted); }
.sub { color: var(--muted); font-size: var(--fs-sm); }
/* the floor line: a 1 px skirting line at the foot of a section, with a thicker rail under its first 48 px */
.floor { position: relative; padding-bottom: var(--s-5); border-bottom: 1px solid var(--line-2); }
.floor::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 48px; height: 3px; background: var(--ink); border-radius: 0 0 2px 2px; }
/* a section label with a hairline running out to the edge */
.sec-h { display: flex; align-items: center; gap: 12px; margin: 0 0 var(--s-3); font: 600 var(--fs-2xs)/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sec-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* cards: only for objects the customer owns (a space, an analysis) */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
a.card, button.card { display: block; color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer; width: 100%; } a.card:hover, button.card:hover { border-color: var(--ink); text-decoration: none; }
.card.flat { background: transparent; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: var(--s-4); }
.sheet { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
.sheet-h { display: flex; align-items: center; gap: 10px; margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-4); padding: 9px var(--s-5); border-bottom: 1px solid var(--line); min-height: 40px; }
.sheet-h .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pencil, .sheet.pencil { border-style: dashed; }
/* dimension tick used as a section divider */
.dimline { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 600 var(--fs-2xs)/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.dimline::before, .dimline::after { content: ""; height: 7px; flex: 1; border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); background: linear-gradient(var(--line-2), var(--line-2)) center / 100% 1px no-repeat; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font: 600 var(--fs-md)/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.btn:hover { border-color: var(--ink); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn .i { width: 17px; height: 17px; }
/* the one filled button of the app: the dock's Scan a room. Page-level buttons stay quiet. */
.btn.cta { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.btn.cta:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
[data-theme="dark"] .btn.cta:hover { background: color-mix(in srgb, var(--brand) 82%, white); color: var(--brand-fg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.cta:hover { background: color-mix(in srgb, var(--brand) 82%, white); color: var(--brand-fg); } }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); } .btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--bg); }
.btn.ghost { background: transparent; } .btn.ghost:hover { background: var(--surface); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--brand-ink); padding: 0 10px; } .btn.quiet:hover { background: var(--brand-soft); border-color: transparent; }
.btn.danger { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 55%, var(--line-2)); background: transparent; } .btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-sm); } .btn.lg { min-height: 48px; padding: 0 22px; font-size: 1rem; } .btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn[aria-busy="true"] { opacity: .75; pointer-events: none; } .btn[aria-busy="true"]::after { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.field-err:empty { display: none; }

/* ---------- the footer ---------- */
.foot { max-width: calc(var(--page) + 40px); margin: 0 auto; padding: var(--s-5) 20px calc(var(--dock-h) + 64px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--muted); font-size: var(--fs-sm); }
.foot a { color: var(--muted); } .foot a:hover { color: var(--ink); }
body.public .foot { padding-bottom: var(--s-6); }

/* ---------- the dock: five destinations and the one primary action, floating on every size ---------- */
.dock { position: fixed; z-index: 50; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(540px, calc(100vw - 16px));
  display: grid; grid-template-columns: 1fr 1fr minmax(76px, 1.3fr) 1fr 1fr 1fr; align-items: center; height: var(--dock-h); padding: 0 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line-2); border-radius: 22px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--bg) 70%, transparent); }
.dock > a, .dock > button { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; min-width: 44px; padding: 0; border: 0; border-radius: 14px; background: none; color: var(--muted);
  font: 700 10px/1 var(--sans); letter-spacing: .02em; text-decoration: none; cursor: pointer; }
.dock > a:hover, .dock > button:hover { color: var(--ink); text-decoration: none; }
.dock .i { width: 22px; height: 22px; }
.dock > a[aria-current="page"], .dock > button.current { color: var(--brand-ink); }
.dock > a[aria-current="page"]::before, .dock > button.current::before { content: ""; position: absolute; top: -2px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
/* Scan a room: raised, filled, the only btn.cta in the app */
.dock > .dock-scan { align-self: start; margin-top: -18px; min-height: 56px; height: 56px; justify-self: center; width: 100%; max-width: 92px; gap: 0; border-radius: 18px; border: 3px solid var(--bg); color: var(--brand-fg); box-shadow: 0 0 0 1px var(--brand); font-size: 0; }
.dock > .dock-scan .i { width: 26px; height: 26px; color: inherit; }
.dock > .dock-scan .l-long { display: none; } .dock > .dock-scan .l-short { font: 800 10px/1 var(--sans); margin-top: 3px; letter-spacing: .02em; }
.dock > .dock-scan:hover { color: var(--brand-fg); }
[data-theme="dark"] .dock > .dock-scan:hover { color: var(--brand-fg); }
.dock > .dock-scan[aria-current="page"]::before { display: none; }
.dock > a.dock-scan[aria-current="page"] { color: var(--brand-fg); } /* the current-page tint (brand-ink) is unreadable on the filled button */
.dock-label { display: block; }
@media (min-width: 720px) {
  .dock { width: min(640px, calc(100vw - 48px)); grid-template-columns: 1fr 1fr minmax(150px, 1.9fr) 1fr 1fr 1fr; }
  .dock > a, .dock > button { font-size: 11px; }
  .dock > .dock-scan { max-width: none; width: calc(100% - 8px); grid-auto-flow: column; justify-content: center; align-content: center; align-items: center; gap: 8px; border-radius: 28px; }
  .dock > .dock-scan .l-short { display: none; } .dock > .dock-scan .l-long { display: inline; font: 800 .9375rem/1 var(--sans); letter-spacing: -.01em; margin: 0; }
  .dock > .dock-scan .i { width: 22px; height: 22px; }
}
.more-sheet { position: fixed; inset: 0; z-index: 45; }
.more-sheet .sheet-in { position: absolute; right: max(8px, calc(50vw - 270px + 6px)); bottom: calc(14px + var(--dock-h) + 22px + env(safe-area-inset-bottom)); width: min(300px, calc(100vw - 16px)); display: grid; gap: 2px; padding: 8px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: sheet-up .22s var(--ease); }
@media (min-width: 720px) { .more-sheet .sheet-in { right: max(8px, calc(50vw - 320px + 6px)); } }
.more-sheet .eyebrow { padding: 6px 10px 6px; }
.more-sheet a, .more-sheet button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--ink); font: 500 var(--fs-md)/1 var(--sans); text-align: left; text-decoration: none; cursor: pointer; }
.more-sheet a:hover, .more-sheet button:hover { background: var(--surface-2); } .more-sheet a[aria-current="page"] { color: var(--brand-ink); font-weight: 700; }
.more-sheet hr { margin: 4px 0; }
@keyframes sheet-up { from { transform: translateY(14px); opacity: 0; } }

/* ---------- tags: the product's signature object. A collar tag with a punched hole, hung on a string. ----------
   Risk sets the colour (act, review, note). Evidence sets the treatment (observed solid, possible dashed, user_confirmed solid + check, not_verifiable hatched). */
.tag, .ev { --tc: var(--note); --tc-fg: var(--note-fg); --tc-ink: var(--note-ink); --tc-soft: var(--note-soft); }
.tag.act { --tc: var(--bad); --tc-fg: var(--bad-fg); --tc-ink: var(--bad-ink); --tc-soft: var(--bad-soft); }
.tag.review { --tc: var(--warn); --tc-fg: var(--warn-fg); --tc-ink: var(--warn-ink); --tc-soft: var(--warn-soft); }
.tag.note { --tc: var(--note); --tc-fg: var(--note-fg); --tc-ink: var(--note-ink); --tc-soft: var(--note-soft); }
.ev { --tc: var(--ink); --tc-fg: var(--bg); --tc-ink: var(--ink); --tc-soft: var(--surface-2); }
.tag, .ev { --tb: var(--tc); --tbd: 1.5px solid var(--tc); --tf: var(--tc-fg); }
.tag.ev-possible, .ev.ev-possible, [data-ev="possible"] { --tb: transparent; --tbd: 1.5px dashed var(--tc); --tf: var(--tc-ink); }
.tag.ev-user_confirmed, .ev.ev-user_confirmed, [data-ev="user_confirmed"] { --tb: var(--tc-soft); --tbd: 1.5px solid var(--tc); --tf: var(--tc-ink); }
.tag.ev-not_verifiable, .ev.ev-not_verifiable, [data-ev="not_verifiable"] { --tb: repeating-linear-gradient(135deg, transparent 0 4px, var(--hatch) 4px 5px); --tbd: 1.5px solid var(--faint); --tf: var(--muted); }
.tag { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; max-width: 100%; padding: 6px 14px 6px 32px; color: var(--tf); font: 600 var(--fs-sm)/1.25 var(--sans); text-align: left; text-decoration: none; }
a.tag, button.tag { cursor: pointer; } a.tag:hover, button.tag:hover { text-decoration: none; transform: translateY(-1px); }
/* the body (outline, fill, punched hole, cut corner) is a masked layer, so focus rings and text stay unclipped */
.tag::before { content: ""; position: absolute; inset: 0; z-index: -1; border: var(--tbd); border-radius: 6px; background: var(--tb);
  -webkit-mask: radial-gradient(circle at 15px 50%, #0000 3.4px, #000 3.8px), linear-gradient(135deg, #0000 7px, #000 7.5px); -webkit-mask-composite: source-in;
  mask: radial-gradient(circle at 15px 50%, #0000 3.4px, #000 3.8px), linear-gradient(135deg, #0000 7px, #000 7.5px); mask-composite: intersect; }
.tag::after { content: ""; position: absolute; left: 10px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border: 1.5px solid var(--tc); border-radius: 50%; }
.tag-k { font: 800 var(--fs-2xs)/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.tag-t { min-width: 0; overflow-wrap: anywhere; }
.ev-user_confirmed .tag-t::after, .tag.ev-user_confirmed .tag-t::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 6px; vertical-align: -1px; background: currentColor;
  -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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.500l5 5L20 6.500'/%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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.500l5 5L20 6.500'/%3E%3C/svg%3E") center / contain no-repeat; }
/* an open ACT tag may carry a travelling highlight on its edge (one per page) */
@property --beam-a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.tag.beam::before { border-color: transparent; background: linear-gradient(var(--tc), var(--tc)) padding-box, conic-gradient(from var(--beam-a), transparent 0 72%, var(--tc-fg) 88%, transparent) border-box; animation: beam 3.4s linear infinite; }
@keyframes beam { to { --beam-a: 360deg; } }
/* a tag hung on its string: .hang above a .tag; swings once on hover, still for reduced motion */
.hang { position: relative; display: inline-block; max-width: 100%; padding-top: 16px; transform-origin: 15px 0; }
.hang::before { content: ""; position: absolute; top: 0; left: 15px; width: 1px; height: 16px; background: var(--line-2); }
.hang::after { content: ""; position: absolute; top: -1px; left: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line-2); }
@media (prefers-reduced-motion: no-preference) { .hang:hover { animation: swing 1.2s var(--ease); } }
@keyframes swing { 20% { transform: rotate(-3deg); } 45% { transform: rotate(2deg); } 70% { transform: rotate(-1deg); } }
/* evidence label as a standalone chip (no hole): <span class="ev ev-possible">Possible</span> */
.ev { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: var(--tbd); border-radius: 4px; background: var(--tb); color: var(--tf); font: 700 var(--fs-2xs)/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.ev.ev-user_confirmed::before { content: ""; width: 9px; height: 5px; margin-top: -2px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
/* numbered pin on a photo; matches a tag's number */
.pin { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 11px/1 var(--mono); border: 0; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink); }
.pin.act { background: var(--bad); color: var(--bad-fg); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--bad); }
.pin.review { background: var(--warn); color: var(--warn-fg); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--warn); }
.pin.note { background: var(--note); color: var(--note-fg); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--note); }
button.pin { cursor: pointer; } button.pin:hover, .pin.active { transform: scale(1.12); }
.pin.pencil-pin, .pin.possible { background: var(--surface); color: var(--ink); border: 1.5px dashed var(--ink); box-shadow: none; }

/* ---------- the height ruler: 0 / 30 / 60 / 90 / 120 cm. Vertical in a report's gutter, .h horizontal in a header. ----------
   <div class="ruler" style="--cm:2.2px" role="img" aria-label="Height scale, 0 to 120 centimetres"><b style="--at:30">30</b>…</div>  */
.ruler { --cm: 2.2px; --max: 130; position: relative; width: 44px; height: calc(var(--cm) * var(--max)); flex: none; color: var(--muted); font: 600 10px/1 var(--mono); user-select: none; border-right: 1px solid var(--ink-2); background:
  repeating-linear-gradient(to top, var(--line-2) 0 1px, transparent 1px calc(var(--cm) * 10)) right bottom / 8px 100% no-repeat,
  repeating-linear-gradient(to top, var(--ink-2) 0 1px, transparent 1px calc(var(--cm) * 30)) right bottom / 16px 100% no-repeat; }
.ruler b { position: absolute; left: 0; bottom: calc(var(--cm) * var(--at, 0) - 5px); font-weight: 600; }
.ruler b::after { content: attr(data-unit); margin-left: 2px; opacity: .7; }
.ruler .eye { position: absolute; left: 0; width: var(--eye-w, 280px); height: 0; bottom: calc(var(--cm) * var(--at, 0)); border-top: 1.5px dashed var(--brand); pointer-events: none; z-index: 2; }
.ruler .eye::before { content: attr(data-label); position: absolute; right: 100%; margin-right: 6px; top: -7px; padding: 1px 5px; border-radius: 3px; background: var(--brand); color: var(--brand-fg); font: 700 9px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ruler.h { width: 100%; height: 32px; border-right: 0; border-top: 1px solid var(--ink-2); background:
  repeating-linear-gradient(to right, var(--line-2) 0 1px, transparent 1px calc(var(--cm) * 10)) left top / 100% 8px no-repeat,
  repeating-linear-gradient(to right, var(--ink-2) 0 1px, transparent 1px calc(var(--cm) * 30)) left top / 100% 16px no-repeat; }
.ruler.h b { bottom: auto; top: 18px; left: calc(var(--cm) * var(--at, 0) - 6px); }
/* height bands in a report: a title row with the band's range on the ruler */
.band { display: flex; align-items: baseline; gap: 10px; margin: 0 0 var(--s-3); }
.band h3 { font-size: var(--fs-lg); } .band .range { font: 600 var(--fs-xs)/1 var(--mono); color: var(--muted); letter-spacing: .04em; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.label, .field > label { font: 600 var(--fs-sm)/1.3 var(--sans); color: var(--ink); }
.label .opt { color: var(--muted); font-weight: 400; margin-left: 6px; }
.hint { color: var(--muted); font-size: var(--fs-sm); } .field-err { color: var(--bad-ink); font-size: var(--fs-sm); display: flex; gap: 6px; align-items: flex-start; }
.field-err::before { content: "!"; flex: none; display: grid; place-items: center; width: 15px; height: 15px; margin-top: 2px; border-radius: 50%; background: var(--bad); color: var(--bg); font: 700 10px/1 var(--mono); }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid > .wide { grid-column: 1 / -1; } @media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 400 var(--fs-md)/1.4 var(--sans); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 54%, calc(100% - 13px) 54%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--brand); }
[aria-invalid="true"] { border-color: var(--bad) !important; } .input[disabled], .select[disabled], .textarea[disabled] { opacity: .55; }
/* number with a unit suffix, like a dimension on a drawing */
.unit-input { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); overflow: hidden; } .unit-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }
.unit-input .input { border: 0; border-radius: 0; min-width: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; } .unit-input .input:focus-visible { outline: none; box-shadow: none; }
.unit-input .unit { display: grid; place-items: center; padding: 0 12px; border-left: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 600 var(--fs-xs)/1 var(--mono); letter-spacing: .06em; }
/* segmented control: one choice */
.seg { display: inline-flex; max-width: 100%; padding: 3px; gap: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); overflow-x: auto; }
.seg label { position: relative; flex: 1 0 auto; } .seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 5px; color: var(--ink-2); font: 600 var(--fs-sm)/1 var(--sans); white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.seg.block { display: flex; }
/* chip toggle group: several choices */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-t { position: relative; } .chip-t input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.chip-t span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 500 var(--fs-sm)/1 var(--sans); }
.chip-t:hover span { border-color: var(--ink); }
.chip-t input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 650; }
.chip-t input:checked + span::before { content: ""; width: 5px; height: 9px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(40deg) translateY(-1px); }
.chip-t input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); }
.chip-t input:disabled + span { opacity: .5; }
/* range */
.range { display: grid; gap: 6px; } .range-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; } .range output { font: 600 var(--fs-sm)/1 var(--mono); color: var(--ink); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--brand) var(--fill, 0%), var(--line-2) var(--fill, 0%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); } input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--brand); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); }
/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; position: relative; } .switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch .track { flex: none; width: 44px; height: 26px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); position: relative; transition: background var(--t-fast); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink); transition: transform var(--t) var(--ease); }
.switch input:checked + .track { background: var(--brand); border-color: var(--brand); } .switch input:checked + .track::after { transform: translateX(18px); border-color: var(--brand-fg); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); }
.switch .txt { display: grid; } .switch .txt small { color: var(--muted); font-size: var(--fs-sm); }
/* file drop zone */
.drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: var(--s-6) var(--s-4); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); color: var(--muted); cursor: pointer; position: relative; transition: border-color var(--t-fast), background var(--t-fast); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; } .drop b { color: var(--ink); } .drop .i { width: 28px; height: 28px; color: var(--brand-ink); }
.drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; } legend { padding: 0; margin-bottom: 8px; font: 600 var(--fs-sm)/1.3 var(--sans); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] { position: relative; flex: none; padding: 11px 16px; border: 0; background: none; color: var(--muted); font: 600 var(--fs-md)/1 var(--sans); cursor: pointer; }
.tabs [role="tab"]:hover { color: var(--ink); } .tabs [role="tab"][aria-selected="true"] { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--brand); border-radius: 2px 2px 0 0; }
.tabs .count { margin-left: 6px; font: 600 var(--fs-2xs)/1 var(--mono); color: var(--muted); }

/* ---------- badges, chips, status dots ---------- */
.badge, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 600 var(--fs-xs)/1.2 var(--sans); white-space: nowrap; }
.badge .i, .chip .i { width: 13px; height: 13px; }
.badge.ok, .chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok-ink); } .badge.warn, .chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }
.badge.bad, .chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad-ink); } .badge.brand, .chip.brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.badge.dot::before, .chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.pencil { border-style: dashed; background: transparent; }
.sdot { display: inline-flex; align-items: center; gap: 7px; font: 600 var(--fs-xs)/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.sdot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.sdot[data-s="good"]::before, .sdot[data-s="ok"]::before, .sdot[data-s="succeeded"]::before { background: var(--ok); } .sdot[data-s="fair"]::before, .sdot[data-s="warn"]::before, .sdot[data-s="running"]::before, .sdot[data-s="queued"]::before { background: var(--warn); }
.sdot[data-s="poor"]::before, .sdot[data-s="bad"]::before, .sdot[data-s="failed"]::before { background: var(--bad); } .sdot[data-s="na"]::before { background: transparent; border: 1.5px dashed var(--faint); }
/* swatches */
.sw { display: inline-block; width: 18px; height: 18px; border-radius: 4px; background: var(--sw, #888); box-shadow: inset 0 0 0 1px rgba(0,0,0,.22), 0 0 0 1px var(--bg); flex: none; } .sw.lg { width: 36px; height: 36px; border-radius: 6px; }
.sw-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }

/* ---------- banner, empty, skeleton ---------- */
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--s-5); padding: 12px 16px; border: 1px solid var(--line-2); border-left-width: 4px; border-radius: var(--r); background: var(--surface); }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); } .banner.bad { border-color: var(--bad); background: var(--bad-soft); } .banner.ok { border-color: var(--ok); background: var(--ok-soft); } .banner.info { border-color: var(--brand); background: var(--brand-soft); }
.banner .grow { min-width: 200px; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: var(--s-7) var(--s-5); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); }
.empty .big { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 1.5px dashed var(--line-2); color: var(--brand-ink); } .empty .big .i { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); } .empty p { max-width: 44ch; }
.skel { position: relative; overflow: hidden; border-radius: var(--r); background: var(--surface-2); min-height: 14px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel.chart { height: 240px; } .skel.line { height: 14px; margin: 8px 0; } .skel.kpi-s { height: 96px; } .skel.block { height: 160px; } .skel.photo { aspect-ratio: 4 / 3; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.t th { padding: 10px 14px; text-align: left; font: 600 var(--fs-2xs)/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); white-space: nowrap; background: var(--surface-2); }
.t th.sortable { cursor: pointer; } .t th.sortable:hover { color: var(--ink); } .t th[aria-sort]::after { content: " \2193"; } .t th[aria-sort="ascending"]::after { content: " \2191"; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; } .t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); } .t tr.clickable { cursor: pointer; } .t tr.clickable:hover td { background: var(--surface-2); }
.t .td-actions { text-align: right; white-space: nowrap; } .table-wrap .empty { border: 0; } .pagebar { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .t.stackable thead { display: none; } .t.stackable tr { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); } .t.stackable td { display: flex; justify-content: space-between; gap: 12px; padding: 0; border: 0; text-align: right; }
  .t.stackable td[data-label]::before { content: attr(data-label); color: var(--muted); font: 600 var(--fs-2xs)/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; text-align: left; }
}

/* ---------- dialog / bottom sheet / toasts ---------- */
.scrim { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: var(--scrim); animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: var(--s-5); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop .22s var(--ease); } .dialog.wide { width: min(720px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: var(--s-5); }
.dialog-key { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r); font-family: var(--mono); word-break: break-all; } .secret-box { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r); font-family: var(--mono); font-size: var(--fs-sm); }
@media (max-width: 640px) { .scrim { align-items: end; padding: 0; } .dialog, .dialog.wide { width: 100%; max-height: 88vh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); animation: sheet-up .28s var(--ease); } .dialog::before { content: ""; display: block; width: 36px; height: 4px; margin: -8px auto 14px; border-radius: 2px; background: var(--line-2); } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--ink); border-left-width: 4px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-pop); animation: pop .22s var(--ease); }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); } .toast.info { border-left-color: var(--brand); }
.toast .body { flex: 1; font-size: var(--fs-sm); line-height: 1.45; } .toast .x { display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; } .toast .x .i { width: 14px; height: 14px; }


/* checkList */
.checks { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); } .checks li:last-child { border-bottom: 0; }
.checks .ck { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok-ink); } .checks .ck .i { width: 11px; height: 11px; stroke-width: 2.4; }
.checks li.bad { background: var(--bad-soft); } .checks li.bad .ck { background: var(--bad); color: var(--bg); } .checks b { font-weight: 600; } .checks span.d { display: block; color: var(--muted); }
.checks-sum { display: flex; align-items: center; gap: 8px; font: 600 var(--fs-xs)/1 var(--mono); letter-spacing: .04em; margin-bottom: 8px; } .checks-sum.bad { color: var(--bad-ink); } .checks-sum.ok { color: var(--ok-ink); }

/* ---------- charts (lib/charts.js, lib/usagechart.js) ---------- */
.chart { position: relative; width: 100%; min-height: 120px; } .chart svg { display: block; overflow: visible; max-width: 100%; } .chart text { fill: var(--muted); font: 10.5px var(--mono); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; } .chart .axis-line { stroke: var(--ink); shape-rendering: crispEdges; } .chart .bar { transition: opacity .15s; } .chart .bar.dim { opacity: .45; }
.chart-tip, .ch-tip { position: absolute; top: 0; z-index: 5; pointer-events: none; min-width: 130px; max-width: 260px; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-xs); background: var(--ink); color: var(--bg); opacity: 0; transition: opacity .12s; } .chart-tip.on, .ch-tip.on { opacity: 1; }
.chart-tip b, .ch-tip-h { display: block; margin-bottom: 3px; font-weight: 650; } .chart-tip .tr, .ch-tip-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-msg, .ch-msg { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 120px; padding: 20px; margin: 0; }
.ch-box { outline: none; } .ch-svg { display: block; width: 100%; height: auto; overflow: visible; } .ch-grid line { stroke: var(--line); } .ch-grid text, .ch-xaxis text { fill: var(--muted); font: 10.5px var(--mono); }
.ch-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } .ch-dot { fill: var(--bg); stroke: var(--c); stroke-width: 1.75; } .ch-dot.sm { fill: var(--c); stroke: none; }
.ch-cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; } .ch-ring { fill: var(--bg); stroke: var(--c); stroke-width: 2.5; } .ch-hit { cursor: crosshair; }
.ch-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); flex: none; } .ch-key.dashed { width: 18px; height: 3px; background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0 0 12px; padding: 0; font-size: var(--fs-sm); color: var(--ink-2); } .ch-legend li { display: inline-flex; align-items: center; gap: 8px; }
.ch-stack-wrap { display: grid; gap: 14px; } .ch-stack { display: flex; gap: 2px; height: clamp(48px, 9vw, 72px); } .ch-stack > i { display: block; flex-basis: 0; min-width: 4px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.ch-stack-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px 20px; list-style: none; margin: 0; padding: 0; } .ch-stack-key li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 9px; align-items: center; font-size: var(--fs-sm); } .ch-stack-key span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-stack-key small { color: var(--muted); font-family: var(--mono); }
.ch-sw { display: block; width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.ch-rank { list-style: none; margin: 0; padding: 0; } .ch-rank li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: baseline; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); } .ch-rank-n { font: 500 var(--fs-xs) var(--mono); color: var(--muted); } .ch-rank-name { font: 600 1.1rem/1.15 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-rank-v { font: 600 var(--fs-sm) var(--mono); }
.ch-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; } .ch-bars li { display: grid; grid-template-columns: minmax(84px, 138px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: var(--fs-sm); } .ch-bar-track { height: 10px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; } .ch-bar-fill { display: block; height: 100%; background: var(--c); } .ch-bar-val { font: 600 var(--fs-xs) var(--mono); text-align: right; }
.ch-mini { display: inline-block; vertical-align: middle; } .ch-mini-bar { fill: var(--c); } .ch-mini-na { fill: var(--line-2); }
.ch-tape { position: relative; height: 30px; margin: 6px 0 18px; border-top: 1px solid var(--ink); } .ch-tape span { position: absolute; top: 0; padding-top: 9px; transform: translateX(-50%); font: 500 10px/1 var(--mono); color: var(--muted); } .ch-tape span::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 7px; background: var(--ink); }

/* ---------- in-app camera (lib/camera.js) ---------- */
body.cam-open { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #000; color: #fff; }
.cam-panel { position: relative; width: 100%; height: 100%; background: #000; overflow: hidden; } .cam-stage { position: absolute; inset: 0; } .cam-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; } .cam-video.mirror { transform: scaleX(-1); }
.cam-guide { position: absolute; inset: 12% 8% 26%; pointer-events: none; display: grid; align-items: start; justify-items: center; background:
  linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px) 33.3% 0 / 1px 100% no-repeat, linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px) 66.6% 0 / 1px 100% no-repeat,
  linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px) 0 33.3% / 100% 1px no-repeat, linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px) 0 66.6% / 100% 1px no-repeat; border: 1px solid rgba(255,255,255,.6); border-radius: 2px; }
.cam-guide span { margin-top: 8px; padding: 6px 10px; background: rgba(0,0,0,.6); font: 600 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; border-radius: 2px; text-align: center; }
.cam-count { position: absolute; inset: 0; display: none; place-items: center; font: 700 min(40vw, 240px)/1 var(--serif); text-shadow: 0 2px 24px rgba(0,0,0,.6); pointer-events: none; } .cam-count.on { display: grid; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 14px 24px; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-hint { padding: 8px 12px; background: rgba(0,0,0,.6); border-radius: 2px; font: 600 14px/1.3 var(--sans); } .cam-hint:empty { display: none; }
.cam-hint[data-state="good"]::before, .cam-hint[data-state="dark"]::before, .cam-hint[data-state="bright"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: #4FD9A0; } .cam-hint[data-state="dark"]::before, .cam-hint[data-state="bright"]::before { background: #FFC24D; }
.cam-tools, .cam-timer { display: flex; gap: 8px; }
.cam-btn { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.5); color: #fff; cursor: pointer; } .cam-btn .i { width: 22px; height: 22px; } .cam-btn[aria-pressed="true"] { background: #fff; color: #000; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 24px 14px max(22px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.cam-chip { min-height: 40px; min-width: 44px; padding: 0 12px; border-radius: 3px; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.5); color: #fff; font: 600 13px/1 var(--mono); cursor: pointer; } .cam-chip[aria-pressed="true"] { background: #fff; color: #000; border-color: #fff; }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 3px solid #fff; background: transparent; padding: 4px; cursor: pointer; display: grid; place-items: center; } .cam-shutter span { width: 100%; height: 100%; border-radius: 50%; background: var(--brand); transition: transform .1s; } .cam-shutter:active span { transform: scale(.88); } .cam-shutter.busy span { border-radius: 8px; transform: scale(.55); }
.cam-btn:focus-visible, .cam-chip:focus-visible, .cam-shutter:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px #000; }
@media (min-width: 861px) { .cam { background: rgba(0,0,0,.78); } .cam-panel { width: min(960px, 92vw); height: min(720px, 90vh); border-radius: 8px; } }
@media (max-width: 640px) { .cam-timer { grid-column: 1 / -1; grid-row: 1; justify-content: center; } .cam-bottom { grid-template-columns: 1fr; justify-items: center; } .cam-spacer { display: none; } }


/* ---------- PetSpace overrides on the shared form/table/dialog kit ---------- */
.chip, .badge { border-radius: var(--r-sm); }
.chip-t span { border-radius: var(--r); }
.chip-t input:checked + span, .seg input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); box-shadow: none; }
.seg input:checked + span { box-shadow: 0 0 0 1px var(--brand); }
.switch input:checked + .track::after { border-color: var(--brand); }
.drop { border-radius: var(--r-lg); }
.tabs [role="tab"][aria-selected="true"]::after { background: var(--brand); }
.toasts { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 40px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 24px)); }
.toast { border: 1px solid var(--line-2); border-left: 4px solid var(--ink); box-shadow: var(--shadow-pop); }
.table-wrap, .banner, .empty { border-radius: var(--r-lg); }
.empty { border-color: var(--line-2); }
.empty .big { border-style: dashed; }
.banner { border-left-width: 4px; }
.banner a.btn { flex: none; }
.checks li.bad { background: var(--bad-soft); }
.wallet-chip .i { width: 14px; height: 14px; }

/* data-colour utilities: <span class="dot d-safety"> or a bar with style="--c:var(--d-zones)" */
.d-safety { --c: var(--d-safety); --ci: var(--d-safety-ink); --cs: var(--d-safety-soft); } .d-enrich { --c: var(--d-enrich); --ci: var(--d-enrich-ink); --cs: var(--d-enrich-soft); }
.d-access { --c: var(--d-access); --ci: var(--d-access-ink); --cs: var(--d-access-soft); } .d-zones { --c: var(--d-zones); --ci: var(--d-zones-ink); --cs: var(--d-zones-soft); }
.d-calm { --c: var(--d-calm); --ci: var(--d-calm-ink); --cs: var(--d-calm-soft); }
.swatch-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--ink)); flex: none; }
/* a big tabular number (scores count up once; reduced motion: static) */
.big-num { font: 800 clamp(2.6rem, 8vw, 4.4rem)/.95 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.big-num small { font: 600 var(--fs-sm)/1 var(--mono); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
/* money is ink, never colour */
.money { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

/* ---------- the public bar (landing, privacy, error) ---------- */
.pubbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: env(safe-area-inset-top) max(16px, calc((100vw - var(--page)) / 2 + 20px)) 0; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.pubbar .brand { font: 800 1.1rem/1 var(--display); letter-spacing: -.03em; }
.pubbar .brand-mark img { display: block; border-radius: 8px; }
.pubbar-actions { display: flex; align-items: center; gap: 6px; }
.pub-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--r); color: var(--ink); font-weight: 600; text-decoration: none; }
.pub-link:hover { background: var(--surface); text-decoration: none; }
.pubbar a:focus-visible, .pubbar button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .strip-in { padding: 0 12px 4px; gap: 8px; }
  .brand .wm { display: none; }
  .wallet-chip .wl { display: none; }
  .main { padding: var(--s-5) 16px var(--s-5); }
  .foot { padding-left: 16px; padding-right: 16px; }
  .btn { min-height: 44px; } .btn.sm { min-height: 40px; } .input, .select { min-height: 46px; font-size: 16px; } .textarea { font-size: 16px; }
  .icon-btn { width: 44px; height: 44px; } .avatar { width: 40px; height: 40px; } .space-btn { min-height: 40px; } .wallet-chip { min-height: 40px; }
  .ruler:not(.h) { display: none; } /* at 375 px heights become section chips */
  .tag { font-size: var(--fs-md); }
}
@media (max-width: 380px) { .strip-act { gap: 2px; } .wallet-chip { padding: 0 8px; } }

/* ---------- print: a sheet is a sheet ---------- */
@media print { .strip, .dock, .more-sheet, .toasts, .pwa-bar, .foot, .skip-link { display: none !important; } body { background: #fff; color: #000; } #app > * { animation: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .tag.beam::before { animation: none; }
}
