/* Scripta app: a clean modern face on top of the component styles in bench.css. */
/* Light and airy by default: warm neutral greys, white surfaces, hairlines rather than boxes. The accent comes from the palette chosen in Settings. */
:root { --bg: #f7f6f3; --surface: #ffffff; --surface-2: #f1efea; --fg: #23262b; --muted: #6f7378; --line: #e6e3dd; --mono-bg: #fbfaf8; --ok: #2e7d5b; --sev-warn: #9a6200; --sev-info: #5c6066; --shadow: 0 1px 2px rgba(30, 28, 24, .05), 0 8px 24px rgba(30, 28, 24, .07); --r: 16px; --r-sm: 11px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #141517; --surface: #1b1d20; --surface-2: #232529; --fg: #e6e4df; --muted: #9b9a95; --line: #2c2e33; --mono-bg: #17191c; --ok: #6fcf9a; --sev-warn: #e8b35a; --sev-info: #a9a9a4; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); } }
:root[data-theme="dark"] { --bg: #141517; --surface: #1b1d20; --surface-2: #232529; --fg: #e6e4df; --muted: #9b9a95; --line: #2c2e33; --mono-bg: #17191c; --ok: #6fcf9a; --sev-warn: #e8b35a; --sev-info: #a9a9a4; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); }
/* rounded corners and a light shadow on every box */
.card, .panelcard, .review, .brief, .comp-bar, .comp-pop, .tour-card, .profile, .drawer .card, .librow, .blockrow { border-radius: var(--r); box-shadow: var(--shadow); }
.card > .hd { border-radius: var(--r) var(--r) 0 0; }
.secbox, .live, textarea, .banner, .libdoc, .step, .micsel, .comp-bar select { border-radius: var(--r-sm); }
.secbox { box-shadow: var(--shadow); }
.btn, .iconbtn, label.f input, label.f select, .blockrow input, .librow input { border-radius: 10px; }
.btn.sm { border-radius: 9px; }
:root { --display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; }
body { font-size: 14px; letter-spacing: -.005em; }
h1, h2, .wordmark, .ptname, .dayhead h1 { font-family: var(--display); letter-spacing: -.02em; }
h2 { font-weight: 600; font-size: 16px; }
.wordmark { font-size: 22px; font-weight: 700; display: inline-flex; align-items: center; gap: 9px; }
.wordmark .seal { width: 26px; height: 26px; }
.wordmark small { font-family: var(--body); font-style: normal; font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 10px; letter-spacing: 0; }
.eyebrow { letter-spacing: .06em; }
.note .lab { font-weight: 600; }
.note .sect { font-family: var(--display); letter-spacing: -.01em; }
/* header styles retired: the app shell is a left sidebar (see .side below) */

/* the app shows one screen at a time by setting the hidden attribute; this must beat every display rule below */
[hidden] { display: none !important; }
img { max-width: 100%; }
.screen { display: block; }
.narrow { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 18px 60px; display: grid; gap: 12px; }
.narrow.wide { max-width: 1400px; }
.tabs { display: flex; gap: 2px; }
.tab { border: 0; background: transparent; color: var(--muted); font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.tab.on { color: var(--accent); background: var(--accent-soft); }
.dayhead { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.dayhead h1 { font-weight: 700; font-size: 26px; margin: 0; line-height: 1.1; }
#screen-day .banner { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
#screen-day .banner.err { border-left-color: var(--sev-block); }
label.btn { cursor: pointer; }
/* status pills: soft tints, no heavy fills */
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.status.recording { color: var(--sev-block); background: color-mix(in srgb, var(--sev-block) 12%, transparent); }
.status.recorded, .status.processing { color: var(--sev-warn); background: color-mix(in srgb, var(--sev-warn) 14%, transparent); }
.status.processed, .status.reviewed { color: var(--accent); background: var(--accent-soft); }
.status.copied { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: transparent; }
.status.complete { color: var(--ok); border-color: transparent; background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* visit */
.visitbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; }
.visitbar .recgroup { margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
@media (max-width: 760px) { .visitbar .recgroup { border-left: 0; padding-left: 0; margin-left: 0; width: 100%; } }
.visitbar .pt { display: flex; flex-direction: column; min-width: 0; }
.ptname { font-size: 17px; font-weight: 600; line-height: 1.15; }
.recgroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.micsel { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); padding: 5px 6px; font-size: 12px; max-width: 150px; }
.btn.rec { border-color: var(--sev-block); color: var(--sev-block); font-weight: 600; }
.btn.rec .recdot { width: 9px; height: 9px; border-radius: 50%; background: var(--sev-block); display: inline-block; }
.btn.rec.on { background: var(--sev-block); color: #fff; }
.btn.rec.on .recdot { background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.vbars { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 4px; }
.vbars i { display: block; width: 4px; height: 4px; border-radius: 2px; background: var(--ok); transition: height .09s ease; }
button.pill { cursor: pointer; font: inherit; font-size: 12px; }
.live { max-height: 220px; overflow: auto; background: var(--mono-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; }
.live .partial { color: var(--muted); }
.review { display: grid; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface); font-size: 13.5px; }
.review .eyebrow { margin-right: 6px; }
.review ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.rv-booking { color: var(--fg); }
.brief { display: grid; gap: 4px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; font-size: 13px; }
.brief .stale { color: var(--sev-warn); }
.progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.progress .step { border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--surface); padding: 8px 12px; }
.progress .step:last-child { border-right: 0; }
.progress .step .t { font-weight: 600; font-size: 13px; }
.progress .step .s { font-family: var(--mono); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-items: start; }
/* the visit's note panel: the note fills the width, Argus sits under it */
.notestack { display: grid; gap: 12px; max-width: 1240px; margin: 0 auto; width: 100%; }
.notestack .col { display: grid; gap: 12px; }
#progress { max-width: 1240px; margin: 0 auto; width: 100%; }
[data-panel=note] { display: grid; gap: 12px; }
/* records and guide: the work on the left, a rail on the right */
.grid2.side-rail { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
@media (max-width: 1100px) { .grid2.side-rail { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); } }
@media (max-width: 980px) { .grid2, .grid2.side-rail { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: 12px; min-width: 0; }
.tucked { display: grid; gap: 8px; }
.tucked details.card > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: baseline; padding: 9px 14px; font-weight: 600; font-size: 13.5px; }
.tucked details.card > summary::-webkit-details-marker { display: none; }
.tucked details.card > summary::before { content: '▸'; color: var(--muted); font-size: 11px; }
.tucked details[open].card > summary::before { content: '▾'; }
.tucked details[open].card > summary { border-bottom: 1px solid var(--line); }
#transcript { min-height: 220px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); }
.tpllist { display: grid; }
.tplrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tplrow:last-child { border-bottom: 0; }
.tplrow:hover { background: var(--surface-2); }
.tplrow .nm { font-weight: 600; grid-column: 1; grid-row: 1; }
.tplrow .hn { color: var(--muted); font-size: 12.5px; grid-column: 1; grid-row: 2; }
.tplrow .ct { color: var(--muted); font-family: var(--mono); font-size: 12px; grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; }
.blockrow { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.blockrow .hd2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blockrow input.bname { font-weight: 600; width: 220px; }
.blockrow input.bhint { flex: 1; min-width: 200px; }
.blockrow input { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 5px 8px; font-size: 13px; color: var(--fg); }
.blockrow textarea { min-height: 80px; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

/* walkthrough */
#tour { position: fixed; inset: 0; z-index: 100; }
.tour-shade { position: absolute; inset: 0; }
.tour-spot { position: absolute; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 16, 24, .55); pointer-events: none; transition: all .25s ease; border: 2px solid var(--accent); }
.tour-card { position: absolute; width: min(360px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.tour-title { font-weight: 600; font-size: 15px; }
.tour-text { font-size: 13.5px; line-height: 1.5; }

/* the note reads as text, not code */
.note { font-family: var(--body); font-size: 14px; line-height: 1.55; }
.note .lab { font-weight: 600; color: var(--muted); }
.note .ln.sub { font-size: 13px; }
.q .line, .q .fix { font-family: var(--body); }

/* records */
.visitlist { display: grid; }
.visitrow { border-bottom: 1px solid var(--line); }
.visitrow:last-child { border-bottom: 0; }
.visitrow > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; }
.visitrow > summary::-webkit-details-marker { display: none; }
.visitrow > summary .d { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.visitrow > summary .ty { font-weight: 600; }
.visitrow > summary .by { color: var(--muted); font-size: 12.5px; }
.visitrow .notebody { padding: 0 14px 12px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; }
.visitrow .notebody .sec { font-weight: 600; margin-top: 8px; }
.askthread { display: grid; gap: 10px; max-height: 50vh; overflow: auto; }
.askthread:empty { display: none; }
.ask-q { background: var(--surface-2); border-radius: 10px 10px 2px 10px; padding: 8px 12px; justify-self: end; max-width: 92%; font-size: 13.5px; }
.ask-a { border: 1px solid var(--line); border-radius: 10px 10px 10px 2px; padding: 10px 12px; max-width: 100%; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.ask-a.thinking { color: var(--muted); }
.remlist { display: grid; }
.remrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.remrow:last-child { border-bottom: 0; }
.remrow.done .tx { text-decoration: line-through; color: var(--muted); }
.remrow .tx { font-size: 14px; }
.remrow .sub { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.remrow input[type=checkbox] { width: 18px; height: 18px; }
.remrow .act { display: flex; gap: 6px; }
.tab .count { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 18px; text-align: center; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--fg); box-shadow: 0 0 0 2px var(--surface); }

#askInput, #letterText, #rawTemplate, #convertedTemplate { font-family: var(--body); font-size: 13.5px; }
#helpBtn { white-space: nowrap; }

/* visit sub-tabs */
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.stab { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 13.5px; padding: 9px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.stab:hover { color: var(--fg); }
.stab.on { color: var(--accent); border-bottom-color: var(--accent); }
.stab svg { flex: none; }
.tabpanel { display: grid; gap: 12px; }
@media (max-width: 520px) { .stab { padding: 9px 9px; font-size: 13px; } }
.tab { white-space: nowrap; }
.guide-a { white-space: pre-wrap; }
.guide-a .h { font-weight: 600; margin-top: 8px; }
.librow { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.librow .hd2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.librow input { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 5px 8px; font-size: 13px; color: var(--fg); }
.librow input.lname { font-weight: 600; width: 260px; }
.librow input.ldate { width: 120px; }
.librow textarea { min-height: 90px; font-family: var(--body); font-size: 13px; }
#guideModes { border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
#guideThread { max-height: none; }
#guideInput { font-family: var(--body); font-size: 13.5px; }
.libdoc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.libdoc .nm { font-weight: 600; grid-column: 1; grid-row: 1; }
.libdoc .sub { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.libdoc .act { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; align-items: center; }
.ask-src { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* the seal: the practice's mark, coloured by the theme, used as the loading sign */
.seal { display: inline-block; width: 26px; height: 26px; background: var(--accent); -webkit-mask: url(../logo-mask-sm.png) center / contain no-repeat; mask: url(../logo-mask-sm.png) center / contain no-repeat; flex: none; }
.seal.big { width: 150px; height: 150px; -webkit-mask-image: url(../logo-mask.png); mask-image: url(../logo-mask.png); }
/* the loader: a tumbleweed, rolling while things load */
.seal.spin { -webkit-mask-image: url(../weed-mask.png); mask-image: url(../weed-mask.png); background: color-mix(in srgb, var(--accent) 70%, #8a7a5a); animation: roll 1.5s linear infinite; }
@keyframes roll { to { transform: rotate(360deg); } }
.trail { position: relative; width: 180px; height: 34px; margin: 4px 0 2px; border-bottom: 1.5px dashed var(--line); }
.trail .seal.spin { position: absolute; left: 0; top: 2px; width: 28px; height: 28px; animation: roll 1.3s linear infinite, along 2.4s ease-in-out infinite alternate; }
@keyframes along { from { left: 4px; } to { left: calc(100% - 32px); } }
@media (prefers-reduced-motion: reduce) { .seal.spin { animation: none; } .trail .seal.spin { animation: none; left: calc(50% - 14px); } }
.splash { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: grid; place-content: center; justify-items: center; gap: 10px; transition: opacity .35s ease; }
.splash.out { opacity: 0; pointer-events: none; }
.splash-name { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -.02em; }
.splash-sub { color: var(--muted); font-size: 13.5px; }

/* progress rings with an estimate */
.progress .step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; }
.progress .step .t { grid-column: 2; }
.progress .step .s { grid-column: 2; }
.ring { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; position: relative; --ring-w: 3px; }
.ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) var(--p, 0%), var(--line) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring-w) - .5px), #000 calc(100% - var(--ring-w))); mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring-w) - .5px), #000 calc(100% - var(--ring-w))); }
.ring .seal { width: 22px; height: 22px; position: relative; z-index: 1; opacity: .35; animation-play-state: paused; }
.ring i { position: absolute; z-index: 1; font-style: normal; font-size: 11px; font-weight: 600; color: var(--accent); display: none; }
.step.run .ring .seal { opacity: 1; animation-play-state: running; }
.step.done .ring { --p: 100%; }
.step.done .ring .seal { display: none; }
.step.done .ring i { display: block; }
.step.fail .ring::before { background: var(--sev-block); }
.est { color: var(--muted); font-family: var(--mono); font-size: 11.5px; margin-left: 6px; }
.busy { display: inline-flex; align-items: center; gap: 8px; }
.busy .ring { grid-row: auto; width: 22px; height: 22px; }
.busy .ring { --ring-w: 2px; }
.busy .ring .seal { width: 13px; height: 13px; opacity: 1; animation-play-state: running; }
.busy .ring .seal { opacity: 1; animation-play-state: running; width: 14px; height: 14px; }
.ask-a.thinking { color: var(--muted); }
.loading { display: grid; justify-items: center; gap: 6px; padding: 28px 12px; text-align: center; color: var(--muted); }
.loading .ring.lg { grid-row: auto; width: 84px; height: 84px; margin-bottom: 8px; }
.loading .ring.lg { --ring-w: 4px; }
.loading .ring.lg .seal { width: 58px; height: 58px; opacity: 1; animation-play-state: running; }
.loading .lt { font-weight: 600; color: var(--fg); font-size: 15px; }
.loading .ls { font-size: 13px; }
@media (max-width: 560px) { .progress { grid-template-columns: 1fr; } .progress .step { border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 12px; } .progress .step:last-child { border-bottom: 0; } .ring { width: 30px; height: 30px; } .ring .seal { width: 18px; height: 18px; } }

/* ===== App shell: a thin icon rail down the left, the work on the right ===== */
body { display: grid; grid-template-columns: 84px minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; }
.side { position: sticky; top: 0; height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px calc(12px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.side .wordmark { padding: 0 0 8px; font-size: 0; gap: 0; }
.side .wordmark .seal { width: 34px; height: 34px; }
.side .wordmark .wm { display: none; }
.side .sideadd { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin: 2px 0 8px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.side .sideadd span { display: none; }
.side .tabs { flex-direction: column; gap: 2px; width: 100%; }
.side .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; width: 100%; font-size: 10.5px; font-weight: 500; border-radius: 10px; color: var(--muted); position: relative; }
.side .tab svg { width: 20px; height: 20px; opacity: .85; }
.side .tab.on { color: var(--accent); background: var(--accent-soft); }
.side .tab.on svg { opacity: 1; }
.side .tab .count { position: absolute; top: 4px; right: 10px; margin: 0; font-size: 10px; line-height: 16px; min-width: 16px; padding: 0 4px; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; padding-top: 6px; border-top: 1px solid var(--line); }
.side .sideupload { cursor: pointer; }
.side .foot .pill { padding: 0; border: 0; background: transparent; }
.side .foot .pill #netText { display: none; }
.side .foot .pill .dot { width: 9px; height: 9px; }
.side .who { display: grid; place-items: center; padding: 2px 0; }
.side .who .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.side .who .nm, .side .who .pr { display: none; }
.splash { grid-column: 1 / -1; }
@media (max-width: 760px) {
  body { display: block; }
  .side { position: sticky; height: auto; flex-direction: row; align-items: center; gap: 2px; padding: 6px max(8px, env(safe-area-inset-right, 0px)) 6px max(8px, env(safe-area-inset-left, 0px)); border-right: 0; border-bottom: 1px solid var(--line); z-index: 20; overflow-x: auto; }
  .side .wordmark { padding: 0 4px 0 0; }
  .side .wordmark .seal { width: 28px; height: 28px; }
  .side .sideadd { width: 36px; height: 36px; margin: 0 4px; }
  .side .tabs { flex-direction: row; width: auto; }
  .side .tab { flex-direction: row; gap: 6px; padding: 7px 8px; font-size: 12.5px; white-space: nowrap; }
  .side .tab svg { width: 16px; height: 16px; }
  .side .tab .count { position: static; margin-left: 2px; }
  .side .foot { margin: 0 0 0 auto; flex-direction: row; width: auto; padding: 0; border: 0; }
  .side .who { display: none; }
}

/* ===== The visit page: patients down the left, the note in the middle, a drawer for the small things ===== */
.visitshell { --rail-w: 300px; --drawer-w: 400px; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); align-items: start; }
.dayrail { border-right: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; height: 100vh; }
.rail-in { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.rail-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 18px 16px 8px; }
.rail-list { display: grid; gap: 2px; padding: 4px 8px 16px; }
.railrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; color: var(--fg); padding: 8px 10px; border-radius: 12px; cursor: pointer; font: inherit; }
.railrow:hover { background: var(--surface-2); }
.railrow.on { background: var(--accent-soft); }
.railrow .av, .prof-hd .av { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: hsl(var(--h) 30% 34%); background: hsl(var(--h) 40% 91%); }
:root[data-theme="dark"] .railrow .av, :root[data-theme="dark"] .prof-hd .av { color: hsl(var(--h) 45% 80%); background: hsl(var(--h) 25% 24%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .railrow .av, :root:not([data-theme="light"]) .prof-hd .av { color: hsl(var(--h) 45% 80%); background: hsl(var(--h) 25% 24%); } }
.railrow .rn { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.railrow .rs { grid-column: 2; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.railrow .rt { grid-column: 3; grid-row: 1; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.railrow .rd { grid-column: 3; grid-row: 2; justify-self: end; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.railrow.st-recording .rd { background: var(--sev-block); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sev-block) 25%, transparent); }
.railrow.st-recorded .rd, .railrow.st-processing .rd { background: var(--sev-warn); }
.railrow.st-processed .rd, .railrow.st-reviewed .rd { background: var(--accent); }
.railrow.st-copied .rd, .railrow.st-complete .rd { background: var(--ok); }
.railrow.st-complete .rn { color: var(--muted); font-weight: 500; }
/* drag handles on the edges that can move */
.rz { position: absolute; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 7; touch-action: none; }
.rz::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background .15s; }
.rz:hover::after, .rz.on::after { background: var(--accent); }
.dayrail .rz { right: -5px; }
.drawer .rz { left: -5px; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing textarea { pointer-events: none; }

.visitmain { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.visittop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.visittop .pt { display: flex; flex-direction: column; min-width: 0; }
.ptbtn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 2px 6px 2px 4px; margin-left: -4px; border-radius: 8px; color: var(--fg); font: inherit; cursor: pointer; text-align: left; }
.ptbtn:hover, .ptbtn.on { background: var(--surface-2); }
.ptbtn svg { color: var(--muted); flex: none; }
.visittop .ptname { font-size: 15px; font-weight: 600; line-height: 1.15; }
.visittop .hint { font-size: 12px; }
.visittop .status { font-size: 11px; padding: 1px 8px; }
.visittop .recgroup { margin-left: auto; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; font-size: 18px; line-height: 1; }
.iconbtn:hover { color: var(--fg); background: var(--surface-2); }
.topbtns { display: inline-flex; gap: 2px; padding-right: 10px; margin-right: 2px; border-right: 1px solid var(--line); }
.topbtn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 500; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.topbtn:hover { color: var(--fg); background: var(--surface-2); }
.topbtn.on { color: var(--accent); background: var(--accent-soft); }
/* the patient's profile, under the name */
.profile { position: absolute; left: 56px; top: calc(100% - 4px); width: min(460px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: min(70vh, 640px); overflow: hidden; }
.prof-hd { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.prof-hd .av { grid-row: auto; }
.prof-name { font-weight: 600; font-size: 14.5px; }
.prof-body { overflow: auto; padding: 12px 14px 14px; display: grid; gap: 12px; font-size: 13px; }
.prof-sum { line-height: 1.55; margin-top: 4px; }
.prof-body ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.prof-body .chk { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.prof-body .chk input { width: auto; margin: 0; }

.visitbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; flex: 1; align-items: start; }
.visitbody.open { grid-template-columns: minmax(0, 1fr) var(--drawer-w); }
.visitcentre { display: grid; gap: 12px; padding: 16px 20px 150px; min-width: 0; max-width: 980px; width: 100%; margin: 0 auto; }
.visitcentre #noteCard { border: 0; box-shadow: none; background: transparent; }
.visitcentre #noteCard > .hd { padding-left: 4px; padding-right: 4px; background: transparent; border: 0; }
.visitcentre #noteCard > .bd { padding: 0; }
.visitcentre #noteView { font-size: 15px; line-height: 1.6; }
.visitcentre #noteView .secbox { background: var(--surface); }
.visitcentre .progress { font-size: 12px; }
.drawer { position: sticky; top: 0; height: 100vh; min-width: 0; border-left: 1px solid var(--line); background: var(--bg); }
.drawer-in { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.drawer-hd { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; font-size: 13.5px; }
.drawer-hd .ttl { font-weight: 600; }
.drawer-hd .hint { font-size: 12px; }
.dpanel { padding: 12px; display: grid; gap: 10px; align-content: start; }
.dpanel .card > .hd { flex-wrap: wrap; padding: 9px 12px; }
.dpanel .card > .hd h2 { display: none; }
.dpanel .card > .bd { padding: 10px 12px 12px; font-size: 13px; }
.dpanel .settings { grid-template-columns: 1fr 1fr; gap: 8px; }
.dpanel textarea { min-height: 120px !important; font-size: 12.5px; }
.dpanel .brief { font-size: 12.5px; }
.vdetails { border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 8px 12px; font-size: 12.5px; }
.vdetails > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.vdetails > summary::-webkit-details-marker { display: none; }
.vdetails[open] > summary { color: var(--fg); }
.vdetails label.chk { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg); }
.vdetails label.chk input { width: auto; }
@media (max-width: 1100px) { .visitshell { grid-template-columns: 240px minmax(0, 1fr); } .visitbody.open { grid-template-columns: minmax(0, 1fr); } .drawer { position: fixed; right: 0; top: 0; height: 100vh; width: min(var(--drawer-w), 100vw); z-index: 40; box-shadow: -12px 0 40px rgba(0,0,0,.12); } }
@media (max-width: 760px) { .visitshell { grid-template-columns: minmax(0, 1fr); } .dayrail { display: none; } .visittop { position: static; } .visitcentre { padding: 12px 12px 150px; } .drawer { width: 100vw; } .drawer .rz { display: none; } .topbtns { border-right: 0; padding-right: 0; } .topbtn span { display: none; } .profile { left: 8px; } }

/* ===== The bar at the bottom: ask, or brief a letter ===== */
.composer { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; gap: 6px; }
.comp-bar { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.comp-bar select { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--fg); padding: 7px 8px; font-size: 12.5px; align-self: center; }
.comp-bar textarea { flex: 1; min-height: 38px; max-height: 140px; resize: none; padding: 9px 10px; border: 0; background: transparent; font-family: var(--body); font-size: 14.5px; line-height: 1.4; color: var(--fg); }
.comp-bar textarea:focus { outline: none; }
.comp-bar .deep { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; align-self: center; }
.comp-bar .btn { border-radius: 12px; padding: 8px 14px; }
.comp-note { justify-self: center; font-size: 11px; color: var(--muted); background: var(--bg); padding: 2px 10px; border-radius: 999px; }
.comp-pop { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 16px 48px rgba(0,0,0,.2); max-height: min(560px, 70vh); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.comp-hd { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); background: var(--accent-soft); font-size: 13.5px; }
.comp-hd .ttl { font-weight: 600; }
.comp-hd .hint { flex: 1; font-size: 11.5px; }
.comp-hd .iconbtn { border: 0; background: transparent; }
.comp-body { overflow: auto; padding: 12px; }
.comp-body .askthread { max-height: none; }
#letterBox { display: grid; gap: 10px; }
#compLetter { width: 100%; min-height: 220px; max-height: 42vh; font-family: var(--body); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 760px) { .composer { left: 8px !important; width: calc(100vw - 16px) !important; } .comp-note { display: none; } .comp-bar .deep span { display: none; } }


/* ===== The patients page: the chosen day at the top, the 30 days before it down the page; the day's tools in a column beside the list ===== */
.daypage { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "panel main"; gap: 0 28px; align-items: start; max-width: 1400px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-block: 22px 80px; }
.daymain { grid-area: main; display: grid; gap: 14px; min-width: 0; }
.daypanel { grid-area: panel; position: sticky; top: 16px; display: grid; gap: 12px; min-width: 0; }
.panelcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.daterow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.btn.upload { justify-content: center; width: 100%; box-sizing: border-box; }
.addcard > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px; }
.addcard > summary::-webkit-details-marker { display: none; }
.addform { display: grid; gap: 8px; padding-top: 4px; }
.addform .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.addform .btnrow { padding-top: 2px; }
.daygroups { display: grid; gap: 22px; }
.daygroup { display: grid; }
.dayghd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.dayghd h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.daygroup.first .dayghd h2 { font-size: 15px; }
.dayrow { display: grid; grid-template-columns: 52px 34px minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(0, 1.6fr) auto; gap: 0 12px; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 9px 6px; font: inherit; cursor: pointer; border-radius: 0; }
.dayrow:hover { background: var(--surface); }
.dayrow .t { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dayrow .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: hsl(var(--h) 30% 34%); background: hsl(var(--h) 40% 91%); }
:root[data-theme="dark"] .dayrow .av { color: hsl(var(--h) 45% 80%); background: hsl(var(--h) 25% 24%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dayrow .av { color: hsl(var(--h) 45% 80%); background: hsl(var(--h) 25% 24%); } }
.dayrow .who { display: grid; min-width: 0; }
.dayrow .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .sub { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .ty { font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .bnote { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .st { justify-self: end; display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.dayrow .st .sub { flex-basis: 100%; text-align: right; }
.dayrow.st-complete .nm { color: var(--muted); font-weight: 500; }
.dayempty { color: var(--muted); padding: 22px 6px; font-size: 13.5px; }
.dayend { padding: 4px 6px; }
@media (max-width: 1100px) { .dayrow { grid-template-columns: 52px 34px minmax(0, 1.6fr) minmax(0, 1.2fr) auto; } .dayrow .bnote { display: none; } }
@media (max-width: 900px) {
  .daypage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "panel" "main"; gap: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .daypanel { position: static; grid-template-columns: 1fr 1fr; align-items: start; }
  .addcard > summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); align-self: center; }
  .addcard[open] > summary::after { transform: rotate(45deg); }
}
@media (max-width: 640px) { .daypanel { grid-template-columns: 1fr; } .dayrow { grid-template-columns: 46px 30px minmax(0, 1fr) auto; padding: 9px 2px; } .dayrow .ty { display: none; } .dayrow .av { width: 30px; height: 30px; font-size: 11px; } .dayghd { top: 0; } }

/* settings: Practice and Evidence base tabs; the evidence base grouped by publisher */
#setTabs { margin-bottom: 2px; }
#setTabs .stab .hint { font-size: 11.5px; margin-left: 2px; }
.liblist { display: grid; gap: 14px; }
.liblist .libgroup { display: grid; gap: 6px; }
.liblist .pub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 4px 2px 0; }
.liblist .libdoc { background: var(--surface); }
.linkbtn { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: inherit; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* templates: tabs, letters, contacts, history and the AI edit box */
#tplTabs { margin-bottom: 2px; }
#tplTabs .stab .hint { font-size: 11.5px; margin-left: 2px; }
.ctsearch { flex: 1; min-width: 240px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 11px; font-size: 13.5px; color: var(--fg); }
.ctfound, .ctlist { display: grid; gap: 10px; }
.ctgroup { display: grid; gap: 8px; }
.ctgroup .pub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 2px 0; }
.ctcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; }
.ctcard.found { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cthd { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cthd .nm { font-weight: 600; font-size: 14px; }
.cthd .act { display: flex; gap: 6px; flex: none; }
.ctcard .sub { color: var(--muted); font-size: 12.5px; }
.ctcard .addr { white-space: pre-line; font-size: 13px; line-height: 1.45; }
.ctbody { display: grid; gap: 4px; }
.people, .ctpeople { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.people .chip, .ctpeople .chip, .topeople .chip { padding: 3px 9px; font-size: 12.5px; gap: 6px; }
.ctpeople .chip .x { border: 0; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.comp-to { display: flex; align-items: center; gap: 8px; position: relative; padding: 0 12px; }
.comp-to .hint { flex: none; font-weight: 600; }
.comp-to input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 7px 10px; font-size: 13px; color: var(--fg); }
.tochip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 6px 5px 11px; font-size: 13px; font-weight: 600; }
.tochip button { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.tolist { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); max-height: 320px; overflow: auto; z-index: 5; display: grid; }
.toitem { display: grid; gap: 2px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toitem:last-child { border-bottom: 0; }
.toitem:hover { background: var(--surface-2); }
.toitem .nm { font-weight: 600; font-size: 13.5px; }
.toitem .sub { color: var(--muted); font-size: 12px; }
.toitem.find .nm { color: var(--accent); }
.topeople { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 4px; }
.topeople .chip { cursor: pointer; }
.topeople .chip:hover { border-color: var(--accent); }
.histlist { display: grid; gap: 6px; }
.histrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.histrow.same { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.histrow .nm { font-weight: 600; font-size: 13px; }
.histrow .sub { color: var(--muted); font-size: 12px; }
.histrow .act { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.histrow .peek { grid-column: 1 / -1; margin: 6px 0 0; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--mono-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 320px; overflow: auto; }
.aibox { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.aibox input { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 11px; font-size: 13.5px; color: var(--fg); }

/* ===== Advice: past chats down the side, the conversation in the middle, the question at the bottom ===== */
.advice { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.chatlist { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; }
.chatlist-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 14px 10px; }
.chatrows { display: grid; gap: 10px; padding: 0 8px 16px; }
.chatgroup { display: grid; gap: 2px; }
.chatgroup .pub { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 8px 4px; }
.chatrow { display: grid; gap: 1px; text-align: left; border: 0; background: transparent; color: var(--fg); padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit; min-width: 0; }
.chatrow:hover { background: var(--surface-2); }
.chatrow.on { background: var(--accent-soft); }
.chatrow .t { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatrow .m { font-size: 11px; color: var(--muted); }
.chatmain { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
.chattop { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.chattitle-wrap { min-width: 0; flex: 1 1 320px; }
.chattitle { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chattop .hint { font-size: 12px; }
.chatlist-toggle { display: none; }
.chatscroll { flex: 1; overflow-y: auto; padding: 20px max(20px, env(safe-area-inset-right, 0px)) 20px max(20px, env(safe-area-inset-left, 0px)); }
.chatintro { max-width: 760px; margin: 8vh auto 0; display: grid; gap: 14px; justify-items: center; text-align: center; }
.chatintro-t { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -.02em; }
.chatintro .chips { justify-content: center; }
.chatthread { max-width: 820px; margin: 0 auto; max-height: none; width: 100%; gap: 14px; }
.chatthread .ask-q { background: var(--accent-soft); color: var(--fg); font-size: 14px; padding: 10px 14px; border-radius: 14px 14px 4px 14px; max-width: 80%; }
.chatthread .ask-a { background: var(--surface); border-color: var(--line); border-radius: 14px 14px 14px 4px; padding: 14px 16px; font-size: 14px; line-height: 1.6; box-shadow: var(--shadow); }
.chatthread .ask-a .h { font-weight: 600; margin-top: 10px; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.chatthread .ask-a .h:first-child { margin-top: 0; }
.chatbar-wrap { padding: 8px max(20px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); display: grid; gap: 6px; justify-items: center; background: var(--bg); }
.chatbar { width: 100%; max-width: 820px; }
.chatnote { font-size: 11.5px; }
@media (max-width: 900px) {
  .advice { grid-template-columns: minmax(0, 1fr); }
  .chatlist { display: none; position: fixed; left: 0; top: 0; z-index: 45; width: min(320px, 90vw); box-shadow: 12px 0 40px rgba(0,0,0,.15); }
  body.chatlist-open .chatlist { display: flex; }
  .chatlist-toggle { display: grid; }
  .chatmain { height: auto; min-height: 100vh; }
  .chatscroll { flex: 1 1 auto; overflow: visible; padding-bottom: 120px; }
  .chatbar-wrap { position: sticky; bottom: 0; }
  .chattop .hint { display: none; }
}

/* adding a patient: the name offers existing records; a linked one shows as a chip */
.addname { position: relative; display: grid; gap: 6px; }
label.f .opt { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 4px; }
.addmatches { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 8; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); display: grid; max-height: 260px; overflow: auto; }
.addmatches .hint { padding: 9px 11px; }
.addmatch { display: grid; gap: 1px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 8px 11px; font: inherit; cursor: pointer; }
.addmatch:last-child { border-bottom: 0; }
.addmatch:hover { background: var(--surface-2); }
.addmatch .nm { font-weight: 600; font-size: 13.5px; }
.addmatch .sub { color: var(--muted); font-size: 12px; }
.linked { display: inline-flex; align-items: center; gap: 6px; justify-self: start; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 12.5px; font-weight: 600; }
.linked button { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 3px; }

/* ===== Forgot to record: the script overlay ===== */
.scriptwrap { position: fixed; inset: 0; z-index: 80; background: color-mix(in srgb, var(--fg) 35%, transparent); display: grid; place-items: center; padding: 16px; }
.scriptcard { width: min(720px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 70px rgba(0,0,0,.25); display: grid; max-height: calc(100vh - 32px); overflow: auto; }
.script-hd { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.script-hd .ttl { font-weight: 600; font-size: 15px; }
.script-body { padding: 28px 24px 22px; display: grid; gap: 12px; }
.script-prog { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.script-q { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
.script-h { font-size: 15px; line-height: 1.5; color: var(--muted); max-width: 60ch; }
.script-rec { display: flex; align-items: center; gap: 10px; padding-top: 8px; font-size: 12.5px; color: var(--muted); }
.script-rec .recdot.live { width: 10px; height: 10px; border-radius: 50%; background: var(--sev-block); display: inline-block; animation: blink 1s infinite; }
.script-rec .stat { font-family: var(--mono); }
.script-rec .hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.script-ft { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
#scriptStart .recdot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
@media (max-width: 600px) { .script-q { font-size: 22px; } .script-body { padding: 20px 16px; } }

/* letterhead */
.lhgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1000px) { .lhgrid { grid-template-columns: minmax(0, 1fr); } }
.lhlogo { display: grid; gap: 8px; }
.lhlogo-box { min-height: 90px; border: 1px dashed var(--line); border-radius: var(--r-sm); display: grid; place-items: center; padding: 10px; background: #fff; }
.lhlogo-box img { max-height: 90px; max-width: 100%; }
.lhpage-wrap { background: var(--surface-2); padding: 18px; }
.lhpage { background: #fff; color: #111; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 210 / 297; padding: 11% 9%; box-sizing: border-box; box-shadow: 0 10px 30px rgba(0,0,0,.12); font-family: Calibri, Arial, sans-serif; font-size: 11pt; overflow: hidden; }

/* sites and the week */
.sitelist { display: grid; gap: 6px; }
.siterow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1.5fr) auto; gap: 8px; align-items: center; }
.siterow input, .siterow select, .weekrow select { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 7px 9px; font-size: 13px; color: var(--fg); min-width: 0; }
.weekgrid { display: grid; gap: 6px; }
.weekrow { display: grid; grid-template-columns: 110px minmax(0, 1.5fr) minmax(0, 1.3fr); gap: 8px; align-items: center; }
.weekrow .wd { font-weight: 600; font-size: 13px; }
@media (max-width: 700px) { .siterow { grid-template-columns: 1fr 1fr; } .weekrow { grid-template-columns: 90px 1fr; } .weekrow .wfocus { grid-column: 2; } }
/* generate */
.genwrap { position: relative; }
.genmenu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 70; width: 320px; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); display: grid; padding: 4px; }
.genfilter { margin: 4px 4px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 7px 10px; font-size: 13px; color: var(--fg); }
.genmenu .pub { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px 4px; }
.genitem { display: grid; gap: 1px; text-align: left; border: 0; background: transparent; color: var(--fg); padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.genitem:hover { background: var(--surface-2); }
.genitem .nm { font-weight: 600; font-size: 13px; }
.genitem .sub { color: var(--muted); font-size: 11.5px; }
.tplgroup { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px 4px; border-bottom: 1px solid var(--line); }
#compLetterhead { max-width: 220px; }

.autosaved { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

/* red flags, photos */
.flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--sev-block) 35%, var(--line)); border-left: 3px solid var(--sev-block); border-radius: var(--r-sm); background: color-mix(in srgb, var(--sev-block) 6%, var(--surface)); font-size: 12.5px; }
.flags .flag { padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.flags .flag.red { color: var(--sev-block); border-color: color-mix(in srgb, var(--sev-block) 45%, transparent); }
.flags .linkbtn { font-size: 12px; margin-left: 4px; }
.flagedit { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.flagedit .chip.red { color: var(--sev-block); border-color: color-mix(in srgb, var(--sev-block) 45%, transparent); }
.flagedit .chip .x { border: 0; background: transparent; color: inherit; font-size: 14px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { margin: 0; width: 150px; display: grid; gap: 4px; }
.photo img { width: 150px; height: 110px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in; }
.photo figcaption { display: flex; gap: 4px; align-items: center; }
.photo figcaption input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; font-size: 11.5px; background: var(--surface); color: var(--fg); }
.photo .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
/* audits */
.audittable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.audittable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.audittable td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.audittable td.good { color: var(--ok); font-weight: 600; } .audittable td.mid { color: var(--sev-warn); font-weight: 600; } .audittable td.poor { color: var(--sev-block); font-weight: 600; }
.auditmiss { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; }
.auditmiss summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.auditlist { padding: 8px 0 2px; font-size: 13px; line-height: 1.8; }
.mutelist { display: grid; gap: 6px; }
.muterow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px; }
.muterow .sub { display: block; color: var(--muted); font-size: 12px; }
/* end of day, nurse view */
.eod { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.eod:last-child { border-bottom: 0; }
.eod ul { margin: 2px 0 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; }
.nursewrap { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.nurse-hd { display: flex; align-items: center; gap: 14px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.nurse-hd .ttl { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -.02em; }
.nurse-hd .hint { font-family: var(--mono); font-size: 16px; }
.nurse-list { overflow: auto; padding: 16px 28px 40px; display: grid; gap: 8px; align-content: start; }
.nurserow { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); font-size: 20px; }
.nurserow.next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nurserow.st-complete { opacity: .55; }
.nurserow .nt { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.nurserow .nn { font-weight: 600; display: grid; gap: 2px; }
.nurserow .nsub { font-weight: 400; font-size: 16px; color: var(--muted); }
.nurserow .nset { font-weight: 500; font-size: 15px; color: var(--accent); }
.nurserow .status { font-size: 14px; padding: 4px 12px; }
@media (max-width: 640px) { .nurserow { grid-template-columns: 64px minmax(0, 1fr); font-size: 17px; } .nurserow .ns { grid-column: 2; } .nurse-hd { padding: 12px 16px; } .nurse-list { padding: 12px 16px 40px; } }
#photoBtn input { display: none; }

/* ===== Letters received: the Letter in overlay, and the lists on the visit, the record and the review strip ===== */
.lettercard { width: min(760px, 100%); }
.li-body { padding: 18px 22px 22px; display: grid; gap: 18px; }
.li-step { display: grid; gap: 10px; }
.li-new { display: grid; gap: 6px; }
.li-new .pair, .lettercard .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.li-get { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.li-big { display: grid; justify-items: center; gap: 4px; padding: 18px 10px 14px; border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--fg); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-align: center; }
.li-big:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.li-big .hint { font-weight: 400; }
.li-big svg { color: var(--accent); }
.li-prog { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.li-prog .spin { width: 22px; height: 22px; display: inline-block; -webkit-mask: url(../weed-mask.png) center / contain no-repeat; mask: url(../weed-mask.png) center / contain no-repeat; background: color-mix(in srgb, var(--accent) 70%, #8a7a5a); animation: roll 1.5s linear infinite; }
.li-actions { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.li-actions .eyebrow { margin-bottom: 2px; }
.ctxletters { display: grid; gap: 8px; }
.ctxl-hd { display: flex; align-items: center; gap: 8px; }
.letterlist { display: grid; gap: 8px; }
.letter { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface); font-size: 13px; }
.letter.done { border-left-color: var(--line); opacity: .8; }
.letter .lt-hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.letter .lt-hd .nm { font-weight: 600; }
.letter .lt-hd .ttl { color: var(--muted); }
.letter .lt-sum { white-space: pre-wrap; line-height: 1.45; }
.letter .lt-sum.clip { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.letter .lt-acts { display: grid; gap: 2px; color: var(--fg); }
.letter .lt-acts li { margin-left: 16px; }
.letter .lt-ft { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.letter .lt-ft .pill { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.letter .lt-ft .pill.done { background: var(--surface-2); color: var(--muted); }
.rv-due li .linkbtn { margin-left: 6px; font-size: 11.5px; }
@media (max-width: 640px) { .li-get { grid-template-columns: 1fr; } .li-big { grid-template-columns: auto 1fr; justify-items: start; text-align: left; padding: 12px 14px; } .li-big .hint { grid-column: 2; } .li-big svg { grid-row: span 2; align-self: center; } }

/* ===== Sign-in and the lock screen ===== */
.authwrap { min-height: calc(100vh - 20px); display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 40px max(16px, env(safe-area-inset-right, 0px)); }
.authcard, .lockcard { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 26px 26px 18px; display: grid; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .seal { width: 44px; height: 44px; flex: none; }
.auth-app { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.auth-step { display: grid; gap: 12px; }
.auth-step h2 { margin: 0; font-size: 18px; }
.btn.wide { width: 100%; justify-content: center; }
.auth-links { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12.5px; }
.auth-foot { border-top: 1px solid var(--line); padding-top: 12px; font-size: 11.5px; }
.pw { position: relative; display: block; }
.pw input { width: 100%; box-sizing: border-box; padding-right: 56px; }
.pwshow { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.codein { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 24px; letter-spacing: .35em; text-align: center; padding: 10px 12px; width: 100%; box-sizing: border-box; }
.qrbox { display: grid; justify-items: center; gap: 8px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); text-align: center; }
.qrbox img { width: 180px; height: 180px; image-rendering: pixelated; }
.qrbox code { font-size: 12px; user-select: all; word-break: break-all; color: #222; }
.lockwrap { position: fixed; inset: 0; z-index: 400; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.lockwrap .lockcard { box-shadow: 0 24px 70px rgba(0,0,0,.18); }
/* Settings, Security */
.secgrid { display: grid; gap: 0; }
.secrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.secrow:first-child { border-top: 0; padding-top: 2px; }
.secrow .nm { font-weight: 600; font-size: 13.5px; }
.teamlist { display: grid; gap: 6px; }
.teamrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 13px; }
.teamrow .nm { font-weight: 600; }
.teamrow .sub { color: var(--muted); font-size: 12px; }
.teamrow .act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.teamrow .pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.teamrow .pill.off { background: color-mix(in srgb, var(--sev-warn) 15%, transparent); color: var(--sev-warn); }
.accesslog { display: grid; }
.logrow { display: grid; grid-template-columns: 130px 1fr 1fr 1fr; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.logrow:first-child { border-top: 0; }
.logrow .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--muted); }
@media (max-width: 640px) { .logrow { grid-template-columns: 1fr 1fr; } }

/* ===== Whose list: the practice on one board ===== */
.whochips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.whochip { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.whochip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.whochip .n { font-weight: 400; opacity: .8; }
.dayrow .clin { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; margin-right: 6px; flex: none; }
.dayrow .arrive { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.dayrow .arrive:hover { border-color: var(--accent); color: var(--accent); }
.status.arrived { background: color-mix(in srgb, var(--sev-ok, #3a8f5c) 16%, transparent); color: var(--sev-ok, #2f7a4c); }
.dayrow.st-arrived .t { color: var(--sev-ok, #2f7a4c); font-weight: 700; }
.clinhead { display: flex; align-items: baseline; gap: 8px; padding: 10px 6px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.clinhead .clin { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; }
.banner.ro { border-left: 3px solid var(--accent); background: var(--accent-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.ro #noteCard .bd, body.ro #argusCard .bd, body.ro #qlist { pointer-events: none; opacity: .92; }
.bookcard { width: min(640px, 100%); }
.asrows { display: grid; gap: 8px; }
.asrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.asrow .nm { font-weight: 600; }
.asrow .sub { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .asrow { grid-template-columns: 1fr; } }
/* where are you today, practices, reports */
.wherelist { display: grid; gap: 8px; }
.wherebtn { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; }
.wherebtn:hover, .wherebtn.pre { border-color: var(--accent); background: var(--accent-soft); }
.wherebtn .nm { font-weight: 600; font-size: 14px; }
.wherebtn .sub { color: var(--muted); font-size: 12px; }
.wherebtn .pill { grid-row: span 2; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.repgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: grid; gap: 2px; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.stat .k { color: var(--muted); font-size: 12px; }
.reptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.reptable th, .reptable td { text-align: left; padding: 7px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.reptable th { color: var(--muted); font-weight: 600; font-size: 12px; border-top: 0; }
.reptable td.n, .reptable th.n { text-align: right; font-variant-numeric: tabular-nums; }
.reptable .low { color: var(--sev-warn); font-weight: 600; }
.reptable button.linkbtn { font-size: 12px; }
ul.missed { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
/* ===== The desk ===== */
.deskgrid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.deskgrid .col { display: grid; gap: 12px; min-width: 0; }
@media (max-width: 900px) { .deskgrid { grid-template-columns: 1fr; } }
.desklive { min-height: 140px; max-height: 320px; overflow: auto; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; }
.desklive .partial { color: var(--muted); }
.desklist { display: grid; }
.desklist.plain { gap: 8px; }
.deskcard { display: grid; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.desklist.plain .deskcard { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; }
.deskcard:first-child { border-top: 0; }
.deskcard .dk-hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.deskcard .dk-hd .nm { font-weight: 600; }
.deskcard .dk-hd .kind { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.deskcard .dk-hd .kind.unmatched { background: color-mix(in srgb, var(--sev-warn) 15%, transparent); color: var(--sev-warn); }
.deskcard .dk-hd .kind.working { background: var(--surface-2); color: var(--muted); }
.deskcard .dk-sum { white-space: pre-wrap; line-height: 1.45; }
.deskcard .dk-clin { padding: 6px 10px; border-radius: 6px; background: var(--accent-soft); font-size: 12.5px; }
.deskcard .dk-acts { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.deskcard .dk-ft { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.deskcard .who { display: grid; gap: 6px; }
.deskcard .who .addname { position: relative; }
.rv-desk { color: var(--fg); }

/* dictation into any text box: one floating button that follows the box you are typing in */
.dictate { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; justify-items: end; gap: 8px; }
.dictate .dbtn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
.dictate .dbtn.on { background: var(--accent); color: #fff; border-color: transparent; }
.dictate .dbtn.on svg { animation: dictpulse 1.2s ease-in-out infinite; }
@keyframes dictpulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.dictate .dpartial { max-width: min(420px, 80vw); padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); font-size: 13px; }
#transcriptRun.edited { animation: dictpulse 1.6s ease-in-out infinite; }
.micin { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: .8; z-index: 2; padding: 0; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.micin:hover { opacity: 1; color: var(--fg); }
.micin.on { background: var(--accent); color: #fff; border-color: transparent; opacity: 1; box-shadow: 0 0 0 calc(2px + 6px * var(--lvl, 0)) var(--accent-soft); }
.micin.on svg { animation: dictpulse 1.2s ease-in-out infinite; }
textarea.dictating { outline: 2px solid var(--accent); outline-offset: 1px; }
