:root {
  color-scheme: light;
  --navy-950: #08172c;
  --navy-900: #0d213d;
  --navy-800: #163052;
  --blue-600: #2367d1;
  --blue-500: #357ee8;
  --blue-100: #e9f1ff;
  --ink-900: #17243a;
  --ink-700: #46566f;
  --ink-500: #748198;
  --line: #e5eaf1;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --red: #c73f4d;
  --red-soft: #fff0f1;
  --green: #288664;
  --green-soft: #eaf8f2;
  --amber: #a76c17;
  --amber-soft: #fff7e4;
  --violet: #7654cb;
  --shadow: 0 12px 34px rgba(16, 33, 61, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink-900); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 20px; color: #fff; background: linear-gradient(175deg, var(--navy-950), #102a4b 78%, #14345a); }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #0c2545; font-family: Georgia, serif; font-size: 22px; font-weight: 700; background: linear-gradient(145deg, #f4f8ff, #bcd4f8); box-shadow: inset 0 0 0 1px rgba(255,255,255,.8); }
.brand strong, .brand span { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 16px; letter-spacing: .1px; }
.brand span { margin-top: 3px; color: #91a8c5; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
nav { display: grid; gap: 7px; margin-top: 24px; }
.nav-item { width: 100%; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; border: 0; border-radius: 10px; color: #aebed2; text-align: left; background: transparent; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(75, 137, 224, .18); box-shadow: inset 3px 0 #5b95e8; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; font-weight: 700; }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 10px; font-size: 11px; text-align: center; background: rgba(255,255,255,.12); }
.sidebar-note { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.04); }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note span:not(.pulse-dot) { margin-top: 4px; color: #91a8c5; font-size: 11px; }
.pulse-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #58cc9c; box-shadow: 0 0 0 4px rgba(88,204,156,.12); }
.pulse-dot.offline { background: #e6a756; box-shadow: 0 0 0 4px rgba(230,167,86,.12); }
.account-button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; margin-top: 12px; padding: 11px 10px; border: 0; border-radius: 11px; color: #fff; text-align: left; background: transparent; }
.account-button:hover { background: rgba(255,255,255,.05); }
.account-button strong, .account-button small { display: block; }
.account-button strong { font-size: 12px; }
.account-button small { margin-top: 2px; color: #8fa5c0; font-size: 10px; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #dceaff; font-size: 10px; font-weight: 700; background: #274b77; }

main { min-width: 0; padding: 30px 42px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--blue-600); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(28px, 3vw, 38px); font-weight: 500; letter-spacing: -.02em; }
h2 { margin-bottom: 6px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
h3 { font-size: 15px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.primary-button, .secondary-button, .icon-button, .text-button { border: 0; border-radius: 9px; font-weight: 700; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; color: #fff; background: var(--blue-600); box-shadow: 0 6px 16px rgba(35,103,209,.2); }
.primary-button:hover { background: #1b59ba; }
.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.primary-button.full { width: 100%; margin-top: 6px; }
.secondary-button { padding: 10px 15px; color: var(--ink-700); background: #eef2f7; }
.secondary-button:hover { background: #e4e9f0; }
.secondary-button:disabled { cursor: wait; opacity: .6; }
.icon-button { width: 41px; height: 41px; color: var(--ink-700); background: var(--surface); border: 1px solid var(--line); }
.icon-button.spinning { animation: spin .7s linear infinite; }
.text-button { margin-left: auto; padding: 7px 2px; color: var(--blue-600); background: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.setup-banner { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid #f0d8a6; border-radius: 11px; background: var(--amber-soft); }
.setup-banner strong { font-size: 13px; }
.setup-banner p { margin: 3px 0 0; color: #775731; font-size: 12px; }
.setup-icon { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; font-family: Georgia, serif; font-weight: 700; background: #d79a3b; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { position: relative; min-width: 0; display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 5px 20px rgba(25,47,82,.035); }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); font-size: 18px; font-weight: 800; background: var(--soft); }
.metric-card span { display: block; margin-bottom: 5px; color: var(--ink-500); font-size: 11px; }
.metric-card strong { font-family: Georgia, serif; font-size: 28px; font-weight: 500; line-height: 1; }
.metric-card small { grid-column: 2; margin-top: -5px; color: #9ba5b5; font-size: 10px; }
.accent-blue { --accent: var(--blue-600); --soft: var(--blue-100); }
.accent-violet { --accent: var(--violet); --soft: #f1edff; }
.accent-red { --accent: var(--red); --soft: var(--red-soft); }
.accent-green { --accent: var(--green); --soft: var(--green-soft); }

.workspace-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.workspace-heading h2 { margin-bottom: 4px; font-size: 20px; }
.workspace-heading p { margin-bottom: 0; color: var(--ink-500); font-size: 12px; }
.search-box { width: min(300px, 38vw); display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-500); background: #fafbfd; }
.search-box:focus-within { border-color: #8bb1ec; box-shadow: 0 0 0 3px rgba(53,126,232,.1); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink-900); background: transparent; font-size: 12px; }
.table-wrap { min-height: 300px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 18px; color: var(--ink-500); font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; background: #fafbfd; }
td { padding: 14px 18px; border-top: 1px solid #edf0f4; color: var(--ink-700); font-size: 12px; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafcff; }
.patient-cell { display: flex; align-items: center; gap: 10px; }
.patient-initials { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #315c92; font-size: 11px; font-weight: 800; background: #edf4fc; }
.patient-cell strong, .patient-cell small { display: block; }
.patient-cell strong { color: var(--ink-900); font-size: 12px; }
.patient-cell small { margin-top: 3px; color: #8c97a8; font-size: 10px; }
.status, .triage-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ready { color: #426387; background: #eef3f8; }
.status-queued, .status-ringing { color: var(--violet); background: #f2edff; }
.status-in-progress { color: var(--blue-600); background: var(--blue-100); }
.status-completed { color: var(--green); background: var(--green-soft); }
.status-failed, .status-incomplete, .status-no-answer, .status-busy, .status-canceled, .status-declined { color: #8d6570; background: #f7eef0; }
.triage-badge { padding: 5px 9px; }
.triage-emergency { color: #a52734; background: #ffe8ea; }
.triage-urgent { color: var(--red); background: var(--red-soft); }
.triage-semi-urgent { color: var(--amber); background: var(--amber-soft); }
.triage-routine { color: var(--green); background: var(--green-soft); }
.triage-unassigned { color: var(--ink-500); background: #f0f2f5; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.row-button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-700); font-size: 10px; font-weight: 700; background: #fff; }
.row-button.call { color: var(--blue-600); border-color: #cbdcf6; background: #f7faff; }
.row-button:hover { border-color: #9cbbe9; }
.empty-state { display: grid; justify-items: center; padding: 62px 20px; text-align: center; }
.empty-mark { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 16px; color: #4a72a5; font-family: Georgia, serif; font-size: 23px; background: #edf4fc; }
.empty-state h3 { margin-bottom: 7px; }
.empty-state p { max-width: 390px; margin-bottom: 17px; color: var(--ink-500); font-size: 12px; }
footer { padding: 18px 0 0; color: #8a95a5; font-size: 10px; text-align: center; }

.modal-backdrop, .drawer-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(6,18,35,.56); backdrop-filter: blur(3px); }
.modal { position: relative; width: min(580px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 30px; border-radius: 16px; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal.compact { width: min(445px, 100%); }
.modal h2 { font-size: 26px; }
.modal-copy { color: var(--ink-500); font-size: 12px; line-height: 1.6; }
.close-button { position: absolute; top: 16px; right: 16px; width: 31px; height: 31px; border: 0; border-radius: 50%; color: var(--ink-500); font-size: 20px; background: #f1f3f6; }
.close-button.static { position: static; flex: 0 0 auto; }
.modal-symbol { width: 43px; height: 43px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 13px; color: var(--blue-600); font-weight: 800; background: var(--blue-100); }
.modal-symbol.lock { font-size: 9px; border: 7px double var(--blue-600); }
.modal form { display: grid; gap: 15px; margin-top: 20px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
label { display: grid; gap: 6px; color: var(--ink-700); font-size: 11px; font-weight: 700; }
input, textarea { width: 100%; padding: 10px 11px; border: 1px solid #dce2ea; border-radius: 8px; outline: 0; color: var(--ink-900); background: #fbfcfd; }
input:focus, textarea:focus { border-color: #82aaea; box-shadow: 0 0 0 3px rgba(53,126,232,.1); background: #fff; }
textarea { resize: vertical; line-height: 1.5; }
.form-note { display: flex; gap: 9px; padding: 10px 11px; border-radius: 8px; color: #765a33; font-size: 10px; line-height: 1.5; background: var(--amber-soft); }
.form-note span { width: 17px; height: 17px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; font-family: Georgia, serif; background: #d49a46; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.call-checks { display: grid; gap: 9px; margin-top: 18px; padding: 13px; border-radius: 10px; color: var(--ink-700); font-size: 11px; background: #f7f9fb; }
.call-checks span { margin-right: 5px; color: var(--green); font-weight: 800; }
.problem-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.problem-list li { padding: 9px 11px; border-radius: 8px; color: #775731; font-size: 11px; background: var(--amber-soft); }

.drawer-backdrop { z-index: 30; display: block; }
.detail-drawer { position: fixed; top: 0; right: 0; z-index: 31; width: min(590px, 92vw); height: 100vh; overflow-y: auto; background: #f7f9fb; box-shadow: -18px 0 60px rgba(5,18,37,.2); transform: translateX(102%); transition: transform .25s ease; }
.detail-drawer.open { transform: translateX(0); }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 22px 25px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(8px); }
.drawer-header h2 { margin: 0; }
.drawer-content { display: grid; gap: 13px; padding: 20px 24px 40px; }
.drawer-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.drawer-card h3 { margin-bottom: 12px; color: var(--ink-900); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.summary-ready-card { border-color: #cfe0f8; background: linear-gradient(145deg, #fff, #f7faff); }
.summary-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.summary-heading h3 { margin-bottom: 3px; font-family: Georgia, serif; font-size: 19px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.summary-heading small { color: var(--ink-500); font-size: 10px; }
.summary-download { flex: 0 0 auto; color: var(--blue-600); background: var(--blue-100); }
.summary-triage { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #e3ebf7; color: var(--ink-500); font-size: 10px; }
.summary-ready-card h4 { margin: 0 0 7px; color: var(--ink-500); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.summary-copy { margin: 0 0 12px; color: var(--ink-700); font-size: 12px; line-height: 1.6; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.detail-grid div > span { display: block; margin-bottom: 4px; color: var(--ink-500); font-size: 9px; text-transform: uppercase; }
.detail-grid div > strong { color: var(--ink-700); font-size: 11px; font-weight: 600; }
.impression { margin: 0; color: var(--ink-700); font-family: Georgia, serif; font-size: 15px; line-height: 1.65; }
.summary-list { display: grid; gap: 8px; margin: 0; padding-left: 17px; color: var(--ink-700); font-size: 11px; line-height: 1.45; }
.transcript { display: grid; gap: 11px; max-height: 420px; overflow-y: auto; }
.transcript-entry { display: grid; grid-template-columns: 62px 1fr; gap: 10px; font-size: 11px; line-height: 1.5; }
.transcript-entry strong { color: var(--blue-600); font-size: 9px; text-transform: uppercase; }
.transcript-entry.patient strong { color: var(--violet); }
.transcript-empty { color: var(--ink-500); font-size: 11px; }
.drawer-call { width: 100%; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 360px; padding: 12px 15px; border-radius: 10px; color: #fff; font-size: 12px; font-weight: 700; background: var(--navy-900); box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.toast.error { background: #9f2e3b; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  main { padding: 28px; }
  th:nth-child(2), td:nth-child(2), th:nth-child(5), td:nth-child(5) { display: none; }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; display: block; padding: 15px 18px; }
  .brand { padding: 0; border: 0; }
  .brand-mark { width: 34px; height: 34px; }
  nav { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
  .nav-item { display: flex; justify-content: center; padding: 9px; font-size: 10px; }
  .nav-icon, .sidebar-note, .account-button, .nav-count { display: none; }
  main { padding: 22px 14px; }
  .topbar { align-items: flex-end; }
  .topbar .eyebrow { display: none; }
  h1 { font-size: 28px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { padding: 13px; grid-template-columns: 34px 1fr; gap: 9px; }
  .metric-icon { width: 34px; height: 34px; }
  .metric-card strong { font-size: 23px; }
  .workspace-heading { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  th:nth-child(4), td:nth-child(4) { display: none; }
  td, th { padding: 12px 10px; }
  .row-actions { flex-direction: column; }
  .field-grid { grid-template-columns: 1fr; }
  .modal { padding: 26px 20px; }
  .detail-grid { grid-template-columns: 1fr; }
}
