/* ============================================================
   VoiceMed AI — Interface styles · v2 redesign
   Deep clinical navy · teal→cyan accent · red reserved for alerts
   Type: Inter (UI) + Space Grotesk (display & clinical numbers)
   ============================================================ */

:root {
    --bg: #070b14;
    --bg-soft: #0c1526;
    --panel: rgba(17, 26, 45, 0.6);
    --panel-2: rgba(24, 35, 58, 0.72);
    --line: rgba(148, 163, 184, 0.13);
    --line-strong: rgba(148, 163, 184, 0.26);
    --text: #e9eef7;
    --muted: #8ea1bb;
    --faint: #5c6e89;

    --accent: #2dd4bf;
    --accent-2: #38bdf8;
    --accent-grad: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
    --danger: #f43f5e;
    --warn: #f59e0b;
    --ok: #34d399;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 44px rgba(2, 6, 16, 0.45);
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;

    color-scheme: dark;
    font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-ui);
    line-height: 1.5;
    background:
        radial-gradient(1100px 560px at 88% -12%, rgba(45, 212, 191, 0.10), transparent 62%),
        radial-gradient(900px 520px at -12% 108%, rgba(56, 189, 248, 0.09), transparent 60%),
        radial-gradient(700px 420px at 50% 118%, rgba(99, 102, 241, 0.07), transparent 65%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(45, 212, 191, 0.28); color: #ffffff; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(148, 163, 184, 0.4); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.hidden { display: none !important; }

.app-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 26px 34px;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 -26px 22px;
    padding: 13px 26px;
    background: rgba(7, 11, 20, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.logo { display: flex; align-items: center; gap: 13px; }

.logo-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #05221d;
    background: var(--accent-grad);
    border-radius: 13px;
    box-shadow: 0 6px 20px rgba(45, 212, 191, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logo h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.logo h1 span {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-tag {
    font-size: 0.72rem;
    color: var(--faint);
    letter-spacing: 0.4px;
    margin-top: 2px;
}

.session-stats {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.stat-chip {
    font-size: 0.78rem;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 6px 13px;
    border-radius: 999px;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

.stat-chip b, .stat-chip strong { color: var(--text); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 6px 14px 6px 11px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
    flex: 0 0 auto;
}

.status-dot.status-idle { background: #64748b; box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.18); }
.status-dot.status-connecting { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); animation: pulse 1.1s infinite; }
.status-dot.status-active { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.22); animation: pulse 1.6s infinite; }
.status-dot.status-ending { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.status-dot.status-error { background: var(--danger); box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.22); animation: pulse 0.8s infinite; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.02); }
}

.status-text {
    font-size: 0.82rem;
    color: var(--muted);
    min-width: 190px;
}

/* ── Emergency banner ───────────────────────────────────── */
.emergency-banner {
    position: relative;
    border: 1px solid rgba(244, 63, 94, 0.55);
    background:
        radial-gradient(600px 200px at 12% 0%, rgba(244, 63, 94, 0.22), transparent 70%),
        linear-gradient(180deg, rgba(244, 63, 94, 0.17), rgba(244, 63, 94, 0.07));
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    overflow: hidden;
    animation: emergency-pulse 1.6s ease-in-out infinite;
}

@keyframes emergency-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.35); }
    50% { box-shadow: 0 0 0 9px rgba(244, 63, 94, 0); }
}

.emergency-header {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pulse-icon {
    font-size: 26px;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: rgba(244, 63, 94, 0.16);
    border: 1px solid rgba(244, 63, 94, 0.45);
    border-radius: 14px;
    animation: icon-throb 1.2s ease-in-out infinite;
}

@keyframes icon-throb {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.emergency-header h2 {
    font-family: var(--font-display);
    color: #fecdd3;
    font-size: 1.12rem;
    letter-spacing: 1.2px;
}

.emergency-header p { color: #fda4af; font-size: 0.84rem; margin-top: 2px; }

.emergency-call {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 11px;
    font-size: 0.95rem;
    white-space: nowrap;
    box-shadow: 0 8px 22px rgba(244, 63, 94, 0.42);
}

.emergency-content { margin-top: 13px; font-size: 0.92rem; color: #ffe4e6; }
.emergency-desc { margin-bottom: 8px; }
.emergency-actions { margin: 6px 0 8px 20px; color: #fecdd3; }
.emergency-actions li { margin: 3px 0; }
.emergency-nums { color: #fda4af; font-size: 0.85rem; }
.emergency-id { color: #fda4af; font-size: 0.78rem; margin-top: 6px; opacity: 0.85; }

/* ── Layout & panels ────────────────────────────────────── */
.main-content {
    display: grid;
    /* minmax(0, …) lets each column shrink below its content's min-width —
       without it a long unbreakable line (e.g. tool args) blows the right
       column out past the viewport and crushes the left one. */
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.analysis-column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.panel {
    position: relative;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
    padding: 20px;
    min-width: 0;
    backdrop-filter: blur(10px);
}

.voice-panel { overflow: hidden; }

.voice-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-grad);
    opacity: 0.85;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.panel-hint {
    font-size: 0.66rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.badge {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent);
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.32);
    padding: 2px 9px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
    font-family: var(--font-ui);
}

.badge-warn {
    color: var(--warn);
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.32);
}

/* ── Voice panel header & options ───────────────────────── */
.voice-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.voice-header h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.2px;
}

.voice-header p {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 4px;
    max-width: 48ch;
}

.voice-options {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.lang-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 6px 9px 6px 13px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.lang-select:hover { border-color: rgba(45, 212, 191, 0.5); }

.lang-select select {
    background: transparent;
    color: var(--text);
    border: none;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.lang-select select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.93rem;
    color: #04211c;
    background: var(--accent-grad);
    border: none;
    padding: 13px 26px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(45, 212, 191, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 11px 28px rgba(45, 212, 191, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .icon { font-size: 1.05rem; }

.btn-danger {
    color: white;
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-ghost {
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line-strong);
    box-shadow: none;
    padding: 8px 14px;
    font-size: 0.84rem;
    border-radius: 999px;
}

.btn-ghost:hover {
    color: var(--accent);
    border-color: rgba(45, 212, 191, 0.5);
    box-shadow: none;
    transform: none;
    filter: none;
}

.btn-icon {
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    color: var(--muted);
    border-radius: 9px;
    padding: 5px 11px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover { color: var(--accent); border-color: rgba(45, 212, 191, 0.5); }

/* ── Triage progress tracker ────────────────────────────── */
.progress-tracker {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 14px 2px 12px;
    margin: 0;
}

.progress-tracker li {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 0 auto;
    color: var(--faint);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.progress-tracker li:not(:last-child)::after {
    content: "";
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: var(--line);
    margin: 0 10px 0 9px;
    min-width: 14px;
    transition: background 0.4s ease;
}

.pt-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--bg-soft);
    transition: all 0.3s ease;
    flex: 0 0 auto;
    position: relative;
}

.progress-tracker li.done { color: var(--text); }

.progress-tracker li.done::after { background: rgba(45, 212, 191, 0.55); }

.progress-tracker li.done .pt-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16);
}

.progress-tracker li.done .pt-dot::after {
    content: "\2713";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: #05221d;
}

/* ── Waveform & session controls ────────────────────────── */
.waveform-container {
    position: relative;
    background:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px) 0 0 / 100% 26px,
        radial-gradient(420px 160px at 50% 50%, rgba(45, 212, 191, 0.06), transparent 70%),
        var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    margin-top: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 18px rgba(2, 6, 16, 0.4);
}

#waveform-canvas { width: 100%; height: 150px; display: block; }

.speaker-hint {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 0.72rem;
    color: var(--muted);
    background: rgba(7, 11, 20, 0.72);
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

.controls {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

/* ── Transcript (chat-style) ────────────────────────────── */
.transcript-wrapper { margin-top: 18px; }

.transcript-wrapper h3 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--faint);
    margin-bottom: 9px;
}

.transcript-container {
    max-height: 430px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-right: 4px;
}

.transcript-msg {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 13px;
    max-width: 92%;
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; }
}

.msg-icon {
    font-size: 0.95rem;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 9px;
    flex: 0 0 auto;
}

.msg-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.msg-label {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--faint);
}

.msg-text { font-size: 0.9rem; line-height: 1.5; word-wrap: break-word; }

.transcript-agent { border-left: 3px solid var(--accent); }
.transcript-agent .msg-icon { background: rgba(45, 212, 191, 0.1); }
.transcript-agent .msg-label { color: var(--accent); }

.transcript-user {
    align-self: flex-end;
    flex-direction: row-reverse;
    border-right: 3px solid var(--accent-2);
    background: rgba(56, 189, 248, 0.07);
}

.transcript-user .msg-icon { background: rgba(56, 189, 248, 0.12); }
.transcript-user .msg-label { color: var(--accent-2); }

.transcript-system {
    align-self: center;
    max-width: 96%;
    background: rgba(148, 163, 184, 0.05);
    border-style: dashed;
    border-color: var(--line-strong);
}

.transcript-system .msg-text { font-size: 0.84rem; color: var(--muted); }

.transcript-msg.interim { opacity: 0.55; font-style: italic; }

/* ── Triage assessment ──────────────────────────────────── */
.triage-display { display: flex; flex-direction: column; gap: 14px; }

.triage-score h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.05;
    letter-spacing: 0.5px;
}

.triage-score p {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 3px;
}

.triage-gauge { display: flex; flex-direction: column; gap: 7px; }

/* Track runs green (left, ESI 5) → amber → red (right, ESI 1) to match the
   markers below; the JS-driven fill covers the track from the left. */
.gauge-bg {
    height: 13px;
    border-radius: 999px;
    background:
        repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), rgba(7, 11, 20, 0.55) calc(20% - 1px) 20%),
        linear-gradient(90deg, var(--ok), var(--warn) 52%, var(--danger));
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(2, 6, 16, 0.5);
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s ease;
}

.gauge-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.66rem;
    color: var(--faint);
    letter-spacing: 0.3px;
}

.triage-recommendation h3 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--faint);
    margin-bottom: 4px;
}

.triage-recommendation p { font-size: 0.92rem; line-height: 1.5; }

/* ── Medication safety ──────────────────────────────────── */
.med-content { display: flex; flex-direction: column; gap: 9px; }

.med-checked {
    font-size: 0.79rem;
    color: var(--muted);
    padding: 7px 11px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.med-allclear { font-size: 0.9rem; color: var(--text); }

.med-interaction {
    border: 1px solid var(--line-strong);
    background: var(--bg-soft);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.med-head {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.med-effect {
    color: var(--muted);
    font-size: 0.84rem;
    margin-top: 5px;
}

.med-rec {
    color: #a7f3d0;
    font-size: 0.82rem;
    margin-top: 3px;
}

.sev-chip {
    display: inline-block;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 9px;
    border-radius: 999px;
}

.sev-high { background: rgba(244, 63, 94, 0.16); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.45); }
.sev-mod, .sev-moderate { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.sev-low { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.4); }

/* ── AI reasoning & actions (tool activity) ─────────────── */
.tool-activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 264px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.tool-empty-state {
    color: var(--faint);
    font-size: 0.85rem;
    font-style: italic;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 0.86rem;
    animation: fade-in 0.25s ease;
}

.tool-icon {
    font-size: 0.95rem;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, 0.07);
    border-radius: 9px;
    flex: 0 0 auto;
}

.tool-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.tool-label { font-weight: 500; }

.tool-args {
    font-size: 0.71rem;
    color: var(--faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-status {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    flex: 0 0 auto;
}

.tool-running { border-color: rgba(56, 189, 248, 0.45); }
.tool-running .tool-status { color: var(--accent-2); animation: status-blink 1.1s ease-in-out infinite; }
.tool-done { border-color: rgba(52, 211, 153, 0.4); }
.tool-done .tool-status { color: var(--ok); }
.tool-failed { border-color: rgba(244, 63, 94, 0.5); }
.tool-failed .tool-status { color: var(--danger); }

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ── SOAP documentation ─────────────────────────────────── */
.soap-container { max-height: 320px; overflow-y: auto; }

#soap-content {
    font-family: "Cascadia Code", Consolas, "JetBrains Mono", monospace;
    font-size: 0.77rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

#soap-content.soap-empty {
    color: var(--faint);
    font-style: italic;
    font-family: var(--font-ui);
    border-style: dashed;
    border-color: var(--line-strong);
    text-align: center;
    padding: 26px 14px;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
    margin-top: 26px;
    text-align: center;
    color: var(--faint);
    font-size: 0.75rem;
    line-height: 1.6;
}

.footer strong { color: var(--muted); }

/* ── Demo Copilot ───────────────────────────────────────── */
.demo-copilot {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 390px;
    max-width: calc(100vw - 40px);
    max-height: min(62vh, 540px);
    display: flex;
    flex-direction: column;
    background: rgba(10, 16, 30, 0.96);
    border: 1px solid rgba(45, 212, 191, 0.4);
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 1px rgba(45, 212, 191, 0.12), 0 0 34px rgba(45, 212, 191, 0.09);
    z-index: 60;
    backdrop-filter: blur(16px);
    animation: dc-in 0.25s ease;
}

@keyframes dc-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; }
}

.dc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}

.dc-head strong {
    color: var(--accent);
    font-family: var(--font-display);
    letter-spacing: 0.3px;
}

.dc-step-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 2px 11px;
}

.dc-steps {
    list-style: none;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dc-steps li {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 13px;
    background: var(--bg-soft);
    transition: border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.dc-steps li.dc-todo { opacity: 0.5; }

.dc-steps li.dc-current {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.3), 0 0 22px rgba(45, 212, 191, 0.1);
}

.dc-steps li.dc-done { opacity: 0.45; border-left: 3px solid var(--ok); }

.dc-say { font-size: 14px; color: var(--text); line-height: 1.5; }

.dc-watch { font-size: 12px; color: var(--muted); margin-top: 6px; }

.dc-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px 13px;
    border-top: 1px solid var(--line);
}

.dc-controls .btn { padding: 7px 13px; font-size: 13px; }
.dc-controls .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.dc-hint {
    font-size: 11px;
    color: var(--faint);
    margin-left: auto;
    text-align: right;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
    .main-content { grid-template-columns: 1fr; }
    .status-text { min-width: 0; }
    .transcript-msg { max-width: 100%; }
}

@media (max-width: 640px) {
    .app-container { padding: 0 14px 26px; }
    .header { margin: 0 -14px 18px; padding: 11px 14px; }
    .voice-header { flex-direction: column; }
    #waveform-canvas { height: 120px; }
    .triage-score h1 { font-size: 2.1rem; }
    .btn { padding: 12px 20px; font-size: 0.9rem; }
    .demo-copilot { left: 12px; right: 12px; bottom: 12px; width: auto; }
    .dc-hint { display: none; }
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .emergency-banner,
    .pulse-icon,
    .status-dot,
    .tool-running .tool-status {
        animation: none !important;
    }
}