/* ==========================================================================
   Banci Toboh Laut — design system
   Palette grounded in siga: black cloth, gold trim. Dark chrome, light content,
   one metal accent. No Tailwind, no build step, no external fonts.
   ========================================================================== */

:root {
  /* --- ink & paper --- */
  --ink:        #131110;
  --ink-2:      #2A2521;
  --ink-3:      #443C35;
  --paper:      #F4F2EE;
  --card:       #FFFFFF;
  --card-2:     #FBFAF7;
  --line:       #E0DAD0;
  --line-soft:  #EFEAE2;
  --text:       #1B1714;
  --muted:      #756C61;

  /* --- accents --- */
  --brass:      #C4941F;
  --brass-lit:  #E7C46B;
  --brass-bg:   #F7EFDB;
  --jade:       #2C6A52;
  --jade-bg:    #E7F0EB;
  --clay:       #99452F;
  --clay-bg:    #F7E9E5;

  /* --- on-dark --- */
  --on-ink:     #F6F2EA;
  --on-ink-dim: #A79C8E;

  /* The floating button must read as raised against the page in either theme. */
  --fab-bg:     #131110;
  --fab-fg:     #F6F2EA;
  --fab-icon:   #E7C46B;

  /* --- type --- */
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, ui-sans-serif, system-ui, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono:  ui-monospace, "SF Mono", "Roboto Mono", "DejaVu Sans Mono", monospace;

  /* --- shape --- */
  --r-xs: 6px;
  --r-sm: 9px;
  --r:    13px;
  --r-lg: 20px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(19,17,16,.05), 0 1px 3px rgba(19,17,16,.04);
  --sh-2: 0 2px 8px rgba(19,17,16,.07), 0 12px 28px rgba(19,17,16,.09);
  --sh-3: 0 -8px 40px rgba(19,17,16,.18);

  --tab-h: 60px;
  --dur: .28s;
  --ease: cubic-bezier(.32,.72,0,1);
}

/* Dark theme. Declared twice on purpose: once for the OS signal, once for the
   explicit toggle, so the toggle wins in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:        #0C0A09;
    --ink-2:      #191512;
    --ink-3:      #2E2823;
    --paper:      #100E0C;
    --card:       #1A1613;
    --card-2:     #211C18;
    --line:       #322B25;
    --line-soft:  #262019;
    --text:       #F1EBE1;
    --muted:      #9C9084;
    --brass:      #D9A93A;
    --brass-lit:  #E7C46B;
    --brass-bg:   #2C2312;
    --jade:       #6FBF9A;
    --jade-bg:    #16281F;
    --clay:       #E0836A;
    --clay-bg:    #2E1A15;
    --on-ink:     #F1EBE1;
    --on-ink-dim: #9C9084;
    --fab-bg:     #D9A93A;
    --fab-fg:     #17130A;
    --fab-icon:   #17130A;
    --sh-1: 0 1px 2px rgba(0,0,0,.4);
    --sh-2: 0 2px 8px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.45);
    --sh-3: 0 -8px 40px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --ink:        #0C0A09;
  --ink-2:      #191512;
  --ink-3:      #2E2823;
  --paper:      #100E0C;
  --card:       #1A1613;
  --card-2:     #211C18;
  --line:       #322B25;
  --line-soft:  #262019;
  --text:       #F1EBE1;
  --muted:      #9C9084;
  --brass:      #D9A93A;
  --brass-lit:  #E7C46B;
  --brass-bg:   #2C2312;
  --jade:       #6FBF9A;
  --jade-bg:    #16281F;
  --clay:       #E0836A;
  --clay-bg:    #2E1A15;
  --on-ink:     #F1EBE1;
  --on-ink-dim: #9C9084;
  --fab-bg:     #D9A93A;
  --fab-fg:     #17130A;
  --fab-icon:   #17130A;
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 8px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.45);
  --sh-3: 0 -8px 40px rgba(0,0,0,.6);
}

/* --------------------------------------------------------------- reset --- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brass-lit); color: #1B1714; }

.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.serif  { font-family: var(--serif); }
.wrap   { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 16px; }
.sr     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* The woven-trim motif. Used on the header only — it loses force if repeated. */
.trim {
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--brass) 0 7px, transparent 7px 14px);
}

/* --------------------------------------------------------------- header -- */

.app-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink);
  color: var(--on-ink);
  padding-top: env(safe-area-inset-top);
}
.hdr-in {
  display: flex; align-items: center; gap: 12px;
  padding-block: 11px 12px;
}
.hdr-title { flex: 1; min-width: 0; }
.hdr-title h1 {
  font-family: var(--serif);
  font-size: 20px; font-weight: 600; line-height: 1.15;
  letter-spacing: -.015em;
}
.hdr-title p {
  font-size: 11px; color: var(--on-ink-dim);
  letter-spacing: .06em; text-transform: uppercase; margin-top: 3px;
}
.hdr-actions { display: flex; align-items: center; gap: 6px; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  color: var(--on-ink-dim);
  border-radius: var(--r-full);
  padding: 6px 11px 6px 9px;
  font-size: 11px; font-family: var(--mono); letter-spacing: -.01em;
  white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--jade); flex: none; }
.status.is-warn .dot { background: var(--brass); }
.status.is-off  .dot { background: var(--clay); }
.status.is-busy .dot { animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.on-dark {
  border-color: rgba(255,255,255,.11);
  background: rgba(255,255,255,.07);
  color: var(--on-ink);
}
.icon-btn.danger:hover { color: var(--clay); border-color: var(--clay); background: var(--clay-bg); }

/* ----------------------------------------------------------- KKD strip --- */
/* Navigation and progress chart in one control. Do not split it in two. */

.strip-wrap {
  position: sticky; top: 0; z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-1);
}
.app-header ~ .strip-wrap { top: calc(env(safe-area-inset-top) + 63px); }
.strip {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px;
  padding-block: 10px 9px;
}
.kkd {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 0; background: none; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.kkd .cap {
  font-family: var(--mono); font-size: 9px; line-height: 1;
  color: var(--muted); height: 10px;
  opacity: 0; transition: opacity var(--dur);
}
.kkd.is-on .cap { opacity: 1; color: var(--brass); font-weight: 700; }
.kkd .track {
  width: 100%; height: 40px;
  border-radius: var(--r-xs);
  background: var(--line-soft);
  display: flex; align-items: flex-end; overflow: hidden;
}
.kkd .fill {
  width: 100%;
  background: var(--brass);
  border-radius: var(--r-xs);
  opacity: .34;                  /* readable against the track, still clearly unselected */
  transition: height var(--dur) var(--ease), opacity var(--dur);
  min-height: 3px;
}
.kkd.is-on .track { background: var(--brass-bg); }
.kkd.is-on .fill  { opacity: 1; }
.kkd:hover .fill  { opacity: .7; }
.kkd .num {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  color: var(--muted); transition: color var(--dur);
}
.kkd.is-on .num { color: var(--text); font-weight: 700; }

/* ---------------------------------------------------------------- card --- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.stack > * + * { margin-top: 12px; }
.view { padding-block: 16px 24px; }
.view.has-fab { padding-bottom: 92px; }   /* last row must clear the floating button */

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 26px 2px 10px;
}
.sec-head:first-child { margin-top: 4px; }
.sec-head h2 {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  letter-spacing: -.01em;
}
.sec-head .hint { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------- zone header --- */

.zone {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
}
.zone-badge {
  flex: none; width: 52px; height: 52px;
  display: grid; place-items: center; gap: 0;
  border-radius: var(--r-sm);
  background: var(--ink); color: var(--on-ink);
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  line-height: 1;
}
.zone-badge small { font-size: 8px; letter-spacing: .12em; opacity: .6; font-weight: 500; }
.zone-main { flex: 1; min-width: 0; }
.zone-main h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.zone-figs { display: flex; gap: 14px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.zone-figs b { font-family: var(--mono); font-weight: 700; color: var(--text); }
.zone-mgr {
  border-top: 1px dashed var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
}
.zone-mgr strong { color: var(--text); font-weight: 600; }

/* ----------------------------------------------------------- household --- */

.hh { overflow: hidden; }
.hh-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 13px 12px 16px;
}
.hh-head .who { flex: 1; min-width: 0; }
.hh-head h3 {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  letter-spacing: -.01em; word-break: break-word;
}
.hh-head .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hh-head .meta b { font-family: var(--mono); color: var(--text); font-weight: 600; }
.hh-head .meta .away { color: var(--clay); }
.hh-tools { display: flex; gap: 6px; flex: none; }

.mem-list { border-top: 1px solid var(--line-soft); background: var(--card-2); }
.mem-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.mem-list li:first-child { border-top: 0; }
.mem-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-list .star { color: var(--brass); display: inline-flex; flex: none; }
.mem-list .star svg { width: 13px; height: 13px; }
.mem-list .age {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  flex: none; min-width: 26px; text-align: right;
}

.confirm {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--clay);
}

/* ---------------------------------------------------------------- pill --- */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; flex: none;
  background: var(--line-soft); color: var(--muted);
}
.pill.jade  { background: var(--jade-bg);  color: var(--jade); }
.pill.clay  { background: var(--clay-bg);  color: var(--clay); }
.pill.brass { background: var(--brass-bg); color: var(--brass); }
.pill.mono  { font-family: var(--mono); }

/* -------------------------------------------------------------- button --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 11px 16px;
  font-size: 14.5px; font-weight: 600;
  color: var(--text);
  transition: transform .1s, background var(--dur), border-color var(--dur), color var(--dur);
}
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; }
.btn.gold  { background: var(--brass); border-color: var(--brass); color: #17130A; }
.btn.gold:hover { background: var(--brass-lit); border-color: var(--brass-lit); }
.btn.dark  { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.btn.dashed { border-style: dashed; }
.btn.block { display: flex; width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-xs); }
.btn.danger { color: var(--clay); border-color: var(--clay); background: var(--clay-bg); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.fab {
  position: fixed; right: max(16px, calc(50vw - 380px + 16px)); z-index: 45;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  height: 52px; padding: 0 20px 0 17px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: var(--r-full);
  background: var(--fab-bg); color: var(--fab-fg);
  font-size: 14.5px; font-weight: 600;
  box-shadow: var(--sh-2);
  transition: transform .14s var(--ease), opacity .14s;
}
.fab svg { width: 19px; height: 19px; color: var(--fab-icon); }
.fab:active { transform: scale(.96); }
.fab[hidden] { display: none; }

/* ---------------------------------------------------- chips & segments --- */
/* Rule 1: never a <select>. A native picker costs four interactions. */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll {
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r-full);
  padding: 8px 14px;
  font-size: 13.5px; color: var(--muted);
  white-space: nowrap; flex: none;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.chip:hover { border-color: var(--muted); color: var(--text); }
.chip.is-on {
  background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600;
}
.chip.gold.is-on { background: var(--brass); border-color: var(--brass); color: #17130A; }
.chip.mono { font-family: var(--mono); }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px;
  background: var(--line-soft);
  border-radius: var(--r-sm);
  padding: 3px;
}
.seg button {
  border: 0; background: transparent;
  border-radius: calc(var(--r-sm) - 2px);
  padding: 10px 6px;
  font-size: 13.5px; color: var(--muted);
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.seg button.is-on {
  background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--sh-1);
}
.seg button.is-on[data-tone="jade"] { color: var(--jade); }
.seg button.is-on[data-tone="clay"] { color: var(--clay); }

.star-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r-full);
  padding: 6px 12px 6px 10px;
  font-size: 12.5px; color: var(--muted);
  transition: all var(--dur);
}
.star-btn svg { width: 14px; height: 14px; }
.star-btn.is-on {
  background: var(--brass-bg); border-color: var(--brass); color: var(--brass); font-weight: 700;
}

/* --------------------------------------------------------------- field --- */

.field { display: block; }
.field + .field { margin-top: 13px; }
.field > .lab {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.input {
  display: block; width: 100%;
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  font-size: 16px; /* below 16px iOS Safari zooms on focus and the layout jumps */
  transition: border-color var(--dur), background var(--dur);
}
.input:focus { outline: none; border-color: var(--brass); background: var(--card); }
.input::placeholder { color: var(--muted); opacity: .7; }
.input.lg { font-size: 17px; font-weight: 600; padding-block: 13px; }
textarea.input { resize: vertical; min-height: 66px; line-height: 1.4; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .field + .field { margin-top: 0; }

.search {
  position: relative;
}
.search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.search .input { padding-left: 36px; }

/* --------------------------------------------------------------- sheet --- */

.sheet {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column; justify-content: flex-end;
  pointer-events: none;
}
.sheet[hidden] { display: none; }
.sheet .scrim {
  position: absolute; inset: 0;
  background: rgba(12,10,9,.5);
  opacity: 0; transition: opacity var(--dur);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet .panel {
  position: relative;
  width: 100%; max-width: 620px; margin-inline: auto;
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--paper);
  box-shadow: var(--sh-3);
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
  pointer-events: auto;
}
.sheet.is-open .scrim { opacity: 1; }
.sheet.is-open .panel { transform: none; }

.sheet-head {
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--on-ink);
  padding: calc(env(safe-area-inset-top) + 12px) 14px 12px;
}
.sheet-head h2 { flex: 1; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.sheet-head .tag {
  font-family: var(--mono); font-size: 11px; color: var(--brass-lit);
  border: 1px solid rgba(231,196,107,.3); border-radius: var(--r-full);
  padding: 4px 9px;
}
.sheet-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 28px;
}
.sheet-body > * + * { margin-top: 12px; }
.sheet-foot {
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.sheet-foot .btn { padding-block: 13px; }

.mem {
  padding: 13px 14px 14px;
  border-radius: var(--r);
  background: var(--card);
}
.mem-top { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.mem-idx {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 3px 6px; flex: none;
}
.mem-top .sp { flex: 1; }

/* ------------------------------------------------------------- reports --- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { padding: 14px 15px 13px; }
.tile .v {
  font-family: var(--mono); font-size: 30px; font-weight: 700;
  line-height: 1; letter-spacing: -.03em;
}
.tile .k { font-size: 12px; color: var(--muted); margin-top: 7px; }
.tile .k small { display: block; font-size: 10.5px; opacity: .8; margin-top: 1px; }
.tile.accent { background: var(--ink); border-color: var(--ink); }
.tile.accent .v { color: var(--brass-lit); }
.tile.accent .k { color: var(--on-ink-dim); }

.bars { padding: 6px 16px 14px; }
.bar-row {
  display: grid; grid-template-columns: 104px 1fr 42px;
  align-items: center; gap: 10px;
  padding-block: 7px;
}
.bar-row .k { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .k.mono { font-size: 12px; }
.bar-row .track {
  display: block;                /* the fill is a span; it must not stay inline */
  height: 8px; border-radius: var(--r-full);
  background: var(--line-soft); overflow: hidden;
}
.bar-row .fill {
  display: block;
  height: 100%; border-radius: var(--r-full);
  background: var(--brass);
  transition: width .5s var(--ease);
  min-width: 2px;
}
.bar-row .fill.jade { background: var(--jade); }
.bar-row .fill.clay { background: var(--clay); }
.bar-row .fill.ink  { background: var(--ink-3); }
.bar-row .v { font-family: var(--mono); font-size: 13px; text-align: right; font-weight: 600; }
.bar-row .v small { color: var(--muted); font-weight: 400; font-size: 11px; }

.rows > li {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.rows > li:first-child { border-top: 0; }
.rows .kkd-tag {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--muted); background: var(--line-soft);
  border-radius: var(--r-xs); padding: 3px 6px; flex: none;
}
.rows .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .nm small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.rows .age { font-family: var(--mono); font-size: 12.5px; color: var(--muted); flex: none; }

.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 34px 22px; text-align: center;
}
.empty .ico {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: var(--r-full); background: var(--line-soft); color: var(--muted);
}
.empty .ico svg { width: 20px; height: 20px; }
.empty p { font-size: 13.5px; color: var(--muted); max-width: 30ch; line-height: 1.5; }

/* ---------------------------------------------------------------- tabs --- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in {
  display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: 760px; margin-inline: auto;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none;
  height: var(--tab-h);
  justify-content: center;
  color: var(--muted);
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  position: relative;
  transition: color var(--dur);
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 21px; height: 21px; }
.tab.is-on { color: var(--text); }
.tab.is-on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--brass);
}

/* --------------------------------------------------------------- toast --- */

.toast {
  position: fixed; z-index: 80;
  left: 50%; transform: translate(-50%, 14px);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: var(--on-ink);
  border-radius: var(--r-full);
  padding: 11px 18px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--sh-2);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brass); flex: none; }
.toast.bad .dot { background: var(--clay); }

/* ------------------------------------------------------------ desktop --- */

@media (min-width: 880px) {
  .view { padding-block: 22px 40px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .report-grid > .sec-head { grid-column: 1 / -1; }
  .sheet { justify-content: center; padding: 24px 16px; }
  .sheet .panel { height: min(100%, 860px); border-radius: var(--r-lg); overflow: hidden; }
  .sheet-head { padding-top: 14px; }
  .sheet-foot { padding-bottom: 14px; }
}

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

/* --------------------------------------------------------------- print --- */

.print-head { display: none; }

@media print {
  :root { --paper: #fff; --card: #fff; --line: #ccc; --line-soft: #e4e4e4; --text: #000; --muted: #555; }
  body { padding: 0; background: #fff; font-size: 11pt; }
  .app-header, .strip-wrap, .tabbar, .fab, .toast, .sheet,
  .no-print, .search, .chips, .btn { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-head {
    display: block; margin-bottom: 16px;
    border-bottom: 2px solid #000; padding-bottom: 10px;
  }
  .print-head h1 { font-family: var(--serif); font-size: 20pt; }
  .print-head p { font-size: 10pt; color: #444; margin-top: 4px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .rows > li, .bar-row { break-inside: avoid; }
  .sec-head { margin-top: 18px; }
}
