/* Neurex: calm light theme */
:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface2: #eef3f1;
  --ink: #1c2b29;
  --ink2: #44544f;
  --muted: #64736f;
  --line: #dde6e2;
  --grid: #edf2ef;
  --primary: #2c7a70;
  --primary-ink: #1f5f57;
  --primary-soft: #e2f0ec;
  --good: #2c8659;
  --good-soft: #e3f3ea;
  --warn: #a8831a;
  --warn-soft: #faf2d8;
  --risk: #c4513b;
  --risk-soft: #fbe7e1;
  --amber: #d8702c;
  --amber-soft: #fdebdc;
  --ch-vib: #3a6db3;
  --ch-br: #2c7a70;
  --ch-lift: #8659c0;
  --ch-emg: #c0507a;
  --shadow: 0 1px 2px rgba(28, 43, 41, .05), 0 6px 20px rgba(28, 43, 41, .06);
  --r: 18px;
  --f: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px; line-height: 1.45; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
body.locked { overflow: hidden; }
h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 800; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono, .num { font-family: var(--f-mono); }
.eyebrow { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.eyebrow.light { color: rgba(255, 255, 255, .75); }
.sub { color: var(--ink2); font-size: 14.5px; margin-top: 3px; }
.fine { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.fine.light { color: rgba(255, 255, 255, .8); }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: 12px; }
.row.gap { gap: 10px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 0; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0 12px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(243, 246, 244, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; margin-right: auto; }
.brand img { border-radius: 8px; }
.livepill { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--ink2); background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.livepill i { width: 8px; height: 8px; border-radius: 50%; background: #b4c0bc; }
.livepill.on { color: var(--primary-ink); border-color: #bfdcd5; background: var(--primary-soft); }
.livepill.on i { background: var(--good); box-shadow: 0 0 0 0 rgba(44, 134, 89, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(44, 134, 89, .45); } 70% { box-shadow: 0 0 0 7px rgba(44, 134, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(44, 134, 89, 0); } }
#soundBtn .snd-off { display: none; }
#soundBtn.muted .snd-on { display: none; }
#soundBtn.muted .snd-off { display: block; }
#soundBtn.muted { color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink2); display: grid; place-items: center; cursor: pointer; }

/* layout */
main { padding: 16px 16px 0; }
.view { margin: 0 auto; }
.view.narrow { max-width: 520px; }
.view.wide { max-width: 1080px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 15.5px; cursor: pointer; text-decoration: none; text-align: center; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .icon-btn:focus-visible, .tabbar a:focus-visible, .seg button:focus-visible { outline: 3px solid #9fcfc6; outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--risk); border-color: var(--risk); color: #fff; }
.btn.ghost { background: transparent; }
.btn.light { color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn.big { width: 100%; min-height: 58px; font-size: 18px; border-radius: 16px; margin-top: 10px; }
.btn.ok { background: #fff; border-color: #fff; color: var(--good); }
.btn.small { min-height: 40px; padding: 8px 10px; font-size: 13.5px; border-radius: 11px; justify-content: flex-start; }
.btn.wide { grid-column: span 2; justify-content: center; }
.btn.danger-text { color: var(--risk); }
.link { background: none; border: 0; padding: 4px 0; color: var(--primary); font-weight: 800; cursor: pointer; font-size: 14.5px; }

/* live: layout. Phones: one column. Laptops: graph on the left, phone screen on the right */
.view.live { max-width: 1180px; }
.live-grid { display: flex; flex-direction: column; gap: 12px; }
.col-main, .col-side { display: contents; }
.o1 { order: 1; } .o2 { order: 2; } .graph-card { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; } .o7 { order: 7; } .o8 { order: 8; } .o9 { order: 9; }
.live-grid .now, .live-grid .feed-head, .live-grid .help-btn, .live-grid #contactCard { margin-top: 0; }
.live-grid .feed-head { margin-bottom: -4px; }
@media (min-width: 960px) {
  .live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
  .col-main, .col-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .col-main { position: sticky; top: 74px; }
}
.meal-btn { width: 100%; min-height: 52px; font-size: 16.5px; }

/* live: the graph card */
.graph-card { padding: 14px 14px 16px; transition: box-shadow .25s, border-color .25s; }
.graph-card[data-flash="risky"] { border-color: var(--risk); box-shadow: 0 0 0 3px rgba(196, 81, 59, .25), var(--shadow); }
.graph-card[data-flash="cough"] { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(216, 112, 44, .25), var(--shadow); }
.graph-card[data-flash="watch"] { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(168, 131, 26, .2), var(--shadow); }
.g-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.g-top .sub { font-size: 13.5px; }
.g-right { display: flex; align-items: center; gap: 8px; }
.bandstat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); white-space: nowrap; }
.bandstat.live { color: var(--primary-ink); background: var(--primary-soft); border-color: #c4e0d9; }
.bandstat.alarm { color: #b55a1c; background: var(--amber-soft); border-color: #f4cfae; }
.bandstat.on { color: #fff; background: var(--risk); border-color: var(--risk); }
.bandstat.on svg { animation: shake .12s linear infinite; }
@keyframes shake { 0% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } 100% { transform: translateX(-1.5px); } }
.clock { font-size: 13px; color: var(--ink2); background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.graph-card .canvas-wrap { margin-top: 10px; }
.canvas-wrap canvas { cursor: crosshair; }
.lane-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink2); margin-top: 8px; font-weight: 600; }
.lane-key span { display: inline-flex; align-items: center; gap: 6px; }
.lane-key i { width: 14px; height: 10px; border-radius: 3px; border: 1px solid; display: inline-block; }
.verdict { margin-top: 12px; background: var(--surface2); border-radius: 14px; padding: 12px 14px; min-height: 64px; }
.verdict h3 { font-size: 18px; }
.verdict h3 small { font-size: 13px; color: var(--muted); font-weight: 700; }
.verdict .sub b { color: var(--ink); }
.verdict .checks { margin-top: 10px; }
.pill.pending { color: var(--primary-ink); background: var(--primary-soft); }
.progress { height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; width: 0; background: var(--primary); border-radius: 5px; }
@media (max-width: 600px) {
  .verdict .checks li:not(.bad):not(.cough) small { display: none; }
  .verdict .checks li { padding: 8px 10px; }
}

/* emergency screen: the live graph sits under the steps */
.sos-graph { margin-top: 18px; background: rgba(255, 255, 255, .96); border-radius: 16px; padding: 10px 10px 12px; }
.sos-graph .eyebrow { margin: 2px 4px 6px; }
.sos-graph .canvas-wrap { margin-top: 0; }
.sos.resolved .sos-graph { display: none; }
@media (min-width: 960px) {
  .sos:not(.resolved) .sos-inner { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .sos-graph { margin-top: 64px; position: sticky; top: 28px; }
}

/* live: stats */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats3 > div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px; text-align: center; box-shadow: var(--shadow); }
.stats3 b { display: block; font-family: var(--f-mono); font-weight: 500; font-size: 30px; line-height: 1.1; }
.stats3 span { font-size: 13px; color: var(--muted); font-weight: 700; }

/* live: now card */
.now { display: flex; gap: 14px; align-items: flex-start; margin-top: 12px; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); border-left: 6px solid var(--primary); min-height: 104px; transition: background .25s, border-color .25s; }
.now h3 { font-size: 20px; }
.now p { color: var(--ink2); margin-top: 4px; font-size: 15.5px; }
.now-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.now.calm { border-left-color: var(--primary); }
.now.amber { background: var(--amber-soft); border-color: #f4cfae; border-left-color: var(--amber); }
.now.amber .now-ic { background: #fff; color: var(--amber); }
.now.risk { background: var(--risk-soft); border-color: #f1c3b8; border-left-color: var(--risk); }
.now.risk .now-ic { background: #fff; color: var(--risk); }

/* live: feed */
.feed-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; font-weight: 800; font-size: 15px; }
.feed-head span:last-child { font-weight: 700; color: var(--muted); font-size: 13px; }
.feed { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.feed li { display: flex; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed li i { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.feed li.risky i { background: var(--risk); }
.feed li.cough i { background: var(--amber); }
.feed li.watch i { background: var(--warn); }
.feed li b { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.feed li .tm { font-family: var(--f-mono); font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.feed li p { color: var(--ink2); font-size: 14px; margin-top: 2px; }
.feed li.empty { color: var(--muted); font-size: 14.5px; justify-content: center; text-align: center; padding: 18px 16px; }
.help-btn { width: 100%; margin-top: 16px; min-height: 54px; color: var(--risk); border: 2px solid #ecc0b5; background: var(--surface); font-size: 17px; }
#contactCard { margin-top: 12px; }
.contact-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.contact-row b { display: block; font-size: 16px; }
.contact-row small { color: var(--muted); font-size: 13.5px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: 800; font-size: 18px; flex: none; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; padding: 3px 9px 3px 5px; border-radius: 999px; white-space: nowrap; }
.pill svg { width: 15px; height: 15px; }
.pill.good { color: var(--good); background: var(--good-soft); }
.pill.warn { color: #8a6b12; background: var(--warn-soft); }
.pill.risk { color: #a8402c; background: var(--risk-soft); }
.pill.amber { color: #b55a1c; background: var(--amber-soft); }
.pill.muted { color: var(--muted); background: var(--surface2); }

/* tab bar */
.tabbar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 4px; padding: 5px; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 8px 28px rgba(28, 43, 41, .14); }
.tabbar a { display: flex; align-items: center; gap: 7px; padding: 10px 22px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 800; font-size: 15px; }
.tabbar a[aria-current="page"] { background: var(--primary); color: #fff; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(20, 34, 32, .38); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(20, 34, 32, .2); }
.sheet-card h2 { margin-bottom: 12px; }
.sheet-card .eyebrow { margin-top: 18px; }
.sheet-card .stats3 { margin: 6px 0 4px; }
.sheet.full .sheet-card { max-width: 980px; }
.sheet.full .sheet-card h2 { margin-bottom: 0; }
@media (min-width: 700px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-card { border-radius: 22px; padding: 24px; }
}
label { display: block; font-size: 14px; font-weight: 700; color: var(--ink2); margin: 12px 0 5px; }
input[type="text"], input:not([type]), input[type="tel"] { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); font-size: 16px; }
input:focus { outline: 3px solid #b6dbd3; border-color: var(--primary); background: #fff; }
.switch { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; color: var(--ink); margin-top: 14px; }
.switch input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; margin-top: 1px; }
.rules { margin: 4px 0 0; padding-left: 18px; color: var(--ink2); font-size: 14.5px; }
.rules li { margin: 4px 0; }
.tips { list-style: none; padding: 0; margin: 4px 0 0; }
.tips li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--good); }
.tips li:first-child { border-top: 0; }
.tips li div { color: var(--ink); }
.tips b { display: block; }
.tips small { color: var(--ink2); font-size: 14px; }

/* sensor readings */
.canvas-wrap { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.canvas-wrap canvas { display: block; width: 100%; }
.checkcard { margin-top: 14px; background: var(--surface2); border-radius: 16px; padding: 14px 16px; }
.checkcard h3 { font-size: 19px; }
.checks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--good); }
.checks li svg { flex: none; margin-top: 1px; }
.checks li.bad { color: var(--risk); border-color: #f1c3b8; }
.checks li.cough { color: var(--amber); border-color: #f4cfae; }
.checks li div { color: var(--ink); min-width: 0; }
.checks b { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.checks .sens { font-family: var(--f-mono); font-weight: 400; font-size: 11px; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.checks .val { display: block; font-family: var(--f-mono); font-size: 13px; color: var(--ink); margin-top: 1px; }
.checks small { display: block; color: var(--ink2); font-size: 13px; margin-top: 2px; }

/* emergency screen */
.sos { position: fixed; inset: 0; z-index: 60; color: #fff; overflow: auto; background: #1f3f3b; }
.sos.contact, .sos.hold { background: #7c2c1f; }
.sos.ems { background: #5e1b12; }
.sos.resolved { background: #1f5a40; }
.sos-inner { max-width: 560px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 20px calc(110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.sos h2 { font-size: 32px; margin: 2px 0 6px; }
.sos .why { font-size: 17px; color: rgba(255, 255, 255, .88); }
.ring { position: relative; width: 150px; height: 150px; margin: 22px auto 10px; }
.ring.big { width: 190px; height: 190px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 9; }
.ring-fg { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.ring > b { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--f-mono); font-weight: 500; font-size: 44px; }
.ring > b small { font-family: var(--f); font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, .8); }
.callbox { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); }
.callbox svg { flex: none; width: 26px; height: 26px; }
.callbox b { display: block; font-size: 17px; }
.callbox small { display: block; color: rgba(255, 255, 255, .82); font-size: 13.5px; }
.callbox.calling svg { animation: ring 1s infinite; }
.callbox.placed { background: rgba(255, 255, 255, .2); }
.callbox.failed { border-style: dashed; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.cd911 { margin: 16px 0 4px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .12); font-size: 15px; }
.panel { margin-top: 14px; background: rgba(255, 255, 255, .96); color: var(--ink); border-radius: 16px; padding: 14px 16px; }
.panel .eyebrow { margin-top: 4px; }
.panel .fine { margin-top: 8px; }
.grounds { list-style: none; padding: 0; margin: 0; }
.grounds li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; color: #a7b3af; }
.grounds li.on { color: var(--risk); }
.grounds li div { color: var(--ink2); }
.grounds li.on div { color: var(--ink); }
.grounds li svg { flex: none; }
.grounds b { display: block; font-size: 15px; }
.grounds small { display: block; font-size: 12.5px; color: var(--muted); }
.badge-demo { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .06em; background: #fff; color: #5e1b12; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.script { font-size: 15px; line-height: 1.5; margin: 2px 0 10px; color: var(--ink); }
.timeline { margin: 4px 0 0; padding-left: 0; list-style: none; font-size: 13.5px; color: var(--ink2); }
.timeline li { display: flex; gap: 10px; padding: 3px 0; }
.timeline .mono { color: var(--muted); min-width: 46px; }

/* graphs tab */
.ghead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.kpis > div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.kpis b { display: block; font-family: var(--f-mono); font-weight: 500; font-size: 26px; }
.kpis span { color: var(--muted); font-size: 13px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.grid2 > *, .kpis > *, .stats3 > * { min-width: 0; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .ghead { flex-direction: column; }
}
.chart { margin-top: 10px; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart svg * { pointer-events: none; }
.chart svg .hit { fill: transparent; pointer-events: all; }
.chart .grid { stroke: var(--line); }
.chart .ax { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
.chart .bar { fill: var(--primary); }
.chart .bar.hl { fill: var(--risk); }
.chart .track { fill: var(--surface2); }
.chart .ref { stroke: var(--ink2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .refl { font-size: 12px; font-weight: 700; fill: var(--ink2); }
.chart .line { fill: none; stroke: var(--ch-lift); stroke-width: 2.4; stroke-linejoin: round; }
.chart .dot { fill: var(--ch-lift); stroke: var(--surface); stroke-width: 2; }
.chart .val { font-family: var(--f-mono); font-size: 12px; fill: var(--ink); }
.chart .lbl { font-size: 13px; font-weight: 700; fill: var(--ink); }
.tablewrap { overflow-x: auto; margin-top: 10px; max-height: 340px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; color: var(--ink); }
td.mono { font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
th.num, td.num { text-align: right; white-space: nowrap; }
td .pill { font-size: 12px; }
.alist { list-style: none; margin: 0; padding: 0; }
.alist li { padding: 11px 2px; border-top: 1px solid var(--grid); }
.alist li:first-child { border-top: 0; }
.ahead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ahead b { font-size: 15px; }
.ahead .mono { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.alist p { color: var(--ink2); font-size: 14px; margin-top: 4px; }
.report { white-space: pre-wrap; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.55; background: var(--surface2); border-radius: 12px; padding: 12px; margin: 10px 0 0; color: var(--ink); max-height: 220px; overflow: auto; }

/* presenter */
.demo { position: fixed; z-index: 70; right: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.demo-toggle { order: 2; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; opacity: .92; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); }
.demo-panel { order: 1; display: none; width: min(330px, calc(100vw - 28px)); max-height: calc(100vh - 170px); overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 14px 40px rgba(20, 34, 32, .25); }
.demo.open .demo-panel { display: block; }
.demo-panel > b { display: block; font-size: 15px; margin-bottom: 10px; }
.demo-panel .eyebrow { margin-top: 12px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.sw { flex: none; width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.sw.good { background: var(--good); }
.sw.warn { background: var(--warn); }
.sw.risk { background: var(--risk); }
.sw.cough { background: var(--amber); }
.seg { display: flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-weight: 800; font-size: 13.5px; color: var(--ink2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

@media (min-width: 700px) { .demo { bottom: 20px; } }

/* toast and tooltip */
.toast { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); top: calc(70px + env(safe-area-inset-top)); background: var(--ink); color: #fff; font-weight: 700; font-size: 14.5px; padding: 10px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px); text-align: center; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 7px 9px; border-radius: 8px; max-width: 240px; line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
#sosBody { display: flex; flex-direction: column; }

/* demo step banner (shown while "Play the demo" runs) */
.demobar { max-width: 1280px; margin: 0 auto 12px; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.demobar .dsegs { display: flex; gap: 4px; flex: none; }
.demobar .dsegs i { width: 22px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .22); }
.demobar .dsegs i.done { background: #8fd3c4; }
.demobar .dsegs i.cur { background: #fff; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.demobar .dtext { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 15px; min-width: 0; }
.demobar .dtext b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #8fd3c4; }
.demobar .dhint { flex-basis: 100%; font-size: 13px; color: rgba(255, 255, 255, .75); }
.speedtag { font-size: 11.5px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; }
.demobar.onsos { margin: 0 0 16px; background: rgba(0, 0, 0, .28); grid-column: 1 / -1; }
.demo-cap { margin: -2px 0 2px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.demo-cap.wide { grid-column: span 2; }

/* swallow log drop-down */
.swlog { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.swlog summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 14px; font-weight: 800; }
.swlog summary::-webkit-details-marker { display: none; }
.swlog summary::before { content: "▸"; color: var(--primary); margin-right: -4px; }
.swlog[open] summary::before { content: "▾"; }
.swlog summary span:first-of-type { margin-right: auto; }
.swlog summary .fine { margin: 0; font-weight: 600; text-align: right; }
.swlog .tablewrap { margin: 0; padding: 0 6px 8px; max-height: 300px; }
.swlog td, #gLog td { white-space: nowrap; }

/* emergency: the live graph and Maya's phone side by side with the steps */
.sos-side { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.sos-side .sos-graph { margin-top: 0; }
.sos.resolved .sos-side { display: none; }
#mayaPhone { background: rgba(255, 255, 255, .96); color: var(--ink); border-radius: 16px; padding: 12px 14px 14px; }
#mayaPhone .eyebrow { margin: 0 0 8px; }
.mscreen { border-radius: 14px; background: #16201f; color: #fff; padding: 14px; }
.mscreen.here { background: #1f5a40; }
.mtop { display: flex; align-items: center; gap: 12px; }
.mtop svg { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: #2c8659; flex: none; }
.mscreen.ringing .mtop svg { animation: ring 1s infinite; }
.mtop small { display: block; font-size: 12px; color: rgba(255, 255, 255, .7); font-weight: 700; }
.mtop b { font-size: 17px; }
.mring { margin-left: auto; width: 12px; height: 12px; border-radius: 50%; background: #8fd3c4; animation: blink 1s infinite; }
.mmsg { margin-top: 10px; font-size: 13.5px; line-height: 1.45; color: rgba(255, 255, 255, .88); }
.mstate { margin-top: 8px; font-size: 12.5px; font-weight: 700; color: #8fd3c4; }
.callbox.sim { border-style: dashed; }
@media (min-width: 960px) {
  .sos:not(.resolved) .sos-inner { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 0 32px; align-items: start; }
  .sos-side { margin-top: 56px; position: sticky; top: 20px; }
  .sos .ring.big { width: 150px; height: 150px; margin: 14px auto 6px; }
  .sos .ring.big > b { font-size: 36px; }
}

/* laptops: keep the graph, the checks and the phone view on one screen */
@media (min-width: 960px) {
  .view.live { max-width: 1280px; }
  .live-grid { grid-template-columns: minmax(0, 1fr) 360px; }
  .col-main { top: 70px; }
  .graph-card { padding: 12px 14px 14px; }
  .verdict { padding: 10px 12px; margin-top: 10px; }
  .verdict h3 { font-size: 16.5px; }
  .verdict .sub { font-size: 13.5px; }
  .verdict .checks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
  .verdict .checks li { padding: 7px 9px; gap: 8px; }
  .verdict .checks b { font-size: 13.5px; flex-wrap: wrap; }
  .verdict .checks .val { font-size: 12.5px; }
  .verdict .checks small { font-size: 12px; }
  .col-side .stats3 b { font-size: 26px; }
  .col-side .stats3 > div { padding: 9px 8px; }
  .col-side .now { min-height: 92px; padding: 14px; }
  .col-side .now h3 { font-size: 18px; }
  .col-side .now p { font-size: 14.5px; }
  .col-side .feed { max-height: 236px; overflow: auto; }
  .col-side .help-btn { min-height: 46px; font-size: 16px; }
  .col-side #contactCard { padding: 12px 14px; }
  .col-side #contactCard .fine { font-size: 12.5px; margin-top: 6px; }
}
@media (min-width: 960px) {
  .sos .grounds li { padding: 4px 0; }
  .sos .panel { padding: 10px 14px; }
  .sos h2 { font-size: 28px; }
}
.swlog th, #gLog th { white-space: nowrap; }
.swlog summary span:first-of-type { white-space: nowrap; }
.swlog td:nth-child(6), .swlog td:nth-child(8), #gLog td:nth-child(6), #gLog td:nth-child(8) { white-space: normal; min-width: 170px; }
@media (max-width: 440px) {
  .top-inner { gap: 6px; padding: 9px 12px; }
  .brand { gap: 7px; font-size: 16px; min-width: 0; }
  .brand img { width: 26px; height: 26px; }
  .livepill { font-size: 12.5px; padding: 4px 9px; gap: 6px; min-width: 0; overflow: hidden; }
  .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
}
@media (max-width: 370px) { .brand img { display: none; } }
.brand { min-width: 0; }
.brand b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livepill, .icon-btn { flex: none; }
