/* CareBook - calm, legible, accessible. No external assets (strict CSP). */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #1c2733;
  --ink-soft: #4a5866;
  --ink-faint: #788593;
  --line: #dde3e8;
  --accent: #3f6787;
  --brand-blue: #688da7;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf3;
  --accent-strong: #2f5470;
  --warn-bg: #fdf3e1;
  --warn-ink: #7a4b07;
  --err-bg: #fbe9e7;
  --err-ink: #8c2a1d;
  --ok-bg: #e5f3e8;
  --ok-ink: #22592f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 42, 46, .06), 0 4px 16px rgba(29, 42, 46, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { --bg: #11171d; --surface: #18212a; --surface-2: #1c2630; --ink: #e8eeef; --ink-soft: #b4c0c2;
    --ink-faint: #8a9799; --line: #2b3a47; --accent: #8fb2cc; --accent-ink: #0d1a24; --accent-soft: #1e2f3d;
    --accent-strong: #b3cde0; --warn-bg: #3a2d14; --warn-ink: #f2cf8f; --err-bg: #3b1f1b; --err-ink: #f3b2a7;
    --ok-bg: #1b3322; --ok-ink: #a9dcb4; --shadow: none; }
}
html[data-theme="dark"] { --bg: #11171d; --surface: #18212a; --surface-2: #1c2630; --ink: #e8eeef; --ink-soft: #b4c0c2;
    --ink-faint: #8a9799; --line: #2b3a47; --accent: #8fb2cc; --accent-ink: #0d1a24; --accent-soft: #1e2f3d;
    --accent-strong: #b3cde0; --warn-bg: #3a2d14; --warn-ink: #f2cf8f; --err-bg: #3b1f1b; --err-ink: #f3b2a7;
    --ok-bg: #1b3322; --ok-ink: #a9dcb4; --shadow: none; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.005em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.3rem; margin-top: 1.75rem; }
h3 { font-size: 1.05rem; font-family: var(--font); }
p { margin: 0 0 1rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); text-decoration: none; }
/* Company logo, transparent. Dark mode swaps in summit-logo-dark.png (black line art drawn light). */
.brand-logo { display: block; height: 84px; width: auto; margin: 4px 0; }
@media (max-width: 640px) { .brand-logo { height: 64px; } }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--accent-ink); border-radius: 1px; }
.brand-mark::before { left: 11px; top: 6px; width: 4px; height: 14px; }
.brand-mark::after { left: 6px; top: 11px; width: 14px; height: 4px; }
.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a, .nav .linkish { color: var(--ink-soft); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav .linkish:hover { background: var(--surface-2); color: var(--ink); }
.nav-user { font-weight: 600; color: var(--ink) !important; }
.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; color: var(--accent); padding: 0; }

.main { padding-top: 2rem; padding-bottom: 3rem; min-height: 70vh; }
.footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--ink-faint); font-size: .85rem; padding-top: 1rem; padding-bottom: 2rem; border-top: 1px solid var(--line); }

/* Idle warning */
.idle-warning { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--line); }
.idle-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; flex-wrap: wrap; }

/* Messages */
.messages { margin-bottom: 1.25rem; display: grid; gap: .5rem; }
.msg { margin: 0; padding: .75rem 1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); }
.msg-success { background: var(--ok-bg); color: var(--ok-ink); }
.msg-error { background: var(--err-bg); color: var(--err-ink); }
.msg-warning { background: var(--warn-bg); color: var(--warn-ink); }

/* Layout helpers */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: 0; color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--ink-faint); margin-bottom: .35rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .9rem; }
/* "· 11 cases pending" beside a heading: readable on the card, not as faint as other side notes (owner, 15 Nov) */
.count-pending { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin: 0 auto; }
.medium { max-width: 640px; margin: 0 auto; }
.auth-card { margin-top: 1.5rem; }
.auth-card h1 { font-size: 1.6rem; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .85rem 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.list > li:first-child { border-top: 0; }
.when { min-width: 9.5rem; font-weight: 600; }
.when small { display: block; font-weight: 400; color: var(--ink-soft); }
.empty { padding: 1.5rem; text-align: center; color: var(--ink-soft); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Badges */
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge-booked { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.badge-cancelled { background: var(--err-bg); color: var(--err-ink); border-color: transparent; }
.badge-completed { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.badge-no_show { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }

/* Forms */
.form { display: grid; gap: 1rem; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field .help { color: var(--ink-faint); font-size: .85rem; margin-top: .25rem; }
.field .errors { color: var(--err-ink); font-size: .88rem; margin: .3rem 0 0; padding: 0; list-style: none; }
.form-errors { background: var(--err-bg); color: var(--err-ink); padding: .7rem 1rem; border-radius: var(--radius); }
.form-errors ul { margin: 0; padding-left: 1.1rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=search], input[type=tel], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .6rem .75rem; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.code-input { font-size: 1.6rem !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: .6rem 1.1rem; min-height: 44px; cursor: pointer; }
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
/* pipeline sends (OCR/MedSum, transcription, Report Gen, PPI, Template report): deep orange, owner 19 Nov; white on #c2410c is 5.2:1 */
.btn-pipe { background: #c2410c; color: #ffffff; border-color: #c2410c; }
.btn-pipe:hover { background: #9a3412; border-color: #9a3412; color: #ffffff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }
.btn-danger { background: var(--surface); color: var(--err-ink); border-color: var(--err-ink); }
.btn-danger:hover { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-ink); }
.btn-small { min-height: 34px; padding: .3rem .75rem; font-size: .9rem; }
.btn-block { width: 100%; }

/* Week navigation */
.weeknav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.weeknav .range { font-weight: 600; min-width: 12rem; text-align: center; }
.btn[aria-disabled=true] { opacity: .4; pointer-events: none; }

/* Booking week: day columns of slot buttons */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .6rem; min-height: 8rem; }
.day-head { text-align: center; margin-bottom: .6rem; }
.day-head .dow { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.day-head .dom { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.day.today { border-color: var(--accent); }
.slots { display: grid; gap: .4rem; }
.slot { display: block; text-align: center; text-decoration: none; padding: .45rem .2rem; border-radius: 7px; border: 1px solid var(--accent); color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; font-size: .92rem; font-variant-numeric: tabular-nums; }
.slot:hover { background: var(--accent); color: var(--accent-ink); }
.day .none { text-align: center; color: var(--ink-faint); font-size: .85rem; margin-top: 1rem; }
@media (max-width: 820px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day-head { display: flex; gap: .6rem; align-items: baseline; text-align: left; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* Doctor schedule */
.sched-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; display: grid; grid-template-columns: 17rem 1fr; }
.sched-day.today { border-color: var(--accent); }
.sched-day.sched-nodate { grid-template-columns: 1fr; }  /* Record reviews: the List view's rows without the date column */
.sched-group { font-size: 1rem; margin: .5rem 0 .25rem; }
/* Clients: the office contact, under the top bar on every page */
.contact-bar { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .86rem; color: var(--ink-soft); padding: .3rem 0; }
.contact-bar .wrap { text-align: right; }
@media print { .contact-bar { display: none; } }
/* Licensed states with no exam site: record reviews and phone calls only */
:root { --map-lic: #d3e0c9; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --map-lic: #33463a; } }
html[data-theme="dark"] { --map-lic: #33463a; }
.usmap .has-lic { fill: var(--map-lic); }
.sw.has-lic { background: var(--map-lic); }
.remote-only { border-left: 4px solid var(--accent); }
/* First page: "just tell us what you need" */
.ask-card { clear: both; }
.ask-card label { display: block; margin-bottom: .4rem; }
.ask-card input[type="text"] { min-width: 12rem; }
.ask-card .faint { margin: .5rem 0 0; font-size: .85rem; }
/* Booking calendar: where the doctor is on an open date */
.cal-city { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--cal-edge, var(--accent-strong)); line-height: 1.2; overflow-wrap: anywhere; }
p.cal-city { font-size: .82rem; margin: -.2rem 0 .5rem; }
/* Due within three days (or past due): the name is bold and red (owner, 14 Nov) */
:root { --due-soon: #c62828; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --due-soon: #ff6b6b; } }
html[data-theme="dark"] { --due-soon: #ff6b6b; }
.due-soon, .sched-item .who.due-soon { color: var(--due-soon); font-weight: 800; }
.todo-due { flex: none; width: 9.5rem; font-weight: 600; font-size: .9rem; }
.todo-due small { display: block; font-weight: 400; color: var(--ink-faint); }
#today { scroll-margin-top: 1rem; }
.sched-site { margin-top: .75rem; padding-top: .65rem; border-top: 1px solid var(--line); font-size: .88rem; line-height: 1.4; }
.sched-site > div { display: block; }
.sched-site .site-name { font-weight: 600; color: var(--accent-strong); }
.sched-site .site-hours { font-weight: 600; font-variant-numeric: tabular-nums; margin: .15rem 0 .3rem; }
.sched-site .site-addr { color: var(--ink-faint); }
.sched-site .site-full { margin-top: .4rem; color: var(--ink-faint); font-style: italic; }
.sched-date { padding: 1rem; border-right: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) 0 0 var(--radius); }
.sched-date .dow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.sched-date .dom { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.sched-items { padding: .5rem 1rem; }
.sched-item { display: flex; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); align-items: baseline; flex-wrap: wrap; text-decoration: none; color: inherit; }
.sched-item:first-child { border-top: 0; }
a.sched-item:hover .who { text-decoration: underline; }
.sched-item .t { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 8.5rem; white-space: nowrap; }
.sched-item .who { font-weight: 600; color: var(--accent-strong); }
.sched-item.off { color: var(--warn-ink); }
.sched-case.st-confirmed { box-shadow: inset 4px 0 var(--conf-line); }
.sched-case.st-hold { box-shadow: inset 4px 0 var(--unconf-line); background: var(--unconf-bg) !important; }
.sched-empty { color: var(--ink-faint); padding: .6rem 0; font-size: .92rem; }
@media (max-width: 640px) {
  .sched-day { grid-template-columns: 1fr; }
  .sched-date { border-right: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; display: flex; gap: .6rem; align-items: baseline; padding: .6rem 1rem; }
}

/* Stats */
.stats { display: flex; gap: .75rem; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; }
.stat b { font-family: var(--serif); font-size: 1.4rem; display: block; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--ink-soft); }

/* Details */
.details { display: grid; grid-template-columns: 9rem 1fr; gap: .6rem 1rem; margin: 0; }
.details dt { color: var(--ink-soft); font-size: .92rem; }
.details dd { margin: 0; font-weight: 500; }
.reason { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: .75rem; border: 1px solid var(--line); font-weight: 400; }
@media (max-width: 520px) { .details { grid-template-columns: 1fr; } .details dt { margin-top: .5rem; } }

/* Doctor directory */
.doctors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.doctor-card { display: flex; flex-direction: column; gap: .4rem; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-family: var(--serif); font-size: 1.1rem; }
.doctor-card .spec { color: var(--ink-soft); font-size: .92rem; margin: 0; }
.doctor-card .bio { font-size: .92rem; color: var(--ink-soft); flex: 1; }

/* MFA */
.qr { display: block; width: 210px; height: 210px; margin: .5rem auto 1rem; background: #fff; border-radius: 8px; padding: 6px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: .5rem .7rem; border-radius: 6px; border: 1px solid var(--line); word-break: break-all; display: block; text-align: center; letter-spacing: .05em; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .5rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-top: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); border-top: 0; }
.table-wrap { overflow-x: auto; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: .8rem 1rem; color: var(--ink); }
[data-mt] { margin-top: 1rem; }
[data-center] { text-align: center; }
[data-mb] { margin-bottom: 1rem; }

/* ---- Medical-legal scheduling additions ---- */
:root { --map-0: #e3e8ec; --map-1: #bed0de; --map-3: #3f6787; --hold: #b26b00; --hold-bg: #fdf0db; }
/* Unconfirmed cases light blue, confirmed orange, everywhere a case is drawn (owner, 1 Dec) */
:root { --unconf: #134f80; --unconf-bg: #d6ecff; --unconf-line: #4aa3e8; --conf: #8a3a00; --conf-bg: #ffd6ad; --conf-line: #f07c1a; }
:root { --map-2: #688da7; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { --map-0: #26313b; --map-1: #2c4559; --map-2: #4a7090; --map-3: #8fb2cc; --hold: #f0b75c; --hold-bg: #3a2c12; }
  html:not([data-theme="light"]) { --unconf: #d3eaff; --unconf-bg: #17405f; --unconf-line: #5ab0f0; --conf: #ffd8b0; --conf-bg: #5c3110; --conf-line: #f08a2c; }
}
html[data-theme="dark"] { --map-0: #26313b; --map-1: #2c4559; --map-2: #4a7090; --map-3: #8fb2cc; --hold: #f0b75c; --hold-bg: #3a2c12; }
html[data-theme="dark"] { --unconf: #d3eaff; --unconf-bg: #17405f; --unconf-line: #5ab0f0; --conf: #ffd8b0; --conf-bg: #5c3110; --conf-line: #f08a2c; }
.grow { flex: 1; min-width: 12rem; }
.map-card { padding: 1rem; }
.usmap { width: 100%; height: auto; display: block; }
.usmap .st { stroke: var(--surface); stroke-width: 1; transition: fill .12s; }
.usmap .has-0 { fill: var(--map-0); }
.usmap .has-1 { fill: var(--map-1); }
.usmap .has-2 { fill: var(--map-2); }
.usmap .has-3 { fill: var(--map-3); }
.usmap a:hover .st, .usmap a:focus .st { fill: var(--accent-strong); }
.usmap a:focus { outline: none; }
.usmap a:focus-visible .st { stroke: var(--ink); stroke-width: 2.5; }
.usmap .st-label { font: 600 11px var(--font); fill: var(--ink-soft); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.usmap .st-label.on { fill: #fff; }
.map-legend { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--ink-soft); margin-top: .5rem; }
.map-legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: -.6rem; vertical-align: -2px; }
.sw.has-0 { background: var(--map-0); } .sw.has-1 { background: var(--map-1); } .sw.has-2 { background: var(--map-2); } .sw.has-3 { background: var(--map-3); }
.chips { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; gap: .5rem; align-items: center; padding: .4rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .92rem; }
a.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip b { background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.tile-count { color: var(--ink-soft); font-size: .88rem; }
.filters select, .filters input { width: auto; min-width: 10rem; }
.date-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.date-chip { font-size: .82rem; padding: .25rem .55rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; font-weight: 600; }
.date-chip:hover { background: var(--accent); color: var(--accent-ink); }
.avatar-lg { width: 60px; height: 60px; font-size: 1.4rem; }
/* Search: "Available from" and "to" always sit side by side, "to" on the right (owner, 15 Nov). Two columns, or four
   on a wide screen; the case type takes two so the dates end the last row together. */
.search-form .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.search-form .field-case_type { grid-column: span 2; }
@media (min-width: 1100px) { .search-form .field-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.search-form .field-row input, .search-form .field-row select { width: 100%; min-width: 0; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.filters-card { display: grid; gap: .75rem; margin-bottom: 1rem; }
.seg { display: flex; flex-wrap: wrap; gap: .35rem; }
.seg-btn { font: inherit; font-weight: 600; font-size: .9rem; padding: .45rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; min-height: 38px; }
a.seg-btn { text-decoration: none; display: inline-flex; align-items: center; }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.cal-head h2 { margin: 0; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; padding-bottom: .2rem; }
.cal td { height: 76px; vertical-align: top; border-radius: 8px; background: var(--surface-2); padding: 0; font-size: .8rem; }
.cal td.out { background: transparent; }
.cal td > a, .cal td > .dnum { display: block; }
.cal td > a { height: 100%; padding: .35rem; text-decoration: none; color: var(--ink); border-radius: 8px; }
.cal td .dnum { font-weight: 600; color: var(--ink-faint); }
.cal td:not(:has(a)) .dnum { padding: .35rem; }
.cal td.open { background: var(--accent-soft); }
.cal td.open .dnum { color: var(--ink); }
.cal td.open > a:hover { outline: 2px solid var(--accent); }
.cal td.sel { outline: 2px solid var(--accent); }
.cal td.today .dnum { text-decoration: underline; text-underline-offset: 3px; }
.open-tag { display: block; margin-top: .2rem; color: var(--accent-strong); font-weight: 600; font-size: .75rem; }
.mine-tag { display: block; margin-top: .2rem; background: var(--hold-bg); color: var(--hold); border-radius: 4px; padding: 0 .3rem; font-weight: 600; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-note { margin: .6rem 0 0; }
.legend-open, .legend-mine { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.legend-open { background: var(--accent-soft); border: 1px solid var(--accent); }
.legend-mine { background: var(--hold-bg); border: 1px solid var(--hold); }
@media (max-width: 560px) { .cal td { height: 54px; } .open-tag, .mine-tag { font-size: .66rem; } }
.slots { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.slot small { display: block; font-weight: 400; font-size: .72rem; color: var(--ink-soft); }
.mine-row { display: block; padding: .5rem .6rem; border-radius: 8px; background: var(--hold-bg); color: var(--ink); text-decoration: none; margin-bottom: .5rem; font-size: .92rem; }
.callout.small { font-size: .85rem; margin-top: 1rem; }
.terms { padding: .75rem 0; border-top: 1px solid var(--line); }
.terms:first-of-type { border-top: 0; }
.terms-head { display: flex; justify-content: space-between; gap: .5rem; }
.terms-fee { font-weight: 600; margin: .15rem 0 .3rem; }
.tiers { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .9rem; color: var(--ink-soft); }
.rule { margin: 1rem 0 0; padding: .75rem 1rem; border-radius: var(--radius); background: var(--accent-soft); font-size: .95rem; }
.rule-immediate { background: var(--warn-bg); color: var(--warn-ink); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.field ul[id] { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .3rem .75rem; }
.field ul[id] label { font-weight: 400; display: flex; gap: .5rem; align-items: center; margin: 0; }
.badge-hold { background: var(--unconf-bg); color: var(--unconf); border-color: transparent; }
.badge-confirmed { background: var(--conf-bg); color: var(--conf); border-color: transparent; }
.card-hold { border-color: var(--unconf-line); }
.hold-callout { background: var(--unconf-bg); color: var(--ink); }
.penalty { padding: 1rem; border-radius: var(--radius); margin-top: .75rem; }
.penalty p { margin: .2rem 0 0; font-weight: 600; }
.penalty-free { background: var(--ok-bg); color: var(--ok-ink); }
.penalty-due { background: var(--err-bg); color: var(--err-ink); }
.toc { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toc a { font-size: .9rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; background: var(--surface); }
.svc { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-top: 1rem; background: var(--surface-2); }
.svc h3 { margin-bottom: .6rem; }
.svc .field-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: .6rem; }
.svc .field-row .field:has(input[type=checkbox]) { display: flex; align-items: center; gap: .5rem; flex-direction: row-reverse; justify-content: flex-end; }
.tiers-edit { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .75rem; }
.tier-add { align-items: flex-end; margin-top: .5rem; }
.tier-add .field { min-width: 140px; }
.card-new { border-color: var(--accent); }
.selectable { user-select: all; text-align: left; font-size: .85rem; }
.sched-item.avail { color: var(--accent-strong); }
.field > div[id] { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .3rem .75rem; }
.field > div[id] label { font-weight: 400; display: flex; gap: .5rem; align-items: center; margin: 0; font-size: .92rem; }
.upload-row input[type=file] { flex: 1; min-width: 200px; font: inherit; font-size: .9rem; }
.field input[type=file] { font: inherit; font-size: .92rem; padding: .5rem; border: 1px dashed var(--line); border-radius: 8px; width: 100%; background: var(--surface-2); }
.field > div[id] input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot th { border-top: 1px solid var(--line); font-size: .92rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.bill-group { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.bill-group:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.bill-group h3 { margin: 0; }
.small-msg { font-size: .88rem; margin: .5rem 0; }
.stat-strong { border-color: var(--accent); }
.inv-draft, .inv-void { background: var(--surface-2); color: var(--ink-soft); }
.inv-open, .inv-partial { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.inv-overdue { background: var(--err-bg); color: var(--err-ink); border-color: transparent; }
.inv-paid { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.inv-brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.inv-meta { display: grid; grid-template-columns: auto auto; gap: .2rem 1rem; margin: 0; font-size: .92rem; }
.inv-meta dt { color: var(--ink-soft); } .inv-meta dd { margin: 0; font-weight: 600; }
.print-page { background: #fff; color: #111; }
@media print { .topbar, .footer, .idle-warning, .page-head .row, aside { display: none !important; } body { background: #fff; } .card { box-shadow: none; border: 0; } }
.amt { width: 8rem !important; min-width: 0; }

/* Reports */
.big-search { display: flex; }
.big-search input { flex: 1; font-size: 1.1rem; min-height: 52px; }
.more-filters summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-top: .75rem; }
.chg { font-weight: 600; font-size: .85rem; white-space: nowrap; }
.chg.up { color: var(--ok-ink); } .chg.down { color: var(--err-ink); }
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark i { display: block; width: 6px; background: var(--map-2); border-radius: 1px; }
.spark-up i:last-child, .spark-up i:nth-last-child(2), .spark-up i:nth-last-child(3) { background: var(--accent-strong); }
.spark-down i:last-child, .spark-down i:nth-last-child(2), .spark-down i:nth-last-child(3) { background: #c56a5a; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: .5rem; align-items: end; height: 180px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; }
.bar i { display: block; width: 70%; max-width: 48px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-n { font-size: .8rem; font-weight: 600; } .bar-m { font-size: .75rem; color: var(--ink-faint); }
.spark i.h0 { height: 2%; } .bar i.h0 { height: 2%; }
.spark i.h1 { height: 10%; } .bar i.h1 { height: 10%; }
.spark i.h2 { height: 20%; } .bar i.h2 { height: 20%; }
.spark i.h3 { height: 30%; } .bar i.h3 { height: 30%; }
.spark i.h4 { height: 40%; } .bar i.h4 { height: 40%; }
.spark i.h5 { height: 50%; } .bar i.h5 { height: 50%; }
.spark i.h6 { height: 60%; } .bar i.h6 { height: 60%; }
.spark i.h7 { height: 70%; } .bar i.h7 { height: 70%; }
.spark i.h8 { height: 80%; } .bar i.h8 { height: 80%; }
.spark i.h9 { height: 90%; } .bar i.h9 { height: 90%; }
.spark i.h10 { height: 100%; } .bar i.h10 { height: 100%; }
.count { display: inline-block; font-family: var(--font); font-size: .8rem; background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; padding: .05rem .55rem; vertical-align: middle; margin-left: .3rem; }

/* Year view: twelve small months */
.yeargrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.minimonth { padding: .8rem .9rem; }
.minimonth h2 { font-size: 1rem; margin: 0 0 .4rem; }
.minimonth h2 a { color: inherit; text-decoration: none; }
.minimonth h2 a:hover { text-decoration: underline; }
.mini { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: .8rem; text-align: center; }
.mini th { font-size: .68rem; color: var(--ink-faint); font-weight: 600; }
.mini td { height: 28px; border-radius: 6px; padding: 0; position: relative; }
.mini td a { display: block; line-height: 28px; border-radius: 6px; text-decoration: none; color: var(--ink-soft); }
.mini td a:hover { outline: 2px solid var(--accent); }
.mini td.booked a::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--ink-faint); }
.mini td.site a, .mini td.open a { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.mini td.mine a { background: var(--hold-bg); color: var(--hold); font-weight: 700; }
.mini td.sel a { outline: 2px solid var(--accent); }
.mini td.today a { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; color: var(--ink); }
.legend-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); vertical-align: 2px; margin: 0 3px; }
/* Hour grid (Day and Week views). Positions are classes because inline styles are blocked by the CSP. */
.tg { --q: 11px; position: relative; max-height: 76vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tg-head, .tg-body { display: grid; grid-template-columns: 4rem repeat(7, minmax(0, 1fr)); }
.tg-1 .tg-head, .tg-1 .tg-body { grid-template-columns: 4rem minmax(0, 1fr); }
.tg-head { position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.tg-corner { font-size: .62rem; color: var(--ink-faint); padding: .5rem .3rem; text-align: right; align-self: end; }
.tg-dayhead { padding: .4rem .35rem .35rem; border-left: 1px solid var(--line); min-width: 0; }
.tg-date { text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .9rem; display: inline-block; padding: .1rem .35rem; border-radius: 999px; }
.tg-date .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.tg-date:hover { background: var(--accent-soft); }
.tg-dayhead.today .tg-date { background: var(--accent); color: var(--accent-ink); }
.tg-dayhead.today .tg-date .dow { color: inherit; }
.tg-dayhead.sel { box-shadow: inset 0 -3px 0 var(--accent); }
.tg-banner { margin-top: .25rem; background: var(--accent-soft); color: var(--accent-strong); border-left: 3px solid var(--accent); border-radius: 4px; padding: .1rem .35rem; font-size: .72rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-1 .tg-banner { white-space: normal; font-size: .82rem; }
.tg-banner.full { background: var(--surface); color: var(--ink-faint); border-left-color: var(--ink-faint); }
.tg-rows { display: grid; grid-template-rows: repeat(96, var(--q)); grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 2px;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent calc(var(--q) * 4)); }
.tg-gutter { background-image: none; }
.tg-col { border-left: 1px solid var(--line); padding: 0 2px 0 1px; min-width: 0; }
.tg-col.today { background-color: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.tg-hour { grid-column: 1 / -1; font-size: .68rem; color: var(--ink-faint); text-align: right; padding-right: .4rem; transform: translateY(-.55em); white-space: nowrap; }
.tg-ev { min-width: 0; overflow: hidden; border-radius: 4px; padding: 0 4px; font-size: .72rem; line-height: 13px; text-decoration: none; margin-bottom: 1px;
  background: var(--warn-bg); color: var(--warn-ink); border-left: 3px solid var(--warn-ink); z-index: 1; }
.tg-ev b { font-weight: 600; }
.tg-ev small { font-size: .66rem; opacity: .85; }
.tg-7 .tg-ev small { display: block; }
.tg-ev.case, .tg-ev.mine { background: var(--hold-bg); color: var(--hold); border-left-color: var(--hold); }
.tg-ev.personal { background: var(--surface-2); color: var(--ink-soft); border-left-color: var(--ink-faint); }
.tg-ev.open { background: var(--accent-soft); color: var(--accent-strong); border: 1px dashed var(--accent); border-left: 3px solid var(--accent); }
a.tg-ev:hover { outline: 2px solid var(--accent); z-index: 2; }
/* day view, office: the case block opens the case; "Move…" beside it moves it (owner, 19 Nov) */
.tg-ev.has-move { display: flex; align-items: flex-start; gap: .4rem; }
.tg-ev.has-move:hover { outline: 2px solid var(--accent); z-index: 2; }
.tg-ev.has-move .tg-open { flex: 1; min-width: 0; overflow: hidden; color: inherit; text-decoration: none; }
.tg-ev.has-move .tg-move { flex: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
/* Month view: a box per day with its first few appointments */
.mcal-card { padding: .5rem; }
.mcal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mcal th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; text-align: right; padding: .2rem .5rem .4rem; }
.mcal td { border: 1px solid var(--line); vertical-align: top; height: 8.6rem; padding: .25rem .3rem .3rem; font-size: .74rem; }
.mcal td.out { background: var(--surface-2); }
.m-num { display: block; width: max-content; margin-left: auto; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .85rem; padding: 0 .4rem; border-radius: 999px; }
.m-num:hover { background: var(--accent-soft); }
.mcal td.today .m-num { background: var(--accent); color: var(--accent-ink); }
.mcal .tg-banner { margin: .15rem 0; }
.m-ev { display: flex; gap: .4rem; justify-content: space-between; text-decoration: none; color: var(--warn-ink); border-left: 3px solid var(--warn-ink); padding-left: .3rem; margin-top: 2px; line-height: 1.35; }
.m-ev.case { color: var(--hold); border-left-color: var(--hold); }
.m-ev.personal { color: var(--ink-soft); border-left-color: var(--ink-faint); }
.m-ev .m-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.m-ev .m-at { color: var(--ink-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
a.m-ev:hover .m-t { text-decoration: underline; }
.m-more { display: block; margin-top: 2px; padding-left: .5rem; color: var(--ink-faint); text-decoration: none; }
.m-more:hover { text-decoration: underline; }
@media (max-width: 760px) { .tg-head, .tg-body { min-width: 760px; } .mcal td { height: 6rem; } .m-ev .m-at { display: none; } }

.rs-0{grid-row-start:1}.rs-1{grid-row-start:2}.rs-2{grid-row-start:3}.rs-3{grid-row-start:4}.rs-4{grid-row-start:5}.rs-5{grid-row-start:6}.rs-6{grid-row-start:7}.rs-7{grid-row-start:8}.rs-8{grid-row-start:9}.rs-9{grid-row-start:10}.rs-10{grid-row-start:11}.rs-11{grid-row-start:12}.rs-12{grid-row-start:13}.rs-13{grid-row-start:14}.rs-14{grid-row-start:15}.rs-15{grid-row-start:16}.rs-16{grid-row-start:17}.rs-17{grid-row-start:18}.rs-18{grid-row-start:19}.rs-19{grid-row-start:20}.rs-20{grid-row-start:21}.rs-21{grid-row-start:22}.rs-22{grid-row-start:23}.rs-23{grid-row-start:24}.rs-24{grid-row-start:25}.rs-25{grid-row-start:26}.rs-26{grid-row-start:27}.rs-27{grid-row-start:28}.rs-28{grid-row-start:29}.rs-29{grid-row-start:30}.rs-30{grid-row-start:31}.rs-31{grid-row-start:32}.rs-32{grid-row-start:33}.rs-33{grid-row-start:34}.rs-34{grid-row-start:35}.rs-35{grid-row-start:36}.rs-36{grid-row-start:37}.rs-37{grid-row-start:38}.rs-38{grid-row-start:39}.rs-39{grid-row-start:40}.rs-40{grid-row-start:41}.rs-41{grid-row-start:42}.rs-42{grid-row-start:43}.rs-43{grid-row-start:44}.rs-44{grid-row-start:45}.rs-45{grid-row-start:46}.rs-46{grid-row-start:47}.rs-47{grid-row-start:48}.rs-48{grid-row-start:49}.rs-49{grid-row-start:50}.rs-50{grid-row-start:51}.rs-51{grid-row-start:52}.rs-52{grid-row-start:53}.rs-53{grid-row-start:54}.rs-54{grid-row-start:55}.rs-55{grid-row-start:56}.rs-56{grid-row-start:57}.rs-57{grid-row-start:58}.rs-58{grid-row-start:59}.rs-59{grid-row-start:60}.rs-60{grid-row-start:61}.rs-61{grid-row-start:62}.rs-62{grid-row-start:63}.rs-63{grid-row-start:64}.rs-64{grid-row-start:65}.rs-65{grid-row-start:66}.rs-66{grid-row-start:67}.rs-67{grid-row-start:68}.rs-68{grid-row-start:69}.rs-69{grid-row-start:70}.rs-70{grid-row-start:71}.rs-71{grid-row-start:72}.rs-72{grid-row-start:73}.rs-73{grid-row-start:74}.rs-74{grid-row-start:75}.rs-75{grid-row-start:76}.rs-76{grid-row-start:77}.rs-77{grid-row-start:78}.rs-78{grid-row-start:79}.rs-79{grid-row-start:80}.rs-80{grid-row-start:81}.rs-81{grid-row-start:82}.rs-82{grid-row-start:83}.rs-83{grid-row-start:84}.rs-84{grid-row-start:85}.rs-85{grid-row-start:86}.rs-86{grid-row-start:87}.rs-87{grid-row-start:88}.rs-88{grid-row-start:89}.rs-89{grid-row-start:90}.rs-90{grid-row-start:91}.rs-91{grid-row-start:92}.rs-92{grid-row-start:93}.rs-93{grid-row-start:94}.rs-94{grid-row-start:95}.rs-95{grid-row-start:96}
.re-1{grid-row-end:2}.re-2{grid-row-end:3}.re-3{grid-row-end:4}.re-4{grid-row-end:5}.re-5{grid-row-end:6}.re-6{grid-row-end:7}.re-7{grid-row-end:8}.re-8{grid-row-end:9}.re-9{grid-row-end:10}.re-10{grid-row-end:11}.re-11{grid-row-end:12}.re-12{grid-row-end:13}.re-13{grid-row-end:14}.re-14{grid-row-end:15}.re-15{grid-row-end:16}.re-16{grid-row-end:17}.re-17{grid-row-end:18}.re-18{grid-row-end:19}.re-19{grid-row-end:20}.re-20{grid-row-end:21}.re-21{grid-row-end:22}.re-22{grid-row-end:23}.re-23{grid-row-end:24}.re-24{grid-row-end:25}.re-25{grid-row-end:26}.re-26{grid-row-end:27}.re-27{grid-row-end:28}.re-28{grid-row-end:29}.re-29{grid-row-end:30}.re-30{grid-row-end:31}.re-31{grid-row-end:32}.re-32{grid-row-end:33}.re-33{grid-row-end:34}.re-34{grid-row-end:35}.re-35{grid-row-end:36}.re-36{grid-row-end:37}.re-37{grid-row-end:38}.re-38{grid-row-end:39}.re-39{grid-row-end:40}.re-40{grid-row-end:41}.re-41{grid-row-end:42}.re-42{grid-row-end:43}.re-43{grid-row-end:44}.re-44{grid-row-end:45}.re-45{grid-row-end:46}.re-46{grid-row-end:47}.re-47{grid-row-end:48}.re-48{grid-row-end:49}.re-49{grid-row-end:50}.re-50{grid-row-end:51}.re-51{grid-row-end:52}.re-52{grid-row-end:53}.re-53{grid-row-end:54}.re-54{grid-row-end:55}.re-55{grid-row-end:56}.re-56{grid-row-end:57}.re-57{grid-row-end:58}.re-58{grid-row-end:59}.re-59{grid-row-end:60}.re-60{grid-row-end:61}.re-61{grid-row-end:62}.re-62{grid-row-end:63}.re-63{grid-row-end:64}.re-64{grid-row-end:65}.re-65{grid-row-end:66}.re-66{grid-row-end:67}.re-67{grid-row-end:68}.re-68{grid-row-end:69}.re-69{grid-row-end:70}.re-70{grid-row-end:71}.re-71{grid-row-end:72}.re-72{grid-row-end:73}.re-73{grid-row-end:74}.re-74{grid-row-end:75}.re-75{grid-row-end:76}.re-76{grid-row-end:77}.re-77{grid-row-end:78}.re-78{grid-row-end:79}.re-79{grid-row-end:80}.re-80{grid-row-end:81}.re-81{grid-row-end:82}.re-82{grid-row-end:83}.re-83{grid-row-end:84}.re-84{grid-row-end:85}.re-85{grid-row-end:86}.re-86{grid-row-end:87}.re-87{grid-row-end:88}.re-88{grid-row-end:89}.re-89{grid-row-end:90}.re-90{grid-row-end:91}.re-91{grid-row-end:92}.re-92{grid-row-end:93}.re-93{grid-row-end:94}.re-94{grid-row-end:95}.re-95{grid-row-end:96}.re-96{grid-row-end:97}
.ov-1-0{grid-column:1 / span 12}.ov-2-0{grid-column:1 / span 6}.ov-2-1{grid-column:7 / span 6}.ov-3-0{grid-column:1 / span 4}.ov-3-1{grid-column:5 / span 4}.ov-3-2{grid-column:9 / span 4}.ov-4-0{grid-column:1 / span 3}.ov-4-1{grid-column:4 / span 3}.ov-4-2{grid-column:7 / span 3}.ov-4-3{grid-column:10 / span 3}.ov-6-0{grid-column:1 / span 2}.ov-6-1{grid-column:3 / span 2}.ov-6-2{grid-column:5 / span 2}.ov-6-3{grid-column:7 / span 2}.ov-6-4{grid-column:9 / span 2}.ov-6-5{grid-column:11 / span 2}
/* The doctor's Week, Day and Month grids use the full window width, not the page's reading width. */
.wide { position: relative; left: 50%; transform: translateX(-50%); width: min(calc(100vw - 32px), 1600px); }
/* Dashboard: today's doctors */
.dayboard-head { align-items: center; gap: .4rem; }
.dayboard-head h2 { margin: 0; }
.dayboard-pick { align-items: center; gap: .6rem; margin: .8rem 0 .4rem; flex-wrap: wrap; }
.dayboard-pick label { font-weight: 600; }
.dayboard-pick select { min-width: 18rem; max-width: 100%; }
.dayboard-site { margin: .5rem 0; padding: .45rem .7rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 4px; }
.dayboard-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.dayboard-list li { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; padding: .45rem 0; border-top: 1px solid var(--line); }
.dayboard-list li:first-child { border-top: 0; }
.dayboard-list .t { min-width: 8.5rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Office master calendar: doctor pull-down under the title */
.cal-picker { align-items: center; gap: .6rem; margin-top: .3rem; }
.cal-picker select { font-size: 1.05rem; font-weight: 600; min-width: 16rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --- Busy schedules: alternate two blues so neighbouring entries are easy to tell apart,
   and pack rows tighter so a full day fits without scrolling (owner's request, 14 Nov). --- */
:root { --zebra-1: #e8f0f6; --zebra-2: #d3e1ec; --case-1: #dbe7f1; --case-1-ink: #24425c; --case-2: #3f6787; --case-2-ink: #ffffff; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { --zebra-1: #17212b; --zebra-2: #1e2c39; --case-1: #2a4256; --case-1-ink: #e3eef7; --case-2: #8fb2cc; --case-2-ink: #0d1a24; }
}
html[data-theme="dark"] { --zebra-1: #17212b; --zebra-2: #1e2c39; --case-1: #2a4256; --case-1-ink: #e3eef7; --case-2: #8fb2cc; --case-2-ink: #0d1a24; }
/* Lists of cases (dashboard, client page, my cases) and the doctor's day list */
.list > li { padding: .4rem .6rem; gap: .75rem; border-top: 0; }
.list > li:nth-child(odd) { background: var(--zebra-1); }
.list > li:nth-child(even) { background: var(--zebra-2); }
.list > li .when { min-width: 8.5rem; }
.list > li .btn-small { padding: .2rem .55rem; min-height: 0; }
.dayboard-list li { padding: .3rem .6rem; border-top: 0; }
.dayboard-list li:nth-child(odd) { background: var(--zebra-1); }
.dayboard-list li:nth-child(even) { background: var(--zebra-2); }
.sched-item { padding: .3rem .5rem; border-top: 0; }
.sched-items > .sched-item:nth-child(odd) { background: var(--zebra-1); }
.sched-items > .sched-item:nth-child(even) { background: var(--zebra-2); }
.sched-day { margin-bottom: .5rem; }
/* Hour grid: cases alternate light and dark blue */
.tg-ev { font-size: .66rem; line-height: 10px; padding: 0 3px; }
.tg-ev.case:nth-of-type(odd), .tg-ev.mine:nth-of-type(odd) { background: var(--case-1); color: var(--case-1-ink); border-left-color: var(--case-2); }
.tg-ev.case:nth-of-type(even), .tg-ev.mine:nth-of-type(even) { background: var(--case-2); color: var(--case-2-ink); border-left-color: var(--case-1-ink); }
.tg-7 .tg-ev small { display: none; }
.tg-1 .tg-ev small { display: inline; }
/* Month boxes */
.mcal td { height: 7rem; font-size: .7rem; }
.m-ev { margin-top: 1px; padding: 0 .3rem; border-radius: 3px; }
.m-ev.case:nth-of-type(odd) { background: var(--case-1); color: var(--case-1-ink); border-left-color: var(--case-2); }
.m-ev.case:nth-of-type(even) { background: var(--case-2); color: var(--case-2-ink); border-left-color: var(--case-1-ink); }
.m-ev.case:nth-of-type(even) .m-at { color: inherit; opacity: .8; }

/* --- Calendar blocks, revised (owner, 14 Nov): blue on blue was hard on the eyes. Cases use
   warm yellow text, the colour that read best, on two alternating backgrounds (amber tint and
   slate) so neighbours stay distinct; other calendar items are plain grey. --- */
:root { --cal-a: #ebbc5e; --cal-b: #a3b8d0; --cal-ink: #3d2400; --cal-edge: #8a5200; --cal-other: #f1f3f5; --cal-other-ink: #4a5866; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { --cal-a: #7a5c24; --cal-b: #46628a; --cal-ink: #fff4d6; --cal-edge: #f0b44a; --cal-other: #1c252d; --cal-other-ink: #aab6c0; }
}
html[data-theme="dark"] { --cal-a: #7a5c24; --cal-b: #46628a; --cal-ink: #fff4d6; --cal-edge: #f0b44a; --cal-other: #1c252d; --cal-other-ink: #aab6c0; }
.tg-ev.case:nth-of-type(odd), .tg-ev.mine:nth-of-type(odd), .m-ev.case:nth-of-type(odd) { background: var(--cal-a); color: var(--cal-ink); border-left-color: var(--cal-edge); }
.tg-ev.case:nth-of-type(even), .tg-ev.mine:nth-of-type(even), .m-ev.case:nth-of-type(even) { background: var(--cal-b); color: var(--cal-ink); border-left-color: var(--cal-edge); }
.m-ev.case:nth-of-type(even) .m-at { color: var(--ink-faint); opacity: 1; }
.tg-ev.case b, .tg-ev.mine b, .m-ev.case .m-t { font-weight: 700; }
.tg-ev { font-size: .7rem; line-height: 11px; }
.tg-ev.busy, .m-ev.busy { background: var(--cal-other); color: var(--cal-other-ink); border-left-color: var(--ink-faint); }
.tg-ev.personal, .m-ev.personal { background: var(--cal-other); color: var(--cal-other-ink); border-left: 3px dotted var(--ink-faint); }
.tg-ev.open { background: transparent; color: var(--ink); border: 1px dashed var(--accent); border-left: 3px solid var(--accent); font-weight: 600; }
/* Text fills its block (owner, 14 Nov): a 30-minute block holds one full line of 14-15px text. */
.tg { --q: 12px; max-height: 80vh; }
.tg-ev { font-size: 14px; line-height: 21px; padding: 0 5px; white-space: nowrap; text-overflow: ellipsis; }
.tg-ev b { font-weight: 700; }
.tg-ev small { font-size: 12px; }
.tg-1 .tg-ev { font-size: 15px; line-height: 22px; }
.tg-7 .tg-ev small { display: none; }
.m-ev { font-size: 12.5px; line-height: 1.4; }
.mcal td { height: 8rem; }
.tg-ev.rs-0.re-1, .tg-ev.rs-1.re-2, .tg-ev.rs-2.re-3, .tg-ev.rs-3.re-4, .tg-ev.rs-4.re-5, .tg-ev.rs-5.re-6, .tg-ev.rs-6.re-7, .tg-ev.rs-7.re-8, .tg-ev.rs-8.re-9, .tg-ev.rs-9.re-10, .tg-ev.rs-10.re-11, .tg-ev.rs-11.re-12, .tg-ev.rs-12.re-13, .tg-ev.rs-13.re-14, .tg-ev.rs-14.re-15, .tg-ev.rs-15.re-16, .tg-ev.rs-16.re-17, .tg-ev.rs-17.re-18, .tg-ev.rs-18.re-19, .tg-ev.rs-19.re-20, .tg-ev.rs-20.re-21, .tg-ev.rs-21.re-22, .tg-ev.rs-22.re-23, .tg-ev.rs-23.re-24, .tg-ev.rs-24.re-25, .tg-ev.rs-25.re-26, .tg-ev.rs-26.re-27, .tg-ev.rs-27.re-28, .tg-ev.rs-28.re-29, .tg-ev.rs-29.re-30, .tg-ev.rs-30.re-31, .tg-ev.rs-31.re-32, .tg-ev.rs-32.re-33, .tg-ev.rs-33.re-34, .tg-ev.rs-34.re-35, .tg-ev.rs-35.re-36, .tg-ev.rs-36.re-37, .tg-ev.rs-37.re-38, .tg-ev.rs-38.re-39, .tg-ev.rs-39.re-40, .tg-ev.rs-40.re-41, .tg-ev.rs-41.re-42, .tg-ev.rs-42.re-43, .tg-ev.rs-43.re-44, .tg-ev.rs-44.re-45, .tg-ev.rs-45.re-46, .tg-ev.rs-46.re-47, .tg-ev.rs-47.re-48, .tg-ev.rs-48.re-49, .tg-ev.rs-49.re-50, .tg-ev.rs-50.re-51, .tg-ev.rs-51.re-52, .tg-ev.rs-52.re-53, .tg-ev.rs-53.re-54, .tg-ev.rs-54.re-55, .tg-ev.rs-55.re-56, .tg-ev.rs-56.re-57, .tg-ev.rs-57.re-58, .tg-ev.rs-58.re-59, .tg-ev.rs-59.re-60, .tg-ev.rs-60.re-61, .tg-ev.rs-61.re-62, .tg-ev.rs-62.re-63, .tg-ev.rs-63.re-64, .tg-ev.rs-64.re-65, .tg-ev.rs-65.re-66, .tg-ev.rs-66.re-67, .tg-ev.rs-67.re-68, .tg-ev.rs-68.re-69, .tg-ev.rs-69.re-70, .tg-ev.rs-70.re-71, .tg-ev.rs-71.re-72, .tg-ev.rs-72.re-73, .tg-ev.rs-73.re-74, .tg-ev.rs-74.re-75, .tg-ev.rs-75.re-76, .tg-ev.rs-76.re-77, .tg-ev.rs-77.re-78, .tg-ev.rs-78.re-79, .tg-ev.rs-79.re-80, .tg-ev.rs-80.re-81, .tg-ev.rs-81.re-82, .tg-ev.rs-82.re-83, .tg-ev.rs-83.re-84, .tg-ev.rs-84.re-85, .tg-ev.rs-85.re-86, .tg-ev.rs-86.re-87, .tg-ev.rs-87.re-88, .tg-ev.rs-88.re-89, .tg-ev.rs-89.re-90, .tg-ev.rs-90.re-91, .tg-ev.rs-91.re-92, .tg-ev.rs-92.re-93, .tg-ev.rs-93.re-94, .tg-ev.rs-94.re-95, .tg-ev.rs-95.re-96 { font-size: 10px; line-height: 12px; }
.tg-banner { font-size: 13px; padding: .15rem .4rem; }
.tg-date { font-size: 1rem; }
/* Calendar page: less chrome above the grid, so more of the day shows. */
.tg ~ .cal-note, .wide + .cal-note { margin-top: .3rem; font-size: .8rem; }
.stats .stat { padding: .3rem .7rem; }
.stats .stat b { font-size: 1.1rem; display: inline; margin-right: .3rem; }
.page-head h1 { margin-bottom: .1rem; }
/* Week: let a label wrap to two tight lines, filling a 30-minute block, so nothing is cut off. */
.tg-7 .tg-ev { white-space: normal; font-size: 12.5px; line-height: 12px; padding-top: 0; overflow: hidden; word-break: break-word; }
.tg-7 .tg-ev b { font-weight: 700; }
.tg-7 .tg-ev.rs-0.re-1, .tg-7 .tg-ev.rs-1.re-2, .tg-7 .tg-ev.rs-2.re-3, .tg-7 .tg-ev.rs-3.re-4, .tg-7 .tg-ev.rs-4.re-5, .tg-7 .tg-ev.rs-5.re-6, .tg-7 .tg-ev.rs-6.re-7, .tg-7 .tg-ev.rs-7.re-8, .tg-7 .tg-ev.rs-8.re-9, .tg-7 .tg-ev.rs-9.re-10, .tg-7 .tg-ev.rs-10.re-11, .tg-7 .tg-ev.rs-11.re-12, .tg-7 .tg-ev.rs-12.re-13, .tg-7 .tg-ev.rs-13.re-14, .tg-7 .tg-ev.rs-14.re-15, .tg-7 .tg-ev.rs-15.re-16, .tg-7 .tg-ev.rs-16.re-17, .tg-7 .tg-ev.rs-17.re-18, .tg-7 .tg-ev.rs-18.re-19, .tg-7 .tg-ev.rs-19.re-20, .tg-7 .tg-ev.rs-20.re-21, .tg-7 .tg-ev.rs-21.re-22, .tg-7 .tg-ev.rs-22.re-23, .tg-7 .tg-ev.rs-23.re-24, .tg-7 .tg-ev.rs-24.re-25, .tg-7 .tg-ev.rs-25.re-26, .tg-7 .tg-ev.rs-26.re-27, .tg-7 .tg-ev.rs-27.re-28, .tg-7 .tg-ev.rs-28.re-29, .tg-7 .tg-ev.rs-29.re-30, .tg-7 .tg-ev.rs-30.re-31, .tg-7 .tg-ev.rs-31.re-32, .tg-7 .tg-ev.rs-32.re-33, .tg-7 .tg-ev.rs-33.re-34, .tg-7 .tg-ev.rs-34.re-35, .tg-7 .tg-ev.rs-35.re-36, .tg-7 .tg-ev.rs-36.re-37, .tg-7 .tg-ev.rs-37.re-38, .tg-7 .tg-ev.rs-38.re-39, .tg-7 .tg-ev.rs-39.re-40, .tg-7 .tg-ev.rs-40.re-41, .tg-7 .tg-ev.rs-41.re-42, .tg-7 .tg-ev.rs-42.re-43, .tg-7 .tg-ev.rs-43.re-44, .tg-7 .tg-ev.rs-44.re-45, .tg-7 .tg-ev.rs-45.re-46, .tg-7 .tg-ev.rs-46.re-47, .tg-7 .tg-ev.rs-47.re-48, .tg-7 .tg-ev.rs-48.re-49, .tg-7 .tg-ev.rs-49.re-50, .tg-7 .tg-ev.rs-50.re-51, .tg-7 .tg-ev.rs-51.re-52, .tg-7 .tg-ev.rs-52.re-53, .tg-7 .tg-ev.rs-53.re-54, .tg-7 .tg-ev.rs-54.re-55, .tg-7 .tg-ev.rs-55.re-56, .tg-7 .tg-ev.rs-56.re-57, .tg-7 .tg-ev.rs-57.re-58, .tg-7 .tg-ev.rs-58.re-59, .tg-7 .tg-ev.rs-59.re-60, .tg-7 .tg-ev.rs-60.re-61, .tg-7 .tg-ev.rs-61.re-62, .tg-7 .tg-ev.rs-62.re-63, .tg-7 .tg-ev.rs-63.re-64, .tg-7 .tg-ev.rs-64.re-65, .tg-7 .tg-ev.rs-65.re-66, .tg-7 .tg-ev.rs-66.re-67, .tg-7 .tg-ev.rs-67.re-68, .tg-7 .tg-ev.rs-68.re-69, .tg-7 .tg-ev.rs-69.re-70, .tg-7 .tg-ev.rs-70.re-71, .tg-7 .tg-ev.rs-71.re-72, .tg-7 .tg-ev.rs-72.re-73, .tg-7 .tg-ev.rs-73.re-74, .tg-7 .tg-ev.rs-74.re-75, .tg-7 .tg-ev.rs-75.re-76, .tg-7 .tg-ev.rs-76.re-77, .tg-7 .tg-ev.rs-77.re-78, .tg-7 .tg-ev.rs-78.re-79, .tg-7 .tg-ev.rs-79.re-80, .tg-7 .tg-ev.rs-80.re-81, .tg-7 .tg-ev.rs-81.re-82, .tg-7 .tg-ev.rs-82.re-83, .tg-7 .tg-ev.rs-83.re-84, .tg-7 .tg-ev.rs-84.re-85, .tg-7 .tg-ev.rs-85.re-86, .tg-7 .tg-ev.rs-86.re-87, .tg-7 .tg-ev.rs-87.re-88, .tg-7 .tg-ev.rs-88.re-89, .tg-7 .tg-ev.rs-89.re-90, .tg-7 .tg-ev.rs-90.re-91, .tg-7 .tg-ev.rs-91.re-92, .tg-7 .tg-ev.rs-92.re-93, .tg-7 .tg-ev.rs-93.re-94, .tg-7 .tg-ev.rs-94.re-95, .tg-7 .tg-ev.rs-95.re-96 { white-space: nowrap; font-size: 10px; line-height: 12px; }
/* The city the doctor spends the day in, at the top of each day (owner, 14 Nov). */
.tg-city { display: inline-block; margin-left: .25rem; font-size: .95rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--cal-edge); vertical-align: middle; }
.tg-1 .tg-city { font-size: 1.15rem; }
.m-head { display: flex; align-items: center; gap: .3rem; }
.m-head .m-num { margin-left: auto; }
.m-city { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--cal-edge); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sched-city { margin-top: .2rem; font-size: 1rem; font-weight: 800; text-transform: uppercase; color: var(--cal-edge); }
/* Case rows (dashboard, client pages): status and Open stacked at the right, rows packed tight (owner, 14 Nov). */
.list > li { padding: .25rem .5rem; gap: .6rem; line-height: 1.25; flex-wrap: nowrap; align-items: center; }
.list > li .when { min-width: 7.2rem; font-size: .85rem; }
.list > li .when small { font-size: .75rem; }
.list > li .grow { min-width: 0; font-size: .88rem; }
.list > li .grow .faint { font-size: .78rem; }
.row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; margin-left: auto; flex: none; }
.row-actions .badge { font-size: .68rem; padding: .05rem .4rem; }
.row-actions .btn-small { font-size: .72rem; padding: .05rem .5rem; min-height: 0; line-height: 1.3; }
@media (max-width: 560px) { .list > li { flex-wrap: wrap; } }
/* Dashboard: the case lists use the full width so each case is one line plus a short second line. */
.stack-cards { display: flex; flex-direction: column; gap: .6rem; }
.stack-cards .card { padding: .6rem .8rem; }
.stack-cards h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.stack-cards .empty { padding: .4rem; font-size: .85rem; }
/* All-day entries across the top of a day (owner, 14 Nov): blocked days, unconfirmed, notes. */
.tg-banner.allday-block { background: #fbe1dc; color: #7a1f12; border-left-color: #c0392b; font-weight: 700; white-space: normal; }
.tg-banner.allday-unconfirmed { background: #ece3f7; color: #4b2a78; border-left: 3px dashed #7d4fc0; white-space: normal; }
.tg-banner.allday-note { background: var(--surface-2); color: var(--ink-soft); border-left-color: var(--ink-faint); font-weight: 500; white-space: normal; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .tg-banner.allday-block { background: #4a1d17; color: #ffc9bf; border-left-color: #e0695a; }
  html:not([data-theme="light"]) .tg-banner.allday-unconfirmed { background: #2f2342; color: #dcc8f7; border-left-color: #a77fe0; }
}
html[data-theme="dark"] .tg-banner.allday-block { background: #4a1d17; color: #ffc9bf; border-left-color: #e0695a; }
html[data-theme="dark"] .tg-banner.allday-unconfirmed { background: #2f2342; color: #dcc8f7; border-left-color: #a77fe0; }
.allday-flag { font-weight: 800; font-size: .9em; }
.allday-decide { display: flex; gap: .25rem; margin-top: .2rem; flex-wrap: wrap; }
.allday-decide button { font: inherit; font-size: 11px; font-weight: 700; padding: .05rem .4rem; border-radius: 4px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.allday-decide button:hover { background: rgba(127,127,127,.15); }
.sched-date .tg-banner { margin-top: .4rem; font-size: 12px; }
/* Contacts and email history */
.table.compact td, .table.compact th { padding: .3rem .5rem; font-size: .85rem; }
.email-list { list-style: none; margin: 0; padding: 0; }
.email-list li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .3rem .5rem; font-size: .86rem; }
.email-list li:nth-child(odd) { background: var(--zebra-1); }
.email-list li:nth-child(even) { background: var(--zebra-2); }
.email-list .t { min-width: 9.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.email-list .dir { color: var(--ink-soft); }
.email-list .subj { flex: 1; min-width: 12rem; font-weight: 600; }
.contact-chips { list-style: none; margin: .3rem 0 0; padding: 0; font-size: .85rem; }
.contact-chips li { padding: .2rem 0; }

/* Drag-and-drop records zone (partials/dropzone.html + js/dropzone.js) */
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 2rem 1.25rem; text-align: center; transition: border-color .15s, background .15s; }
.dropzone.dz-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dz-busy { opacity: .7; pointer-events: none; }
.dropzone input.dz-input { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.dz-title { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; margin: 0 0 .35rem; color: var(--ink); }
.dz-sub { color: var(--ink-soft); margin: 0 auto 1.1rem; max-width: 34rem; }
.dz-buttons { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.dz-note { color: var(--ink-faint); font-size: .85rem; margin: 1rem 0 0; }
.dz-status { font-size: .92rem; margin: .75rem 0 0; color: var(--ink-soft); }
.dz-status:empty { display: none; }
.dz-status.dz-bad { color: var(--warn-ink); }
.dz-list { list-style: none; padding: 0; margin: 0; text-align: left; }
.dropzone.dz-has-files .dz-list { margin-top: 1rem; border-top: 1px solid var(--line); }
.dz-list li { display: flex; gap: .75rem; align-items: baseline; padding: .4rem .25rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.dz-list li > span:first-child { flex: 1; overflow-wrap: anywhere; }
.dz-remove { font: inherit; font-size: .85rem; background: none; border: 0; color: var(--err-ink); cursor: pointer; padding: 0 .25rem; text-decoration: underline; }
.upload-form { margin-top: .75rem; }
@media (max-width: 520px) { .dropzone { padding: 1.5rem .9rem; } .dz-title { font-size: 1.25rem; } }

/* Original files / Processed files buttons on case lists (scheduling/_files_btn.html).
   They sit mid-row and are the biggest controls on it: files are what people open most. */
.case-files { display: flex; gap: .5rem; flex: 0 0 auto; justify-content: flex-start; flex-wrap: nowrap; align-items: center; min-width: 0; }
.row-status, .list > li .row-actions { margin-left: auto; flex: none; display: flex; align-items: center; gap: .4rem; }
.files-btn { gap: .4rem; white-space: nowrap; font-size: .9rem; min-height: 36px; padding: .35rem .95rem; }
.list > li .files-btn { font-size: .88rem; padding: .3rem .9rem; min-height: 34px; }
.files-btn .files-n { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .78rem; min-width: 1.5em; padding: 0 .45em; line-height: 1.5; text-align: center; }
.list > li .grow { flex: 0 1 30%; }
.list > li .when { flex: 0 0 8.5rem; min-width: 0; }
.row-actions { flex-direction: row; align-items: center; gap: .4rem; }
.dayboard-list li { align-items: center; flex-wrap: nowrap; }
.dayboard-list .db-title { flex: 0 1 28%; min-width: 0; }
.sched-case { align-items: center; flex-wrap: nowrap; }
.sched-case-link { display: flex; gap: 1rem; align-items: baseline; flex-wrap: nowrap; flex: 0 1 30rem; min-width: 0; overflow: hidden; text-decoration: none; color: inherit; }
.sched-case-link .t { flex: none; }
.sched-what { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sched-what .who { overflow-wrap: anywhere; }
.sched-what .faint { font-size: .82rem; }
.sched-case-link .faint { min-width: 0; }
.sched-case-link:hover .who { text-decoration: underline; }
@media (max-width: 760px) {
  .list > li, .dayboard-list li, .sched-case { flex-wrap: wrap; }
  .case-files { flex-basis: 100%; }
  .dayboard-list .db-title, .sched-case-link { flex-basis: auto; }
}
.list-wide { width: min(calc(100vw - 32px), 1680px); }
.dz-list li progress { width: 9rem; height: .5rem; accent-color: var(--accent); }
.dz-note-file { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.dz-list li.dz-done .dz-note-file { color: var(--ok-ink); }
.dz-list li.dz-failed .dz-note-file { color: var(--err-ink); white-space: normal; }
.dropzone.dz-busy { opacity: 1; pointer-events: auto; }
.dropzone.dz-busy .dz-buttons { opacity: .5; pointer-events: none; }
.dz-list li { flex-wrap: wrap; }
.dz-list li .dz-name { flex: 1 1 12rem; min-width: 8rem; overflow-wrap: anywhere; }
.separate-form { margin-top: .75rem; }

/* "Already on file?" suggestions under the claimant name (js/claimants.js) */
.claimant-suggest { margin-top: .4rem; border: 1px solid var(--accent); border-radius: 10px; background: var(--surface-2); padding: .5rem; }
.claimant-suggest-head { margin: .1rem .3rem .4rem; font-weight: 600; font-size: .92rem; }
.claimant-option { display: flex; flex-wrap: wrap; gap: .1rem .4rem; align-items: baseline; width: 100%; text-align: left; font: inherit; font-size: .92rem;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin-top: .35rem; cursor: pointer; }
.claimant-option:hover, .claimant-option:focus { border-color: var(--accent); }
.claimant-option .faint { flex-basis: 100%; font-size: .82rem; }
.claimant-none { color: var(--ink-soft); }
.claimant-chip { margin-top: .4rem; padding: .5rem .7rem; border-radius: 8px; background: var(--ok-bg); color: var(--ok-ink); font-size: .92rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: baseline; }
.claimant-chip .dz-remove { margin-left: auto; }
.same-person { border: 2px solid var(--warn-ink); border-radius: 10px; background: var(--warn-bg); padding: .75rem 1rem; margin: 1rem 0; }
.same-person legend { font-weight: 700; padding: 0 .3rem; color: var(--warn-ink); }
.same-option { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0; }
.claimant-chip[hidden], .claimant-suggest[hidden] { display: none; }
.claimant-chip-detail { flex-basis: 100%; font-size: .85rem; }
.case-files .files-btn { justify-content: center; min-width: 9.4rem; }
.case-files .files-processed { min-width: 10.9rem; }
.case-files .details-btn { min-width: 5.5rem; }
.doc-list > li .grow { flex: 1 1 auto; }
.files-btn.files-have { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.files-btn.files-have:hover { background: var(--ok-bg); color: var(--ok-ink); filter: brightness(1.1); }
.files-btn.files-have .files-n { background: var(--ok-ink); color: var(--ok-bg); }
.files-btn.files-missing { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-ink); }
.files-btn.files-missing:hover { background: var(--err-bg); color: var(--err-ink); filter: brightness(1.1); }
/* Size of the original records (pages, video, audio) - billing and workload */
.record-size { flex: 0 0 7.2rem; font-size: .82rem; line-height: 1.25; font-weight: 600; color: var(--ink-soft); align-self: center; padding-left: .3rem; font-variant-numeric: tabular-nums; }
.record-total { margin: -.2rem 0 .6rem; font-weight: 600; color: var(--ink-soft); }
/* Client contacts: what they do */
.role-chip { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; margin: 0 .25rem .2rem 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); white-space: nowrap; }
.who-does { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.who-does dt { font-weight: 600; }
.who-does dd { margin: 0; }
.head-action { float: right; font-family: var(--font); }
.requested-form { margin-top: .35rem; gap: .4rem; }
.requested-form select { max-width: 22rem; }
/* Not enough room for name + buttons on one line: buttons go to a second line, lined up under the name. */
@media (max-width: 1299px) {
  .sched-case { flex-wrap: wrap; row-gap: .35rem; }
  .sched-case-link { flex: 1 1 calc(100% - 8rem); order: 0; }
  .sched-case .row-status { order: 1; }
  .sched-case .case-files { order: 2; margin-left: calc(8.5rem + 1rem); }
}
@media (max-width: 1149px) {
  .list > li, .dayboard-list li { flex-wrap: wrap; row-gap: .35rem; }
  .list > li .grow, .dayboard-list .db-title { flex: 1 1 calc(100% - 18rem); }
  .list > li .row-actions, .dayboard-list .row-status { order: 1; }
  .list > li .case-files { order: 2; margin-left: calc(8.5rem + .75rem); }
  .dayboard-list .case-files { order: 2; margin-left: calc(8.5rem + .8rem); }
}
@media (max-width: 760px) {
  .sched-case .case-files, .list > li .case-files, .dayboard-list .case-files { margin-left: 0; flex-wrap: wrap; }
}
/* Fixed columns so every row lines up whatever the counts and page numbers say (owner, 14 Nov). */
.case-files .files-btn { width: 10.2rem; min-width: 0; flex: none; padding-left: .5rem; padding-right: .5rem; }
.case-files .files-processed { width: 11.6rem; }
.case-files .details-btn { width: 6rem; }
/* calendar list, office: "Move…" under the status badge, in the column already there (owner, 19 Nov) */
.sched-case .row-status { flex-wrap: wrap; row-gap: .2rem; }
.sched-case .row-status .move-link { flex-basis: 100%; text-align: right; font-size: .85rem; font-weight: 600; }
/* "Awaiting Cliff AI / human" under Processed files (office + named doctors). The cell is exactly the button, so the
   buttons in every row stay on one line (owner, 15 Nov); the label hangs just below it like a tab, and only that
   row gets a little room underneath for it. */
.processed-cell { position: relative; display: inline-flex; flex: none; width: 11.6rem; }
.processed-cell .files-processed { width: 100%; }
.processed-cell .cliff-wait { position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border-radius: 0 0 6px 6px; padding: .05rem .6rem .1rem; }
.cliff-wait { font-size: .7rem; font-weight: 700; line-height: 1.2; text-align: center; color: var(--warn-ink);
  background: var(--warn-bg); border-radius: 4px; padding: .1rem .3rem; white-space: nowrap; }
.processed-cell .cliff-wait + .cliff-wait { top: calc(100% + 2px + 1.1rem); }
.list > li:has(.processed-cell), .dayboard-list li:has(.processed-cell), .sched-case:has(.processed-cell) { padding-bottom: 1.15rem; }
.cliff-wait-note { margin: .2rem 0 .6rem; }
.cliff-wait-note .cliff-wait { display: inline-block; font-size: .82rem; }
.case-files .record-size { flex: 0 0 8.2rem; width: 8.2rem; }
.sched-case-link { flex: 1 1 0; }
.sched-case .row-status, .dayboard-list .row-status { flex: 0 0 6.6rem; justify-content: flex-end; margin-left: 0; }
.list > li .grow { flex: 1 1 0; }
.dayboard-list .db-title { flex: 1 1 0; }
.list > li .row-actions { flex: 0 0 auto; min-width: 6.6rem; justify-content: flex-end; margin-left: 0; }
.case-files .files-doctor { width: 10rem; margin-left: .3rem; }
.files-btn.qd-over { outline: 3px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
.files-btn.qd-busy { opacity: .8; pointer-events: none; }
.case-files .files-doctor-office { width: 10.4rem; }
/* The report section: stands out when a row's Upload report button opens it */
.report-card { border-color: var(--accent); }
.report-card:target { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent); scroll-margin-top: 1rem; }
/* Report loop: ticks, actions, the green light */
.doc-list .pick { display: flex; align-items: center; padding-right: .3rem; }
.doc-list .pick input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.report-actions { margin: .75rem 0; }
.report-actions .row { gap: .5rem; flex-wrap: wrap; }
.report-ready-btn { background: #1f8a4c; border-color: #1f8a4c; color: #fff; }
.report-ready-btn:hover { background: #18703d; border-color: #18703d; color: #fff; }
.report-jobs { margin-top: .5rem; }
.connect-details { overflow-wrap: anywhere; }
/* PPI calculator: a menu of the rules to rate under, opened from its button (owner, 17 Nov) */
.ppi-pick { position: relative; display: inline-block; }
.ppi-pick > summary { list-style: none; cursor: pointer; }
.ppi-pick > summary::-webkit-details-marker { display: none; }
.ppi-menu { position: absolute; z-index: 20; top: calc(100% + .35rem); left: 0; min-width: 19rem; max-width: min(28rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  padding: .7rem .85rem; display: flex; flex-direction: column; gap: .35rem; }
.ppi-menu p { margin: 0 0 .2rem; }
.ppi-menu label { display: flex; gap: .45rem; align-items: baseline; cursor: pointer; }
.ppi-menu .btn { margin-top: .4rem; align-self: flex-start; }
.ppi-menu .ppi-pieces { margin-top: .45rem; font-size: .85rem; overflow-wrap: anywhere; }
.tpl-group { margin: .8rem 0 .2rem; font-weight: 700; color: var(--ink-soft); }
.tpl-files li { padding: .15rem 0; }
.tpl-files input { margin-right: .4rem; }
.final-badge { font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: #fff; background: #1f8a4c; padding: .05rem .45rem; border-radius: 999px; }
.report-ready-banner { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 auto 1rem; max-width: 1100px;
  padding: 1rem 1.25rem; border-radius: 12px; background: #1f8a4c; color: #fff; box-shadow: 0 0 0 4px rgba(31, 138, 76, .35); }
.report-ready-banner a { color: #fff; }
.report-ready-banner .rr-title { font-size: 1.25rem; font-weight: 800; letter-spacing: .03em; }
.report-ready-banner .btn { background: #fff; color: #145c33; border-color: #fff; }
.report-ready-banner .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.report-sent-note { max-width: 1100px; margin: 0 auto 1rem; color: var(--ok-ink); font-weight: 600; }
.ready-light { flex: none; margin-left: .4rem; font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-decoration: none; color: #fff;
  background: #22a35a; padding: .35rem .7rem; border-radius: 999px; box-shadow: 0 0 0 3px rgba(34, 163, 90, .35), 0 0 14px rgba(34, 163, 90, .6); }
.ready-light:hover { color: #fff; }
.reports-ready-card { border: 2px solid #22a35a; box-shadow: 0 0 0 4px rgba(34, 163, 90, .2); }
.reports-ready-card h2 { color: #1f8a4c; }
.report-sub { font-family: var(--font); font-size: .95rem; margin: .9rem 0 .2rem; }

/* Appearance chosen in My account (owner, 14 Nov): html[data-theme] = auto | light | dark */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="auto"] { color-scheme: light dark; }
/* The logo: the original on light backgrounds, the light version on dark ones */
.brand-logo-dark { display: none; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .brand-logo-light { display: none; } html:not([data-theme="light"]) .brand-logo-dark { display: block; } }
html[data-theme="dark"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: block; }

/* Colour schemes (My account > Appearance): html[data-scheme] = summit (default) | warm | contrast.
   Each has a light and a dark set; the dark set applies exactly when the dark-mode rules above do. */
html[data-scheme="warm"][data-theme="light"] { --bg: #f6f2ec; --surface: #fffdf9; --surface-2: #faf5ee; --ink: #2d2722; --ink-soft: #5c5249; --ink-faint: #877a6d; --line: #e5dacd; --accent: #8a5a3b; --brand-blue: #a0714f; --accent-ink: #ffffff; --accent-soft: #f2e5d8; --accent-strong: #6b4329; --zebra-1: #fbf6ef; --zebra-2: #f1e7da; --case-1: #f1e4d6; --case-1-ink: #5a3a22; --case-2: #8a5a3b; --case-2-ink: #ffffff; }
@media (prefers-color-scheme: light) { html[data-scheme="warm"][data-theme="auto"] { --bg: #f6f2ec; --surface: #fffdf9; --surface-2: #faf5ee; --ink: #2d2722; --ink-soft: #5c5249; --ink-faint: #877a6d; --line: #e5dacd; --accent: #8a5a3b; --brand-blue: #a0714f; --accent-ink: #ffffff; --accent-soft: #f2e5d8; --accent-strong: #6b4329; --zebra-1: #fbf6ef; --zebra-2: #f1e7da; --case-1: #f1e4d6; --case-1-ink: #5a3a22; --case-2: #8a5a3b; --case-2-ink: #ffffff; } }
html[data-scheme="warm"][data-theme="dark"] { --bg: #191613; --surface: #221d19; --surface-2: #2a241f; --ink: #f0e8de; --ink-soft: #cdbfae; --ink-faint: #9e9080; --line: #3b332b; --accent: #d9a77f; --brand-blue: #b9875f; --accent-ink: #20150d; --accent-soft: #3a2c20; --accent-strong: #ecc6a6; --zebra-1: #1f1b17; --zebra-2: #29231d; --case-1: #4a3523; --case-1-ink: #f6e3d1; --case-2: #d9a77f; --case-2-ink: #20150d; }
@media (prefers-color-scheme: dark) { html[data-scheme="warm"][data-theme="auto"] { --bg: #191613; --surface: #221d19; --surface-2: #2a241f; --ink: #f0e8de; --ink-soft: #cdbfae; --ink-faint: #9e9080; --line: #3b332b; --accent: #d9a77f; --brand-blue: #b9875f; --accent-ink: #20150d; --accent-soft: #3a2c20; --accent-strong: #ecc6a6; --zebra-1: #1f1b17; --zebra-2: #29231d; --case-1: #4a3523; --case-1-ink: #f6e3d1; --case-2: #d9a77f; --case-2-ink: #20150d; } }
html[data-scheme="contrast"][data-theme="light"] { --bg: #ffffff; --surface: #ffffff; --surface-2: #f2f2f2; --ink: #000000; --ink-soft: #1c1c1c; --ink-faint: #3d3d3d; --line: #7a7a7a; --accent: #0b4a86; --brand-blue: #0b4a86; --accent-ink: #ffffff; --accent-soft: #d8e7f6; --accent-strong: #052f58; --zebra-1: #ffffff; --zebra-2: #e9e9e9; --case-1: #d8e7f6; --case-1-ink: #00203f; --case-2: #0b4a86; --case-2-ink: #ffffff; --ok-ink: #0b5a23; --err-ink: #9b0f00; --warn-ink: #6b3d00; }
@media (prefers-color-scheme: light) { html[data-scheme="contrast"][data-theme="auto"] { --bg: #ffffff; --surface: #ffffff; --surface-2: #f2f2f2; --ink: #000000; --ink-soft: #1c1c1c; --ink-faint: #3d3d3d; --line: #7a7a7a; --accent: #0b4a86; --brand-blue: #0b4a86; --accent-ink: #ffffff; --accent-soft: #d8e7f6; --accent-strong: #052f58; --zebra-1: #ffffff; --zebra-2: #e9e9e9; --case-1: #d8e7f6; --case-1-ink: #00203f; --case-2: #0b4a86; --case-2-ink: #ffffff; --ok-ink: #0b5a23; --err-ink: #9b0f00; --warn-ink: #6b3d00; } }
html[data-scheme="contrast"][data-theme="dark"] { --bg: #000000; --surface: #0b0b0b; --surface-2: #161616; --ink: #ffffff; --ink-soft: #ececec; --ink-faint: #c4c4c4; --line: #7a7a7a; --accent: #a8d4ff; --brand-blue: #1d4f80; --accent-ink: #00172d; --accent-soft: #0f2b47; --accent-strong: #d6ebff; --zebra-1: #000000; --zebra-2: #1a1a1a; --case-1: #0f2b47; --case-1-ink: #ffffff; --case-2: #a8d4ff; --case-2-ink: #00172d; --ok-ink: #7fffa6; --err-ink: #ffb4a8; --warn-ink: #ffd88a; }
@media (prefers-color-scheme: dark) { html[data-scheme="contrast"][data-theme="auto"] { --bg: #000000; --surface: #0b0b0b; --surface-2: #161616; --ink: #ffffff; --ink-soft: #ececec; --ink-faint: #c4c4c4; --line: #7a7a7a; --accent: #a8d4ff; --brand-blue: #1d4f80; --accent-ink: #00172d; --accent-soft: #0f2b47; --accent-strong: #d6ebff; --zebra-1: #000000; --zebra-2: #1a1a1a; --case-1: #0f2b47; --case-1-ink: #ffffff; --case-2: #a8d4ff; --case-2-ink: #00172d; --ok-ink: #7fffa6; --err-ink: #ffb4a8; --warn-ink: #ffd88a; } }
/* Appearance choices on My account */
.appearance-form fieldset { border: 0; padding: 0; margin: 0 0 .9rem; }
.appearance-form legend { font-weight: 600; margin-bottom: .3rem; }
.appearance-form .check { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; }
.scheme-swatch { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.scheme-swatch i { width: 1.1rem; height: 1.1rem; display: block; }
.scheme-summit i:nth-child(1) { background: #688da7; } .scheme-summit i:nth-child(2) { background: #3f6787; } .scheme-summit i:nth-child(3) { background: #e4edf3; }
.scheme-warm i:nth-child(1) { background: #a0714f; } .scheme-warm i:nth-child(2) { background: #8a5a3b; } .scheme-warm i:nth-child(3) { background: #f2e5d8; }
.scheme-contrast i:nth-child(1) { background: #000; } .scheme-contrast i:nth-child(2) { background: #0b4a86; } .scheme-contrast i:nth-child(3) { background: #fff; }
/* Entries from the doctor's own calendar that aren't cases (errands, meetings, "busy"): a colour of their
   own (violet - no theme uses it) with a full outline, so their length always shows against the calendar
   (owner, 14 Nov). Never close to the page colours; checked against every theme (see tests). */
:root { --cal-own: #cbbcf0; --cal-own-ink: #2f2163; --cal-own-edge: #6a4cc4; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --cal-own: #4a3d80; --cal-own-ink: #f0eaff; --cal-own-edge: #b39cff; } }
html[data-theme="dark"] { --cal-own: #4a3d80; --cal-own-ink: #f0eaff; --cal-own-edge: #b39cff; }
.tg-ev.busy, .m-ev.busy, .tg-ev.personal, .m-ev.personal {
  background: var(--cal-own); color: var(--cal-own-ink); border: 1px solid var(--cal-own-edge); border-left: 3px solid var(--cal-own-edge); }
.tg-ev.personal, .m-ev.personal { border-style: dashed; border-left-style: solid; }
.m-ev.busy .m-at, .m-ev.personal .m-at { color: var(--cal-own-ink); opacity: .8; }
/* Case blocks: a full outline too, so each one's length shows (owner, 14 Nov) */
.tg-ev.case, .tg-ev.mine, .m-ev.case { border: 1px solid var(--cal-edge); border-left-width: 3px; }
/* Slim top bar; the big logo sits on the left beside the page title, calendar controls on the right (owner, 14 Nov) */
.topbar-inner { min-height: 0; padding-top: .3rem; padding-bottom: .3rem; }
.brand-text { font-size: .95rem; font-weight: 600; letter-spacing: .01em; color: var(--ink-soft); }
.nav a, .nav .linkish { padding: .28rem .55rem; font-size: .86rem; }
.page-logo { float: left; margin: .4rem 1.5rem .6rem 0; line-height: 0; }
.page-logo img { height: 200px; width: auto; }
.page-logo .brand-logo-dark { display: none; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .page-logo .brand-logo-light { display: none; } html:not([data-theme="light"]) .page-logo .brand-logo-dark { display: block; } }
html[data-theme="dark"] .page-logo .brand-logo-light { display: none; }
html[data-theme="dark"] .page-logo .brand-logo-dark { display: block; }
.wide, .stack-cards, .dayboard { clear: both; }
@media (max-width: 760px) {
  .page-logo { float: none; display: flex; justify-content: center; margin: .5rem 0 .25rem; }
  .page-logo img { height: 96px; }
}
@media print { .page-logo { display: none; } }
/* Calendar pages: title, doctor picker, view buttons and tools line up on the right, opposite the logo */
@media (min-width: 761px) {
  .sched-head { flex-direction: column; align-items: flex-end; text-align: right; margin-bottom: .75rem; }
  .sched-head .cal-picker, .sched-head .weeknav, .cal-tools { justify-content: flex-end; }
}
/* The logo's EKG baseline runs along the top border of the first card under the page title (owner, 15 Nov).
   The baseline is 53.3% down the logo (rows 288-297 of 549); the title block is made just tall enough for the
   card below it to start there. A title block that is naturally taller than that pushes the card lower. */
@media (min-width: 761px) { .page-head { min-height: calc(200px * .533 + .4rem - 1.5rem); } }
/* Find-a-doctor pages and the doctor's page: everything beside the logo (breadcrumb, title, subtitle, button) is
   centred, top to bottom, on the EKG baseline (owner, 15 Nov). The block is made twice as tall as the baseline is
   deep (53.3% down the 200 px logo, plus the logo's top margin) and its contents are centred in it. */
@media (min-width: 761px) {
  .page-head.head-on-line { min-height: calc(2 * (200px * .533 + .4rem)); align-items: center; align-content: center; margin-bottom: .75rem; }
  .head-on-line h1 { margin-bottom: .25rem; }
  .head-on-line p:last-child { margin-bottom: 0; }
}
/* Sign-in and other small centred cards start below the logo instead of sliding under it */
@media (min-width: 761px) { .narrow { clear: both; } }
/* A card holding a list of cases starts below the logo: its rows are too wide to sit beside it */
@media (min-width: 761px) { .card:has(> .list) { clear: both; } }
/* Narrow pages (booking form, case page): the column sits beside the logo, never under it */
@media (min-width: 761px) { .medium { display: flow-root; } }
/* Booking page: the calendar and its side column start below the logo and use the wide layout (owner, 14 Nov) */
@media (min-width: 901px) {
  .detail-grid { clear: both; position: relative; left: 50%; transform: translateX(-50%); width: min(calc(100vw - 32px), 1400px); grid-template-columns: minmax(0, 2.6fr) minmax(300px, 1fr); }
  .cal-tools .spacer { display: none; }
}

/* "Still to come" (owner, 15 Nov): something the client said is on the way. Doctor and office only. */
.still-badge { display: inline-block; margin-top: .2rem; font-size: .78rem; font-weight: 700; color: var(--warn-ink); background: var(--warn-bg);
  border: 1px solid var(--warn-ink); border-radius: 4px; padding: .05rem .4rem; }
/* beside the doctor's name in a list row: a little room after "MD" (owner, 15 Nov); on its own line in To do rows */
.list .still-badge { margin-left: .75rem; }
.sched-what .still-badge { display: table; margin-left: 0; }
.still-card { border-color: var(--warn-ink); }
.still-card h2 { color: var(--warn-ink); }
.still-add { gap: .5rem; flex-wrap: wrap; align-items: center; }
.still-add input[type=text] { flex: 1 1 12rem; min-width: 0; }

/* A person's email signature as text (account page, confirmation email page) */
.sig-preview { white-space: pre-wrap; font: inherit; font-size: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; margin: .4rem 0; }
.confirm-email textarea { width: 100%; font: inherit; }

/* The three drop areas on a case page, each its own colour so a file goes where it's meant to (owner, 16 Nov) */
.dropzone.dz-section { border-width: 2px; border-style: dashed; }
.dropzone.dz-original { border-color: var(--accent); }
.dropzone.dz-original .dz-title { color: var(--accent-strong); }
.dropzone.dz-processed { border-color: var(--ok-ink); }
.dropzone.dz-processed .dz-title { color: var(--ok-ink); }
.dropzone.dz-doctor { border-color: var(--warn-ink); }
.dropzone.dz-doctor .dz-title { color: var(--warn-ink); }

/* The doctor's Done checkbox (owner, 16 Nov) */
.done-box { display: inline-flex; align-items: center; margin: 0 .4rem; }
.done-box label { display: inline-flex; gap: .35rem; align-items: center; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.done-box input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--ok-ink); }
.done-note { color: var(--ok-ink); font-weight: 600; margin: .2rem 0 .6rem; }

/* Template report in two steps (owner, 16 Nov): files, then templates, each a click */
.tpl-pick { display: grid; gap: .45rem; margin: .3rem 0 .8rem; }
.tpl-file { display: block; width: 100%; text-align: left; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; }
.tpl-file:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpl-final, .tpl-default { border-color: var(--ok-ink); border-width: 2px; }
.no-show-box input[type=checkbox] { accent-color: var(--err-ink); }
.no-show-box label { color: var(--err-ink); }
/* The doctor ticked Done: a solid green "Complete" (owner, 16 Nov) */
.badge-complete { background: var(--ok-ink); color: var(--ok-bg); border-color: transparent; font-weight: 700; }

/* Live pipeline progress on the case page (owner, 16 Nov) */
.pipe-progress { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pbar { display: inline-block; width: 9rem; height: .7rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.pbar-fill { display: block; height: 100%; background: var(--ok-ink); transition: width .6s ease; }
.pbar-pct { font-variant-numeric: tabular-nums; }
.pbar-note { flex-basis: 100%; }

/* Template report draft: what was filled, and what's still asked (owner, 17 Nov) */
.fill-ask { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; font-size: .9rem; }
.fill-ask input { margin-left: .25rem; }

/* Case page for the doctor and the office: the whole screen, not the 640 px column (owner, 17 Nov). The title and
   details sit beside the logo; below it Compile report takes the left, Original and Processed files stack on the
   right, and the office's Emails, Billing and Terms sit side by side. One column on a small screen; clients keep the
   narrow page. */
.case-sections { max-width: 640px; margin: 0 auto; }
@media (min-width: 761px) {
  .case-top { max-width: none; }
  .case-sections { clear: both; max-width: none; }
}
@media (min-width: 1200px) {
  main.wrap:has(.case-sections) { max-width: 1760px; }
  .case-top .details { grid-template-columns: 9rem minmax(0, 1fr) 9rem minmax(0, 1fr); column-gap: 1.5rem; }
  .case-sections:not(.case-tail) { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-top: 1.25rem; }
  .case-sections:not(.case-tail) > .card { margin-top: 0; }
  .case-sections > #doctor { grid-row: span 2; }
  .case-office { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
}
/* On a phone a file's name keeps at least 10rem; its buttons go to the next line when they don't fit beside it */
@media (max-width: 560px) { .doc-list > li .grow { flex: 1 1 10rem; } .doc-list > li > .row-actions, .doc-list > li > form { margin-left: auto; } }
.check-all-row { margin: .25rem 0 .35rem; }

/* Build report (owner, 18 Nov 2026) */
.build-files { margin: 0 0 .5rem; }
.build-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); flex-wrap: wrap; }
.build-row .grow { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.build-arrow { font-size: 1.2rem; opacity: .7; }
.build-to { display: flex; flex-wrap: nowrap; align-items: center; gap: .4rem; margin-left: auto; }
.build-to select.build-dest, .build-dest { display: inline-block; min-width: 10rem; width: auto; margin: 0; }
.build-sub select { display: inline-block; width: auto; max-width: 100%; }
.build-sub li { list-style: none; }
.build-opt { display: block; margin: .6rem 0 .2rem; }
.build-sub { margin: .1rem 0 .6rem 1.6rem; }
.build-plan li { margin: .35rem 0; }
.build-status { margin: .8rem 0; padding: .6rem .8rem; border: 1px solid var(--line, rgba(127,127,127,.3)); border-radius: 8px; }
.build-failed { border-color: #c0392b; }
.build-chain { display: flex; flex-wrap: wrap; gap: .3rem .9rem; list-style: none; padding: 0; margin: .3rem 0; }
.build-step + .build-step::before { content: "→ "; opacity: .6; }
.build-done { color: var(--ok, #2e7d32); }
.build-failed .build-step.build-failed, .build-step.build-failed { color: #c0392b; }
.build-waiting, .build-stopped { opacity: .65; }

/* Build report flowchart (owner, 18 Nov 2026) */
.build-page.wide { max-width: 72rem; margin: 0 auto; }
.build-steps-nav { display: flex; gap: 1.2rem; list-style: none; padding: 0; margin: .4rem 0 1rem; color: var(--ink-faint); }
.build-steps-nav .on { color: var(--ink, inherit); font-weight: 700; }
.build-pick { list-style: none; padding-left: 0; }
.build-pick li { padding: .25rem 0; list-style: none; }
.build-search input[type=search] { width: 100%; }
.flow-top { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1rem; margin-top: 1rem; }
.flow-file { display: flex; flex-direction: column; align-items: center; width: 13rem; }
.flow-card { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; background: var(--card, transparent); text-align: center; overflow-wrap: anywhere; }
.flow-src { width: 100%; min-height: 4.2rem; }
.flow-kind { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.flow-cover { border-style: dashed; }
.flow-arrow { position: relative; display: flex; flex-direction: column; align-items: center; padding: .5rem 0 1.1rem; }
.flow-arrow::before { content: ""; position: absolute; top: 0; bottom: .55rem; left: 50%; border-left: 2px solid var(--line); z-index: 0; }
.flow-arrow::after { content: "▼"; position: absolute; bottom: -.15rem; left: 50%; transform: translateX(-50%); font-size: .8rem; color: var(--ink-faint); }
.flow-order { position: relative; z-index: 1; margin: .2rem 0; width: auto; max-width: 12rem; }
.flow-fixed { padding: .2rem .5rem; border: 1px dashed var(--line); border-radius: 6px; background: var(--bg, transparent); font-size: .9rem; }
.flow-off { opacity: .45; }
.flow-ctx .flow-src { border-style: dotted; }
.flow-join { height: 0; border-top: 2px solid var(--line); margin: .2rem auto 1.1rem; width: min(90%, 60rem); }
.flow-earlier { text-align: center; }
.flow-spine { display: flex; flex-direction: column; align-items: center; }
.flow-mid { min-width: 16rem; font-weight: 600; }
.flow-level { display: flex; flex-direction: column; align-items: center; }
.flow-sub { margin: 0 0 .7rem; text-align: center; }
.flow-sub select { display: inline-block; width: auto; max-width: 22rem; }
.flow-final { border-width: 2px; border-color: var(--accent, #2e7d32); }
@media (max-width: 640px) { .flow-file { width: 100%; } .flow-mid { min-width: 0; width: 100%; } }
.flow [hidden] { display: none !important; }
/* flowchart, lettered (owner, 18 Nov 2026) */
.flow-board { position: relative; }
.flow-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0; }
.flow-line { fill: none; stroke: var(--ink-faint); stroke-width: 1.6; }
.flow-line-ctx { stroke-dasharray: 5 4; }
.flow-headfill { fill: var(--ink-faint); }
.flow-top, .flow-spine, .flow-earlier { position: relative; z-index: 1; }
.flow-top { margin-bottom: 4.5rem; }
.flow-product { width: 100%; font-size: .92rem; }
.flow-letter { display: inline-block; min-width: 1.5rem; padding: 0 .3rem; border-radius: 999px; background: var(--accent-soft, #e8eef3); color: var(--ink, inherit); text-align: center; }
.flow-letter:empty { display: none; }
.flow-merged { border-style: double; border-width: 3px; }
.flow-then { padding-top: .3rem; }
.flow-target { min-width: 20rem; text-align: left; }
.flow-target > strong { display: block; text-align: center; margin-bottom: .3rem; }
.flow-parts li { padding: .1rem 0; font-weight: 400; }
.flow-parts:empty::before { content: "Choose a command for at least one file."; color: var(--ink-faint); font-weight: 400; }
.flow-legend-list { list-style: none; padding-left: 0; margin: .4rem 0; }
.flow-legend-list li { padding: .1rem 0; break-inside: avoid; }
@media (max-width: 640px) { .flow-target { min-width: 0; width: 100%; } }
/* legend on the left (owner, 18 Nov) */
.build-page.wide { max-width: 84rem; }
.flow-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.flow-legend { position: sticky; top: 1rem; font-size: .92rem; margin: 0; }
.flow-legend summary { cursor: pointer; }
@media (max-width: 900px) { .flow-layout { grid-template-columns: 1fr; } .flow-legend { position: static; } }

/* For the report header (case page, owner 20 Nov 2026) */
.header-facts { margin: .8rem 0 .2rem; }
.header-facts summary { cursor: pointer; }
.header-facts-list { border-collapse: collapse; margin: .3rem 0 .6rem; }
.header-facts-list th { text-align: left; font-weight: 600; padding: .15rem .8rem .15rem 0; white-space: nowrap; vertical-align: top; }
.header-facts-list td { padding: .15rem .8rem .15rem 0; vertical-align: top; overflow-wrap: anywhere; }

/* Search box in the top bar: every signed-in person, their own cases only (owner, 28 Nov). */
.top-search { flex: 1 1 220px; max-width: 360px; margin: 0; position: relative; }
.top-search input { width: 100%; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; background: var(--surface-2); color: var(--ink); }
.top-search input:focus { background: var(--surface); outline: 2px solid var(--accent, #2563eb); outline-offset: 0; }
@media (max-width: 640px) { .top-search { order: 3; flex-basis: 100%; max-width: none; } }

/* A doctor's day on another clock (Portland in Pacific time): label it under the city (owner, 29 Nov). */
.sched-tz { font-size: .78rem; color: var(--ink-faint); margin-top: .1rem; }

/* case page: ← Back on the left, Next claimant → on the right (owner, 30 Nov) */
.case-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.case-nav .case-next { margin-left: auto; }

/* Unconfirmed light blue, confirmed orange (owner, 1 Dec). Last in the file so it wins over the alternating case
   colours and the colour schemes above. */
.tg-ev.case.st-confirmed, .tg-ev.mine.st-confirmed, .m-ev.case.st-confirmed { background: var(--conf-bg); color: var(--conf); border-color: var(--conf-line); }
.tg-ev.case.st-hold, .tg-ev.mine.st-hold, .m-ev.case.st-hold { background: var(--unconf-bg); color: var(--unconf); border-color: var(--unconf-line); }
.m-ev.case.st-confirmed .m-at, .m-ev.case.st-hold .m-at { color: inherit; opacity: .8; }

/* Suggestions under the top search box while typing (owner, 1 Dec) */
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; list-style: none; margin: 0; padding: .3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 70vh; overflow-y: auto; }
.suggest li { margin: 0; }
.suggest a { display: block; padding: .4rem .6rem; border-radius: 7px; text-decoration: none; color: var(--ink); line-height: 1.3; }
.suggest a b { display: block; font-weight: 600; font-size: .92rem; }
.suggest a span { display: block; font-size: .78rem; color: var(--ink-faint); }
.suggest a:hover, .suggest a.on { background: var(--accent-soft); }
.suggest-none { padding: .45rem .6rem; font-size: .85rem; color: var(--ink-faint); }

/* The colour legend beside the calendar (owner, 1 Dec); below it on narrow screens */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1rem; align-items: start; }
.cal-main { min-width: 0; }
.cal-side { align-self: start; display: grid; gap: 1rem; }
.cal-legend { padding: .8rem .9rem; font-size: .85rem; }
.quick-day { padding: .8rem .9rem; font-size: .85rem; }
.quick-day h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 .5rem; }
.quick-day .qd-label { display: block; font-weight: 600; margin-bottom: .2rem; }
.quick-day input[type=date] { width: 100%; }
.qd-cities { display: grid; gap: .4rem; margin-top: .6rem; }
.qd-city { display: block; width: 100%; text-align: left; white-space: normal; }
.qd-city small { display: block; font-weight: 400; color: var(--ink-soft); font-size: .72rem; line-height: 1.25; }
.qd-note { font-size: .75rem; margin: .6rem 0 0; }
.qd-other { margin-top: .6rem; }
.qd-other summary { cursor: pointer; font-weight: 600; }
.qd-fields { display: grid; gap: .45rem; margin-top: .5rem; }
.qd-fields label { display: grid; gap: .15rem; font-weight: 600; }
.qd-fields input, .qd-fields select { width: 100%; font-weight: 400; }
.qd-fields p { margin: 0; font-size: .75rem; }
.qd-hours { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.cal-legend h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 .5rem; }
.cal-legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.cal-legend li { margin: 0; }
.cal-legend small { display: block; color: var(--ink-soft); font-size: .78rem; line-height: 1.3; margin-top: .15rem; }
.cal-legend .lg { display: block; position: static; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; line-height: 20px; padding: 0 6px; }
.cal-legend .lg.tg-banner { padding: .1rem .4rem; }
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }

  .qd-cities { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
  .cal-legend ul { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
}


/* Doctors list (owner, 1 Dec: "line up the buttons and things"): actions beside the title, search on its own row. */
.search-inline { display: flex; gap: .5rem; align-items: center; margin: 0 0 1rem; overflow: hidden; }
.search-inline input { flex: 1; min-width: 0; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.doctor-table .num { text-align: center; }
.doc-actions { white-space: nowrap; text-align: right; }
.doc-actions .btn + .btn { margin-left: .4rem; }
.clear-logo { clear: both; }

/* Office dashboard (owner, 1 Dec: "side by side ... instead of everything in a scroll going down"): the lists sit in
   two columns, each list scrolls inside its own card, cancellations and Apple notes fold away. */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.dash-card { min-width: 0; display: flex; flex-direction: column; }
.dash-card h2 { margin-top: 0; }
.dash-card > p.faint { margin: -.2rem 0 .6rem; font-size: .85rem; }
.dash-scroll { max-height: 30rem; overflow-y: auto; overscroll-behavior: contain; margin: 0; }
.dash-card .list > li { flex-wrap: wrap; row-gap: .35rem; }
.dash-card .list > li .grow { flex: 1 1 14rem; min-width: 0; }
.dash-card .row-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.dash-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin: .9rem 0 .35rem; display: flex; align-items: center; gap: .4rem; }
.dash-scroll > .dash-sub:first-child { margin-top: 0; }
.dash-card p.small { font-size: .82rem; margin: 0 0 .4rem; }
details.fold > summary, details.dash-fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker, details.dash-fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before, details.dash-fold > summary h2::before { content: "▸ "; color: var(--ink-faint); }
details.fold[open] > summary::before, details.dash-fold[open] > summary h2::before { content: "▾ "; }
details.dash-fold > summary h2 { margin: 0; display: inline; }
details.dash-fold[open] > summary { margin-bottom: .8rem; }
details.fold ul { margin: .5rem 0 0; }
@media (max-width: 1099px) { .dash-grid { grid-template-columns: 1fr; } }
/* case rows in a half-width dashboard card: the file buttons take their own line and share it */
.dash-card .list > li .case-files { order: 2; flex: 1 1 100%; margin-left: 0; flex-wrap: wrap; gap: .35rem; }
.dash-card .case-files .files-btn, .dash-card .case-files .files-processed, .dash-card .case-files .files-doctor, .dash-card .case-files .files-doctor-office { width: auto; min-width: 0; flex: 0 1 auto; margin-left: 0; padding-left: .55rem; padding-right: .55rem; }
.dash-card .case-files .processed-cell { flex: 1 1 auto; }
.dash-card .case-files .record-size { flex: 0 0 auto; width: auto; padding: 0 .2rem; }
.dash-card .list > li .row-actions { order: 1; margin-left: auto; }

/* Clean-up pass (owner, 1 Dec: "clean up the look for everything").
   1. The page title sits level with the logo and everything after it starts below the logo, full width, instead of
      squeezing into the strip beside it. */
@media (min-width: 761px) {
  .page-head { min-height: calc(200px + 1rem); align-items: center; align-content: center; }
}
/* 2. A case row never crushes the name to a letter per line: when there isn't room, the buttons move to a second line. */
.sched-case, .list > li, .dayboard-list li { flex-wrap: wrap; row-gap: .35rem; }
.sched-case-link { min-width: 15rem; }
.list > li > .grow { min-width: 13rem; }
.dayboard-list .db-title { min-width: 13rem; }
/* 3. Filter bars: one even row of controls */
.filters { gap: .5rem; align-items: center; }
.filters input, .filters select { flex: 1 1 10rem; min-width: 0; }
.filters .btn { flex: none; }
