/* SafeCue parent app: hand-written mobile CSS, no build step. */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --soft: #f1f5f9;
  --brand: #2563eb;
  --brand-2: #0d9488;
  --brand-soft: #eff6ff;
  --high: #dc2626;
  --high-soft: #fef2f2;
  --medium: #d97706;
  --medium-soft: #fffbeb;
  --low: #16a34a;
  --low-soft: #f0fdf4;
  --mark: #fde68a;
  --current: #e0ecff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 16px;
  --tabbar-h: 64px;
  --top-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Top bar + tab bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(244, 246, 251, .92);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.live.on { color: var(--low); }
.live.on i { background: var(--low); box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

.sound-pill { border: 0; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  background: var(--medium-soft); color: #92400e; }

.view {
  max-width: 560px; margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.1; }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--brand); }

/* ---------- Cards + generic bits ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.card-flush { padding: 0; overflow: hidden; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 6px; }
.section-title h2 { font-size: 17px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer;
  background: var(--soft); color: var(--text); transition: transform .08s ease, background .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 17px; border-radius: 14px; }
.btn-link { background: none; padding: 6px 0; color: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.badge-high { background: var(--high-soft); color: var(--high); }
.badge-medium { background: var(--medium-soft); color: var(--medium); }
.badge-low { background: var(--low-soft); color: var(--low); }
.badge-info { background: var(--brand-soft); color: var(--brand); }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px;
  font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill-attention { background: var(--high-soft); color: var(--high); }
.pill-going { background: var(--brand-soft); color: var(--brand); }
.pill-ok { background: var(--low-soft); color: var(--low); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; background: var(--card); }

.note { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.note-info { background: var(--brand-soft); color: #1e3a8a; }
.note-ok { background: var(--low-soft); color: #14532d; }
.note-warn { background: var(--medium-soft); color: #78350f; }

/* ---------- Home: status card ---------- */
.status-card { padding: 0; overflow: hidden; }
.status-head { padding: 16px; display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 24px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.status-name { font-size: 20px; font-weight: 750; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.status-grid > div { padding: 10px 12px; border-right: 1px solid var(--border); }
.status-grid > div:last-child { border-right: 0; }
.status-grid b { display: block; font-size: 15px; }
.status-grid span { font-size: 12px; color: var(--muted); }
.ok-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--low); margin-right: 5px; vertical-align: 1px; }
.battery { display: inline-block; width: 20px; height: 10px; border: 1.5px solid currentColor; border-radius: 3px;
  position: relative; margin-right: 6px; vertical-align: -1px; }
.battery::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.battery i { position: absolute; left: 1px; top: 1px; bottom: 1px; background: var(--low); border-radius: 1px; }
.mini-map { height: 130px; background: var(--soft); }
.location-row { padding: 10px 16px; font-size: 14px; border-top: 1px solid var(--border); }

/* ---------- Alert list ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { display: flex; gap: 12px; align-items: stretch; padding: 12px 14px; border-bottom: 1px solid var(--border); color: inherit; }
.alert-item:last-child { border-bottom: 0; }
.alert-item:active { background: var(--soft); }
.risk-bar { width: 4px; border-radius: 4px; flex: none; background: var(--low); }
.risk-bar.high { background: var(--high); }
.risk-bar.medium { background: var(--medium); }
.risk-bar.low { background: #cbd5e1; }
.risk-bar.info { background: var(--brand); }
.alert-item .title { font-weight: 650; overflow-wrap: anywhere; }
.alert-item .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.alert-item .side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.alert-item.quiet .title { font-weight: 550; color: #334155; }
.day-head { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 4px 6px; }
.attention { border: 1.5px solid #fecaca; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--soft); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { border: 0; background: none; border-radius: 9px; padding: 8px 6px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* ---------- Alert detail ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 4px -4px; font-weight: 600; padding: 6px 4px; }
.detail-head h1 { font-size: 22px; margin: 8px 0 4px; }
.detail-head .meta { color: var(--muted); font-size: 14px; }
.reason { font-size: 15px; margin: 8px 0 12px; }
.label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.map { height: 190px; background: var(--soft); }
.map-foot { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }

.player { display: flex; align-items: center; gap: 12px; }
.play { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play:disabled { opacity: .5; }
.wave { flex: 1; min-width: 0; height: 64px; }
.player-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }

.transcript { list-style: none; margin: 0; padding: 0; }
.line { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 10px; margin: 0 -10px; border-radius: 12px; cursor: pointer; transition: background .2s; }
.line .ts { grid-row: span 2; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.line .who { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.line .text { font-size: 16px; }
.line.current { background: var(--current); box-shadow: inset 3px 0 0 var(--brand); }
.line.past .text { color: #334155; }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 2px; font-weight: 600; }
.who-0 { color: #b91c1c; } .who-1 { color: #7c3aed; } .who-2 { color: #0369a1; } .who-child { color: var(--brand-2); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action { border: 1.5px solid var(--border); background: var(--card); border-radius: 14px; padding: 14px 10px; font-weight: 650; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .08s; }
.action:active { transform: scale(.97); }
.action .ic { font-size: 22px; line-height: 1; }
.action.going { background: var(--brand); border-color: var(--brand); color: #fff; }
.action.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.action.going.on { background: #1d4ed8; color: #fff; box-shadow: 0 0 0 3px #bfdbfe; }
.status-line { margin-top: 12px; font-size: 14px; }

/* ---------- Settings ---------- */
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.field:last-child { border-bottom: 0; }
.field input, .field select { font: inherit; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--card); color: var(--text); max-width: 55%; text-align: right; }
.setting-block { padding: 12px 0; }
.setting-block p { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }

/* ---------- How it works ---------- */
.pipeline { list-style: none; margin: 0; padding: 0; position: relative; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding-bottom: 18px; position: relative; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 2px; background: var(--border); }
.step .num { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--brand-soft); }
.step.band .num { background: #ecfdf5; }
.step h3 { margin-top: 2px; }
.step p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.where { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.where.band { background: #ecfdf5; color: #047857; }
.where.server { background: var(--brand-soft); color: var(--brand); }
.where.phone { background: #f5f3ff; color: #6d28d9; }

/* ---------- Overlays ---------- */
.onboarding { position: fixed; inset: 0; z-index: 50; background: linear-gradient(160deg, #1d4ed8, #0f766e); display: flex; align-items: flex-end; justify-content: center;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px); overflow-y: auto; }
.onboarding-card { background: var(--card); border-radius: 24px; padding: 24px 20px 20px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.onboarding-icon { width: 64px; height: 64px; border-radius: 16px; }
.onboarding h1 { margin: 14px 0 8px; font-size: 26px; }
.onboarding-list { padding-left: 18px; margin: 14px 0 18px; font-size: 15px; }
.onboarding-list li { margin-bottom: 8px; }
.install-hint { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }

.banner { position: fixed; z-index: 40; left: 12px; right: 12px; top: calc(var(--safe-top) + 8px); max-width: 536px; margin: 0 auto;
  border: 0; border-radius: 16px; padding: 14px 16px; text-align: left; font-weight: 700; font-size: 16px; color: #fff; background: var(--high);
  box-shadow: 0 10px 30px rgba(220, 38, 38, .4); cursor: pointer; animation: drop .35s ease-out; }
.banner { display: flex; align-items: center; gap: 12px; }
.banner > span:first-child { flex: 1; }
.banner-x { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .2); font-size: 13px; }
.banner-talk { background: var(--brand); box-shadow: 0 10px 30px rgba(37, 99, 235, .35); }
@keyframes drop { from { transform: translateY(-120%); } to { transform: none; } }

.toast { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }

/* Leaflet: our own marker instead of image icons */
.pin { width: 18px; height: 18px; border-radius: 50%; background: var(--high); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--high), 0 2px 6px rgba(0, 0, 0, .3); }
.pin.child { background: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-2), 0 2px 6px rgba(0, 0, 0, .3); }
.leaflet-container { font: inherit; }
/* Leaflet panes use z-index 400+; keep them inside their card, under the bars and overlays. */
.map, .mini-map { position: relative; z-index: 0; }
.leaflet-control-attribution { font-size: 10px !important; }
body[data-page="home"] #live { display: none; }

@media (min-width: 600px) {
  .view { padding-top: 16px; }
}

/* ---------- Incoming emergency (call screen) ---------- */
.call { position: fixed; inset: 0; z-index: 60; color: #fff; background: radial-gradient(120% 80% at 50% 0%, #ef4444, #991b1b 55%, #450a0a);
  display: flex; justify-content: center; overflow-y: auto; padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px); }
.call-inner { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.call-head { text-align: center; }
.call-tag { display: inline-block; font-weight: 900; letter-spacing: .25em; font-size: 13px; padding: 5px 14px; border-radius: 999px; background: rgba(255, 255, 255, .18); animation: blink-tag 1s steps(2) infinite; }
@keyframes blink-tag { 50% { background: rgba(255, 255, 255, .38); } }
.call-avatar { width: 108px; height: 108px; border-radius: 50%; margin: 20px auto 12px; display: grid; place-items: center; font-size: 46px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 4px solid rgba(255, 255, 255, .9); animation: ring-pulse 1.4s ease-out infinite; }
@keyframes ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 100% { box-shadow: 0 0 0 30px rgba(255, 255, 255, 0); } }
.call-head h1 { font-size: 34px; }
.call-head p { margin: 4px 0 0; opacity: .9; }
.call-map { height: 150px; border-radius: 18px; overflow: hidden; position: relative; z-index: 0; border: 2px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .2); }
.call-status { text-align: center; font-weight: 650; min-height: 24px; }
.call-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.call-btn { border: 0; border-radius: 22px; padding: 18px 10px; font-size: 18px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.call-btn .ic { font-size: 30px; line-height: 1; }
.call-btn:active { transform: scale(.97); }
.call-answer { background: #16a34a; color: #fff; box-shadow: 0 8px 24px rgba(22, 163, 74, .5); }
.call-going { background: #fff; color: #991b1b; }
.call-details { background: none; border: 0; color: #fff; opacity: .85; text-decoration: underline; padding: 8px; font-weight: 600; }

/* ---------- Escalation timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.tl-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--soft); }
.tl.ringing .tl-dot { background: var(--medium-soft); animation: pulse-amber 1.2s infinite; }
@keyframes pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .45); } 100% { box-shadow: 0 0 0 10px rgba(217, 119, 6, 0); } }
.tl.ok .tl-dot { background: var(--low-soft); }
.tl.services .tl-dot { background: var(--high-soft); }
.tl b { display: block; }
.tl span { font-size: 13px; color: var(--muted); }
.services-card { margin-top: 4px; border-radius: 12px; padding: 12px 14px; background: var(--high-soft); color: #7f1d1d; font-size: 14px; }
.respond { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.respond .btn { padding: 16px 10px; font-size: 16px; }
.btn-green { background: #16a34a; color: #fff; }

/* ---------- Talk tab ---------- */
.talk-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 2px 4px; }
.talk-map { height: 170px; }
.pin.pulse { animation: pin-pulse 1.6s ease-out infinite; }
@keyframes pin-pulse { 0% { box-shadow: 0 0 0 2px var(--brand-2), 0 0 0 0 rgba(13, 148, 136, .55); } 100% { box-shadow: 0 0 0 2px var(--brand-2), 0 0 0 18px rgba(13, 148, 136, 0); } }
.band-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.band-row .row { font-size: 14px; font-weight: 600; flex-wrap: wrap; gap: 14px; }
.sees { display: flex; align-items: center; gap: 10px; background: #020617; color: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.sees-label { flex: none; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #93c5fd; }
.sees-led { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #334155; }
.sees-led.green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.sees-led.red { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 22px 0 18px; }
.mic { --lvl: 0; position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-2)); box-shadow: 0 12px 30px rgba(37, 99, 235, .35); display: grid; place-items: center; transition: transform .1s; }
.mic:active { transform: scale(.96); }
.mic svg { width: 48px; height: 48px; fill: currentColor; position: relative; }
.mic.live { background: linear-gradient(145deg, #ef4444, #b91c1c); box-shadow: 0 12px 30px rgba(220, 38, 38, .4); }
.mic-ring { position: absolute; inset: -12px; border-radius: 50%; border: 5px solid rgba(37, 99, 235, .25); transform: scale(calc(1 + var(--lvl) * .35)); transition: transform .08s linear; }
.mic.live .mic-ring { border-color: rgba(220, 38, 38, .35); animation: idle-ring 2s ease-in-out infinite; }
@keyframes idle-ring { 50% { opacity: .55; } }
.mic-label { font-size: 15px; color: var(--muted); text-align: center; }
.mic-label b { color: var(--text); font-variant-numeric: tabular-nums; }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick button { border: 1.5px solid var(--border); background: var(--card); border-radius: 16px; padding: 14px 10px; display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform .08s; }
.quick button:active { transform: scale(.97); background: var(--brand-soft); }
.quick .q-ic { font-size: 30px; line-height: 1; }
.caption-form { display: flex; gap: 8px; margin-top: 12px; }
.caption-form input { flex: 1; min-width: 0; font: inherit; border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--card); color: var(--text); }
.speech-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 20px; }
.speech-row .btn { padding: 8px 12px; font-size: 14px; }
.speech-row .btn.on { background: var(--high-soft); color: var(--high); }

.rec-panel { padding: 0; overflow: hidden; }
.rec-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.rec { color: var(--high); font-weight: 800; }
.rec i { font-style: normal; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.talk-lines { list-style: none; margin: 0; padding: 6px 16px 10px; max-height: 300px; overflow-y: auto; }
.talk-lines li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--soft); }
.talk-lines li:last-child { border-bottom: 0; }
.talk-lines .ts { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.talk-lines .who { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; display: block; }
.talk-lines .parent .who { color: var(--brand); }
.talk-lines .lina .who { color: var(--brand-2); }
.cap-note { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.talk-lines .empty-line { display: block; color: var(--muted); font-size: 14px; padding: 14px 0; text-align: center; }

/* ---------- Settings: contacts, switches ---------- */
.contacts { list-style: none; margin: 0; padding: 0; }
.contact { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.contact:last-child { border-bottom: 0; }
.contact [data-act="edit"] { cursor: pointer; min-width: 0; }
.c-num { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--brand-soft); color: var(--brand); }
.contact.fixed .c-num { background: var(--brand); color: #fff; }
.c-move { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--card); font-size: 17px; font-weight: 700; cursor: pointer; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.c-form { display: grid; gap: 8px; }
.c-form input { font: inherit; border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--card); color: var(--text); min-width: 0; }
.switch-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: #cbd5e1; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Heart rate ---------- */
.heart-ic { display: inline-block; font-size: 30px; line-height: 1; --beat: .7s; animation: beat var(--beat) ease-in-out infinite; transform-origin: center; }
.heart-ic.small { font-size: 18px; }
.heart-ic.big { font-size: 46px; }
.heart-ic.off { animation: none; filter: grayscale(1); opacity: .5; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.16); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
.heart-card { display: flex; align-items: center; gap: 14px; color: inherit; }
.heart-card.elevated, .heart-hero.elevated { box-shadow: 0 0 0 2px var(--medium), var(--shadow); }
.bpm b { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bpm span { font-size: 13px; color: var(--muted); font-weight: 700; }
.bpm.big b { font-size: 48px; }
.spark { width: 120px; flex: none; }
.spark-svg { width: 100%; height: 40px; display: block; overflow: visible; }
.heart-hero { display: flex; align-items: center; gap: 18px; }
.ok-dot.grey { background: #94a3b8; }

.hr-chart { position: relative; touch-action: pan-y; }
.hr-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.hr-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hr-dot { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.hr-grid { stroke: var(--border); stroke-width: 1; }
.hr-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.hr-rest { fill: rgba(37, 99, 235, .07); }
.hr-mark-line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 3; opacity: .35; }
.hr-mark { fill: var(--card); stroke: var(--text); stroke-width: 2; }
.hr-mark-n { fill: var(--text); font-size: 10px; font-weight: 800; }
.act-still { fill: #ccfbf1; } .act-walking { fill: #2dd4bf; } .act-running { fill: #0f766e; } .act-off { fill: #e2e8f0; }
.hr-guide { position: absolute; top: 6px; bottom: 30px; width: 1px; background: var(--text); opacity: .4; pointer-events: none; }
.hr-cursor { position: absolute; top: 6px; bottom: 30px; width: 2px; background: var(--brand); pointer-events: none; }
.hr-tip { position: absolute; top: -8px; transform: translateY(-100%); background: #0f172a; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.hr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.hr-legend .sw { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hr-legend .sw.act-still { background: #ccfbf1; } .hr-legend .sw.act-walking { background: #2dd4bf; } .hr-legend .sw.act-running { background: #0f766e; } .hr-legend .sw.act-off { background: #e2e8f0; }
.hr-rest-sw { background: rgba(37, 99, 235, .16); }
.hr-summary { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.hr-marks { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.hr-marks .n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--text); color: var(--text); font-size: 10px; font-weight: 800; margin-right: 6px; }
.hr-stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; padding: 12px 6px; }
.hr-stats span { display: block; font-size: 12px; color: var(--muted); }
.hr-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.hr-event { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 15px; }
.hr-event:last-child { border-bottom: 0; }
.ev-ic { font-size: 20px; line-height: 1.2; }
.banner-quiet { background: #334155; box-shadow: 0 10px 30px rgba(15, 23, 42, .3); }
.call-map-wrap { position: relative; }
.call-hr { position: absolute; z-index: 500; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; background: #fff; color: #991b1b; border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.call-hr b { font-size: 18px; font-variant-numeric: tabular-nums; }
