/* Layout: soft clinic workspace. Sidebar + top bar on a laptop; bento of rounded cards with portraits; bottom tabs on a phone. */
:root {
  --bg: #F9FCFC;
  --surface: #FFFFFF;
  --surface-2: #F3F8F8;
  --ink: #16282B;
  --ink-2: #4B5F63;
  --ink-3: #75878B;
  --line: #E4ECEC;
  --accent: #1E5B5E;
  --accent-2: #2F7B7C;
  --accent-soft: #E0EEED;
  --on-accent: #FFFFFF;
  --tint-teal: #E4F5F2;
  --tint-blue: #E8F0FC;
  --tint-lilac: #F0EBFB;
  --tint-sand: #FEF3E0;
  --amber: #995A00;
  --amber-bg: #FDF0D8;
  --amber-line: #F0CF94;
  --green: #1B7343;
  --green-bg: #E2F2E8;
  --green-line: #A9D9BC;
  --red: #B42318;
  --red-bg: #FCE8E6;
  --red-line: #F2B8B2;
  --shadow: 0 1px 2px rgba(22,40,43,.04), 0 8px 24px rgba(22,40,43,.06);
  --shadow-lg: 0 24px 60px rgba(10,30,32,.22);
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 18px;
  --r-sm: 12px;
  --fs-xs: 0.8125rem;
  --fs-s: 0.9rem;
  --fs-b: 1.0625rem;
  --fs-h3: 1.1875rem;
  --fs-h2: 1.375rem;
  --fs-h1: 2.125rem;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { background: radial-gradient(1200px 520px at 18% -8%, color-mix(in srgb, var(--tint-teal) 70%, transparent), transparent 70%), var(--bg); background-attachment: fixed; color: var(--ink); font-family: var(--font-body); font-size: var(--fs-b); line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.25; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-h1); letter-spacing: -.01em; }
h2 { font-size: var(--fs-h3); }
h3 { font-size: var(--fs-b); }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.av { display: block; border-radius: 50%; flex: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; padding-block: 20px; padding-inline: 16px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 12px; padding: 0 6px 18px; }
.logo-mark { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--accent); display: grid; place-items: center; font-family: var(--font-display); font-size: 1.35rem; color: var(--accent); flex: none; }
.logo b { font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; line-height: 1.1; display: block; }
.logo span { font-size: var(--fs-xs); color: var(--ink-3); }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; text-align: left; padding: 11px 12px; border-radius: 12px; font-weight: 700; color: var(--ink-2); }
.nav-btn:hover { background: var(--surface-2); }
.nav-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-btn svg { width: 22px; height: 22px; flex: none; }
.nav-btn .count { margin-left: auto; min-width: 26px; text-align: center; font-size: var(--fs-xs); padding: 1px 8px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.me b { display: block; font-size: var(--fs-s); }
.me span { font-size: var(--fs-xs); color: var(--ink-3); }
.btn-book { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--accent); color: var(--on-accent); padding: 12px; border-radius: 12px; font-weight: 700; }
.btn-book svg { width: 18px; height: 18px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.top-in { display: flex; align-items: center; gap: 12px; padding-block: 14px; padding-inline: 28px; max-width: 1440px; width: 100%; margin-inline: auto; }
.top .mlogo { display: none; }
.gsearch { flex: 1 1 auto; max-width: 520px; position: relative; }
.gsearch input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 11px 16px 11px 44px; }
.gsearch svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sample { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1.5px dashed var(--ink-3); color: var(--ink-2); padding: 4px 11px; border-radius: 999px; white-space: nowrap; background: var(--surface); }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--amber); color: var(--surface); font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.role { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.role button { border: 0; background: transparent; padding: 4px 12px 4px 4px; border-radius: 999px; font-size: var(--fs-s); font-weight: 700; color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.role button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
main { padding-block: 8px 56px; padding-inline: 28px; max-width: 1440px; width: 100%; margin-inline: auto; }
.wrap { display: flex; flex-direction: column; gap: 22px; }
.bottom { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.card-head .sub { color: var(--ink-2); font-size: var(--fs-s); width: 100%; }
.rows { list-style: none; margin: 0; padding: 0 10px 10px; }
.row { display: flex; align-items: center; gap: 12px 14px; padding: 12px; border-radius: 14px; flex-wrap: wrap; }
.row + .row { border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--surface-2); border-radius: 14px; }
.row-main { flex: 1 1 200px; min-width: 0; }
.row-main .name { font-weight: 700; }
.row-main .meta { color: var(--ink-2); font-size: var(--fs-s); }
.empty { padding: 4px 22px 22px; color: var(--ink-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
.page-head > div { margin-right: auto; min-width: 0; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.back { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 4px 0; }

/* Status. Three colours only: amber waiting, green approved/ready, red medical flag. */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.wait { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.chip.ok { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.chip.flag { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.draft { display: inline-flex; align-items: center; font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1.5px dashed var(--ink-3); color: var(--ink-2); white-space: nowrap; }
.count-badge { font-size: var(--fs-xs); font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); }
.count-badge.zero { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.pill-time { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-family: var(--font-mono); font-size: var(--fs-s); white-space: nowrap; background: var(--surface); }
.pill-time svg { width: 14px; height: 14px; color: var(--ink-3); }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 700; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.approve { background: var(--green); border-color: var(--green); color: var(--surface); }
.btn.small { padding: 6px 12px; font-size: var(--fs-s); border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Today bento ---------- */
.hello { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.hello-photo { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; background: #FFFFFF; border: 4px solid var(--surface); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); flex: none; }
.av-photo { object-fit: cover; background: #E9ECEC; }
.hello > div { margin-right: auto; }
.hello p { color: var(--ink-2); margin-top: 2px; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; text-align: left; min-width: 0; }
button.tile { cursor: pointer; }
button.tile:hover { filter: brightness(.98); border-color: var(--line); }
.tile .lbl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-s); color: var(--ink-2); }
.tile .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface); display: grid; place-items: center; flex: none; }
.tile .ico svg { width: 18px; height: 18px; color: var(--accent); }
.tile .big { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .note { font-size: var(--fs-s); color: var(--ink-2); }
.t-sand { background: var(--tint-sand); } .t-sand .big { color: var(--amber); }
.t-blue { background: var(--tint-blue); }
.t-lilac { background: var(--tint-lilac); }
.t-teal { background: var(--tint-teal); }
.hero-tiles { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.ring-card { display: flex; align-items: center; gap: 18px; padding: 20px 22px; }
.ring-card .big { font-family: var(--font-display); font-size: 3.2rem; line-height: 1; }
.ring-card .lbl { font-weight: 700; color: var(--ink-2); font-size: var(--fs-s); }
.ring-card .txt { margin-right: auto; display: flex; flex-direction: column; gap: 4px; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; }
.ring small { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-size: .7rem; color: var(--ink-3); }
.stock-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.stock-card .lbl { font-weight: 700; color: var(--ink-2); font-size: var(--fs-s); }
.stock-card .big { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.15; }
.stock-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stock-row .muted { margin-right: auto; }

.appr-row .av { box-shadow: 0 0 0 3px var(--amber-bg); }
.waited { font-weight: 700; color: var(--amber); font-size: var(--fs-s); white-space: nowrap; }
.days { display: flex; gap: 8px; padding: 0 22px 8px; overflow-x: auto; }
.day { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; min-width: 66px; gap: 0; }
.day .d { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.day .n { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15; }
.day .c { font-size: var(--fs-xs); color: var(--ink-2); }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day[aria-pressed="true"] .d, .day[aria-pressed="true"] .c { color: var(--on-accent); opacity: .85; }
.now-tag { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); }
.appt-row.seen { opacity: .7; }

/* Next patient */
.next { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.next-top { display: flex; gap: 14px; align-items: center; }
.next-top .eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.next-top h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; }
.next-top .muted { font-size: var(--fs-s); }
.kv { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.kv div { display: flex; align-items: center; gap: 10px; font-size: var(--fs-s); }
.kv svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* Chat preview + files */
.chat-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; cursor: pointer; }
.chat-row:hover { background: var(--surface-2); }
.chat-row + .chat-row { border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.bubble { background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; font-size: var(--fs-s); margin-top: 4px; }
.chat-row .name { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-row .when { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); margin-left: auto; }
.file { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; flex-wrap: wrap; }
.file + .file { border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.file.click { cursor: pointer; }
.file.click:hover { background: var(--surface-2); }
.ficon { width: 40px; height: 46px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--font-mono); font-size: .66rem; font-weight: 500; flex: none; position: relative; }
.ficon::after { content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px; background: var(--surface); border-bottom-left-radius: 6px; }
.file .fn { font-family: var(--font-mono); font-size: var(--fs-s); word-break: break-all; }
.file select { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 8px; max-width: 100%; }

/* Owner's Desk preview (Step 3) */
.owner { padding: 20px 22px; border: 1.5px dashed var(--ink-3); background: var(--surface); box-shadow: none; display: flex; flex-direction: column; gap: 14px; }
.owner-tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.owner-tag svg { width: 14px; height: 14px; }
.owner h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; }
.money { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.money div { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.money span { display: block; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 700; }
.money b { font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 70px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--ink-3); opacity: .35; }
.bars div.cur i { background: var(--accent); opacity: .85; }
.bars span { font-size: .7rem; color: var(--ink-3); }

/* ---------- Approval ---------- */
.approval { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.p-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.ph { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ph > div { margin-right: auto; min-width: 0; }
.ph p { color: var(--ink-2); }
.proto-block { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.med { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.med.offstock { border-color: var(--red-line); background: var(--red-bg); }
.med-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.med-name { font-weight: 700; font-size: var(--fs-h3); margin-right: auto; }
.med-dose { color: var(--ink-2); }
.med-why { font-size: var(--fs-s); color: var(--ink-2); }
.med-edit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.med-edit label { font-size: var(--fs-s); color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
input, textarea, select { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.med-edit input, .med input, textarea { width: 100%; }
textarea { min-height: 96px; resize: vertical; }
.offstock-note { color: var(--red); font-weight: 700; font-size: var(--fs-s); }
.list-plain { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; }
.sect-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.keep { border-left: 3px solid var(--line); padding: 8px 12px; background: var(--surface-2); border-radius: 0 10px 10px 0; }
.facts { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.fact-group h4 { margin: 0 0 6px; font-size: var(--fs-b); }
.fact { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 4px 0; }
.fact > span:first-child { flex: 1 1 200px; min-width: 0; }
.src { font-family: var(--font-mono); font-size: .76rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--accent); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.src:hover { border-color: var(--accent); }
.history { padding: 0 22px 20px; }
.history ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r) var(--r); }
.actions .btn { flex: 1 1 auto; padding: 13px 16px; }
.role-note { padding: 12px 22px 16px; font-size: var(--fs-s); color: var(--ink-2); }
.sendback { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; border: 1px solid; font-size: var(--fs-s); }
.banner.ok { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.banner.wait { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.banner.flag { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }

/* ---------- Patient ---------- */
.p-hero { padding: 22px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.p-hero .who { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.p-hero .who-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.p-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 20px; margin: 0; }
.p-facts dt { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; }
.p-facts dd { margin: 0; font-weight: 700; }
.redstrip { border: 1px solid var(--red-line); background: var(--red-bg); border-radius: var(--r); padding: 16px 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; }
.redstrip h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--red); margin-bottom: 4px; }
.redstrip ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.redstrip .glp { font-weight: 700; color: var(--red); }
.p-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.tbl-wrap { overflow-x: auto; padding: 0 0 10px; }
table.labs { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.labs th, .labs td { text-align: left; padding: 10px 22px; border-top: 1px solid var(--line); }
.labs th { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.labs tr.out td { background: var(--red-bg); }
.labs tr.out td.val { color: var(--red); font-weight: 700; }
.hl { font-size: .74rem; font-weight: 700; margin-left: 6px; }
details.sec { border-top: 1px solid var(--line); }
details.sec summary { list-style: none; cursor: pointer; padding: 12px 22px; display: flex; gap: 12px; align-items: center; }
details.sec summary::-webkit-details-marker { display: none; }
details.sec summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; flex: none; }
details.sec[open] summary::before { transform: rotate(45deg); }
details.sec summary .n { font-family: var(--font-mono); font-size: var(--fs-s); color: var(--ink-3); width: 1.6rem; }
details.sec summary .t { font-weight: 700; margin-right: auto; }
details.sec summary .c { font-size: var(--fs-s); color: var(--ink-3); }
.sec-body { padding: 0 22px 14px 60px; }
.sec-body .fact { border-top: 1px dashed var(--line); }
.sec-body .fact:first-child { border-top: 0; }
.binder-tools { display: flex; gap: 8px; padding: 0 22px 12px; flex-wrap: wrap; }
.notes { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.notes blockquote { margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0 22px 20px; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 8px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 12px; top: 32px; bottom: -8px; border-left: 2px solid var(--line); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.tl-dot svg { width: 13px; height: 13px; color: var(--accent); }
.tl-when { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-mono); }

/* ---------- Patients ---------- */
.search { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px; }
.search input { width: 100%; border-radius: 999px; padding: 12px 18px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: var(--fs-s); color: var(--ink-2); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filter .k { font-family: var(--font-mono); font-weight: 500; margin-left: 4px; opacity: .8; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 22px; align-items: start; }
.thread-list .row[aria-current="true"] { background: var(--accent-soft); border-radius: 14px; }
.thread { display: flex; flex-direction: column; min-height: 560px; overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-head > div { margin-right: auto; min-width: 0; }
.msgs { flex: 1; padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.msg-line { display: flex; gap: 8px; align-items: flex-end; }
.msg-line.out { flex-direction: row-reverse; }
.msg { max-width: min(78%, 34rem); padding: 10px 14px; border-radius: 4px 16px 16px 16px; background: var(--surface); border: 1px solid var(--line); }
.msg-line.out .msg { background: var(--accent-soft); border-color: transparent; border-radius: 16px 4px 16px 16px; }
.msg .who { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); margin-bottom: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.msg .fileline { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: var(--fs-s); }
.msg .fileline svg { width: 16px; height: 16px; }
.reply { display: flex; flex-direction: column; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.reply-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.reply textarea { min-height: 76px; }

/* ---------- Overlay ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8,20,22,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; padding: 22px; max-height: 88vh; overflow: auto; }
.modal .doc { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-family: var(--font-mono); font-size: var(--fs-s); white-space: pre-wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-s); font-weight: 700; color: var(--ink-2); }
.form-grid .full { grid-column: 1 / -1; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); }


/* Consultation recording preview (Step 2) */
.btn-rec { display: flex; align-items: center; gap: 12px; text-align: left; border: 1.5px dashed var(--ink-3); background: var(--surface); border-radius: 12px; padding: 10px 12px; width: 100%; }
.btn-rec:hover { background: var(--surface-2); }
.btn-rec b { display: block; font-size: var(--fs-s); }
.btn-rec small { display: block; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; letter-spacing: .04em; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.rec-live .rec-dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); } 50% { box-shadow: 0 0 0 9px var(--accent-soft); } }
.rec-modal { max-width: 640px; }
.rec-head { display: flex; align-items: center; gap: 12px; }
.rec-head > div { margin-right: auto; min-width: 0; }
.rec-timer { font-family: var(--font-mono); font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.transcript { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 14px; max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.tline { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 8px; font-size: var(--fs-s); }
.tline .ts { font-family: var(--font-mono); color: var(--ink-3); font-size: var(--fs-xs); padding-top: 2px; }
.tline b { color: var(--accent); }
.consent { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.writeup { display: flex; flex-direction: column; gap: 8px; }
.writeup li { margin-bottom: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .card, .tile { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: .001; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  body.settled .card, body.settled .tile { animation: none; }
}

@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash .col.side-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
  .approval, .p-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top .mlogo { display: grid; }
  .top-in { padding-inline: 16px; flex-wrap: wrap; }
  .gsearch { order: 9; flex-basis: 100%; max-width: none; }
  main { padding-inline: 16px; padding-block: 4px 104px; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom .nav-btn { flex-direction: column; gap: 2px; justify-content: center; font-size: .75rem; padding: 8px 4px 10px; border-radius: 0; position: relative; }
  .bottom .nav-btn .count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 0; padding: 0 6px; font-size: .7rem; }
  body.detail .bottom { display: none; }
  body.detail main { padding-bottom: 24px; }
  /* Phone order on Today follows the brief: approvals, appointments, enquiries, labs, follow-ups */
  .dash { display: flex; flex-direction: column; }
  .dash .col, .dash .col.side-col { display: contents; }
  .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; } .o7 { order: 7; } .o8 { order: 8; } .o9 { order: 9; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.has-thread .thread-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .actions.sticky { position: sticky; bottom: 0; z-index: 10; box-shadow: 0 -8px 24px rgba(0,0,0,.08); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); border-radius: 0; }
  .med-edit { grid-template-columns: minmax(0, 1fr); }
  .sec-body { padding-left: 22px; }
  .labs th, .labs td { padding: 9px 14px; }
  h1 { font-size: 1.75rem; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hero-tiles { grid-template-columns: minmax(0, 1fr); }
  .tile .big { font-size: 2.2rem; }
  .hello-photo { width: 92px; height: 92px; }
  .hello > div { flex: 1 1 160px; }
  .role .rn { display: none; }
  .role button { padding: 3px; }
  .card-head, .proto-block, .facts, .history, .notes, .timeline, .actions, .days { padding-inline: 16px; }
  .rows { padding-inline: 4px; }
  .actions .btn { flex: 1 1 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .msg { max-width: 86%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Inbox and Reports (scoped; older component styles on the new tokens) ---------- */
:root {
  --cream: var(--bg);
  --card: var(--surface);
  --border: var(--line);
  --ink-soft: var(--ink-2);
  --teal: var(--accent);
  --teal-dark: var(--accent);
  --sage: var(--accent-soft);
  --radius: var(--r-sm);
  --amber-text: var(--amber);
  --amber-dot: var(--amber);
  --green-text: var(--green);
  --green-dot: var(--green);
  --red-text: var(--red);
  --red-dot: var(--red);
}
body.full main { max-width: none; padding: 0 20px 16px; height: calc(100dvh - 72px); display: flex; flex-direction: column; }
body.full main > .inbox-layout { flex: 1; min-height: 0; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
body.full main .avatar, body.full main svg.av { flex-shrink: 0; }
.loading { padding: 40px; color: var(--ink-3); }
.draft { font-size: var(--fs-xs); }
@media (max-width: 860px) { body.full main { height: calc(100dvh - 140px); padding: 0 8px 8px; } }
/* Cards */

body.full main .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

body.full main .card + .card { margin-top: 16px; }

body.full main .grid {
  display: grid;
  gap: 16px;
}

body.full main .grid-4 { grid-template-columns: repeat(4, 1fr); }
body.full main .grid-2 { grid-template-columns: 1fr 1fr; }

@media (max-width: 1100px) {
  body.full main .grid-4 { grid-template-columns: repeat(2, 1fr); }
  body.full main .grid-2 { grid-template-columns: 1fr; }
}

body.full main .stat-tile {
  border-radius: var(--radius);
  padding: 18px;
  background: var(--sage);
}

body.full main .stat-tile .stat-label {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

body.full main .stat-tile .stat-number {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

body.full main .stat-tile .stat-note {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* Badges / pills */

body.full main .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

body.full main .badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

body.full main .badge-amber { background: var(--amber-bg); color: var(--amber-text); }
body.full main .badge-amber::before { background: var(--amber-dot); }

body.full main .badge-green { background: var(--green-bg); color: var(--green-text); }
body.full main .badge-green::before { background: var(--green-dot); }

body.full main .badge-red { background: var(--red-bg); color: var(--red-text); }
body.full main .badge-red::before { background: var(--red-dot); }

body.full main .badge-neutral { background: var(--sage); color: var(--teal-dark); }
body.full main .badge-neutral::before { background: var(--teal); }

/* Lists */

body.full main .row-list .row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

body.full main .row-list .row:last-child { border-bottom: none; }

body.full main .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

body.full main .row-main { flex: 1; min-width: 0; }
body.full main .row-title { font-weight: 700; font-size: 14.5px; }
body.full main .row-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
body.full main .row-aside { flex-shrink: 0; text-align: right; }

/* Patients filter tabs */

body.full main .tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

body.full main .tab-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

body.full main .tab-btn.active {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}

/* Buttons */

body.full main .btn-primary {
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  background: var(--teal-dark);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

body.full main .btn-primary:hover { background: var(--teal); }

body.full main .btn-secondary {
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Patient profile */

body.full main .profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

body.full main .profile-head .avatar { width: 64px; height: 64px; font-size: 22px; }

body.full main .profile-name {
  font-family: Georgia, serif;
  font-size: 26px;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.full main .profile-meta {
  display: flex;
  gap: 32px;
  margin-top: 14px;
  flex-wrap: wrap;
}

body.full main .profile-meta .meta-label {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 3px;
}

body.full main .profile-meta .meta-value { font-weight: 700; font-size: 14.5px; }

body.full main .profile-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

body.full main .clinical-banner {
  background: var(--red-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 16px 0;
}

@media (max-width: 1100px) {
  body.full main .clinical-banner { grid-template-columns: repeat(2, 1fr); }
}

body.full main .clinical-banner .field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--red-text);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 4px;
}

body.full main .clinical-banner .field-value { font-size: 14px; }

body.full main .labs-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
body.full main .labs-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 0 8px;
  font-weight: 700;
}
body.full main .labs-table td { padding: 8px 0; border-top: 1px solid var(--border); }
body.full main .labs-table .flag-high, body.full main .labs-table .flag-low { color: var(--red-text); font-weight: 700; }

body.full main .protocol-list { list-style: none; margin: 0; padding: 0; }
body.full main .protocol-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
body.full main .protocol-list li:last-child { border-bottom: none; }
body.full main .protocol-list .item-note { color: var(--ink-soft); font-size: 12.5px; }

body.full main .notes-box {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
}

body.full main .notes-box:focus { border-color: var(--teal); }

/* Inbox */

body.full main .inbox-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 420px;
}

body.full main .inbox-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-y: auto;
}

body.full main .inbox-list .row {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

body.full main .inbox-list .row.active { background: var(--sage); }
body.full main .inbox-list .row:hover { background: var(--sage); }

body.full main .inbox-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.full main .inbox-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
}

body.full main .inbox-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

body.full main .thread-head-name {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.full main .thread-head-name .row-title, body.full main .thread-head-name .row-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.full main .mode-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.full main .inbox-detail-head .back { font-weight: 700; color: var(--teal-dark); cursor: pointer; }

body.full main .chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: clip;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.full main .chat-msg { max-width: 72%; }
body.full main .chat-msg.from-patient { align-self: flex-start; }
body.full main .chat-msg.from-assistant { align-self: flex-end; }

body.full main .chat-meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

body.full main .chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  background: var(--sage);
}

body.full main .chat-msg.from-assistant .chat-bubble {
  background: var(--teal-dark);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

body.full main .chat-msg.from-patient .chat-bubble {
  border-radius: 14px 14px 14px 4px;
}

body.full main .chat-msg .chat-bubble {
  position: relative;
}

body.full main .chat-msg .reply-quote {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-left: 3px solid var(--teal);
  border-radius: 4px;
  background: rgba(0,0,0,.05);
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

body.full main .chat-msg.from-assistant .reply-quote {
  background: rgba(255,255,255,.12);
  border-left-color: rgba(255,255,255,.4);
  color: rgba(255,255,255,.7);
}

body.full main .chat-reactions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

body.full main .chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
}

body.full main .chat-reaction:hover { border-color: var(--teal); }

body.full main .chat-reaction .reaction-count {
  font-size: 11px;
  color: var(--ink-soft);
}

body.full main .chat-msg-wrapper {
  position: relative;
  max-width: 72%;
}

body.full main .chat-msg-wrapper.from-patient { align-self: flex-start; }
body.full main .chat-msg-wrapper.from-assistant { align-self: flex-end; }

body.full main .chat-msg-wrapper .chat-msg {
  max-width: none;
  align-self: auto;
}

body.full main .chat-msg-actions {
  display: none;
  position: absolute;
  top: 4px;
  gap: 2px;
  z-index: 10;
}

body.full main .chat-msg-wrapper.from-patient .chat-msg-actions { left: 100%; margin-left: 4px; }
body.full main .chat-msg-wrapper.from-assistant .chat-msg-actions { right: 100%; margin-right: 4px; }

body.full main .chat-msg-wrapper:hover .chat-msg-actions { display: flex; }

body.full main .chat-msg-action {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 0;
}

body.full main .chat-msg-action:hover {
  background: var(--sage);
  color: var(--ink);
}

body.full main .chat-media {
  max-width: 280px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}

body.full main .chat-media img, body.full main .chat-media video {
  display: block;
  max-width: 100%;
  border-radius: 10px;
}

body.full main .chat-media audio { width: 240px; }

body.full main .chat-media .doc-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,.04);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
}

body.full main .chat-msg.from-assistant .doc-attachment {
  background: rgba(255,255,255,.1);
  color: #fff;
}

body.full main .doc-attachment .doc-icon {
  font-size: 20px;
  flex-shrink: 0;
}

body.full main .voice-waveform {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-width: 200px;
}

body.full main .voice-waveform .play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  padding: 0;
}

body.full main .voice-waveform .wave-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 28px;
}

body.full main .voice-waveform .wave-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--teal);
  opacity: .5;
}

body.full main .chat-msg.from-assistant .voice-waveform .play-btn {
  background: rgba(255,255,255,.2);
}

body.full main .chat-msg.from-assistant .voice-waveform .wave-bar {
  background: rgba(255,255,255,.5);
}

body.full main .voice-duration {
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

body.full main .chat-msg.from-assistant .voice-duration {
  color: rgba(255,255,255,.6);
}

/* Typing indicator */

body.full main .typing-indicator {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

body.full main .typing-indicator .typing-dots {
  display: flex;
  gap: 3px;
  padding: 10px 14px;
  background: var(--teal-dark);
  border-radius: 14px 14px 4px 14px;
}

body.full main .typing-indicator .typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  animation: typing-bounce .6s infinite alternate;
}

body.full main .typing-indicator .typing-dot:nth-child(2) { animation-delay: .15s; }
body.full main .typing-indicator .typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes typing-bounce {
  0% { opacity: .3; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(-3px); }
}

body.full main .typing-indicator .typing-label {
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* Mode status in thread header */

body.full main .thread-mode-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

body.full main .thread-mode-badge.mode-bot {
  background: var(--green-bg);
  color: var(--green-text);
}

body.full main .thread-mode-badge.mode-human {
  background: var(--amber-bg);
  color: var(--amber-text);
}

/* Compose bar */

body.full main .compose-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--cream);
}

body.full main .compose-left {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

body.full main .compose-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0 8px;
  min-height: 42px;
  transition: border-color .15s;
}

body.full main .compose-input-wrap:focus-within { border-color: var(--teal); }

body.full main .compose-reply-preview {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

body.full main .compose-reply-preview .reply-body {
  flex: 1;
  border-left: 3px solid var(--teal);
  padding-left: 8px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.full main .compose-reply-preview .reply-sender {
  font-weight: 700;
  color: var(--teal-dark);
  font-size: 11px;
  display: block;
}

body.full main .compose-reply-cancel {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-soft);
  flex-shrink: 0;
  padding: 0;
}

body.full main .compose-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 4px;
  background: transparent;
  max-height: 120px;
  min-height: 20px;
  overflow-y: auto;
}

body.full main .compose-emoji-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
}

body.full main .compose-emoji-btn:hover { background: var(--sage); }

body.full main .compose-right {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

body.full main .compose-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 18px;
  padding: 0;
}

body.full main .compose-icon-btn:hover { color: var(--teal-dark); background: var(--sage); }

body.full main .compose-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--teal-dark);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  padding: 0;
}

body.full main .compose-send-btn:hover { background: var(--teal); }
body.full main .compose-send-btn:disabled { opacity: .4; cursor: default; }

body.full main .compose-record-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  padding: 0;
}

body.full main .compose-record-btn:hover { color: var(--teal-dark); }

body.full main .compose-record-btn.recording {
  background: var(--red-bg);
  color: var(--red-text);
  animation: pulse-record 1.2s infinite;
}

@keyframes pulse-record {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

body.full main .recording-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 42px;
}

body.full main .recording-indicator .rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red-dot);
  animation: pulse-record 1.2s infinite;
}

body.full main .recording-indicator .rec-timer {
  font-size: 14px;
  font-weight: 600;
  color: var(--red-text);
  font-variant-numeric: tabular-nums;
}

body.full main .recording-indicator .rec-cancel {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
}

body.full main #voice-preview {
  gap: 8px;
}

body.full main #voice-preview audio {
  flex: 1;
  min-width: 0;
  height: 32px;
}

body.full main #voice-preview .chat-msg-action {
  flex-shrink: 0;
}

/* Emoji picker */

body.full main .emoji-picker-overlay {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  width: 320px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.full main .emoji-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  overflow-x: auto;
}

body.full main .emoji-picker-tabs button {
  padding: 8px 6px;
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  opacity: .5;
  flex-shrink: 0;
}

body.full main .emoji-picker-tabs button.active { opacity: 1; border-bottom: 2px solid var(--teal); }

body.full main .emoji-picker-search {
  padding: 8px;
}

body.full main .emoji-picker-search input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

body.full main .emoji-picker-search input:focus { border-color: var(--teal); }

body.full main .emoji-picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

body.full main .emoji-picker-grid button {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

body.full main .emoji-picker-grid button:hover { background: var(--sage); }

/* Reaction picker (mini) */

body.full main .reaction-picker {
  position: absolute;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 6px 8px;
  display: flex;
  gap: 2px;
}

body.full main .reaction-picker button {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .1s;
}

body.full main .reaction-picker button:hover { transform: scale(1.25); background: var(--sage); }

/* Media preview overlay (WhatsApp-style full screen) */

body.full main .media-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #111;
  display: flex;
  flex-direction: column;
}

body.full main .media-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,.6);
}

body.full main .media-preview-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

body.full main .media-preview-close:hover { background: rgba(255,255,255,.2); }

body.full main .media-preview-name {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.full main .media-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
}

body.full main .media-preview-content {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

body.full main .media-preview-doc {
  text-align: center;
  color: rgba(255,255,255,.8);
}

body.full main .media-preview-doc span { display: block; margin-bottom: 12px; }
body.full main .media-preview-doc .att-name { font-size: 15px; font-weight: 600; color: #fff; }
body.full main .media-preview-doc .att-size { font-size: 12px; color: rgba(255,255,255,.5); margin-top: 4px; }

body.full main .media-preview-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(0,0,0,.6);
}

body.full main .media-preview-caption {
  flex: 1;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

body.full main .media-preview-caption::placeholder { color: rgba(255,255,255,.4); }

body.full main .media-preview-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

body.full main .media-preview-send:hover { opacity: .9; }
body.full main .media-preview-send:disabled { opacity: .5; cursor: default; }

/* Thread controls */

body.full main .inbox-detail-head .control-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

body.full main .inbox-detail-head .control-btn:hover { border-color: var(--teal); color: var(--teal-dark); }

body.full main .inbox-detail-head .control-btn.active {
  background: var(--amber-bg);
  border-color: var(--amber-dot);
  color: var(--amber-text);
}

/* Timestamp dividers */

body.full main .chat-date-divider {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 8px 0;
  position: relative;
}

body.full main .chat-date-divider span {
  background: var(--card);
  padding: 2px 12px;
  border-radius: 8px;
  font-weight: 600;
}

/* Lab report review */

body.full main .lab-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
}

body.full main .lab-row + .lab-row { border-top: 1px solid var(--border); }

body.full main .lab-row-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

body.full main .lab-key-col, body.full main .lab-key-input { flex: 2; min-width: 0; }
body.full main .lab-val-col, body.full main .lab-val-input { flex: 1; min-width: 0; }
body.full main .lab-unit-col, body.full main .lab-unit-input { flex: 1; min-width: 0; }
body.full main .lab-ref-col, body.full main .lab-ref-input { flex: 1.2; min-width: 0; }
body.full main .lab-del-col { width: 28px; flex-shrink: 0; }
body.full main .lab-flag-col { width: 84px; flex-shrink: 0; }

body.full main .lab-key-input, body.full main .lab-val-input, body.full main .lab-unit-input, body.full main .lab-ref-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  outline: none;
}

body.full main .lab-key-input:focus, body.full main .lab-val-input:focus, body.full main .lab-unit-input:focus, body.full main .lab-ref-input:focus {
  border-color: var(--teal);
}

body.full main .lab-del-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.full main .lab-del-btn:hover { background: var(--red-bg); color: var(--red-text); }

body.full main .panel-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

body.full main .panel-select:focus { border-color: var(--teal); }

body.full main .patient-details {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
  font-size: 13px;
}
body.full main .patient-details summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}
body.full main .patient-details summary::-webkit-details-marker { display: none; }
body.full main .patient-details .pd-facts {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.full main .patient-details .pd-more { font-size: 12px; font-weight: 600; color: var(--teal-dark); }
body.full main .patient-details .pd-more::after { content: ' \25BE'; }
body.full main .patient-details[open] .pd-more::after { content: ' \25B4'; }
body.full main .patient-details[open] .pd-grid { margin-top: 10px; }
body.full main .patient-details .pd-stage {
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--teal-dark);
  background: var(--sage);
  padding: 2px 8px;
  border-radius: 999px;
}
body.full main .patient-details .pd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px 16px;
}
body.full main .patient-details .pd-label { font-size: 11px; color: var(--ink-soft); }
body.full main .patient-details .pd-value { color: var(--ink); font-weight: 600; text-transform: capitalize; overflow-wrap: anywhere; }
body.full main .patient-details .pd-missing { color: var(--ink-soft); font-weight: 400; font-style: italic; text-transform: none; }
body.full main .patient-details .pd-notes { margin-top: 8px; color: var(--ink-soft); max-height: 96px; overflow-y: auto; }



.intake-section { margin-top: 18px; }
.intake-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.intake-row { display: grid; grid-template-columns: minmax(160px, 2fr) 3fr; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.intake-q { color: var(--ink-2); font-size: var(--fs-s); }
.intake-a { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) { .intake-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Sign-in ---------- */
/* Auth */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-title {
  font-family: Georgia, serif;
  font-size: 22px;
  margin-bottom: 2px;
}

.auth-sub {
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  font-family: inherit;
}

.auth-card input:focus { border-color: var(--accent); }

.auth-card .btn-primary {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  width: 100%;
  background: var(--red-bg);
  color: var(--red-text);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  text-align: left;
}

.signout-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  flex-shrink: 0;
}

.auth-screen { background: var(--bg); }
.auth-card .btn { width: 100%; justify-content: center; }


/* Links styled as the prototype's buttons */
a.nav-btn, a.tile, a.chat-row { color: inherit; text-decoration: none; }
a.btn, a.back, a.icon-btn { text-decoration: none; }
a.chat-row .bubble { color: var(--ink-2); }
.intake-wrap { padding: 0 22px 20px; }
a.btn:not(.primary) { color: var(--ink); }

/* Empty states in Inbox and Reports fill their panel, centred */
body.full main .empty-state,
body.full main .inbox-detail-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 160px; padding: 24px;
  text-align: center; color: var(--ink-3); font-size: var(--fs-s);
}
