/* A health worker's register: cloth cover, two ruled pages, printed labels, entries in ink.
   Martel (book serif) for headings and names; Hind for everything small and for vital numbers. Red is reserved for danger. */
/* Martel's digits sit unevenly, so numbers inside a Martel line use an even sans. */
@font-face { font-family: PrintedDigits; font-weight: 400; src: local('Arial'), local('Helvetica'), local('Roboto'); unicode-range: U+30-39; }
@font-face { font-family: PrintedDigits; font-weight: 700 900; src: local('Arial Bold'), local('Arial-BoldMT'), local('Helvetica-Bold'), local('Roboto-Bold'); unicode-range: U+30-39; }
:root {
  --cover: #1d2b45; --cover-edge: #111b2e; --page: #fdfefb; --rule: #c4d6e4; --margin: #7fa6bd;
  --ink: #12223b; --soft: #475569; --pen: #123a9a; --pencil: #5b6470;
  --marigold: #f5a800; --marigold-deep: #8a5a00; --danger: #b00d0d; --danger-bg: #fde7e4;
  --print: Hind, 'Kohinoor Devanagari', 'Noto Sans Devanagari', 'Nirmala UI', system-ui, sans-serif;
  --head: PrintedDigits, Martel, 'Noto Serif Devanagari', 'Kohinoor Devanagari', 'Nirmala UI', Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 18px/1.5 var(--print); color: var(--ink); background: var(--page); caret-color: var(--pen); }
::selection { background: var(--marigold); }
p { margin: 0; } h2 { font-size: 1rem; margin: 22px 0 4px; font-weight: 800; }
[hidden] { display: none !important; }
.muted { color: var(--soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app { background: var(--cover); min-height: 100dvh; padding: 0 10px 20px; }
header { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; max-width: 1240px; margin: 0 auto; padding: 14px 4px 12px; color: #fff; }
/* The paper label pasted on a register's cover. */
.label { background: var(--page); color: var(--ink); padding: 6px 16px 8px; outline: 2px solid var(--ink); outline-offset: -6px; }
h1 { margin: 0; font-size: 1.45rem; line-height: 1.15; font-weight: 800; }
.label p { font-size: .9rem; line-height: 1.3; } .label [lang] { color: var(--soft); }
.chip { font-size: .78rem; color: #dbe5f2; text-align: right; }
.note { max-width: 1240px; margin: 0 auto 10px; background: #fff2cc; border-left: 0; padding: 10px 14px; }

button { font: inherit; cursor: pointer; min-height: 48px; border: 2px solid var(--ink); border-radius: 3px; background: var(--page); color: var(--ink); padding: 8px 14px; font-weight: 600; }
button:hover:not(:disabled) { background: #e8eff6; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
:is(button, input, select, textarea, a, ol, summary):focus-visible { outline: 3px solid #0b63d6; outline-offset: 3px; }
input, textarea, select { font: inherit; flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 3px; background: #fff; color: var(--ink); }
input::placeholder { color: #5a6675; }
label { font-size: .9rem; } a { color: var(--pen); text-underline-offset: 3px; }
summary { cursor: pointer; min-height: 48px; padding: 11px 0; font-weight: 800; }
.tally { font-weight: 400; font-size: .9rem; margin-left: 8px; }

.book { max-width: 1240px; margin: 0 auto; display: grid; gap: 10px; }
.page { background: var(--page); padding: 18px 16px 20px; min-width: 0; }
#stage { display: flex; flex-direction: column; gap: 12px; }
.banner { position: sticky; top: 6px; z-index: 2; display: flex; gap: 10px; align-items: center; background: var(--danger); color: #fff; font-weight: 800; font-size: 1.15rem; line-height: 1.3; padding: 11px 14px; }
.banner svg { flex: none; width: 28px; height: 28px; fill: currentColor; }
.who { font: 700 1.4rem/1.45 var(--head); color: var(--pen); }
.ask { font-size: 1.8rem; line-height: 1.4; font-weight: 800; text-wrap: balance; overflow-wrap: anywhere; }
.details { font-size: 1.05rem; line-height: 1.4; color: var(--soft); }

/* Printed-form digit boxes: one digit to a box. */
.focus { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 12px 0 14px; }
#focus-label { font-weight: 800; font-size: 1.25rem; line-height: 1; padding-bottom: 16px; min-width: 3.2em; }
#focus-value { display: flex; align-items: flex-end; gap: 10px; font: 800 2.9rem/1 var(--print); font-variant-numeric: tabular-nums lining-nums; color: var(--pen); }
.boxes { display: inline-flex; gap: 4px; }
.cell { display: grid; place-items: center; width: 1.12em; height: 1.4em; border: 2px solid var(--ink); background: #fff; }
.dot { align-self: flex-end; }
.focus.danger .cell { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.change { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.change ins { text-decoration: none; }
.change del { position: relative; font: 700 .58em/1.1 var(--print); color: var(--pencil); text-decoration: none; padding: 0 .12em; }
.change del::after { content: ''; position: absolute; inset-inline: -.25em; top: 48%; height: .13em; background: var(--pen); transform: rotate(-9deg); }

.quick { display: flex; gap: 10px; flex-wrap: wrap; } .quick:empty { display: none; }
.quick button { flex: 1 1 110px; min-height: 64px; font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.quick small { display: block; font-size: .8rem; font-weight: 400; }
.quick .yes { background: var(--pen); border-color: var(--pen); color: #fff; } .quick .yes:hover:not(:disabled) { background: #0c2a72; }
#dock { display: flex; flex-direction: column; gap: 10px; }
.visit-open #dock { position: sticky; bottom: 0; z-index: 1; background: var(--page); padding: 8px 0 max(8px, env(safe-area-inset-bottom)); }
#mic { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; min-height: 104px; font-size: 1.9rem; font-weight: 800; background: var(--marigold); color: var(--ink); border: 3px solid var(--ink); }
#mic:hover:not(:disabled) { background: #ffb91f; }
#mic svg { width: 44px; height: 44px; fill: currentColor; }
#mic.on { background: var(--ink); color: var(--marigold); font-size: 1.3rem; }
#mic.on svg { animation: hear 1s ease-in-out infinite; } @keyframes hear { 50% { transform: scale(1.18); } }
.visit-open #mic { min-height: 72px; font-size: 1.45rem; }
.partial { font: 400 1.1rem/1.4 var(--print); color: var(--pencil); } .partial:empty { display: none; }
#cancel-visit { align-self: flex-start; border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 4px; font-weight: 400; padding-inline: 4px; }
#cancel-visit.armed { align-self: stretch; background: var(--danger-bg); border-color: var(--danger); color: var(--danger); font-weight: 800; text-decoration: none; }

.example { display: grid; gap: 6px; justify-items: start; border-left: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 12px 0; }
.example .phrase { font: 700 1.4rem/1.5 var(--head); color: var(--pen); } .example .en { font-size: .92rem; color: var(--soft); }
.upcoming ul { margin: 0; padding: 0; list-style: none; }
.upcoming li { padding: 7px 0 3px; border-bottom: 1px solid var(--rule); font: 700 1.1rem/1.6 var(--head); color: var(--pen); }
.visit-open .upcoming { display: none; } .visit-open.asked-followups .upcoming { display: block; }
#saved-note { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font: 700 1.3rem var(--head); color: var(--pen); }
.stamp { display: inline-block; padding: 3px 14px; border: 3px solid var(--pen); color: var(--pen); font: 800 1.1rem/1.4 var(--print); transform: rotate(-4deg); }

/* The written page. Every row is printed, so it reads as a form before anything is said. */
.record > summary { font-size: 1.2rem; border-bottom: 3px double var(--ink); padding: 4px 0 8px; min-height: 48px; }
#card-empty { padding-top: 8px; }
dl { margin: 0; }
.row { display: grid; grid-template-columns: 8.2em minmax(0, 1fr); min-height: 46px; border-bottom: 1px solid var(--rule); }
.row dt { padding: 9px 10px 6px 0; border-right: 3px double var(--margin); font-weight: 600; }
.row dd { margin: 0; padding: 7px 0 4px 14px; font-weight: 800; font-size: 1.15rem; color: var(--pen); overflow-wrap: anywhere; }
.row:first-child dd { font: 700 1.4rem/1.35 var(--head); }
.row.pencil dd { color: var(--pencil); font-weight: 400; } .row.pencil.vital dd { font-weight: 800; }
.row.vital dd { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-family: var(--print); font-weight: 800; font-size: 1.4rem; font-variant-numeric: tabular-nums lining-nums; }
.row.vital .change { flex-direction: row; align-items: baseline; gap: 6px; } .row.vital .change del { font-size: .8em; }
.row.danger { background: var(--danger-bg); } .row.danger dt, .row.danger.vital dd { color: var(--danger); }
.state { font: 600 .82rem/1.3 var(--print); border: 1px solid currentColor; padding: 0 7px; }
.key { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: .95rem; } .key .pencil { color: var(--pencil); } .key .ink { color: var(--pen); font-weight: 700; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 7px 0 3px; border-bottom: 1px solid var(--rule); } .ledger li > span:first-child { font: 700 1.15rem/1.4 var(--head); color: var(--pen); } .ledger .danger > span:last-child { color: var(--danger); font-weight: 800; }
.talklog { margin-top: 10px; }
#log { list-style: none; padding: 4px; margin: 0; max-height: 240px; overflow-y: auto; font-size: .98rem; }
#log:empty::before { content: 'अभी कोई बात नहीं हुई।'; color: var(--soft); }
#log li { padding: 6px 0; border-bottom: 1px solid var(--rule); } #log .you { color: var(--pen); font-weight: 600; } #log .you::before { content: 'आप: '; } #log .app::before { content: 'रजिस्टर: '; font-weight: 600; }

.demo, footer { max-width: 1240px; margin: 12px auto 0; color: #fff; }
.demo { border-top: 1px solid #47577a; } .demo form { margin-bottom: 12px; }
.type-row { display: flex; gap: 8px; } .samples { display: flex; flex-wrap: wrap; gap: 8px; } .samples button { font-size: .95rem; }
.demo-actions { display: flex; gap: 18px; align-items: center; margin-top: 12px; } .demo a { color: #ffd37a; display: inline-flex; align-items: center; min-height: 44px; }
footer { font-size: .82rem; color: #c3cfe0; text-wrap: pretty; }

/* Open book: speak on the left page, read the entry on the right. */
@media (min-width: 900px) {
  .app { padding-inline: 24px; }
  .book { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; background: var(--cover-edge); padding: 10px 12px 14px; align-items: stretch; }
  .page { padding: 26px 34px 28px; min-height: 560px; }
  #stage { background: linear-gradient(to left, rgb(18 34 59 / .16), transparent 26px), var(--page); }
  .record { background: linear-gradient(to right, rgb(18 34 59 / .16), transparent 26px), var(--page); }
  .record > summary { cursor: default; list-style: none; display: flex; justify-content: space-between; align-items: baseline; } .record > summary::-webkit-details-marker { display: none; }
  .ask { font-size: 2.2rem; } #focus-value { font-size: 3.4rem; } h1 { font-size: 1.7rem; }
  .visit-open #dock { position: static; }
}
@media (max-height: 700px) and (max-width: 899px) {
  .visit-open header { padding: 6px 2px; } .visit-open .chip, .visit-open .label p { display: none; } .visit-open .label { padding: 2px 12px; outline: 0; } .visit-open h1 { font-size: 1.05rem; }
  .visit-open #stage { gap: 8px; padding: 8px 12px 10px; }
  .visit-open .banner { font-size: .98rem; padding: 7px 10px; } .visit-open .banner svg { width: 22px; height: 22px; }
  .visit-open .who { font-size: 1.2rem; } .visit-open .ask { font-size: 1.35rem; } .visit-open .details { font-size: .95rem; line-height: 1.3; }
  .visit-open .focus { padding: 7px 0 9px; } .visit-open #focus-value { font-size: 2.35rem; } .visit-open #focus-label { padding-bottom: 10px; }
  .visit-open #dock { gap: 8px; } .visit-open .quick button { min-height: 52px; font-size: 1.15rem; } .visit-open #mic { min-height: 58px; font-size: 1.25rem; } .visit-open #mic svg { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }

/* Evals and transcript-capture pages */
body:not(.app) { max-width: 1120px; margin: 0 auto; padding: 16px; }
body:not(.app) header { color: var(--ink); align-items: center; padding-inline: 0; } body:not(.app) header p { font-size: 1rem; }
.talk { border-top: 2px solid var(--ink); padding: 16px 0; } .talk label { margin-right: 8px; } .talk p { margin-bottom: 12px; } .talk #mic { min-height: 64px; font-size: 1.3rem; }
#summary { font-size: 1.5rem; margin: 16px 0 10px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; } td, th { border: 1px solid var(--margin); padding: 8px; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.pass { color: #0b5d3b; font-weight: 800; } td.pass { white-space: nowrap; } .fail { color: var(--danger); font-weight: 800; }

h1, h2, .ask, .record > summary, .demo > summary, .talklog summary, .quick button, #mic, .stamp, .banner { font-family: var(--head); font-weight: 800; }
.quick small { font-family: var(--print); }

h1 { white-space: nowrap; } .label { padding: 9px 18px 10px; }
@media (max-width: 899px) { h1 { font-size: 1.15rem; } .label p { font-size: .8rem; } .chip { font-size: .7rem; } }
@media (max-height: 700px) and (max-width: 899px) { .visit-open .label { padding: 2px 12px; } }

/* Language switch */
.tools { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.lang { display: flex; } .lang button { min-height: 44px; padding: 4px 14px; border-color: #dbe5f2; background: transparent; color: #fff; border-radius: 0; } .lang button + button { border-left: 0; }
.lang button[aria-pressed="false"]:hover:not(:disabled) { background: #31446a; color: #fff; } .lang button[aria-pressed="true"]:hover:not(:disabled) { background: var(--marigold); } .lang button[aria-pressed="true"] { background: var(--marigold); border-color: var(--marigold); color: var(--ink); font-weight: 800; }
#log:lang(en):empty::before { content: 'Nothing said yet.'; } :lang(en) > * #log .you::before { content: 'You: '; } :lang(en) > * #log .app::before { content: 'Register: '; }
@media (max-height: 700px) and (max-width: 899px) { .visit-open .tools { flex-direction: row; } }

/* Index tabs on the register's edge. They give way while a visit is open. */
#tabs { display: flex; gap: 4px; max-width: 1240px; margin: 0 auto; }
#tabs button { min-height: 46px; border: 0; border-radius: 4px 4px 0 0; background: #31446a; color: #fff; padding: 6px 18px; }
#tabs button:hover:not(:disabled) { background: #415783; } #tabs button:active { transform: none; }
#tabs [aria-current] { background: var(--page); color: var(--ink); font-weight: 800; } #tabs [aria-current]:hover:not(:disabled) { background: var(--page); }
.visit-open #tabs { display: none; }
#howto { max-width: 1240px; margin: 0 auto; min-height: 0; }
#howto h2 { font-size: 1.45rem; line-height: 1.4; margin: 26px 0 8px; text-wrap: balance; } #howto h2:first-child { margin-top: 0; }
.steps { margin: 0 0 18px; padding-left: 1.5em; max-width: 46em; } .steps li { padding: 9px 0 9px 6px; border-bottom: 1px solid var(--rule); }
.steps li::marker { font-weight: 800; color: var(--pen); } .steps b { display: block; font-size: 1.15rem; } .steps span { display: block; }
#howto q { display: block; font: 700 1.1rem/1.55 var(--head); color: var(--pen); }
.also { margin: 0 0 14px; padding: 0; list-style: none; max-width: 46em; } .also li { padding: 6px 0 3px; border-bottom: 1px solid var(--rule); }
#start { background: var(--marigold); min-height: 64px; width: 100%; max-width: 26em; font: 800 1.35rem var(--head); border-width: 3px; } #start:hover:not(:disabled) { background: #ffb91f; }
