:root {
  --bg: #f4f6f8; --card: #fff; --ink: #14212b; --muted: #637381; --line: #e3e8ee;
  --brand: #0f766e; --brand-soft: #e6f4f2; --accent: #0ea5e9;
  --emerg: #dc2626; --emerg-soft: #fde8e8; --high: #ea580c; --high-soft: #fff1e6;
  --mid: #2563eb; --mid-soft: #e8f0fe; --low: #64748b; --low-soft: #eef2f6;
  --radius: 16px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 2px 8px rgba(16,24,40,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418; --card: #162127; --ink: #e6edf1; --muted: #93a4b0; --line: #24323a;
    --brand: #2dd4bf; --brand-soft: #123a36; --emerg-soft: #3a1a1a; --high-soft: #3a2614;
    --mid-soft: #172a4a; --low-soft: #1f2a33; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
main { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand b { display: block; font-size: 16px; }
.brand span { display: block; font-size: 12px; color: var(--muted); margin-top: -2px; }
.badge-demo { font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 99px; white-space: nowrap; }

.tab { display: none; } .tab.active { display: block; }
.sec { font-size: 13px; color: var(--muted); font-weight: 600; margin: 20px 4px 8px; }

.hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--brand), #115e59);
  color: #fff; border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.hero h2 { margin: 0 0 2px; font-size: 18px; }
.hero p { margin: 0; font-size: 13px; opacity: .9; }
.mic { flex: none; width: 68px; height: 68px; border-radius: 50%; border: 0; background: #fff; color: var(--brand);
  display: grid; place-items: center; box-shadow: 0 0 0 6px rgba(255,255,255,.18); transition: transform .1s; }
.mic:active { transform: scale(.94); }

.list { display: grid; gap: 10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%,40% { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); } }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.name { font-weight: 700; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.summary { margin: 8px 0 0; }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 4px 10px; margin: 10px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.todos { margin: 10px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; list-style: none; font-size: 14px; }
.todos li { padding-left: 20px; position: relative; } .todos li + li { margin-top: 4px; }
.todos li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 3px; }
details.raw { margin-top: 10px; font-size: 13px; }
details.raw summary { color: var(--muted); cursor: pointer; }
details.raw p { margin: 6px 0 0; padding: 10px 12px; border-left: 3px solid var(--line); background: var(--bg); border-radius: 0 8px 8px 0; white-space: pre-wrap; }

.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.u-응급 { color: var(--emerg); background: var(--emerg-soft); }
.u-높음 { color: var(--high); background: var(--high-soft); }
.u-보통 { color: var(--mid); background: var(--mid-soft); }
.u-낮음 { color: var(--low); background: var(--low-soft); }
.st { font-size: 12px; color: var(--muted); }
.card.urgent { border-left: 4px solid var(--emerg); }

.actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.actions input { flex: 1 1 180px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.primary { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.small { font-size: 13px; padding: 7px 12px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; position: sticky; top: 58px; z-index: 4; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--emerg); color: #fff; font-size: 11px; line-height: 18px; }
.pill:empty { display: none; }
.sub { display: none; } .sub.on { display: block; }

.day { margin-bottom: 14px; }
.day h4 { margin: 0 0 6px 4px; font-size: 13px; color: var(--muted); }
.day h4.today { color: var(--brand); }
.slot { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; }
.slot + .slot { margin-top: 6px; }
.slot time { font-weight: 700; font-variant-numeric: tabular-nums; width: 46px; }
.slot .ai { font-size: 11px; color: var(--accent); font-weight: 700; margin-left: 6px; }
.slot.flash { animation: flash 2s ease; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.alert b { color: var(--emerg); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 40px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 10px; border-radius: 99px; background: var(--brand); }
.bar .track { background: var(--bg); border-radius: 99px; }
#btn-reset { display: block; margin: 24px auto 0; }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.bottom button { flex: 1; border: 0; background: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.bottom svg { width: 24px; height: 24px; fill: currentColor; }
.bottom button.on { color: var(--brand); font-weight: 700; }
.dot { position: absolute; top: 6px; left: calc(50% + 10px); width: 8px; height: 8px; background: var(--emerg); border-radius: 50%; }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(8,15,20,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { width: 100%; max-width: 560px; background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet-card.center { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px 44px; text-align: center; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-card { border-radius: 22px; } }
.call-head { display: flex; gap: 14px; align-items: center; }
.call-head b { display: block; font-size: 17px; } .call-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--muted); }
.pulse.live { background: var(--emerg); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 100% { box-shadow: 0 0 0 14px rgba(220,38,38,0); } }
.transcript { margin: 16px 0 10px; min-height: 120px; max-height: 38vh; overflow: auto; padding: 14px; border-radius: 14px; background: var(--bg); font-size: 17px; line-height: 1.6; }
.transcript .interim { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }
.warn { font-size: 13px; color: var(--high); background: var(--high-soft); padding: 8px 10px; border-radius: 10px; margin-bottom: 8px; }
.samples summary { font-size: 14px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: 13px; }
.samples textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--card); color: var(--ink); }
.call-actions { display: flex; gap: 8px; margin-top: 14px; }
.call-actions .ghost { flex: 0 0 auto; }
.hang { flex: 1; border: 0; border-radius: 12px; padding: 14px; font-weight: 700; color: #fff; background: var(--emerg); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
