/* One typeface for Tamil and English, shipped with the app so it needs no network. */
@font-face {
  font-family: "Anek Tamil";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/fonts/anek-tamil-tamil.woff2) format("woff2");
  unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC;
}
@font-face {
  font-family: "Anek Tamil";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/fonts/anek-tamil-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f5f2ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #13211c;
  --ink-2: #34433e;
  --muted: #5f6b66;
  --line: #e7e2d7;
  --line-strong: #d3cdbf;
  --brand: #0a5c4a;
  --brand-deep: #063d31;
  --brand-soft: #dfeee8;
  --brand-tint: #f0f7f4;
  --sun: #f2ab27;
  --sun-ink: #4a3100;
  --sun-soft: #fff2cf;
  --urgent: #c2301d;
  --urgent-ink: #8f1f10;
  --urgent-soft: #fde8e3;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(19, 33, 28, 0.05), 0 4px 14px rgba(19, 33, 28, 0.05);
  --shadow-2: 0 2px 4px rgba(19, 33, 28, 0.05), 0 16px 36px rgba(19, 33, 28, 0.1);
  --font: "Anek Tamil", system-ui, -apple-system, "Segoe UI", "Noto Sans Tamil", "Tamil Sangam MN", "Latha", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}
/* A soft wash of the two brand colours behind every screen. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px 560px at 105% -8%, #dcefe6 0, transparent 62%),
    radial-gradient(820px 460px at -12% 4%, #fdeecb 0, transparent 58%);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.2; font-weight: 700; }
h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; }
h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 650; }
a { color: var(--brand); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.icon { display: inline-flex; flex: none; width: 1.25em; height: 1.25em; }
.icon svg { width: 100%; height: 100%; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.08rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.mark { width: 34px; height: 34px; flex: none; }
.topbar nav { margin-left: auto; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(19, 33, 28, 0.06); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.95rem; white-space: nowrap; }
.topbar nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.topbar nav a[aria-current="page"] { background: var(--surface); color: var(--brand-deep); font-weight: 650; box-shadow: var(--shadow-1); }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .topbar nav { margin-left: 0; width: 100%; }
}

/* ---- Layout helpers ---- */
.page { max-width: 1160px; margin: 0 auto; padding: 24px 20px 72px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-1); }
.card.empty { text-align: center; padding: 44px 24px; border-style: dashed; border-color: var(--line-strong); background: rgba(255, 255, 255, 0.5); box-shadow: none; }

/* ---- Controls ---- */
button, .button {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; min-height: 46px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 1px 2px rgba(19, 33, 28, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
button:hover, .button:hover { border-color: var(--brand); }
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px;
}
button.primary, .button.primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(6, 61, 49, 0.3), 0 8px 18px rgba(10, 92, 74, 0.24);
}
button.primary:hover, .button.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
button.big, .button.big { min-height: 60px; font-size: 1.2rem; padding: 12px 28px; border-radius: 16px; }
button.quiet, .button.quiet { border-color: transparent; background: transparent; color: var(--brand); box-shadow: none; min-height: 40px; padding: 6px 12px; }
button.quiet:hover, .button.quiet:hover { background: var(--brand-soft); border-color: transparent; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #b9b3a4; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); outline: none; }
input[type="radio"] { width: 20px; height: 20px; padding: 0; accent-color: var(--brand); box-shadow: none; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b66' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
textarea { resize: vertical; min-height: 76px; }
label { display: grid; gap: 5px; font-size: 0.875rem; font-weight: 550; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 1rem; font-weight: 400; }

/* A two-way switch, e.g. English / தமிழ் */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(19, 33, 28, 0.07); }
.seg button { min-height: 34px; padding: 3px 16px; border: 0; border-radius: 999px; background: transparent; box-shadow: none; color: var(--ink-2); font-size: 0.92rem; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-deep); box-shadow: var(--shadow-1); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-deep); white-space: nowrap; }
.chip.off, .chip.done { background: #ecebe5; color: var(--ink-2); }
.chip.urgent { background: var(--urgent); color: #fff; }
.chip.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.chip.state.off::before { background: transparent; box-shadow: inset 0 0 0 2px #9aa39f; }

.banner { padding: 12px 16px; border-radius: 16px; background: var(--sun-soft); border: 1px solid #f1d58c; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.urgent { background: var(--urgent-soft); border-color: #f3c0b7; color: var(--urgent-ink); font-weight: 600; }
.banner.urgent > span:first-child::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
  background: var(--urgent); box-shadow: 0 0 0 4px rgba(194, 48, 29, 0.2);
}
.note { padding: 12px 14px; border-radius: 14px; background: var(--brand-tint); border: 1px solid #cfe5dc; font-size: 0.95rem; }
.note.warn { background: var(--sun-soft); border-color: #f1d58c; color: var(--sun-ink); }
.note.ok { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-soft); border-color: #b9dccd; color: var(--brand-deep); font-weight: 600; animation: rise 0.3s ease both; }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 12px 22px; border-radius: 999px; background: var(--brand-deep); color: #fff; font-weight: 600;
  box-shadow: 0 12px 30px rgba(6, 61, 49, 0.35); animation: toast-in 0.25s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }
.note h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--brand); }

/* ---- Push-to-talk button, shared by every screen ---- */
.ptt {
  position: relative; flex: none;
  width: 148px; height: 148px; border-radius: 50%; border: none;
  background: radial-gradient(circle at 32% 26%, #17866f, var(--brand) 58%, var(--brand-deep));
  color: #fff; font-size: 1rem; font-weight: 600; line-height: 1.2; padding: 14px;
  flex-direction: column; gap: 6px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 10px rgba(10, 92, 74, 0.1), 0 0 0 22px rgba(10, 92, 74, 0.05), 0 16px 32px rgba(10, 92, 74, 0.3);
  transition: transform 0.14s ease, box-shadow 0.2s ease;
}
.ptt svg { width: 36px; height: 36px; }
.ptt:hover { transform: scale(1.03); }
.ptt.listening {
  background: radial-gradient(circle at 32% 26%, #ee6a52, #d83f2a 58%, #a92a19);
  transform: scale(1.07);
  box-shadow: 0 0 0 10px rgba(216, 63, 42, 0.14), 0 0 0 22px rgba(216, 63, 42, 0.07), 0 16px 32px rgba(216, 63, 42, 0.3);
}
.ptt.listening::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(216, 63, 42, 0.55); animation: ring 1.3s ease-out infinite;
}
.ptt.small { width: 98px; height: 98px; font-size: 0.8rem; padding: 10px; gap: 3px; margin: 10px; box-shadow: 0 0 0 8px rgba(10, 92, 74, 0.09), 0 10px 22px rgba(10, 92, 74, 0.26); }
.ptt.small.listening { box-shadow: 0 0 0 8px rgba(216, 63, 42, 0.14), 0 10px 22px rgba(216, 63, 42, 0.28); }
.ptt.small svg { width: 26px; height: 26px; }
@keyframes ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }

.heard { min-height: 1.5em; font-size: 1.08rem; }
.heard:empty::before { content: attr(data-placeholder); color: var(--muted); }

/* ---- Home ---- */
.hero { display: grid; gap: 44px; align-items: center; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); padding: 28px 0 12px; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.7rem); line-height: 1.06; letter-spacing: -0.025em; font-weight: 750; text-wrap: balance; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 58%, #f8d27a 58%, #f8d27a 90%, transparent 90%); }
.hero .lede { font-size: 1.18rem; color: var(--ink-2); max-width: 44ch; }
.eyebrow { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.88rem; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-1); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); }

.flow { position: relative; display: grid; gap: 14px; }
.flow::before { content: ""; position: absolute; left: 34px; top: 30px; bottom: 30px; border-left: 2px dashed var(--line-strong); }
.flow-step { position: relative; display: grid; gap: 6px; }
.flow-step:nth-child(2) { margin-left: 30px; }
.flow-label { justify-self: start; margin-left: 12px; padding: 1px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; }
.flow-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.flow-card p { font-size: 1rem; line-height: 1.4; }
.flow-card .bubble { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; }
.flow-card .bubble svg { width: 22px; height: 22px; }
.flow-card .rx-mark { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--sun-soft); color: var(--sun-ink); font-size: 1.5rem; font-weight: 700; }
.flow-card > div { min-width: 0; }
.flow-card .mini { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 6px 0 0; font-size: 0.95rem; line-height: 1.4; }
.flow-card .mini dt { color: var(--muted); font-size: 0.82rem; padding-top: 2px; white-space: nowrap; }
.flow-card .mini dd { margin: 0; }
.flow-card .dose { margin-top: 6px; }
.flow-card .dose .slot { min-width: 62px; padding: 3px 10px; }
.wave { display: flex; gap: 3px; align-items: center; height: 20px; margin-bottom: 4px; }
.wave i { width: 3px; height: 30%; border-radius: 2px; background: var(--brand); animation: wave 1.1s ease-in-out infinite alternate; }
.wave i:nth-child(3n) { animation-delay: -0.3s; }
.wave i:nth-child(3n + 1) { animation-delay: -0.7s; }
.wave i:nth-child(4n) { animation-delay: -0.5s; }
@keyframes wave { from { height: 20%; } to { height: 100%; } }

.home { gap: 52px; max-width: 1080px; }
.home > section { scroll-margin-top: 84px; }
.home .hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.2rem); line-height: 1.1; }
.home .hero h1 span { display: block; }
.home .hero h1 em { white-space: nowrap; }
.pair .card { align-content: start; }
.home h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.home h3 .icon { color: var(--brand); font-size: 1.1rem; vertical-align: -4px; margin-right: 6px; }
.pair { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.pair .lead { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-1); }
.points { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; color: var(--ink-2); }
.points li::marker { color: var(--brand); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { display: grid; gap: 6px; align-content: start; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); }
.tile .badge { width: 44px; height: 44px; margin-bottom: 4px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 1.2rem; }
.tile strong { font-size: 1.12rem; line-height: 1.25; font-weight: 700; }
.tile.care { background: var(--surface-2); box-shadow: none; color: var(--ink-2); }
.tile.care .badge { background: var(--sun-soft); color: var(--sun-ink); }
.door .say { padding: 8px 12px; border-left: 3px solid var(--brand); background: var(--brand-tint); border-radius: 0 10px 10px 0; font-size: 0.98rem; }
.door.main .say { border-left-color: var(--sun); background: rgba(255, 255, 255, 0.12); }
@media (max-width: 760px) {
  .pair { grid-template-columns: 1fr; }
  .home { gap: 40px; }
  .flow-card .mini { grid-template-columns: 1fr; gap: 0; }
  .flow-card .mini dd { margin-bottom: 4px; }
}

.doors { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.door {
  display: grid; gap: 8px; align-content: start; padding: 22px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1);
  text-decoration: none; color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.door:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--brand); }
.door .badge { width: 50px; height: 50px; margin-bottom: 6px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 1.3rem; }
.door .step { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; color: var(--muted); }
.door strong { font-size: 1.35rem; line-height: 1.2; font-weight: 700; }
.door .go { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 650; color: var(--brand); }
.door.main { background: linear-gradient(155deg, #11806a, var(--brand) 55%, var(--brand-deep)); color: #fff; border-color: transparent; box-shadow: 0 16px 36px rgba(10, 92, 74, 0.28); }
.door.main .muted, .door.main .step { color: #cfe8e0; }
.door.main .badge { background: rgba(255, 255, 255, 0.16); color: #fff; }
.door.main .go { color: #fff; }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 12px; }
}

/* ---- Patient intake kiosk ---- */
.kiosk { min-height: 100dvh; display: flex; flex-direction: column; }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; min-height: 66px; }
.kiosk main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 12px 20px 28px; text-align: center; }
.kiosk main > section { width: 100%; animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.kiosk .question { font-size: clamp(1.9rem, 4.8vw, 3rem); line-height: 1.28; font-weight: 650; max-width: 21ch; text-wrap: balance; }
.kiosk .heard { display: inline-flex; align-items: center; min-height: 54px; max-width: 34ch; padding: 10px 22px; border-radius: 18px; font-size: 1.25rem; border: 1px solid transparent; }
.kiosk .heard:not(:empty) { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.kiosk .ptt:not(.small) { width: 164px; height: 164px; font-size: 1.05rem; }
.kiosk #heard-confirm:empty { display: none; }
/* Yes / change stay in reach under a long read-back list. */
.kiosk .dock {
  position: sticky; bottom: 12px; z-index: 5; justify-content: center; gap: 14px;
  padding: 8px 18px; border-radius: 40px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: var(--shadow-2);
}
/* While an answer is being sorted. */
.busy .kiosk .heard:not(:empty) { animation: thinking 0.7s ease-in-out infinite alternate; }
.busy .kiosk .ptt { opacity: 0.55; }
@keyframes thinking { from { border-color: var(--line); } to { border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); } }
.kiosk footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px calc(18px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.kiosk .welcome-mark { width: 68px; height: 68px; filter: drop-shadow(0 10px 18px rgba(10, 92, 74, 0.28)); }
.kiosk .lang-choice { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); width: min(600px, 100%); }
.lang-card { flex-direction: column; gap: 12px; min-height: 200px; padding: 22px; border-radius: 28px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow-2); font-size: 1.7rem; font-weight: 650; }
.lang-card:hover { border-color: var(--brand); transform: translateY(-3px); }
.lang-card .glyph { width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 2.9rem; font-weight: 700; line-height: 1; }
.lang-card:last-child .glyph { background: var(--sun-soft); color: var(--sun-ink); }
.kiosk .help {
  min-height: 56px; padding: 10px 24px; border-radius: 999px; border-color: transparent;
  background: var(--sun); color: var(--sun-ink); font-size: 1.08rem;
  box-shadow: 0 8px 20px rgba(242, 171, 39, 0.36);
}
.kiosk .help:hover { background: #f6b83f; border-color: transparent; }
.kiosk .help.nudge { animation: nudge 0.9s ease-in-out infinite alternate; }
@keyframes nudge { from { box-shadow: 0 0 0 0 rgba(242, 171, 39, 0.7), 0 8px 20px rgba(242, 171, 39, 0.36); } to { box-shadow: 0 0 0 12px rgba(242, 171, 39, 0), 0 8px 20px rgba(242, 171, 39, 0.36); transform: scale(1.04); } }
.steps { display: flex; gap: 6px; align-items: center; }
.steps i { width: 30px; height: 6px; border-radius: 3px; background: rgba(19, 33, 28, 0.13); transition: background 0.3s ease; }
.steps i.on { background: var(--brand); }

.readback { display: grid; width: min(640px, 100%); text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.readback button { justify-content: space-between; text-align: left; min-height: 58px; padding: 9px 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent; font-weight: 500; font-size: 1.12rem; }
.readback button:last-child { border-bottom: 0; }
.readback button:hover { background: var(--brand-tint); }
.readback button:active { transform: none; }
.readback button b { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.readback button::after {
  content: ""; flex: none; width: 20px; height: 20px; opacity: 0.4;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a5c4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4zM13 7l4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.readback .fixed { padding: 9px 20px; background: var(--surface-2); font-weight: 500; font-size: 1.12rem; }
.readback .fixed b { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.readback.pick { border-color: var(--sun); box-shadow: 0 0 0 5px var(--sun-soft); }
.readback.pick button::after { opacity: 1; }

.ticket { width: min(440px, 100%); display: grid; justify-items: center; background: var(--surface); border-radius: 30px; box-shadow: var(--shadow-2); overflow: hidden; }
.ticket-head { width: 100%; padding: 14px 20px; background: var(--brand); color: #fff; font-size: 1.2rem; font-weight: 600; }
.token-number { padding: 20px 0 8px; font-size: clamp(6rem, 24vw, 10rem); font-weight: 800; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.ticket-line { width: 100%; padding: 18px 26px 26px; border-top: 2px dashed var(--line-strong); font-size: 1.3rem; font-weight: 600; line-height: 1.4; text-wrap: balance; }
.ticket.urgent .ticket-head { background: var(--urgent); }
.token-number.urgent { color: var(--urgent); }

.review { display: grid; gap: 12px; justify-items: center; width: min(520px, 100%); margin-top: 8px; padding: 16px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.6); font-size: 1rem; }
.type-instead { width: min(520px, 100%); justify-self: center; }
.type-instead summary { cursor: pointer; display: inline-block; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: 0.95rem; font-weight: 550; list-style: none; }
.type-instead summary::-webkit-details-marker { display: none; }
.type-instead summary:hover { background: rgba(19, 33, 28, 0.06); color: var(--ink); }
.type-instead form { display: flex; gap: 8px; margin-top: 8px; }

/* ---- Staff screens ---- */
.staff { display: grid; gap: 20px; grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.staff > * { min-width: 0; }
.staff > aside { position: sticky; top: 76px; }
@media (max-width: 820px) {
  .staff { grid-template-columns: 1fr; }
  .staff > aside { position: static; }
}
.queue { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.queue button { width: 100%; justify-content: flex-start; text-align: left; gap: 12px; font-weight: 400; min-height: 64px; padding: 8px 10px; border-color: transparent; border-radius: 16px; background: transparent; box-shadow: none; }
.queue button:hover { background: var(--surface-2); border-color: var(--line); }
.queue button[aria-pressed="true"] { background: var(--brand-tint); border-color: var(--brand); }
.tok { flex: none; display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-deep); font-size: 1.25rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.tok.urgent, .is-urgent .tok { background: var(--urgent); color: #fff; }
.is-done .tok { background: #ecebe5; color: var(--muted); }
.tok.big { min-width: 62px; height: 62px; border-radius: 19px; font-size: 1.8rem; }
.queue .who { flex: 1; min-width: 0; display: grid; }
.queue .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .who span:first-child { font-weight: 600; }

.patient-head { display: flex; gap: 16px; align-items: center; }
.patient-head .row { margin-top: 6px; gap: 6px; }
.panel { display: grid; gap: 10px; padding: 16px 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.said { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px 16px; margin: 0; }
.said dt { color: var(--muted); font-size: 0.9rem; padding-top: 2px; }
.said dd { margin: 0; font-size: 1.08rem; font-weight: 500; }
@media (max-width: 560px) { .said { grid-template-columns: 1fr; gap: 2px; } .said dd { margin-bottom: 8px; } }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.stat { display: grid; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.stat span { font-size: 0.8rem; font-weight: 550; color: var(--muted); }
.stat b { font-size: 1.3rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }

.vitals { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.meds { display: grid; gap: 12px; }
.med { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.med .tok { min-width: 32px; height: 32px; border-radius: 10px; font-size: 1rem; margin-top: 22px; }
.med .fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.med .fields label { flex: 1 1 96px; min-width: 0; }
.med .fields label.wide { flex: 2 1 190px; }
.med label.flag > input, .med label.flag > select { border-color: var(--sun); box-shadow: 0 0 0 3px var(--sun-soft); }
.med .preview { grid-column: 2; display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border-left: 4px solid var(--brand); font-size: 0.98rem; }
.med .preview:empty { display: none; }
.med .line-actions { grid-column: 2; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.med.confirmed { background: var(--brand-tint); border-color: var(--brand); }
.med.confirmed .tok { background: var(--brand); color: #fff; }
button.confirm.done { background: var(--surface); color: var(--brand-deep); border-color: var(--brand); box-shadow: none; }

/* The dose at a glance: morning, afternoon, night (1-0-1), then food, then how long. */
.dose { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 4px; }
.dose .slots { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.dose .slot { display: grid; justify-items: center; align-content: center; gap: 0; min-width: 76px; min-height: 0; padding: 5px 12px 4px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent; font-weight: 400; line-height: 1.2; }
.dose .slot:last-child { border-right: 0; }
.dose .slot b { font-size: 1.25rem; font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; }
.dose .slot span { font-size: 0.75rem; color: var(--muted); }
.dose .slot.on { background: var(--brand-soft); }
.dose .slot.on b, .dose .slot.on span { color: var(--brand-deep); }
.dose button.slot:hover { background: var(--brand-tint); }
.dose button.slot.on:hover { background: #cfe5dc; }
.chip.food { background: var(--sun-soft); color: var(--sun-ink); }
.med .preview .note { margin-top: 6px; padding: 6px 10px; font-size: 0.9rem; }

/* Confirmed medicines: on the doctor screen and on the printed sheet */
.rx-list { list-style: none; counter-reset: med; margin: 0; padding: 0; display: grid; gap: 10px; }
.rx-list li { counter-increment: med; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; break-inside: avoid; }
.rx-list li::before { content: counter(med); grid-row: 1 / span 3; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.rx-list li > * { grid-column: 2; display: block; }
.rx-list li strong { font-size: 1.15rem; font-weight: 700; }
.rx-list .ta { font-size: 1.12rem; font-weight: 500; }

/* ---- Printed prescription ---- */
.toolbar { max-width: 760px; margin: 24px auto 0; padding: 0 20px; }
.sheet { max-width: 760px; margin: 18px auto 64px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow-2); }
.sheet > header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 2px solid var(--brand); }
.sheet > header .brand { font-size: 1.5rem; }
.sheet > header .mark { width: 44px; height: 44px; }
.sheet .rx-mark { font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--brand); margin-top: 6px; }
.sheet .foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .sheet { padding: 22px; border-radius: 0; border-left: 0; border-right: 0; } }
@media print {
  body { background: #fff; }
  body::before { display: none; }
  .no-print { display: none !important; }
  .sheet { border: none; margin: 0; padding: 0; max-width: none; box-shadow: none; }
  .panel, .rx-list li::before, .dose .slot, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Speech test ---- */
.log-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table.log { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
table.log th, table.log td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log tr:last-child td { border-bottom: 0; }
table.log th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.85rem; }
fieldset.choice { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
fieldset.choice legend { padding: 0 6px; font-size: 0.875rem; font-weight: 550; color: var(--muted); }
label.radio { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 1rem; cursor: pointer; }
label.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
label.radio:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
