/* Layout: fixed left rail + one working column; on phones the rail becomes a top tab strip. Hoo design tokens (design-system/tokens.css), dark first. */
:root {
  --bg: #060B16; --panel: #0F1A33; --panel2: #17264B; --line: rgba(160,185,235,.14);
  --fg: #F2F5FB; --muted: #96A5C8; --decor: #64739A;
  --accent: #F4C70A; --accent-ink: #1A1400; --blue: #00AFEF;
  --ok: #46E08A; --ok-ink: #04200F; --warn: #FFB547; --warn-ink: #2A1800; --bad: #FF6B6B; --bad-ink: #2A0000;
  --test: #3A1E44; --test-ink: #F0C2FA;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) {
  --bg: #F3F5FA; --panel: #FFFFFF; --panel2: #E8EDF7; --line: rgba(17,35,71,.14);
  --fg: #0D1730; --muted: #4A5775; --decor: #7A86A3; --accent: #F4C70A; --accent-ink: #1A1400; --blue: #0077A8;
  --ok: #1F9D57; --ok-ink: #FFFFFF; --warn: #B86E00; --warn-ink: #FFFFFF; --bad: #C93A3A; --bad-ink: #FFFFFF;
  --test: #F3E2F8; --test-ink: #5B1F6E; color-scheme: light; } }
:root[data-theme="light"] {
  --bg: #F3F5FA; --panel: #FFFFFF; --panel2: #E8EDF7; --line: rgba(17,35,71,.14);
  --fg: #0D1730; --muted: #4A5775; --decor: #7A86A3; --accent: #F4C70A; --accent-ink: #1A1400; --blue: #0077A8;
  --ok: #1F9D57; --ok-ink: #FFFFFF; --warn: #B86E00; --warn-ink: #FFFFFF; --bad: #C93A3A; --bad-ink: #FFFFFF;
  --test: #F3E2F8; --test-ink: #5B1F6E; color-scheme: light; }

* { box-sizing: border-box }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-body); margin: 0 }
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }

.mockbar { background: var(--test); color: var(--test-ink); font-size: 12.5px; padding-block: 7px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between }
.mockbar label { display: flex; gap: 6px; align-items: center }
.mockbar select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px }

.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 34px) }
.rail { border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; padding-left: max(12px, env(safe-area-inset-left, 0px)) }
.brand { font: 800 20px/1 var(--font-display); padding: 4px 10px 16px; display: flex; gap: 8px; align-items: baseline }
.brand small { font: 600 11px/1 var(--font-body); color: var(--muted); letter-spacing: .08em; text-transform: uppercase }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500 }
.nav a:hover { background: var(--panel) }
.nav a[aria-current="page"] { background: var(--panel2); color: var(--fg) }
.nav .count { font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-weight: 700 }
.nav .later { font-size: 11px; color: var(--decor) }
.me { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted) }
.me b { color: var(--fg); display: block }

main { min-width: 0; padding-block: 22px 60px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)) }
.top { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px }
.crumb { color: var(--muted); font-size: 13px }
.crumb a { color: var(--muted) }
.search { flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; color: var(--muted) }
.search input { border: 0; background: transparent; outline: none; width: 100%; color: var(--fg) }
h1 { font: 800 28px/1.1 var(--font-display); margin: 0 0 4px; text-wrap: balance }
h2 { font: 700 15px/1.3 var(--font-body); margin: 0 }
.sub { color: var(--muted); margin: 0 0 18px }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600 }

.grid { display: grid; gap: 14px }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.cols-main { grid-template-columns: minmax(0, 1fr) 320px; align-items: start }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px }
.tile .big { font: 800 30px/1 var(--font-display); margin: 6px 0 4px }
.tile .src { font-size: 12px; color: var(--decor) }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap }
.p-new { background: var(--accent); color: var(--accent-ink) }
.p-progress { background: var(--blue); color: #001A24 }
.p-wait { background: var(--warn); color: var(--warn-ink) }
.p-ok { background: var(--ok); color: var(--ok-ink) }
.p-bad { background: var(--bad); color: var(--bad-ink) }
.p-quiet { background: var(--panel2); color: var(--fg) }
.p-test { background: var(--test); color: var(--test-ink) }
.sev { width: 4px; align-self: stretch; border-radius: 4px }

table { width: 100%; border-collapse: collapse }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel) }
th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top }
tr:last-child td { border-bottom: 0 }
tr.row { cursor: pointer }
tr.row:hover td { background: var(--panel2) }
td .t { font-weight: 600 }
td .m { color: var(--muted); font-size: 12.5px }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-size: 13px; color: var(--muted) }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg) }

.work { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line) }
.work:last-child { border-bottom: 0 }
.work .body { min-width: 0; flex: 1 }
.work a { color: var(--fg); font-weight: 600; text-decoration: none }
.work a:hover { text-decoration: underline }
.due { font-size: 12px; color: var(--muted); white-space: nowrap }
.due.hot { color: var(--warn); font-weight: 600 }

dl.facts { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; margin: 0 }
dl.facts dt { color: var(--muted) }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere }
.flag { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); margin-bottom: 12px }
.flag.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent) }
.flag.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent) }

.actions { display: grid; gap: 8px }
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 12px; padding: 9px 12px; font-weight: 600; text-align: left; display: flex; justify-content: space-between; gap: 8px; align-items: center }
.btn:hover:not(:disabled) { border-color: var(--muted) }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.danger { color: var(--bad) }
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn small { font-weight: 500; font-size: 12px; opacity: .8 }
.why { font-size: 12px; color: var(--decor); margin: -2px 2px 4px }

.timeline { list-style: none; margin: 0; padding: 0 }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px }
.timeline li:last-child { border-bottom: 0 }
.timeline time { color: var(--muted) }
.timeline .who { color: var(--muted) }
.timeline .reason { display: block; color: var(--fg); margin-top: 2px }
.timeline .refused { color: var(--bad) }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 14px; overflow-x: auto }
.tabs button { background: none; border: 0; padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap }
.tabs button[aria-selected="true"] { color: var(--fg); border-color: var(--accent) }

dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--fg); padding: 20px; width: min(460px, calc(100vw - 32px)) }
dialog::backdrop { background: rgba(0,0,0,.55) }
dialog textarea { width: 100%; min-height: 90px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; resize: vertical }
.row-end { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 14px 34px rgba(0,0,0,.4); z-index: 50 }
.empty { text-align: center; color: var(--muted); padding: 34px 12px }
.noaccess { text-align: center; padding: 40px 16px }
.noaccess h1 { font-size: 22px }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr) }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; gap: 2px;
    padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)) }
  .brand { padding: 4px 10px 4px 0 } .brand small { display: none }
  .nav { display: flex; gap: 2px } .nav a { white-space: nowrap; gap: 6px } .nav .later, .nav .hide-sm { display: none }
  .me { display: none }
  main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
  .cols-3, .cols-main { grid-template-columns: minmax(0, 1fr) }
  dl.facts { grid-template-columns: minmax(0, 1fr) } dl.facts dt { margin-top: 6px }
  .hide-sm { display: none }
}
@media (prefers-reduced-motion: no-preference) { .btn, .nav a, .chip { transition: background .16s, border-color .16s } }
/* Real app additions */
html, body { min-height: 100% }
.shell { min-height: 100vh }
.signin { max-width: 420px; margin: 12vh auto 0; padding-inline: 16px }
.signin input { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin: 8px 0 12px }
.signin .btn { width: 100%; justify-content: center }
.banner { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel) }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent) }
.loading { color: var(--muted); padding: 30px 0 }
.signout { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; margin-top: 6px; font-size: 12.5px }

[hidden] { display: none !important }

/* Numbers (D109) */
.ns { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.ns .big { font-size: 56px; }
.bars { width: 100%; max-width: 420px; height: 64px; display: block; margin-top: 8px; }
.bars rect { fill: var(--accent); }
.tile .bars { height: 40px; }
.tile.weak { box-shadow: inset 0 0 0 2px var(--warn); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Settings */
.setrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setrow label, .setgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 140px; }
.setrow label.grow, .savebar .grow { flex: 1 1 220px; }
.setrow input, .setrow select, .setgrid input, .setgrid textarea, .setgrid select, #sFeat, .savebar input { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-size: 14px; }
.setrow fieldset { border: 1px solid var(--line); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px; margin: 0; flex: 1 1 100%; }
.setrow .tick { flex-direction: row; align-items: center; min-width: 0; color: var(--fg); }
.setrow .off { display: none; }
.rowbtns { display: flex; gap: 6px; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.setgrid .wide { grid-column: 1 / -1; }
.setgrid textarea { min-height: 90px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: var(--bg); padding: 14px 0; margin-top: 14px; }

/* ---------- Laylo (db/015): every type, the next 30 days ---------- */
.laylo-av { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 17px; margin-right: 10px; vertical-align: middle; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.legend .cell { width: 16px; height: 16px; margin-left: 8px; }
.cell { display: grid; place-items: center; min-width: 26px; height: 32px; border-radius: 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell.h0 { background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1.5px dashed color-mix(in srgb, var(--bad) 60%, transparent); }
.cell.h1 { background: color-mix(in srgb, var(--blue) 35%, var(--panel)); color: var(--fg); }
.cell.h2 { background: color-mix(in srgb, var(--blue) 70%, var(--panel)); color: var(--fg); }
.cell.h4 { background: var(--accent); color: var(--accent-ink); }
table.laylo { border-collapse: separate; border-spacing: 3px; }
table.laylo th, table.laylo td { padding: 0; border: 0; }
table.laylo thead th { font-size: 11px; color: var(--muted); font-weight: 500; text-align: center; white-space: nowrap; }
table.laylo tbody th { text-align: left; padding-right: 10px; white-space: nowrap; font-size: 14px; }
table.laylo tr.off th, table.laylo tr.off td:not(:last-child) { opacity: .4; }
.switch { position: relative; display: inline-flex; margin-left: 8px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { width: 44px; height: 26px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--ok-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }

/* ---------- Claims (db/015) ---------- */
.claim { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.claim > img, .claim > .nopic { width: 100%; height: 200px; object-fit: cover; background: var(--panel2); }
.claim > .nopic { display: grid; place-items: center; color: var(--muted); }
.claim > .nopic svg { width: 40px; height: 40px; }
.claimbody { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.claimhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.claimhead b { font-size: 18px; }
.claimant { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 10px 12px; }
.claimant .av { width: 38px; height: 38px; border-radius: 50%; background: var(--test); color: var(--test-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.claimant .who { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.claimant .who span { color: var(--muted); font-size: 13.5px; }
.claimant .via { color: var(--ok); display: grid; }
.claimbtns { display: flex; gap: 10px; }
.claimbtns .btn, .claimstate .btn { min-height: 46px; justify-content: center; gap: 8px; }
.claimbtns .btn:not(.round) { flex: 1; }
.btn.round { width: 46px; padding: 0; justify-content: center; border-radius: 50%; }
.claimstate { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px; flex-wrap: wrap; }
.claimstate.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.claimstate.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.claimstate b { flex-grow: 1; }
.claimstate span { color: var(--muted); width: 100%; font-size: 13.5px; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px 0; cursor: pointer; align-self: flex-start; font: inherit; font-size: 13px; min-height: 24px; }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); margin-top: 18px; }
.flow svg { color: var(--accent); }
.claimhead .m, .claimant .m { white-space: nowrap; }
