/* ==========================================================================
   InstaPraxis Central Store - design system (cs.css)
   Adapted from the clinic app's mc.css so the look matches; central-store
   specific components (charts, transcript, filters, share pages) at the end.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
  --brand: #0b6e6e;
  --brand-600: #0a6262;
  --brand-700: #075050;
  --brand-800: #053c3c;
  --brand-50: #e8f5f4;
  --brand-100: #cdeae7;
  --indigo: #4f46e5;
  --indigo-50: #eef0ff;
  --amber: #d97706;
  --amber-50: #fff6e5;
  --rose: #e11d48;
  --rose-50: #fff0f3;
  --green: #15803d;
  --green-50: #ecfdf3;
  --sky: #0369a1;
  --sky-50: #e9f6fe;
  --ink: #0f1e2e;
  --ink-2: #273647;
  --muted: #5b6b7b;
  --muted-2: #8795a3;
  --line: #e3e8ee;
  --line-2: #eef2f6;
  --bg: #f4f7f9;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 46, .06);
  --shadow: 0 1px 3px rgba(15, 30, 46, .06), 0 8px 24px rgba(15, 30, 46, .06);
  --shadow-lg: 0 20px 50px rgba(15, 30, 46, .16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sidebar-w: 248px;
  --series-1: #0d9488;
  --series-2: #d97706;
  --grid: #e9eef3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 .7em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- icons ---------- */
.ic { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 28px; height: 28px; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--b); color: #fff; font: 600 14px/1.2 var(--font);
  cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s, opacity .15s;
  white-space: nowrap; text-decoration: none !important; user-select: none;
}
.btn:hover { background: var(--brand-700); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn.lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); }
.btn.soft { background: var(--brand-50); color: var(--brand-700); }
.btn.soft:hover { background: var(--brand-100); }
.btn.indigo { background: var(--indigo); } .btn.indigo:hover { background: #4338ca; }
.btn.danger { background: var(--rose); } .btn.danger:hover { background: #be123c; }
.btn.amber { background: var(--amber); } .btn.amber:hover { background: #b45309; }
.btn.green { background: var(--green); } .btn.green:hover { background: #166534; }
.btn.link { background: none; color: var(--brand); padding: 4px 6px; }
.btn.link:hover { background: var(--brand-50); }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.ghost .spin, .btn.soft .spin { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: 400 14.5px/1.4 var(--font); color: var(--ink); background: #fff;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 110, 110, .14); }
textarea.input { resize: vertical; min-height: 70px; }
.input.sm { padding: 7px 10px; font-size: 13.5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font: 600 13.5px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.choice { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.choice > label { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: #fff; display: flex; gap: 12px; align-items: flex-start; transition: border-color .15s, background .15s; }
.choice > label:hover { border-color: var(--brand-100); }
.choice > label.on { border-color: var(--brand); background: var(--brand-50); }
.choice input { display: none; }
.choice .t { font-weight: 700; }
.choice .d { font-size: 13px; color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 15.5px; }
.card-h .sub { color: var(--muted); font-size: 13px; }
.card-b { padding: 16px 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; }
.card.flat { box-shadow: none; }
.card.hover { transition: box-shadow .15s, transform .15s, border-color .15s; cursor: pointer; }
.card.hover:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--brand-100); }

/* stat tile */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat.indigo .ico { background: var(--indigo-50); color: var(--indigo); }
.stat.amber .ico { background: var(--amber-50); color: var(--amber); }
.stat.green .ico { background: var(--green-50); color: var(--green); }
.stat.rose .ico { background: var(--rose-50); color: var(--rose); }

/* action tile (patient home / clinic) */
.tile { padding: 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: all .15s; color: var(--ink); text-decoration: none !important; min-height: 132px; }
.tile:hover { border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-2px); }
.tile .ti { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; }
.tile .tt { font-weight: 700; font-size: 15px; }
.tile .td { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.ti.c1 { background: #e8f5f4; color: #0b6e6e; }
.ti.c2 { background: #eef0ff; color: #4f46e5; }
.ti.c3 { background: #fff0f3; color: #e11d48; }
.ti.c4 { background: #fff6e5; color: #d97706; }
.ti.c5 { background: #e9f6fe; color: #0369a1; }
.ti.c6 { background: #ecfdf3; color: #15803d; }
.ti.c7 { background: #f5efff; color: #7c3aed; }
.ti.c8 { background: #fdf2f8; color: #db2777; }

/* ---------- chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.brand { background: var(--brand-50); color: var(--brand-700); }
.chip.indigo { background: var(--indigo-50); color: var(--indigo); }
.chip.amber { background: var(--amber-50); color: #b45309; }
.chip.rose { background: var(--rose-50); color: var(--rose); }
.chip.green { background: var(--green-50); color: var(--green); }
.chip.sky { background: var(--sky-50); color: var(--sky); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.live .dot { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f8fbfb; }
.tbl-wrap { overflow-x: auto; }

/* ---------- avatar ---------- */
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, #0b6e6e, #14918f); flex: 0 0 auto; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }
.av.indigo { background: linear-gradient(135deg, #4f46e5, #6d63ff); }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, #17184a 0%, #13284a 45%, #0d2b33 100%); color: #d5dcf0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brandbox { padding: 18px 18px 14px; display: flex; gap: 11px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.07); }
.side .brandbox .logo { width: 38px; height: 38px; flex: 0 0 38px; }
.side .brandbox .bn { font-weight: 800; color: #fff; font-size: 14.5px; line-height: 1.15; }
.side .brandbox .bs { font-size: 11.5px; color: #8fb3b3; }
.side nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #6f9696; padding: 14px 12px 6px; font-weight: 700; }
.side nav a { display: flex; gap: 11px; align-items: center; padding: 9px 12px; border-radius: 10px; color: #cfe3e3; font-weight: 500; font-size: 14px; text-decoration: none; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: rgba(45, 212, 191, .14); color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
.side nav a .badge { margin-left: auto; background: #2dd4bf; color: #053c3c; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.side .me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); display: flex; gap: 10px; align-items: center; }
.side .me .n { color: #fff; font-weight: 600; font-size: 13.5px; }
.side .me .r { font-size: 12px; color: #8fb3b3; }
.side .me button { margin-left: auto; background: transparent; border: 0; color: #8fb3b3; cursor: pointer; padding: 6px; border-radius: 8px; }
.side .me button:hover { color: #fff; background: rgba(255,255,255,.08); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .title { font-weight: 700; font-size: 17px; }
.topbar .crumb { color: var(--muted); font-size: 13px; }
.topbar .burger { display: none; }
.content { padding: 22px 24px 60px; max-width: 1400px; width: 100%; }
.content.wide { max-width: none; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h1 { margin: 0; font-size: 24px; }
.page-h .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.page-h .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.searchbox { position: relative; flex: 1; max-width: 420px; }
.searchbox .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.searchbox input { padding-left: 38px; background: var(--line-2); border-color: transparent; }
.searchbox input:focus { background: #fff; }

@media (max-width: 980px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(15,30,46,.35); z-index: 50; }
  .topbar .burger { display: inline-flex; }
  .content { padding: 16px 14px 70px; }
  .topbar { padding: 0 14px; }
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.on { color: var(--brand-700); border-bottom-color: var(--brand); }
.tabs button .n { background: var(--line-2); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }

/* ---------- list items ---------- */
.li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; }
.li.click:hover { background: #f8fbfb; }
.li .t { font-weight: 600; }
.li .s { font-size: 13px; color: var(--muted); }
.time-pill { min-width: 62px; text-align: center; font-weight: 700; font-size: 13px; padding: 6px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); }

/* ---------- timeline ---------- */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .ev { position: relative; padding-bottom: 16px; }
.tl .ev::before { content: ''; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }
.tl .ev.indigo::before { border-color: var(--indigo); }
.tl .ev.amber::before { border-color: var(--amber); }
.tl .ev.rose::before { border-color: var(--rose); }
.tl .ev .d { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- empty / skeleton ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; color: var(--muted-2); margin-bottom: 8px; }
.sk { background: linear-gradient(90deg, #eef2f6 25%, #f6f8fa 37%, #eef2f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- modal / drawer ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 30, 46, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1100px; }
.modal-h { padding: 18px 22px 10px; display: flex; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; font-size: 18px; }
.modal-h .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.modal-h .x:hover { background: var(--line-2); }
.modal-b { padding: 6px 22px 18px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; background: #fafbfc; border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- toast ---------- */
#mc-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f1e2e; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; display: flex; gap: 10px; align-items: center; animation: pop .18s; }
.toast.ok { background: #065f46; }
.toast.err { background: #9f1239; }

/* ---------- callouts ---------- */
.note { padding: 12px 14px; border-radius: 12px; background: var(--brand-50); color: var(--brand-800); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.note.amber { background: var(--amber-50); color: #92400e; }
.note.rose { background: var(--rose-50); color: #9f1239; }
.note.indigo { background: var(--indigo-50); color: #3730a3; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }

/* ---------- vitals grid ---------- */
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.vital { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.vital .l { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.vital .v { font-size: 19px; font-weight: 800; }
.vital .u { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.vital.warn { border-color: #fcd34d; background: #fffbeb; }
.vital.bad { border-color: #fda4af; background: #fff1f2; }

/* ---------- autocomplete ---------- */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 80; max-height: 340px; overflow-y: auto; padding: 4px; }
.ac-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.ac-item.on, .ac-item:hover { background: var(--brand-50); }
.ac-item .a1 { font-weight: 700; }
.ac-item .a2 { font-size: 12.5px; color: var(--muted); }
.ac-item .a3 { margin-left: auto; font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.ac-item mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 3px; }

/* ---------- landing ---------- */
.lp-nav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.lp-nav .in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.lp-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hero { background: radial-gradient(1200px 500px at 85% -10%, #d7f0ee 0%, transparent 60%), radial-gradient(800px 400px at -10% 110%, #eef0ff 0%, transparent 60%), #f7fbfb; padding: 64px 0 56px; }
.hero h1 { font-family: var(--serif); font-size: 48px; line-height: 1.08; letter-spacing: -.02em; font-weight: 700; color: #0d2b33; }
.hero .lead { font-size: 18px; color: var(--ink-2); max-width: 560px; }
.hero .creds { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; }
.portrait { border-radius: 28px; background: linear-gradient(160deg, #0b6e6e, #0d2b33); color: #fff; padding: 30px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.portrait::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(45, 212, 191, .18); }
.section { padding: 56px 0; }
.section h2 { font-family: var(--serif); font-size: 32px; color: #0d2b33; }
.feature { padding: 20px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.feature .ti { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; }
.footer { background: #0d2b33; color: #a9c4c4; padding: 36px 0; font-size: 14px; }
.footer a { color: #e6f5f4; }
@media (max-width: 760px) { .hero h1 { font-size: 34px; } .hero { padding: 36px 0; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth .art { background: linear-gradient(160deg, #0b6e6e 0%, #0d2b33 75%); color: #e6f5f4; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px; background: rgba(45, 212, 191, .12); }
.auth .art h1 { font-family: var(--serif); font-size: 40px; color: #fff; line-height: 1.1; }
.auth .form { display: flex; align-items: center; justify-content: center; padding: 36px 20px; background: #fff; }
.auth .form .box { width: 100%; max-width: 400px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .art { display: none; } }

/* ---------- consult workspace ---------- */
.cx { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.cx.with-video { grid-template-columns: 340px minmax(0, 1fr); }
@media (max-width: 1200px) { .cx { grid-template-columns: minmax(0, 1fr); } }
.cx-left { position: sticky; top: 78px; max-height: calc(100vh - 92px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1200px) { .cx-left { position: static; max-height: none; } }
.pt-card { padding: 16px; }
.pt-card .nm { font-size: 18px; font-weight: 800; }
.video-box { position: relative; background: #0b1620; border-radius: 16px; overflow: hidden; aspect-ratio: 16/9; }
.video-box video.remote { width: 100%; height: 100%; object-fit: cover; background: #0b1620; }
.video-box video.local { position: absolute; right: 12px; bottom: 12px; width: 26%; max-width: 200px; border-radius: 12px; border: 2px solid rgba(255,255,255,.7); background: #1f2937; object-fit: cover; aspect-ratio: 4/3; }
.video-box .vb-ctrl { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; display: flex; gap: 8px; justify-content: center; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.video-box .vb-ctrl .btn { background: rgba(255,255,255,.16); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.2); }
.video-box .vb-ctrl .btn.danger { background: var(--rose); }
.video-box .vb-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #cbd5e1; text-align: center; padding: 20px; }
.scribe-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #0d2b33; color: #e6f5f4; }
.scribe-bar .lvl { width: 70px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.scribe-bar .lvl i { display: block; height: 100%; width: 0; background: #2dd4bf; transition: width .1s; }
.transcript { max-height: 260px; overflow-y: auto; font-size: 13.5px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.transcript .ln { padding: 6px 10px; border-radius: 10px; background: var(--line-2); }
.transcript .ln.patient { background: var(--indigo-50); }
.transcript .ln .who { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rx-sec { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.rx-sec:last-child { border-bottom: 0; }
.rx-sec > .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rx-sec > .hd h4 { margin: 0; }
.med-row { display: grid; grid-template-columns: 28px minmax(180px, 2.4fr) 1fr 1fr 1fr 1.4fr 34px; gap: 8px; align-items: center; padding: 6px 0; }
.med-row .n { font-weight: 700; color: var(--muted); text-align: center; }
.med-row .gen { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 900px) { .med-row { grid-template-columns: 24px 1fr 1fr; } .med-row > :nth-child(n+3) { grid-column: span 1; } }
.test-row { display: grid; grid-template-columns: 28px minmax(200px, 2fr) 1.4fr 34px; gap: 8px; align-items: center; padding: 5px 0; }
.mic-live { animation: micp 1.2s infinite; }
@keyframes micp { 0%,100% { box-shadow: 0 0 0 0 rgba(225,29,72,.45); } 50% { box-shadow: 0 0 0 8px rgba(225,29,72,0); } }

/* history panel */
.hx-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.hx-item + .hx-item { margin-top: 8px; }
.hx-item .h { display: flex; gap: 8px; align-items: center; }
.hx-item .h .t { font-weight: 700; font-size: 14px; }
.hx-item .h .d { margin-left: auto; font-size: 12px; color: var(--muted); }
.hx-item ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.hx-item .rxm { font-size: 13px; color: var(--ink-2); }
.flag-hi { color: var(--rose); font-weight: 700; }
.flag-lo { color: var(--sky); font-weight: 700; }
.trend { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.trend .p { background: var(--line-2); padding: 2px 7px; border-radius: 6px; }

/* print helpers */
@media print { .side, .topbar, .no-print { display: none !important; } .content { padding: 0; } body { background: #fff; } }

/* ==========================================================================
   Central Store additions
   ========================================================================== */
.side .brandbox .bs { color: #9fb0d8; }
.side nav .sec { color: #7f8fc0; }
.side nav a { color: #d5dcf0; }
.side .me .r { color: #9fb0d8; }
.topbar .who { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.topbar .who .chip { font-weight: 600; }
.content { margin: 0 auto; }
h1.serif, .page-h h1 { font-family: var(--serif); font-weight: 700; color: #13284a; }
.num { font-variant-numeric: tabular-nums; }
.dim { opacity: .55; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w100 { width: 100%; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--line-2); padding: 1px 6px; border-radius: 6px; }
pre.code { display: block; padding: 12px 14px; overflow-x: auto; white-space: pre; line-height: 1.45; border: 1px solid var(--line); background: #f8fafc; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; word-break: break-all; padding: 12px 14px; border-radius: 12px; background: #0f1e2e; color: #a7f3d0; user-select: all; }
.chip.gray { background: var(--line-2); color: var(--muted); }
.chip.dark { background: #13284a; color: #e0e7ff; }
.stat .ico.c-teal { background: #e6f6f4; color: #0d9488; }
.stat .sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1500px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat { padding: 12px; } .stat .ico { display: none; } }
.health { display: flex; gap: 10px; align-items: center; }
.health .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted-2); flex: 0 0 auto; }
.health .dot.ok { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; }
.health .dot.bad { background: #dc2626; box-shadow: 0 0 0 4px #fee2e2; }
.health .dot.warn { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; }
.filters .f-item { display: flex; flex-direction: column; gap: 4px; min-width: 130px; flex: 0 1 auto; }
.filters .f-item.grow2 { flex: 1 1 240px; }
.filters .f-item label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filters .f-item .input { padding: 8px 10px; font-size: 13.5px; }
.filters .f-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.tbl td.snip { padding-top: 0; color: var(--muted); font-size: 13px; }
.tbl mark, .tx mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 2px; }
.tbl tr.withdrawn td { color: var(--muted-2); text-decoration: line-through; }
.tbl tr.erased td { color: var(--muted-2); }
.tbl td .sub { font-size: 12px; color: var(--muted); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart svg text.val { fill: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart svg text.lbl { fill: var(--ink-2); font-size: 12px; }
.chart svg .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart svg .axis line { stroke: #d5dde5; stroke-width: 1; shape-rendering: crispEdges; }
.chart svg .hit { fill: transparent; cursor: default; outline: none; }
.chart svg .hit:hover + .mark, .chart svg .hit:focus + .mark { filter: brightness(1.12); }
.chart svg g.col:hover .seg, .chart svg g.col:focus-within .seg, .chart svg g.bar:hover .seg, .chart svg g.bar:focus-within .seg { filter: brightness(1.15) saturate(1.05); }
.chart svg g.col:focus, .chart svg g.bar:focus { outline: none; }
.chart .tip { position: absolute; pointer-events: none; background: #0f1e2e; color: #fff; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); white-space: nowrap; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); }
.chart .tip .tv { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chart .tip .tk { display: inline-block; width: 10px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 6px; }
.chart .tip .tl { color: #cbd5e1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-table { margin-top: 8px; font-size: 12.5px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.chart-table table { margin-top: 6px; }
.chart-empty { padding: 40px 10px; text-align: center; color: var(--muted-2); font-size: 13px; }

/* conversation detail */
.cv { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1150px) { .cv { grid-template-columns: minmax(0, 1fr); } }
.player { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 62px; z-index: 10; background: #fff; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--line-2); }
.player audio { width: 100%; height: 40px; }
.player .parts { display: flex; gap: 6px; flex-wrap: wrap; }
.tx { display: flex; flex-direction: column; gap: 2px; padding: 8px; max-height: 70vh; overflow-y: auto; }
.tx .ln { display: grid; grid-template-columns: 62px 86px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; align-items: baseline; border: 1px solid transparent; }
.tx .ln:hover { background: #f6f9fb; }
.tx .ln.on { background: var(--brand-50); border-color: var(--brand-100); }
.tx .ln .t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tx .ln .who { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tx .ln .who.doctor { color: var(--brand-700); }
.tx .ln .who.patient { color: var(--indigo); }
.tx .ln .who.mixed, .tx .ln .who.unknown { color: var(--muted); }
.tx .ln .orig { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.tx .ln .lang { font-size: 10.5px; color: var(--muted-2); margin-left: 6px; text-transform: uppercase; }
.tx .tag { background: #fff1d6; color: #92400e; padding: 0 4px; border-radius: 4px; font-size: 12px; font-weight: 600; }
@media (max-width: 640px) { .tx .ln { grid-template-columns: 52px minmax(0, 1fr); } .tx .ln .who { grid-column: 2; } .tx .ln .body { grid-column: 1 / -1; } }
.kv.tight { gap: 5px 12px; font-size: 13.5px; }
.kv .v { word-break: break-word; }
.side-card + .side-card { margin-top: 14px; }

/* key reveal / steps */
.steps { counter-reset: st; display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: st; display: flex; gap: 10px; font-size: 14px; }
.steps li::before { content: counter(st); width: 22px; height: 22px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: 0 0 auto; }

/* login */
.totp-qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.totp-qr img { width: 180px; height: 180px; border-radius: 12px; border: 1px solid var(--line); padding: 6px; background: #fff; }
.code-input { font: 700 24px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .35em; text-align: center; }
.auth .art .brand { display: flex; gap: 12px; align-items: center; }
.auth .art .brand .bn { font-weight: 800; font-size: 16px; color: #fff; }
.auth .art { background: linear-gradient(160deg, #17184a 0%, #13284a 40%, #0b6e6e 100%); }
.auth .art ul { padding-left: 18px; color: #cfe3e3; font-size: 14.5px; line-height: 1.7; }

/* markdown */
.md h2 { font-size: 20px; margin-top: 4px; }
.md h3 { font-size: 16px; margin-top: 18px; }
.md h4 { margin-top: 16px; }
.md table { margin: 6px 0 12px; }
.md ul { padding-left: 20px; margin: 6px 0 12px; }
.md li { margin: 3px 0; }
.md p { color: var(--ink-2); }

/* public share pages */
.share-body { background: radial-gradient(1100px 420px at 90% -10%, #dde9ff 0%, transparent 60%), radial-gradient(900px 400px at -10% 0%, #d7f0ee 0%, transparent 55%), var(--bg); min-height: 100vh; }
.share-wrap { max-width: 1040px; margin: 0 auto; padding: 22px 18px 60px; }
.share-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-top .bn { font-weight: 800; color: #13284a; }
.share-top .bs { font-size: 12px; color: var(--muted); }
.share-audio { border-top: 1px solid var(--line-2); }
.share-audio summary { padding: 12px 18px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }

/* misc */
.danger-zone { border-color: #fecdd3; }
.danger-zone .card-h { border-bottom-color: #ffe4e6; }
.banner { padding: 10px 14px; border-radius: 12px; font-size: 13.5px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.mini-bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.mini-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* The view container receives programmatic focus on navigation (for screen readers); no ring needed. */
#view:focus { outline: none; }
