/* Journeyman concept prototype — tokens from /DESIGN.md (UNBRANDED Teflon Hub base) */
@font-face { font-family: "IBM Plex Sans"; src: url(assets/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(assets/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(assets/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --primary: #1F2429; --secondary: #3D454D; --tertiary: #262C32;
  --neutral: #F3F4F5; --surface: #FFFFFF; --sunken: #F7F8F9;
  --border: #D3D8DD; --border-strong: #7B848D;
  --text: #1B1F24; --muted: #525A63; --on-dark: #FFFFFF; --on-dark-muted: #C9CFD5;
  --success: #1B6B3A; --success-subtle: #E5F2E9;
  --warning: #8A4A00; --warning-subtle: #FCEFDC;
  --danger: #B3261E; --danger-subtle: #FBE9E7;
  --info: #1D5A8E; --info-subtle: #E6EFF8;
  --focus: #1B1F24;
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px;
  --ease-in: cubic-bezier(0.2, 0, 0, 1);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 1rem/1.5 var(--sans); color: var(--text); background: var(--neutral); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; min-height: 100vh; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 2.25rem; font-weight: 600; }
h2 { font-size: 1.375rem; line-height: 1.875rem; font-weight: 600; }
h3 { font-size: 1.125rem; line-height: 1.625rem; font-weight: 600; }
/* h1 receives programmatic focus after navigation (tabindex=-1, not a tab stop): no ring */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-weight: 500; font-size: 0.875em; letter-spacing: 0; white-space: nowrap; }
.muted { color: var(--muted); }
.sm { font-size: 0.875rem; line-height: 1.25rem; }
.cap { font-size: 0.75rem; line-height: 1rem; font-weight: 500; }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 8px; }

/* ---------- Demo bar (demo-only chrome) ---------- */
.demobar { background: var(--primary); color: var(--on-dark); display: flex; align-items: center; gap: 16px; padding: 8px 16px; min-height: 52px; flex-wrap: wrap; --focus: #FFFFFF; position: relative; z-index: 20; }
.demobar .wordmark { font-weight: 600; font-size: 1rem; }
.sandbox { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 500; line-height: 1rem; padding: 4px 8px; border: 1px solid #8B949C; border-radius: var(--r-sm); color: var(--on-dark); }
.personas { display: flex; gap: 2px; background: #333A41; padding: 3px; border-radius: 6px; margin-left: auto; }
.personas button { background: transparent; border: 0; color: var(--on-dark-muted); padding: 6px 12px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: 0.875rem; }
.personas button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; }
.personas button:hover:not([aria-pressed="true"]) { color: var(--on-dark); }
.democlock { font-size: 0.875rem; color: var(--on-dark-muted); white-space: nowrap; }
.democlock strong { color: var(--on-dark); font-weight: 500; }
.btn-demo { background: transparent; color: var(--on-dark); border: 1px solid #8B949C; border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: 0.875rem; }
.btn-demo[aria-expanded="true"] { background: var(--surface); color: var(--text); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--tertiary); background: var(--tertiary); color: #fff; font-weight: 500; font-size: 0.9375rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color 120ms var(--ease-in); }
.btn:hover { background: var(--secondary); border-color: var(--secondary); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--sunken); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); text-decoration: underline; text-underline-offset: 3px; padding: 0 8px; }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 0.875rem; }
.btn[disabled], .btn[aria-disabled="true"] { background: #E3E6E9; border-color: #E3E6E9; color: #4D555D; cursor: not-allowed; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }

/* ---------- Badges and tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; line-height: 1rem; font-weight: 500; padding: 3px 8px; border-radius: var(--r-sm); white-space: nowrap; }
.badge.planned { background: var(--sunken); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.badge.progress { background: var(--info-subtle); color: var(--info); }
.badge.checked { background: var(--success-subtle); color: var(--success); }
.badge.overdue { background: var(--danger); color: #fff; }
.badge.done { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.badge.attention { background: var(--warning-subtle); color: var(--warning); }
.badge.danger-soft { background: var(--danger-subtle); color: var(--danger); }
.tag { display: inline-flex; align-items: center; font-size: 0.75rem; line-height: 1rem; font-weight: 500; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.tag.book { background: var(--primary); color: #fff; }
.tag.record { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tag.receipt { background: transparent; color: var(--text); border: 1px dashed var(--border-strong); padding: 1px 5px; }
.countpill { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 600; }
.countpill.neutral { background: var(--primary); }

/* ---------- Desktop app shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); flex: 1; min-height: 0; }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; }
.side .prod { padding: 4px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side .prod strong { display: block; font-size: 1rem; }
.side .prod span { font-size: 0.8125rem; color: var(--muted); }
.side nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--text); font-size: 0.9375rem; }
.side nav a:hover { background: var(--sunken); }
.side nav a[aria-current="page"] { background: var(--primary); color: #fff; font-weight: 500; --focus: #1B1F24; }
.side nav a .countpill { margin-left: auto; }
.side nav a[aria-current="page"] .countpill.neutral { background: #fff; color: var(--text); }
.side .who { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 0.8125rem; line-height: 1.25rem; }
.side .who strong { display: block; font-size: 0.875rem; }
.main { padding: 24px 32px 48px; min-width: 0; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead .t { min-width: 0; }
.pagehead .t p { color: var(--muted); margin-top: 4px; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.crumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.panel > .ph { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.panel > .ph h2, .panel > .ph h3 { font-size: 1rem; line-height: 1.5rem; }
.panel > .pb { padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.grid-c5 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* KPI strip: a single row of figures inside one panel (no card grid) */
.kpis { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 20px; }
.kpis > div { padding: 14px 20px; border-right: 1px solid var(--border); min-width: 150px; }
.kpis > div:last-child { border-right: 0; }
.kpis .v { font-size: 1.5rem; line-height: 2rem; font-weight: 600; white-space: nowrap; }
.kpis .l { font-size: 0.8125rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpis .alert .v { color: var(--danger); }
.kpis .bybase { margin-left: auto; display: flex; gap: 20px; align-items: center; font-size: 0.875rem; color: var(--muted); }
.kpis .bybase b { color: var(--text); font-weight: 600; }

/* Filters */
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lbl { font-size: 0.875rem; font-weight: 500; }
.field .help { font-size: 0.8125rem; color: var(--muted); }
.field .err { font-size: 0.8125rem; color: var(--danger); display: flex; gap: 6px; align-items: center; }
.input, select.input, textarea.input { height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); width: 100%; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input[readonly] { background: var(--sunken); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.input.lowconf { border-color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); background: #FFFBF4; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; align-items: end; }
.seg { display: inline-flex; align-self: flex-start; }
.seg label { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; height: 40px; cursor: pointer; font-size: 0.9375rem; border: 1px solid var(--border-strong); background: var(--surface); }
.seg label + label { margin-left: -1px; }
.seg label:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.seg label:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg input:checked + span { font-weight: 600; }
.seg label:has(input:checked) { background: var(--primary); color: #fff; border-color: var(--primary); position: relative; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }
.locked { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); background: var(--sunken); font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--primary); }

/* Tables */
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.25rem; }
thead th { position: sticky; top: 0; background: var(--sunken); color: var(--muted); font-size: 0.75rem; line-height: 1rem; font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
thead th.num { text-align: right; }
tbody td { padding: 0 12px; height: 48px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--sunken); }
tbody tr.overdue td { background: var(--danger-subtle); }
tbody tr.overdue td { border-bottom-color: #EDB7B1; }
tbody tr.overdue:hover td { background: #F8DEDA; }
tbody tr.group td { background: var(--sunken); height: 36px; font-weight: 600; font-size: 0.8125rem; }
tfoot td { padding: 10px 12px; border-top: 1px solid var(--border-strong); font-weight: 600; background: var(--surface); }
.cellmain { display: flex; flex-direction: column; line-height: 1.25rem; }
.cellmain small { color: var(--muted); font-size: 0.8125rem; }
td .cellmain small { white-space: nowrap; }
.cellmain.start { align-items: flex-start; }
.route { display: inline-flex; align-items: center; gap: 6px; }
.route .ic { color: var(--muted); }
.modeic { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.modeic .ic { width: 18px; height: 18px; }

/* Leg timeline (C2) */
.legs { list-style: none; margin: 0; padding: 0; }
.legs > li { display: grid; grid-template-columns: 36px 56px minmax(0, 2fr) minmax(0, 1.25fr) 150px 140px 180px; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); min-height: 64px; }
.legs > li:last-child { border-bottom: 0; }
.legs > li.overdue { background: var(--danger-subtle); }
.legs > li.todo { background: #FBFBFC; }
.legs .lic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--border); }
.legs .lic .ic { width: 18px; height: 18px; }
.legs .lid { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.legs .sect { display: block; padding: 10px 20px; background: var(--sunken); font-size: 0.8125rem; font-weight: 600; border-bottom: 1px solid var(--border); min-height: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font-size: 0.9375rem; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 4px 12px rgba(16, 20, 24, .10); min-width: 260px; padding: 6px; z-index: 10; }
.menu .pop button { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: var(--r-sm); cursor: pointer; align-items: flex-start; }
.menu .pop button:hover { background: var(--sunken); }
.menu .pop small { display: block; color: var(--muted); font-size: 0.8125rem; }

/* Notices */
.notice { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid; align-items: flex-start; font-size: 0.9375rem; }
.notice .ic { width: 20px; height: 20px; margin-top: 2px; }
.notice.info { background: var(--info-subtle); border-color: #B7CDE3; color: var(--text); }
.notice.info > .ic { color: var(--info); }
.notice.danger { background: var(--danger-subtle); border-color: #EDB7B1; }
.notice.danger > .ic { color: var(--danger); }
.notice.warning { background: var(--warning-subtle); border-color: #E9C894; }
.notice.warning > .ic { color: var(--warning); }
.notice.success { background: var(--success-subtle); border-color: #A9CFB5; }
.notice.success > .ic { color: var(--success); }
.notice strong { display: block; }
.notice .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Empty / skeleton */
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ic { width: 28px; height: 28px; color: var(--muted); }
.empty p { color: var(--muted); max-width: 46ch; }
.sk { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, #ECEEF0 0%, #F5F6F7 50%, #ECEEF0 100%); background-size: 200% 100%; animation: sk 1.4s linear infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Offers (C3) */
.offers { list-style: none; margin: 0; padding: 0; }
.offer { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1.25fr) 130px 140px; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer; }
.offer:last-child { border-bottom: 0; }
.offer:hover { background: var(--sunken); }
.offer.sel { background: #EEF0F2; }
.offer.off { cursor: default; }
.offer.off:hover { background: transparent; }
.offer.offhead { cursor: default; padding-top: 8px; padding-bottom: 8px; background: var(--sunken); font-size: 0.75rem; line-height: 1rem; font-weight: 500; color: var(--muted); }
.offer.offhead:hover { background: var(--sunken); }
.offer.offhead .num { text-align: right; }
.offer input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.offer .times { font-size: 1.0625rem; font-weight: 600; }
.offer .price { text-align: right; font-weight: 600; font-size: 1.0625rem; }
.offer .why { grid-column: 2 / -1; font-size: 0.875rem; color: var(--warning); display: flex; gap: 6px; align-items: center; }
.countdown { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.countdown.low { color: var(--warning); }
.countdown.gone { color: var(--danger); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 0.9375rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; font-size: 0.9375rem; }
.rules .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--muted); }

/* Money lines */
.money { width: 100%; font-size: 0.9375rem; }
.money td { height: auto; padding: 8px 0; border: 0; }
.money tr.total td { border-top: 1px solid var(--border-strong); padding-top: 12px; font-weight: 600; font-size: 1.0625rem; }
.money td:last-child { text-align: right; white-space: nowrap; }

/* Extraction (C5) */
.docpreview { background: #E7E9EC; border-radius: var(--r-md); padding: 24px; min-height: 560px; display: flex; flex-direction: column; align-items: center; gap: 16px; position: relative; }
.paper { background: #fff; width: 100%; max-width: 480px; padding: 32px 36px; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-size: 0.8125rem; line-height: 1.35rem; color: #2A2F35; }
.paper .ptitle { font-size: 1.125rem; font-weight: 600; margin-bottom: 2px; }
.paper hr { border: 0; border-top: 1px solid #D9DCDF; margin: 14px 0; }
.paper table td { padding: 3px 0; height: auto; border: 0; font-size: 0.8125rem; }
.paper mark { background: #FFE9B8; color: inherit; padding: 0 2px; }
.receiptpaper { font-family: var(--mono); max-width: 300px; font-size: 0.8125rem; transform: rotate(-1.2deg); }
.docfile { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); font-size: 0.875rem; }
.reading { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 0.9375rem; }
.reading .spin { width: 18px; height: 18px; border: 2px solid #C9CED3; border-top-color: var(--primary); border-radius: 50%; animation: spin 800ms linear infinite; }
.conf { display: inline-flex; gap: 4px; align-items: center; font-size: 0.75rem; font-weight: 500; color: var(--warning); }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: 32px; text-align: center; background: var(--sunken); display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* Alert history (H2) */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 64px 20px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9375rem; }
.hist li:last-child { border-bottom: 0; }
.hist time { font-weight: 600; }
.hist .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--muted); }
.hist li.red .ic { color: var(--danger); }
.hist li.green .ic { color: var(--success); }
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; }
.contacts li > .ic { margin-top: 3px; }
.contacts li > .btn { grid-column: 2; justify-self: start; margin-top: 6px; }
.contacts li:last-child { border-bottom: 0; }
.contacts .who2 { flex: 1; min-width: 0; }
.contacts small { display: block; color: var(--muted); font-size: 0.8125rem; }
.bigstat { font-size: 2rem; line-height: 2.5rem; font-weight: 600; color: var(--danger); }

/* ---------- Traveller (mobile) ---------- */
.stage { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 24px; gap: 32px; }
.stagenote { max-width: 300px; color: var(--muted); font-size: 0.875rem; padding-top: 8px; }
.stagenote h2 { color: var(--text); font-size: 1rem; margin-bottom: 8px; }
.phone { width: 390px; height: 800px; background: var(--neutral); border-radius: 28px; outline: 10px solid #1F2429; overflow: hidden; display: flex; flex-direction: column; position: relative; margin: 10px; }
.m-head { background: var(--primary); color: #fff; padding: 14px 16px 12px; --focus: #fff; }
.m-head .r1 { display: flex; align-items: center; gap: 8px; }
.m-head .r1 .sandbox { margin-left: auto; font-size: 0.6875rem; padding: 2px 6px; }
.m-head .back { background: none; border: 0; color: #fff; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; cursor: pointer; font-size: 0.9375rem; min-height: 32px; }
.m-head h1 { font-size: 1.25rem; line-height: 1.75rem; margin-top: 6px; }
.m-head p { color: var(--on-dark-muted); font-size: 0.875rem; }
.m-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.m-foot { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.m-foot .who2 { flex: 1; font-size: 0.8125rem; line-height: 1.125rem; color: var(--muted); }
.m-foot .who2 strong { display: block; color: var(--text); font-size: 0.875rem; }
.m-call { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border-strong); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nextcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.nextcard .lbl { font-size: 0.8125rem; color: var(--muted); }
.nextcard .what { font-size: 1.0625rem; font-weight: 600; line-height: 1.5rem; }
.bigbtn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; width: 100%; border-radius: var(--r-md); border: 0; background: var(--tertiary); color: #fff; font-size: 1.0625rem; font-weight: 600; cursor: pointer; }
.bigbtn:hover { background: var(--secondary); }
.bigbtn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.bigbtn .ic { width: 22px; height: 22px; }
.m-legs { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.m-legs li + li { border-top: 1px solid var(--border); }
.m-legs button { width: 100%; background: none; border: 0; text-align: left; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 12px; cursor: pointer; align-items: start; min-height: 64px; }
.m-legs button:hover { background: var(--sunken); }
.m-legs li.overdue button { background: var(--danger-subtle); }
.m-legs li.current button { background: var(--sunken); }
.m-legs .lic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--border); }
.m-legs .lic .ic { width: 16px; height: 16px; }
.m-legs .t1 { font-weight: 600; font-size: 0.9375rem; line-height: 1.25rem; }
.m-legs .t2 { font-size: 0.8125rem; color: var(--muted); line-height: 1.125rem; margin-top: 2px; }
.m-legs .badge { margin-top: 2px; }
.m-sect { font-size: 0.875rem; font-weight: 600; color: var(--muted); margin-top: 4px; }
.m-banner { background: var(--danger); color: #fff; border-radius: var(--r-md); padding: 14px 16px; display: flex; gap: 12px; align-items: center; border: 0; width: 100%; text-align: left; cursor: pointer; font-size: 0.9375rem; font-weight: 500; --focus: #1B1F24; }
.m-banner .ic { width: 22px; height: 22px; }
.m-status { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.m-status .ic { width: 22px; height: 22px; margin-top: 2px; }
.m-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; }
.m-detail dl.kv { font-size: 0.9375rem; grid-template-columns: 104px minmax(0, 1fr); }
.stamp { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--success-subtle); color: var(--success); font-weight: 600; }
.stamp .ic { width: 22px; height: 22px; }
.photo { background: #3B4148; border-radius: var(--r-md); padding: 20px; display: flex; justify-content: center; }

/* ---------- Demo controls drawer ---------- */
.drawer { position: fixed; top: 52px; right: 0; bottom: 0; width: 400px; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -4px 0 16px rgba(16,20,24,.10); z-index: 30; display: flex; flex-direction: column; }
.drawer .dh { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.drawer .dh h2 { font-size: 1rem; line-height: 1.5rem; }
.drawer .db { overflow-y: auto; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.drawer h3 { font-size: 0.875rem; line-height: 1.25rem; margin-bottom: 6px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; }
.steps button { background: none; border: 0; text-align: left; padding: 5px 6px; border-radius: var(--r-sm); cursor: pointer; font-size: 0.8125rem; line-height: 1.125rem; width: 100%; }
.steps button:hover { background: var(--sunken); }
.steps .n { font-size: 0.75rem; font-weight: 600; color: var(--muted); padding-top: 5px; text-align: right; }
.steps .who3 { display: block; color: var(--muted); font-size: 0.75rem; }
.statebtns { display: flex; flex-wrap: wrap; gap: 6px; }
.statebtns button { height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font-size: 0.8125rem; }
.statebtns button:hover { background: var(--sunken); }
.statebtns button[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.stategroup { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--border); }
.stategroup .sid { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; padding-top: 6px; }
.nextev { border-bottom: 1px solid var(--border); padding-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.opalert { border-top: 2px solid var(--warning); border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 0.8125rem; }
.opalert strong { color: var(--warning); }

/* Toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--primary); color: #fff; padding: 12px 16px; border-radius: var(--r-md); display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 24px rgba(16,20,24,.16); font-size: 0.9375rem; pointer-events: auto; max-width: 560px; }
.toast .ic { width: 18px; height: 18px; }

/* v0.2: money cells, totals row, demo-preset label, unconfirmed lines */
.cellmain.end { align-items: flex-end; }
.legs .cellmain small.nowrap { white-space: nowrap; }
.money .cellmain small { white-space: nowrap; }
.sumrow { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: flex-start; }
.sumrow strong { display: block; font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
.preset { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 0.75rem; line-height: 1rem; color: var(--muted); white-space: nowrap; }
.cellmain > .preset { margin: 4px 0 0; }
tr.pending td { color: var(--muted); }
tr.pending td .badge { color: var(--warning); }

/* Narrow main area (e.g. Demo controls open beside a 1440 screen): stack the two-column layouts */
.main { container-type: inline-size; }
@container (max-width: 1080px) {
  .grid2, .grid-c5 { grid-template-columns: minmax(0, 1fr); }
  .grid2 > .panel[style*="sticky"] { position: static !important; }
  .formgrid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }
  .legs > li { grid-template-columns: 36px 56px minmax(0, 1.6fr) minmax(0, 1.2fr) 130px 130px; }
  .legs > li > span:last-child { grid-column: 3 / -1; }
  .legs > li.sect { display: block; }
}

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

/* Real phones (and 390px screenshots): no frame */
@media (max-width: 600px) {
  .stage { padding: 0; align-items: stretch; }
  .stagenote { display: none; }
  .phone { width: 100%; height: auto; border-radius: 0; outline: 0; margin: 0; }
  .m-body { overflow: visible; }
  .m-foot { position: sticky; bottom: 0; }
  .demobar { gap: 8px; padding: 6px 12px; flex-wrap: nowrap; min-height: 48px; }
  .demobar .democlock, .demobar > .sandbox { display: none; }
  .personas { margin-left: auto; }
  .personas button { padding: 6px 9px; }
  .personas button span.pl, .btn-demo span.pl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-demo { padding: 6px 9px; }
  .drawer { width: 100%; top: 0; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 16px; }
}
