/* Hallmark · shape: app screen · genre: modern-minimal · theme: Cobalt (deal 1/3, seed clinical-documentation-follow-up-dashboard-c8c2·9144b25d·2026-12-03·r0) · redesign: full · brand: Safwa (spec 2026-12-03)
 * nav: kept (side rail on wide screens, bottom bar under 900px) · signature: the branch ruler, every branch a tick on one 0 to 100 scale · states: loading, empty, error, full
 * axes: dark/grotesk-sans/warm · posture: restrained · contrast: pass · modes: dark+light · data: sample · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E3 S4 R4 V4 · weakest: E, the first version led with five equal tiles and a 70-row table; one figure, one chart and the ruler now lead and the table closes */
@import url("./tokens.css");
@import url("./base.css");

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 500; font-display: swap; src: url(/fonts/familjen-grotesk-latin-500-normal.woff2) format("woff2"); unicode-range: U+0020-007E, U+2010-2027; }
@font-face { font-family: "Familjen Grotesk"; font-weight: 600; font-display: swap; src: url(/fonts/familjen-grotesk-latin-600-normal.woff2) format("woff2"); unicode-range: U+0020-007E, U+2010-2027; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }

/* Base */
body { font-size: var(--text-sm); line-height: 1.6; }
[data-mode="dark"] body { font-weight: 350; }
h1, h2, h3 { line-height: 1.35; max-width: none; }
h1 { font-size: var(--text-display); } h2 { font-size: var(--text-section); } h3 { font-size: var(--text-title); }
p:not([class]) { max-width: 72ch; }
button { cursor: pointer; color: inherit; }
input, select { color: inherit; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.fig { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--color-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.code { font-family: var(--font-outlier); font-size: var(--text-xs); direction: ltr; unicode-bidi: isolate; background: var(--color-paper-3); border-radius: 4px; padding: var(--space-3xs) var(--space-xs); word-break: normal; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.code.nb, .ref li .code { word-break: normal; overflow-wrap: normal; white-space: nowrap; }

/* Interim-rule marker: on every screen, signed in or not */
.mark { background: var(--color-paper-2); color: var(--color-ink-2); border-bottom: 1px solid var(--color-rule); padding: var(--space-xs) var(--space-md); font-size: var(--text-xs); line-height: 1.6; display: flex; gap: var(--space-2xs) var(--space-md); align-items: center; flex-wrap: wrap; }
.mark b { font-weight: 600; color: var(--color-ink); }
.mark .txt { flex: 1 1 320px; min-width: 0; }
.mark .txt::before, .chip::before, .delta::before, .notice::before { content: ""; display: inline-block; width: 14px; height: 14px; flex: none; vertical-align: -2px; margin-inline-end: var(--space-2xs); background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.mark .txt::before, .chip.pending::before, .notice::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.2'/%3E%3Cpath d='M8 4.6v3.7l2.3 1.5'/%3E%3C/svg%3E"); }

/* Status is text with one icon, never a filled chip */
.chip { display: inline-block; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; color: var(--color-ink-2); }
.chip.live::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E"); }
.chip.none::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.2'/%3E%3Cpath d='M5 8h6'/%3E%3C/svg%3E"); }
.chip.review::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.6'/%3E%3Cpath d='M10.5 10.500L14 14'/%3E%3C/svg%3E"); }
.chip.live { color: var(--color-ink); }
.chip.off::before, .chip.fake::before { display: none; }
.chip.off { color: var(--color-muted); }
.runerr { font-size: var(--text-xs); color: var(--color-ink-2); }
.chip.fake { color: var(--color-ink); font-weight: 600; border: 1px solid var(--color-rule-2); border-radius: 4px; padding: 0 var(--space-xs); }

/* Shell: kept. Bottom bar on small screens, side rail from 900px */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--color-paper-2); border-bottom: 1px solid var(--color-rule); padding: var(--space-xs) var(--space-md); display: flex; align-items: center; gap: var(--space-sm); }
.brand { display: flex; align-items: center; gap: var(--space-xs); font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); line-height: 1.3; }
.logo { display: block; flex: none; mix-blend-mode: var(--logo-blend); }
.logo.for-light, [data-mode="dark"] .logo.for-dark { display: block; } .logo.for-dark, [data-mode="dark"] .logo.for-light { display: none; }
.brand .logo { width: 34px; height: auto; }
.brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--color-muted); }
.topbar .who { margin-inline-start: auto; font-size: var(--text-xs); line-height: 1.5; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-xs); justify-content: flex-end; }
.topbar .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; flex-basis: 100%; text-align: end; }
.topbar .who span { color: var(--color-muted); }
.linkbtn { background: none; border: 0; padding: 0; min-height: 24px; color: var(--color-ink-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; font-size: var(--text-xs); position: relative; }
.linkbtn::after { content: ""; position: absolute; inset: -10px -8px; }
@media (hover: hover) { .linkbtn:hover { color: var(--color-accent-text); } }
.linkbtn:active { color: var(--color-ink); }
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-sticky-nav); background: var(--color-paper-2); border-top: 1px solid var(--color-rule); display: flex; padding: var(--space-2xs) var(--space-2xs) calc(var(--space-2xs) + env(safe-area-inset-bottom)); }
.nav a { flex: 1 1 0; min-width: 0; min-height: 48px; text-align: center; padding: var(--space-2xs); border-radius: var(--radius-input); color: var(--color-ink-2); text-decoration: none; font-size: var(--text-xs); font-weight: 500; display: grid; justify-items: center; align-content: center; gap: var(--space-3xs); transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.nav a svg { width: 20px; height: 20px; }
.nav a[aria-current="page"] { color: var(--color-on-wash); background: var(--color-accent-wash); }
.nav a:active { background: var(--color-paper-3); }
.nav .navhead, .nav .lg { display: none; }
.main { flex: 1; padding: var(--space-md) var(--space-md) var(--space-3xl); max-width: 1280px; width: 100%; margin: 0 auto; }
.foot { margin-top: var(--space-lg); padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); font-size: var(--text-xs); color: var(--color-muted); display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); justify-content: space-between; }

@media (min-width: 900px) {
  .shell { padding-inline-start: var(--side); }
  .topbar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); flex-direction: column; align-items: stretch; padding: var(--space-lg) var(--space-md) var(--space-md); gap: 0; z-index: var(--z-sticky); border-bottom: 0; border-inline-end: 1px solid var(--color-rule); }
  .topbar .who { margin: auto 0 0; padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); font-size: var(--text-sm); justify-content: flex-start; }
  .topbar .who b { max-width: 100%; text-align: start; }
  .nav { position: fixed; inset-block: 96px 120px; inset-inline: 0 auto; width: var(--side); background: none; border: 0; flex-direction: column; padding: 0 var(--space-sm); gap: var(--space-3xs); overflow-y: auto; }
  .nav a { flex: none; min-height: 40px; display: flex; align-items: center; justify-items: start; gap: var(--space-xs); text-align: start; font-size: var(--text-sm); padding: var(--space-xs) var(--space-sm); }
  .nav a[aria-current="page"] { box-shadow: inset -2px 0 0 var(--color-accent); }
  .brand { gap: var(--space-sm); } .brand .logo { width: 48px; }
  .nav .lg { display: inline; } .nav .sm { display: none; }
  .nav .navhead { display: block; color: var(--color-muted); font-size: var(--text-xs); padding: var(--space-md) var(--space-sm) var(--space-2xs); }
  .main { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
}
@media (hover: hover) { .nav a:hover { background: var(--color-paper-3); color: var(--color-ink); } .nav a[aria-current="page"]:hover { background: var(--color-accent-wash); color: var(--color-on-wash); } }

/* Page head, period controls */
.head { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-lg); align-items: flex-end; margin-bottom: var(--space-md); padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-rule); }
.head .sub { color: var(--color-muted); font-size: var(--text-sm); margin-top: var(--space-2xs); }
.head .grow { flex: 1 1 260px; min-width: 0; }
.range { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.seg { display: inline-flex; gap: var(--space-3xs); background: var(--color-paper-3); border-radius: var(--radius-input); padding: var(--space-3xs); box-shadow: var(--shadow-key-press); }
.seg button, .tabs a { border: 0; background: none; min-height: 32px; padding: 0 var(--space-sm); border-radius: 4px; font-size: var(--text-sm); color: var(--color-ink-2); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.seg button[aria-pressed="true"], .tabs a[aria-selected="true"] { background: var(--color-key-face); color: var(--color-ink); font-weight: 500; box-shadow: var(--shadow-card); }
.seg button:active, .tabs a:active { background: var(--color-paper-2); }
@media (hover: hover) { .seg button:hover, .tabs a:hover { color: var(--color-ink); } }
.field { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); }
input[type="text"], input[type="password"], input[type="search"], select, .datebox {
  background: var(--color-key-face); border: 1px solid var(--color-muted); border-radius: var(--radius-input); padding: 0 var(--space-sm); min-height: 36px; max-width: 100%; font-size: var(--text-sm);
  outline: 2px solid transparent; outline-offset: -3px; transition: border-color var(--dur-micro) var(--ease-out); }
input:focus-visible, select:focus-visible, .datebox:focus-within { outline-color: var(--color-focus); }
@media (hover: hover) { input[type="text"]:hover, input[type="search"]:hover, input[type="password"]:hover, select:hover, .datebox:hover { border-color: var(--color-ink-2); } }
input::placeholder { color: var(--color-muted); }
select { padding-inline-end: var(--space-lg); }
/* The date field shows day/month/year whatever the browser locale; the native picker sits on top, invisible */
.datebox { position: relative; display: inline-flex; align-items: center; gap: var(--space-xs); min-width: 124px; color: var(--color-ink); }
.datebox svg { width: 16px; height: 16px; color: var(--color-muted); flex: none; }
.datebox input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; }
.datebox input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* Keys */
.btn { border: 0; background: var(--color-gold); color: var(--color-accent-ink); border-radius: var(--radius-input); padding: 0 var(--space-md); min-height: 36px; font-weight: 500; font-size: var(--text-sm); display: inline-flex; align-items: center; gap: var(--space-xs); text-decoration: none; box-shadow: var(--shadow-key-accent); position: relative; transition: translate var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.btn::after { content: ""; position: absolute; inset: -4px 0; }
.btn.ghost, .btn.danger { background: var(--color-key-face); color: var(--color-ink); box-shadow: var(--shadow-key); }
.btn.danger { color: var(--color-error); }
.btn.small { min-height: 28px; padding: 0 var(--space-sm); font-size: var(--text-xs); }
.btn.small::after { inset: -8px 0; }
.btn.icon { padding: 0; width: 36px; justify-content: center; }
@media (hover: hover) { .btn:hover { translate: 0 -1px; } .btn:not(.ghost):not(.danger):hover { background: var(--color-gold-hi); } }
.btn:active { translate: 0 2px; box-shadow: var(--shadow-key-press); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; translate: none; background: var(--color-paper-3); color: var(--color-muted); box-shadow: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Lead: one figure and its chart */
.lead-grid { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-lg); }
.kpi.hero { min-width: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.kpi .lab { font-size: var(--text-sm); color: var(--color-ink-2); }
.kpi.hero .val { color: var(--color-accent-text); font-family: var(--font-display); font-weight: 600; font-size: 4rem; line-height: 1; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: end; }
.kpi.hero .of { font-size: var(--text-sm); color: var(--color-muted); }
.delta { font-size: var(--text-sm); color: var(--color-ink); display: inline-block; white-space: nowrap; }
.delta.up::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 13V3.500M4 7.200l4-4 4 4'/%3E%3C/svg%3E"); }
.delta.down::before { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v9.500M4 8.800l4 4 4-4'/%3E%3C/svg%3E"); }
.delta.flat::before, .delta.na::before { display: none; }
.delta.na { color: var(--color-muted); white-space: normal; }
.stack { display: flex; gap: 1px; height: 12px; border-radius: 2px; overflow: hidden; direction: rtl; }
.stack i { display: block; height: 100%; }
.stack .s-ok, .legend .l-ok::before { background: var(--color-data-ok); } .stack .s-none, .legend .l-none::before { background: var(--color-data-none); }
.stack .s-review, .legend .l-review::before { background: var(--color-data-review); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath d='M-1 1l2-2M0 4l4-4M3 5l2-2' stroke='black' stroke-width='1.300'/%3E%3C/svg%3E") 0 0 / 4px 4px; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath d='M-1 1l2-2M0 4l4-4M3 5l2-2' stroke='black' stroke-width='1.300'/%3E%3C/svg%3E") 0 0 / 4px 4px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); font-size: var(--text-xs); color: var(--color-ink-2); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-inline-end: var(--space-2xs); }
.legend .l-prev::before { background: var(--color-muted); height: 2px; vertical-align: 3px; }
.plot { min-width: 0; }
.plot h2, .band h2 { font-size: var(--text-title); }
.plot .caption, .band .caption { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-2xs); }
.plot-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-md); margin-bottom: var(--space-xs); }
.plot-head .legend { margin-inline-start: auto; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--color-muted); font-variant-numeric: tabular-nums; }
.chart .g { stroke: var(--color-rule); stroke-width: 1; }
.chart .cur { fill: none; stroke: var(--color-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .prev { fill: none; stroke: var(--color-muted); stroke-width: 1.5; stroke-linejoin: round; opacity: 0.6; }
.chart .pt { fill: var(--color-paper); stroke: var(--color-accent); stroke-width: 2; }
.chart .ptl { fill: var(--color-ink); font-weight: 600; font-size: 12px; }
.chart .hit { fill: transparent; }
@media (min-width: 900px) { .lead-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: var(--space-xl); } .kpi.hero { padding-inline-end: var(--space-xl); border-inline-end: 1px solid var(--color-rule); } }

/* Stat row: figures and labels, ruled, no tiles */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 var(--space-lg); border-block: 1px solid var(--color-rule); }
.stats > div { padding: var(--space-sm) 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 var(--space-xs); }
.stats > div:nth-child(odd) { padding-inline-end: var(--space-md); border-inline-end: 1px solid var(--color-rule); }
.stats > div:nth-child(even) { padding-inline-start: var(--space-md); }
.stats > div:nth-child(n+3) { border-top: 1px solid var(--color-rule); }
.stats dt { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--color-ink-2); line-height: 1.5; min-height: 3em; }
.stats dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats dd small { font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--color-muted); margin-inline-start: var(--space-2xs); }
.spark { width: 72px; height: 24px; display: block; overflow: visible; }
.spark path { fill: none; stroke: var(--color-ink-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
@media (min-width: 900px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats > div, .stats > div:nth-child(even), .stats > div:nth-child(odd) { padding: var(--space-md); border-top: 0; border-inline-end: 1px solid var(--color-rule); }
  .stats > div:first-child { padding-inline-start: 0; } .stats > div:last-child { padding-inline-end: 0; border-inline-end: 0; }
  .stats dt { min-height: 0; margin-bottom: var(--space-2xs); }
}

/* The branch ruler (signature) */
.band { margin-bottom: var(--space-lg); min-width: 0; }
.ruler { margin-top: var(--space-sm); }
.ruler .iqr { fill: var(--color-paper-3); }
.ruler .base { stroke: var(--color-rule-2); stroke-width: 1; }
.ruler .tk line { stroke: var(--color-ink-2); stroke-width: 2; transition: stroke var(--dur-micro) var(--ease-out); }
.ruler .tk.small line { stroke: var(--color-rule-2); }
.ruler .tk rect { fill: transparent; }
.ruler .tk:hover line, .ruler .tk:focus-visible line { stroke: var(--color-accent); stroke-width: 3; }
.ruler .tk:focus-visible { outline: none; }
.ruler .tk:focus-visible rect { stroke: var(--color-focus); stroke-width: 2; }
.ruler .med { stroke: var(--color-accent); stroke-width: 2; }
.ruler .medl { fill: var(--color-ink); font-weight: 600; font-size: 12px; }
.rulertip { min-height: 1lh; font-size: var(--text-sm); color: var(--color-ink-2); margin-top: var(--space-2xs); }
.rulertip b { color: var(--color-ink); font-weight: 600; }

/* Three short lists */
.trio { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-lg); }
.trio h2 { font-size: var(--text-title); padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-ink); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-sm); align-items: baseline; padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); }
.rows a { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .rows a:hover, a.name:hover { color: var(--color-accent-text); text-decoration: underline; } }
.rows a:active, a.name:active { color: var(--color-ink); }
.rows .v { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.rows .x { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--color-muted); }
.rows .nil { display: block; padding: var(--space-sm) 0; color: var(--color-muted); font-size: var(--text-sm); }
@media (min-width: 900px) { .trio { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl); } }

/* Sections and tables: ruled, full width, no outer box */
.card { margin-bottom: var(--space-lg); min-width: 0; }
.card > header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-ink); }
.card > header h2 { font-size: var(--text-title); }
.card > header .tools { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.card .body { padding-top: var(--space-sm); }
.note { font-size: var(--text-xs); color: var(--color-muted); padding-top: var(--space-xs); max-width: 96ch; }
.tablewrap { overflow-x: auto; }
.tablewrap.tall { max-height: 560px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: start; font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--color-rule-2); white-space: nowrap; background: var(--color-paper); position: sticky; top: 0; z-index: var(--z-base); }
td { padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--color-rule); vertical-align: middle; }
th:first-child, td:first-child { padding-inline-start: 0; } th:last-child, td:last-child { padding-inline-end: 0; }
td.n, th.n { text-align: end; }
td .name { font-weight: 500; color: var(--color-ink); text-decoration: none; }
@media (hover: hover) { tbody tr:hover td { background: var(--color-paper-2); } }
.rank { color: var(--color-muted); font-size: var(--text-xs); width: 28px; }
.ratecell { display: grid; grid-template-columns: 56px minmax(96px, 1fr); gap: var(--space-xs); align-items: center; min-width: 200px; }
.ratecell b { font-family: var(--font-display); font-weight: 600; }
.ratecell .stack { height: 8px; }
td .delta { font-size: var(--text-xs); }
@media (max-width: 719px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: var(--space-sm) 0; border-bottom: 1px solid var(--color-rule); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2xs) var(--space-sm); }
  table.cards td { padding: 0; border: 0; text-align: start; min-width: 0; }
  table.cards td[data-l]::before { content: attr(data-l); display: block; font-size: var(--text-xs); color: var(--color-muted); }
  table.cards td.wide { grid-column: 1 / -1; }
  table.cards td.rank, table.cards td.hide-sm { display: none; }
  .ratecell { min-width: 0; }
  .tablewrap.tall { max-height: none; }
  body { font-size: var(--text-md); }
  input[type="text"], input[type="password"], input[type="search"], select, .datebox { font-size: var(--text-md); min-height: 40px; }
  .btn { min-height: 40px; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-sm) 0; font-size: var(--text-sm); }

/* The four states of a data region */
.empty { padding: var(--space-lg) 0; color: var(--color-muted); border-bottom: 1px solid var(--color-rule); }
.empty b { display: block; color: var(--color-ink); font-weight: 600; }
.errbox { padding: var(--space-lg) 0; display: grid; gap: var(--space-sm); justify-items: start; }
.sk { background: var(--color-paper-3); border-radius: 4px; animation: skp 1.2s var(--ease-in-out) infinite alternate; }
.sk.t { height: 28px; width: 180px; margin-bottom: var(--space-md); } .sk.f { height: 64px; width: 220px; } .sk.c { height: 190px; } .sk.r { height: 36px; margin-top: var(--space-xs); } .sk.b { height: 88px; margin-bottom: var(--space-lg); }
@keyframes skp { from { opacity: 1; } to { opacity: 0.45; } }
.loading { color: var(--color-muted); }

/* Messages and one-time values */
.msg { margin: 0 0 var(--space-md); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-input); font-size: var(--text-sm); border: 1px solid var(--color-rule-2); border-inline-start-width: 1px; background: var(--color-paper-2); }
.msg.err { color: var(--color-error); border-color: var(--color-error); }
.msg.ok { color: var(--color-ink); }
.once { margin: 0 0 var(--space-lg); padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-accent); background: var(--color-accent-wash); color: var(--color-on-wash); border-radius: var(--radius-card); font-size: var(--text-sm); display: grid; gap: var(--space-xs); }
.once h2 { font-size: var(--text-title); color: var(--color-ink); }
.once .code { background: var(--color-key-face); color: var(--color-ink); padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); }
.totp-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2xs); margin: var(--space-xs) 0; }
.totp-codes .code { text-align: center; font-size: var(--text-sm); padding: var(--space-xs); }
.notice { color: var(--color-ink-2); font-size: var(--text-sm); }

/* Admin */
.grid3 { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-lg); }
@media (min-width: 900px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl); } .grid3 .card { margin-bottom: 0; } }
.req .big { font-family: var(--font-display); font-weight: 600; font-size: var(--text-3xl); line-height: 1.2; text-align: end; }
.req ul, .ref ul { margin: var(--space-xs) 0 0; padding-inline-start: var(--space-md); color: var(--color-ink-2); display: grid; gap: var(--space-2xs); }
.req .nofig { font-weight: 500; color: var(--color-ink); }
.form { display: grid; gap: var(--space-sm); grid-template-columns: minmax(0, 1fr); padding-top: var(--space-sm); }
.form label, .login label { display: grid; gap: var(--space-2xs); font-size: var(--text-sm); color: var(--color-ink-2); }
.form .full { grid-column: 1 / -1; }
@media (min-width: 720px) { .form { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; } }
.branchpick { max-height: 160px; overflow: auto; border: 1px solid var(--color-rule-2); border-radius: var(--radius-input); padding: var(--space-xs) var(--space-sm); display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3xs) var(--space-sm); }
.picklab { font-size: var(--text-sm); color: var(--color-ink-2); margin-bottom: var(--space-2xs); }
.branchpick label, .scopepick label { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; color: var(--color-ink); min-height: 28px; }
.scopepick { display: grid; gap: var(--space-2xs); }
input[type="checkbox"] { accent-color: var(--color-accent); width: 16px; height: 16px; }
.tabs { max-width: 100%; overflow-x: auto; }
.pre { direction: ltr; text-align: left; unicode-bidi: isolate; font-family: var(--font-outlier); font-size: var(--text-xs); line-height: 1.7; background: var(--color-graphite); color: var(--color-graphite-ink); border-radius: var(--radius-card); padding: var(--space-sm) var(--space-md); margin: 0 0 var(--space-sm); overflow-x: auto; white-space: pre; }

/* Sign-in */
.login { min-height: calc(100vh - 48px); display: grid; place-items: center; padding: var(--space-lg) var(--space-md); }
.login .box { width: min(400px, 100%); }
.login .top { padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-ink); }
.login .top .logo { width: 168px; height: auto; margin-inline: auto; }
.login .top { text-align: center; }
.login .top h1 { margin-top: var(--space-sm); }
.login .top p { color: var(--color-muted); }
.login form { padding-top: var(--space-md); display: grid; gap: var(--space-sm); }
.login input { width: 100%; direction: ltr; text-align: start; min-height: 40px; }
.login .btn { justify-content: center; min-height: 40px; }

.printhead, .printonly { display: none; }
/* Print: the figures and the table, none of the controls */
@media print {
  .printhead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-ink); background: var(--color-logo-ground); }
  .pbrand { display: flex; align-items: center; gap: var(--space-sm); font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); line-height: 1.3; white-space: nowrap; }
  .pbrand img { display: block; width: auto; height: 60px; flex: none; }
  .pbrand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--color-muted); }
  .pmeta { margin: 0; font-size: var(--text-xs); line-height: 1.6; color: var(--color-ink-2); }
  .pmeta > div { display: flex; gap: var(--space-xs); justify-content: flex-end; white-space: nowrap; } .pmeta > div[hidden] { display: none; }
  .pmeta dt { color: var(--color-muted); } .pmeta dd { margin: 0; color: var(--color-ink); font-weight: 600; }
  .rulertip { display: none; } .rulertip.printonly { display: block; }
  .topbar, .nav, .range, .tools, .pager, .btn, .foot .noprint { display: none !important; }
  .shell { padding: 0; } .main { padding: 0 var(--space-sm); max-width: none; }
  .tablewrap.tall { max-height: none; overflow: visible; }
  th { position: static; }
  .lead-grid, .band, .stats, .rows li { break-inside: avoid; }
  .trio h2, .card > header { break-after: avoid; }
  tr { break-inside: avoid; }
  table { font-size: var(--text-xs); } td, th { padding-inline: var(--space-2xs); }
  td .name, td .code { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
  td.wide .code { white-space: normal; overflow-wrap: anywhere; }
  .ratecell { min-width: 150px; grid-template-columns: 46px minmax(70px, 1fr); }
  .delta::before { -webkit-mask: none; mask: none; background: none; width: auto; height: auto; vertical-align: baseline; }
  .delta.up::before { content: "\2191"; } .delta.down::before { content: "\2193"; }
}
tbody.fold tr.more { display: none; }
@media print { tbody.fold tr.more { display: table-row; } }
.rows .v .delta { font-size: inherit; }
.rows .v, .rows a { line-height: 1.6; }
.brand > div { white-space: nowrap; }
@media (max-width: 899px) {
  .brand small { display: none; }
  .stats > div { grid-template-columns: minmax(0, 1fr); }
  .stats .spark { margin-top: var(--space-2xs); }
  .range .btn.icon { display: none; }
  .range .field { flex: 1 1 140px; } .range .datebox { flex: 1; }
}

/* «عرض الفروع»: group, branch, doctor and the side-by-side comparison. Same tokens and parts as the dashboard; the tile and the comparison grid are the only new containers. */
.crumbs { margin-bottom: var(--space-sm); font-size: var(--text-sm); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-xs); color: var(--color-muted); }
.crumbs li + li::before { content: "\2039"; margin-inline-end: var(--space-xs); }
.crumbs a { color: var(--color-ink-2); text-decoration: none; }
.crumbs a:active { color: var(--color-ink); }
.crumbs [aria-current] { color: var(--color-ink); font-weight: 500; }
@media (hover: hover) { .crumbs a:hover, .xnotes a:hover, .cmp a:hover { color: var(--color-accent-text); text-decoration: underline; } }
.xp { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
.xmain { min-width: 0; }
.xlead { margin-bottom: var(--space-lg); }
.xlist ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-ink); overflow-y: auto; scroll-snap-type: y proximity; }
.xlist li { scroll-snap-align: start; }
.xlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.xlist li[hidden], .tile[hidden], .xtray[hidden], .tiles.fold .tile.more { display: none; }
.xlist li a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: var(--space-2xs) var(--space-xs); min-height: 44px; padding: var(--space-xs); border-radius: 4px; color: var(--color-ink); text-decoration: none; transition: background-color var(--dur-micro) var(--ease-out); }
.xlist li a .stack { grid-column: 1 / -1; height: 4px; }
.xlist li a b { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); }
.xlist li a[aria-current] { background: var(--color-accent-wash); color: var(--color-on-wash); box-shadow: inset -2px 0 0 var(--color-accent); }
.xlist li a:active { background: var(--color-paper-3); }
@media (hover: hover) { .xlist li a:hover { background: var(--color-paper-2); } .xlist li a[aria-current]:hover { background: var(--color-accent-wash); } }
.xlist .nm { font-size: var(--text-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xlist .xnone { padding: var(--space-sm) 0; color: var(--color-muted); font-size: var(--text-sm); }
.xbar { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding-bottom: var(--space-xs); }
.xbar input, .xbar .field, .xbar select { flex: 1 1 120px; min-width: 0; }
.xck { position: relative; z-index: var(--z-base); display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 28px; font-size: var(--text-xs); color: var(--color-ink-2); cursor: pointer; justify-self: start; }
.xck input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-accent); }
.xck::after { content: ""; position: absolute; inset: -8px -4px; }
@media (max-width: 1099px) {
  .xlist .xtoggle { width: 100%; justify-content: center; }
  .xlist:not(.open) .xbody { display: none; }
  .xlist.open .xbody { padding-top: var(--space-sm); }
  .xlist ul { max-height: 320px; }
}
@media (min-width: 1100px) {
  .xp.has-list { grid-template-columns: 272px minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
  .xlist { position: sticky; top: var(--space-md); }
  .xlist .xtoggle { display: none; }
  .xlist ul { max-height: calc(100vh - 240px); }
  .xp.has-list .lead-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  .xp.has-list .kpi.hero { padding-inline-end: 0; border-inline-end: 0; }
}
@media (min-width: 1280px) { .xp.has-list .lead-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-xl); } .xp.has-list .kpi.hero { padding-inline-end: var(--space-xl); border-inline-end: 1px solid var(--color-rule); } }
.xnotes { min-width: 0; }
.xmain > .xnotes { margin-bottom: var(--space-lg); }
.xnotes h2 { font-size: var(--text-title); padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-ink); }
.xnotes ul { list-style: none; margin: 0; padding: 0; }
.xnotes li { padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); font-size: var(--text-sm); line-height: 1.8; }
.xnotes a, .cmp a.name { color: var(--color-ink); font-weight: 600; text-decoration: none; }
.xnotes a:active, .cmp a:active { color: var(--color-accent-text); }
.xdays, .xbench, .xcmpplot { margin-bottom: var(--space-lg); }
.bars .b-ok { fill: var(--color-data-ok); } .bars .b-none { fill: var(--color-data-none); }
.bars .hl { stroke: var(--color-data-review); stroke-width: 2; }
.xtable summary { display: inline-flex; align-items: center; min-height: 32px; font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; }
.xtable .tablewrap { max-height: 360px; overflow-y: auto; }
.xvs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-md); margin: var(--space-sm) 0 var(--space-xs); max-width: 560px; }
.xvs dt { font-size: var(--text-xs); color: var(--color-ink-2); }
.xvs dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); line-height: 1.3; }
.xvs dd .delta { font-size: inherit; }
.xband .me { fill: var(--color-accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: var(--space-sm); padding-top: var(--space-sm); }
.searching .tiles.fold .tile.more:not([hidden]) { display: grid; }
.searching .pager { display: none; }
.tile { position: relative; display: grid; align-content: start; gap: var(--space-xs); min-width: 0; padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); border: 1px solid var(--color-rule); border-radius: var(--radius-card); transition: border-color var(--dur-micro) var(--ease-out); }
.tile h3 { font-size: var(--text-title); font-weight: 600; line-height: 1.4; }
.tile h3 a { color: var(--color-ink); text-decoration: none; }
.tile h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
.tile h3 a:focus-visible { outline: none; } .tile h3 a:focus-visible::after { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.tile:active { background: var(--color-paper-3); }
@media (hover: hover) { .tile:hover { border-color: var(--color-ink-2); } }
.tv { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-sm); min-width: 0; }
.tv b { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); line-height: 1.1; }
.tv .spark { margin-inline-start: auto; align-self: center; }
.tchg { font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
.tchg .delta { font-size: inherit; }
.tile .stack { height: 8px; }
.tx { margin: 0; font-size: var(--text-xs); line-height: 1.6; color: var(--color-muted); }
.cmp { --cols: 2; }
.cmp.n3 { --cols: 3; } .cmp.n4 { --cols: 4; }
.crow { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(var(--cols), minmax(0, 1fr)); align-items: center; gap: 0 var(--space-md); padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); }
.crow.chead { align-items: end; border-bottom-color: var(--color-rule-2); }
.cl { font-size: var(--text-sm); color: var(--color-ink-2); }
.cc { min-width: 0; font-size: var(--text-sm); }
.chead .cc { display: grid; justify-items: start; gap: var(--space-2xs); }
.chead .name { font-weight: 600; overflow-wrap: anywhere; }
.cc .big { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); }
.cc .stack { height: 10px; max-width: 220px; }
.cc small { font-size: var(--text-xs); }
.cmp .rm { font-size: var(--text-xs); color: var(--color-muted); }
.lk { display: inline-block; width: 24px; height: 0; border-top: 2px solid var(--color-accent); vertical-align: middle; margin-inline-end: var(--space-2xs); }
.lk.k2 { border-top-style: dashed; border-top-color: var(--color-ink); } .lk.k3 { border-top-style: dotted; border-top-color: var(--color-ink-2); } .lk.kg { border-top-width: 1px; border-top-color: var(--color-muted); }
.legend.lines span::before { display: none; }
.lines .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lines .k1 { stroke: var(--color-accent); } .lines .k2 { stroke: var(--color-ink); stroke-dasharray: 7 5; } .lines .k3 { stroke: var(--color-ink-2); stroke-dasharray: 1 5; } .lines .kg { stroke: var(--color-muted); stroke-width: 1.2; }
.card .note .legend { margin-bottom: var(--space-2xs); }
.xtray { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); margin-top: var(--space-md); padding: var(--space-sm) var(--space-md); background: var(--color-paper-3); border: 1px solid var(--color-rule-2); border-radius: var(--radius-card); box-shadow: var(--shadow-pop); font-size: var(--text-sm); }
.xtray .tt { flex: 1 1 200px; min-width: 0; }
@media (min-width: 900px) { .xtray { bottom: var(--space-md); } }
@media (max-width: 719px) {
  .crow { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--space-2xs) var(--space-sm); }
  .cl { grid-column: 1 / -1; font-size: var(--text-xs); }
  .chead .cl { display: none; }
  .cc .big { font-size: var(--text-lg); }
  .cc small.muted { display: block; }
  .xvs dd { font-size: var(--text-lg); }
}
@media print {
  .xlist, .xtray, .xck, .xtable, .xdays .seg, .cmp .rm { display: none !important; }
  .xp.has-list { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tiles.fold .tile.more { display: grid; }
  .tiles { gap: var(--space-xs); } .tile { padding: var(--space-xs) var(--space-sm); gap: var(--space-2xs); }
  .note { break-before: avoid; } .foot { break-before: avoid; }
  .card > header, .xnotes h2, .legend { break-after: avoid; }
  .tile, .xnotes li, .crow, .xdays, .xbench, .xcmpplot { break-inside: avoid; }
}

/* Doctor visits: field marks, the per-field summary and the text of one opened visit */
.chip.fm.live::before { background: var(--color-data-ok); }
.chip.fm.none { color: var(--color-muted); }
.frows { display: grid; gap: var(--space-xs); padding: var(--space-sm) 0 var(--space-2xs); }
.frow { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); align-items: center; font-size: var(--text-sm); }
.frow .fl { font-weight: 500; color: var(--color-ink); }
.frow .stack { height: 10px; }
.frow .fv { color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.frow .fv b { font-family: var(--font-display); font-weight: 600; color: var(--color-ink); }
@media (min-width: 900px) { .frow { grid-template-columns: 200px minmax(120px, 1fr) minmax(0, 1.4fr); gap: var(--space-md); } }
#visits > header .seg { flex-wrap: wrap; }
table.vt td.act { white-space: nowrap; text-align: end; }
tr.vtext > td { padding: 0 0 var(--space-sm); background: none; }
@media (hover: hover) { tbody tr.vtext:hover td { background: none; } }
.vbox { border-inline-start: 2px solid var(--color-accent); background: var(--color-paper-2); padding: var(--space-sm) var(--space-md); border-radius: 0 var(--radius-input) var(--radius-input) 0; display: grid; gap: var(--space-xs); }
[dir="rtl"] .vbox { border-radius: var(--radius-input) 0 0 var(--radius-input); }
.vfields { margin: 0; display: grid; gap: var(--space-sm); }
.vfields > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3xs); padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.vfields > div:last-child { border-bottom: 0; padding-bottom: 0; }
.vfields dt { font-size: var(--text-xs); color: var(--color-ink-2); display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); align-items: baseline; font-weight: 500; }
.vfields dd { margin: 0; min-width: 0; }
.vfields p { margin: 0; }
.vtxt { white-space: pre-line; unicode-bidi: plaintext; text-align: right; overflow-wrap: anywhere; max-width: 96ch; line-height: 1.8; color: var(--color-ink); }
.vnone { color: var(--color-muted); font-weight: 500; }
@media (min-width: 900px) { .vfields > div { grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-md); } .vfields dt { flex-direction: column; gap: var(--space-3xs); } }
.docpick { display: grid; gap: var(--space-sm); grid-template-columns: minmax(0, 1fr); } .docpick[hidden] { display: none; }
@media (min-width: 720px) { .docpick { grid-template-columns: repeat(2, minmax(0, 1fr)); } .docpick .note { grid-column: 1 / -1; } }
.once .bulk { margin: 0; white-space: pre; overflow-x: auto; max-height: 260px; text-align: left; line-height: 1.9; }
#visits .seg button { gap: var(--space-xs); } #visits .seg .cnt { color: var(--color-muted); font-weight: 400; }
@media (max-width: 719px) {
  table.cards tr.vtext { display: block; padding-top: 0; } table.vt td.act { text-align: start; padding-top: var(--space-2xs); }
  table.cards.vt td.f { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); }
  table.cards.vt td.f[data-l]::before { display: inline; font-size: var(--text-sm); }
  #visits > header .seg { width: 100%; } #visits .seg button { flex: 1 1 auto; justify-content: center; white-space: normal; min-height: 40px; }
}
/* Print carries the marks only: the text of an opened visit stays on screen and is never put on paper. */
@media print { tr.vtext { display: none !important; } #visits > header .seg { display: none; } table.vt td.act { display: none; } }

/* Caseload «حصر حالات الطبيب», branch-group scope and regions «المناطق». Same tokens and parts as the rest. */
.notice.plain { margin: 0 0 var(--space-md); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-accent); background: var(--color-accent-wash); color: var(--color-on-wash); border-radius: var(--radius-input); max-width: 110ch; line-height: 1.8; }
.notice.plain b { color: var(--color-ink); }
.sub2 { display: block; margin-top: var(--space-2xs); font-size: var(--text-xs); color: var(--color-muted); }
.hand { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); padding: var(--space-sm) 0; border-bottom: 1px solid var(--color-rule); }
.hand .picked { font-size: var(--text-sm); color: var(--color-muted); margin-inline-end: auto; }
.hand .field select { min-width: 200px; }
table.ct td.pick { width: 36px; } table.ct td.pick input, .hand .pickall input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-accent); }
table.ct td.st { min-width: 190px; }
#caseload .seg button { gap: var(--space-xs); } #caseload .seg .cnt { color: var(--color-muted); font-weight: 400; }
.acts { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; } .acts .msg { margin: 0; } .acts .msg[hidden] { display: none; }
.card > .acts { padding-top: var(--space-sm); }
.scopebox { display: grid; gap: var(--space-sm); } .scopebox [hidden] { display: none; } .scopebox .note { padding-top: 0; }
.branchpick.tall { max-height: 320px; align-items: start; } .branchpick small { font-size: var(--text-xs); }
.filebtn { position: relative; cursor: pointer; } .filebtn:focus-within { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.rgblock { padding: var(--space-sm) 0; border-bottom: 1px solid var(--color-rule); }
.rgblock h3, .rgleft h3 { font-size: var(--text-md); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-xs) var(--space-sm); margin: 0 0 var(--space-xs); }
.rgblock h3 small { font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--color-muted); }
table.rgt select { width: 100%; max-width: 320px; } table.rgt select.dup { border-color: var(--color-error); }
table.rgt td:first-child { width: 30%; } table.rgt td:nth-child(2) { width: 26%; }
.rgleft { padding: var(--space-sm) 0; } .rgleft p { margin: 0; font-size: var(--text-sm); line-height: 1.9; }
td.blist { font-size: var(--text-sm); color: var(--color-ink-2); max-width: 60ch; line-height: 1.8; }
@media (max-width: 719px) {
  .hand .picked { flex: 1 1 100%; } .hand .field { flex: 1 1 100%; } .hand .field select { flex: 1; min-width: 0; } .hand .btn { flex: 1 1 auto; justify-content: center; }
  #caseload > header .tools { width: 100%; } #caseload > header .seg { width: 100%; flex-wrap: wrap; } #caseload .seg button { flex: 1 1 40%; justify-content: center; white-space: normal; min-height: 40px; }
  table.cards.ct td.pick { grid-column: 1 / -1; width: auto; } table.cards.ct td.st { grid-column: 1 / -1; min-width: 0; }
  table.rgt td:first-child, table.rgt td:nth-child(2) { width: auto; } table.cards.rgt td:last-child { grid-column: 1 / -1; } table.rgt select { max-width: none; }
  .head .range .btn:not(.icon) { flex: 1 1 auto; justify-content: center; }
}
@media print { .hand, table.ct td.pick, table.ct th:has(.sr), #caseload > header .seg { display: none !important; } .notice.plain { background: none; } }
.hand .pickall { display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 28px; font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; }
