/* سجل الطفح الجلدي
   Cool porcelain paper, ink-blue for actions, and one colour per case classification.
   The classification colours are the only strong colour on the page; everything else stays grey. */
:root {
  color-scheme: light;
  --paper: #f2f4f6; --surface: #ffffff; --sunk: #e9edf1; --line: #d9dee4; --line-strong: #b7c0ca;
  --ink: #18212b; --ink-2: #4e5966; --ink-3: #6b7581;
  --act: #23408e; --act-ink: #ffffff; --act-soft: #e3e9f7;
  --measles: #b0213b; --measles-soft: #fbe6ea;
  --rubella: #8a3597; --rubella-soft: #f4e6f6;
  --pending: #9a6200; --pending-soft: #fcf0d6;
  --discarded: #2f6b52; --discarded-soft: #e2f0e8;
  --vaccine: #4a5c78; --vaccine-soft: #e6ebf2;
  --none: #8b95a1;
  --window: rgb(47 107 82 / .10); --infectious: rgb(176 33 59 / .10);
  --mk-measles: #b0213b; --mk-rubella: #8a3597; --mk-pending: #a36000; --mk-vaccine: #2f6db3; --mk-discarded: #21835a; --mk-none: #a3acb7;
  --radius-s: 6px; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #12161b; --surface: #1a2027; --sunk: #222a33; --line: #2e3742; --line-strong: #46515e;
    --ink: #e9edf1; --ink-2: #b4bdc7; --ink-3: #8f99a5;
    --act: #8fa8f0; --act-ink: #0e1730; --act-soft: #1f2b4b;
    --measles: #f08a9b; --measles-soft: #3d1b23;
    --rubella: #d79be2; --rubella-soft: #351d3a;
    --pending: #e5b45a; --pending-soft: #372a12;
    --discarded: #7fcfa8; --discarded-soft: #16332a;
    --vaccine: #a9b9d4; --vaccine-soft: #232d3c;
    --none: #6d7783;
    --window: rgb(127 207 168 / .12); --infectious: rgb(240 138 155 / .14);
    --mk-measles: #e5536c; --mk-rubella: #a974e0; --mk-pending: #b37a0c; --mk-vaccine: #3f8fe6; --mk-discarded: #2ea672; --mk-none: #5d6773;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #12161b; --surface: #1a2027; --sunk: #222a33; --line: #2e3742; --line-strong: #46515e;
  --ink: #e9edf1; --ink-2: #b4bdc7; --ink-3: #8f99a5;
  --act: #8fa8f0; --act-ink: #0e1730; --act-soft: #1f2b4b;
  --measles: #f08a9b; --measles-soft: #3d1b23;
  --rubella: #d79be2; --rubella-soft: #351d3a;
  --pending: #e5b45a; --pending-soft: #372a12;
  --discarded: #7fcfa8; --discarded-soft: #16332a;
  --vaccine: #a9b9d4; --vaccine-soft: #232d3c;
  --none: #6d7783;
  --window: rgb(127 207 168 / .12); --infectious: rgb(240 138 155 / .14);
  --mk-measles: #e5536c; --mk-rubella: #a974e0; --mk-pending: #b37a0c; --mk-vaccine: #3f8fe6; --mk-discarded: #2ea672; --mk-none: #5d6773;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.65 "Readex Pro", "Geeza Pro", Tahoma, sans-serif; font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
a { color: var(--act); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); padding: 7px 16px; border-radius: var(--radius-s); cursor: pointer; font-weight: 500; min-height: 40px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--measles); border-color: currentColor; background: transparent; }
.btn.danger:hover { background: var(--measles-soft); }
.btn.sm { padding: 3px 11px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 8px 11px; min-height: 42px; }
.input:hover { border-color: var(--ink-3); }
.input:focus { border-color: var(--act); outline: 2px solid var(--act-soft); outline-offset: 0; }
select.input { cursor: pointer; }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.7; }
label.field { display: block; }
label.field > span { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.req { color: var(--measles); }
.legacy-note { font-size: 12.5px; color: var(--pending); margin-top: 4px; }

.msg { padding: 10px 14px; border-radius: var(--radius-s); font-size: 14px; border-inline-start: 3px solid currentColor; }
.msg.error { background: var(--measles-soft); color: var(--measles); }
.msg.warn { background: var(--pending-soft); color: var(--pending); }
.msg.ok { background: var(--discarded-soft); color: var(--discarded); }
.msg.info { background: var(--act-soft); color: var(--act); }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.auth-card h1 { font-size: 28px; }
.auth-card .btn { width: 100%; }
.auth-theme { position: absolute; top: 16px; inset-inline-end: 16px; }

/* shell */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1200px; margin: auto; padding: 0 16px; display: flex; align-items: center; gap: 4px 24px; flex-wrap: wrap; min-height: 56px; }
.brand { font-weight: 600; font-size: 16px; display: flex; align-items: center; color: inherit; text-decoration: none; }
.nav { display: flex; gap: 2px; align-self: stretch; }
.nav a { display: flex; align-items: center; padding: 0 12px; text-decoration: none; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--act); border-bottom-color: var(--act); }
.who { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
main { max-width: 1200px; margin: auto; padding: 28px 16px 120px; display: grid; gap: 22px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card > h2 { margin-bottom: 14px; }
.card-sub { color: var(--ink-2); font-size: 13px; margin: -10px 0 14px; }
.loading { padding: 48px; text-align: center; color: var(--ink-2); }

/* classification colours */
.cls-confirmed { --m: var(--mk-measles); --c: var(--measles); --c-soft: var(--measles-soft); }
.cls-probable { --m: var(--mk-rubella); --c: var(--rubella); --c-soft: var(--rubella-soft); }
.cls-measles { --m: var(--mk-measles); --c: var(--measles); --c-soft: var(--measles-soft); }
.cls-rubella { --m: var(--mk-rubella); --c: var(--rubella); --c-soft: var(--rubella-soft); }
.cls-pending { --m: var(--mk-pending); --c: var(--pending); --c-soft: var(--pending-soft); }
.cls-discarded { --m: var(--mk-discarded); --c: var(--discarded); --c-soft: var(--discarded-soft); }
.cls-vaccine { --m: var(--mk-vaccine); --c: var(--vaccine); --c-soft: var(--vaccine-soft); }
.cls-none { --m: var(--mk-none); --c: var(--none); --c-soft: var(--sunk); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--c-soft, var(--sunk)); color: var(--c, var(--ink-2)); }
.pill.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.bad { --c: var(--measles); --c-soft: var(--measles-soft); }
.pill.good { --c: var(--discarded); --c-soft: var(--discarded-soft); }
.pill.warn { --c: var(--pending); --c-soft: var(--pending-soft); }
.pill.info { --c: var(--act); --c-soft: var(--act-soft); }
.pill.none { --c: var(--ink-2); --c-soft: var(--sunk); }

/* the classification bar replaces a row of number boxes */
.overview { display: grid; gap: 14px; }
.overview-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.overview-total strong { font-size: 34px; font-weight: 600; line-height: 1; }
.bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--sunk); gap: 2px; }
.bar span { background: var(--m); min-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 4px; margin: 0; padding: 0; list-style: none; }
.legend button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; border-radius: var(--radius-s); padding: 5px 10px; cursor: pointer; color: var(--ink); }
.legend button::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--m); }
.legend button:hover { background: var(--sunk); }
.legend button[aria-pressed="true"] { border-color: var(--c); background: var(--c-soft); }
.legend b { font-weight: 600; }

/* filters and the case table */
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters label.field { min-width: 140px; }
.search { flex: 1 1 280px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { font-size: 13px; color: var(--ink-2); font-weight: 500; text-align: start; background: var(--sunk); white-space: nowrap; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.cases-table td { font-size: 14px; white-space: nowrap; }
.cases-table td.wrap { white-space: normal; min-width: 170px; }
.cases-table tbody td:first-child { border-inline-start: 4px solid var(--c, transparent); }
.cases-table tbody tr { cursor: pointer; }
.cases-table tbody tr:hover td { background: var(--paper); }
.cases-table th button { all: unset; cursor: pointer; }
.cases-table th button:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.cases-table .name-cell { font-weight: 500; }
.empty-state { padding: 36px 16px; text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; }

/* due appointments */
.due { list-style: none; margin: 0; padding: 0; display: grid; }
.due li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.due li:last-child { border-bottom: 0; }
.due .when { font-weight: 500; }

/* sectioned form and case page: section name in a side column, like a paper investigation form */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sec { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 22px 22px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-head h2 { font-size: 16px; }
.sec-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.field-wrap { min-width: 0; }
.field-wrap.full { grid-column: 1 / -1; }
.detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
.detail > div { min-width: 0; }
.detail .full { grid-column: 1 / -1; }
.detail dt { font-size: 13px; color: var(--ink-2); }
.detail dd { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 500; }
.detail dd.empty { color: var(--ink-3); font-weight: 400; }
.savebar { position: sticky; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); padding: 12px 22px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.sheet-foot { margin: 0; padding: 12px 22px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); }
.savebar .hint { margin-inline-end: auto; font-size: 13px; color: var(--ink-2); }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px; cursor: pointer; background: var(--surface); min-height: 38px; }
.check:has(input:checked) { background: var(--act-soft); border-color: var(--act); color: var(--act); font-weight: 500; }
.check:has(input:focus-visible) { outline: 2px solid var(--act); outline-offset: 2px; }
.check input { accent-color: var(--act); margin: 0; }

/* case header and the rash timeline */
.case-head { display: grid; gap: 10px; }
.case-head .back { font-size: 13.5px; }
.case-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.case-title h1 { font-size: 30px; }
.case-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; }
.tl { padding: 20px 22px 16px; }
.tl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.tl-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.tl-key span::before { content: ""; display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }
.tl-key .k-inf::before { background: var(--infectious); border: 1px solid var(--measles); }
.tl-key .k-win::before { background: var(--window); border: 1px solid var(--discarded); }
.tl-scroll { overflow-x: auto; padding-bottom: 4px; }
/* Axis geometry: the line sits at y=95; two label lanes above it, two below, the day scale at the bottom. */
.tl-axis { position: relative; min-width: 640px; height: 196px; }
.tl-band { position: absolute; }
.tl-band.inf { top: 70px; height: 52px; background: var(--infectious); border-inline: 1px dashed var(--measles); }
.tl-band.win { top: 77px; height: 38px; background: var(--window); }
.tl-line { position: absolute; top: 95px; inset-inline: 0; height: 2px; background: var(--line-strong); }
/* Points are zero-width anchors placed from the right (RTL); children centre on them with translateX(50%). */
.tl-tick { position: absolute; top: 0; width: 0; height: 100%; }
.tl-tick::before { content: ""; position: absolute; top: 176px; inset-inline-start: 0; width: 1px; height: 5px; background: var(--line-strong); }
.tl-tick span { position: absolute; top: 180px; inset-inline-start: 0; transform: translateX(50%); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; direction: ltr; }
.tl-ev { position: absolute; top: 0; width: 0; height: 100%; text-align: center; }
.tl-ev .dot, .tl-ev .lab { position: absolute; inset-inline-start: 0; transform: translateX(50%); }
.tl-ev .dot { top: 89px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink-2); }
.tl-ev.rash .dot { top: 86px; width: 20px; height: 20px; background: var(--measles); border-color: var(--measles); box-shadow: 0 0 0 4px var(--measles-soft); }
.tl-ev .lab { white-space: nowrap; font-size: 12px; line-height: 1.35; color: var(--ink-2); }
.tl-ev .lab b { display: block; font-weight: 600; font-size: 13px; color: var(--ink); }
.tl-ev.rash .lab b { color: var(--measles); }
.tl-ev.up .lab { top: 50px; }
.tl-ev.up2 .lab { top: 12px; }
.tl-ev.down .lab { top: 112px; }
.tl-ev.down2 .lab { top: 143px; }
.tl-note { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.tl-note.warn { color: var(--pending); }
.tl-empty { padding: 18px 22px; color: var(--ink-2); font-size: 14px; }

/* attachments, follow-up, ready replies */
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.drop.over { border-color: var(--act); background: var(--act-soft); }
.drop-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.drop-row select { width: auto; }
.files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; }
.files li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.files .name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.timeline { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.timeline li { border-inline-start: 2px solid var(--line-strong); padding-inline-start: 12px; }
.timeline p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.audit-detail { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; white-space: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); overflow: hidden; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 13px; }
.chip-text { padding: 4px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-align: start; }
.chip-text:hover { background: var(--act-soft); color: var(--act); }
.chip-x { padding: 4px 9px; color: var(--ink-3); border-inline-start: 1px solid var(--line) !important; }
.chip-x:hover { background: var(--measles-soft); color: var(--measles); }
.chips-save { margin-top: 6px; }
.combo { position: relative; }
.combo-box { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 30; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgb(15 25 40 / .16); }
.combo-box[hidden] { display: none; }
.combo-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 11px; cursor: pointer; font-size: 14px; }
.combo-item:hover, .combo-item.on { background: var(--act-soft); }
.combo-x { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.combo-x:hover { background: var(--measles-soft); color: var(--measles); }

dialog { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 480px; width: calc(100% - 32px); padding: 24px; }
dialog::backdrop { background: rgb(10 15 25 / .5); }
dialog h2 { margin-bottom: 10px; }
dialog.wide { max-width: min(960px, calc(100% - 32px)); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }
.preview-img { display: block; max-width: 100%; max-height: 70vh; margin: auto; }
.theme-btn { white-space: nowrap; }

@media (max-width: 820px) {
  .sec { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px 16px; }
  .savebar { padding: 12px 16px; }
  .tl { padding: 16px; }
}
@media (max-width: 560px) {
  .form-grid, .detail { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 23px; }
  .case-title h1 { font-size: 24px; }
  .overview-total strong { font-size: 28px; }
  .who a { display: none; }
  .due li { grid-template-columns: 1fr auto; }
  .due .when { grid-column: 1 / -1; }
}
@media print { .top, .toolbar, .savebar { display: none; } }

/* fill from HESN */
.hesn { background: var(--surface); border: 1px solid var(--act); border-radius: var(--radius); padding: 0 18px; }
.hesn[open] { padding-bottom: 16px; }
.hesn summary { cursor: pointer; padding: 14px 0; display: flex; gap: 6px 14px; align-items: baseline; flex-wrap: wrap; list-style-position: inside; }
.hesn-title { font-weight: 600; color: var(--act); font-size: 16px; }
.hesn-steps { margin: 0 0 12px; padding-inline-start: 22px; color: var(--ink-2); font-size: 14px; display: grid; gap: 2px; }
.hesn > .small { margin: 10px 0 0; }
.hesn-result:empty { display: none; }
.hesn-result { margin-top: 12px; display: grid; gap: 12px; }
.hesn-table td { font-size: 14px; vertical-align: top; }
.hesn-table td:first-child, .hesn-table th:first-child { width: 36px; }
.hesn-table td.v { font-weight: 600; }
.hesn-table td.now { color: var(--ink-2); font-size: 13px; }
.hesn-table tr.differs td.now { color: var(--pending); }
.hesn-table tr.same td { color: var(--ink-3); }
.hesn-table input { accent-color: var(--act); width: 17px; height: 17px; }
.hesn-actions { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.field-wrap.filled .input, .field-wrap.filled .checks { animation: filled 1.6s ease-out; }
@keyframes filled { from { box-shadow: 0 0 0 3px var(--act); background: var(--act-soft); } to { box-shadow: 0 0 0 0 transparent; } }

/* email to the sector */
.mail-subject { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; background: var(--sunk); border-radius: var(--radius-s); margin-bottom: 12px; font-weight: 500; }
.mail { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 18px 20px; max-height: 55vh; overflow: auto; background: #fff; color: #111; font-size: 14.5px; line-height: 1.75; user-select: text; }
.mail p { margin: 0 0 8px; }
.mail .b { font-weight: 600; }
.mail-gap { display: inline-block; width: 3em; }
.mail ol { margin: 0 0 10px; padding-inline-start: 22px; }
.mail ol.sub { padding-inline-start: 40px; }
.mail li { margin-bottom: 4px; }
.mail-table { border-collapse: collapse; margin-bottom: 16px; width: auto; }
.mail-table th, .mail-table td { border: 1px solid #999; padding: 4px 10px; background: #fff; color: #111; font-size: 14px; white-space: nowrap; }
.mail-table th { font-weight: 400; }

/* quick sector and centre */
.place { display: grid; gap: 12px; }
.place.needs { border-color: var(--pending); border-inline-start-width: 4px; }
.place-head { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.place.needs .place-head .small { color: var(--pending); }
.place-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
@media (max-width: 560px) { .place-row { grid-template-columns: minmax(0, 1fr); } }

/* cluster logo and department */
.brand { gap: 12px; }
.logo { display: block; }
.logo img { display: block; height: 100%; width: auto; }
.top-logo { height: 40px; }
.logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo .logo-light { display: none; } :root:not([data-theme="light"]) .logo .logo-dark { display: block; } }
:root[data-theme="dark"] .logo .logo-light { display: none; }
:root[data-theme="dark"] .logo .logo-dark { display: block; }
.brand-text { display: grid; line-height: 1.3; padding-inline-start: 12px; border-inline-start: 1px solid var(--line); }
.brand-text b { font-weight: 600; font-size: 15.5px; }
.brand-text span { font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
.top-in { min-height: 64px; padding-block: 6px; }
.auth-brand { display: grid; gap: 6px; }
.auth-logo { height: 72px; margin-bottom: 14px; }
.dept { margin: 0; font-size: 14px; color: var(--act); font-weight: 500; }
@media (max-width: 560px) {
  .top-logo { height: 32px; }
  .brand-text span { display: none; }
}
@media print { .top { display: block !important; } .top .nav, .top .who { display: none; } }

/* users */
.who .me { font-weight: 500; color: var(--ink); }
.add-user { display: grid; gap: 12px; }
.add-user > h2 { margin: 0; }
.add-user p { margin: 0; }
.add-row { display: grid; grid-template-columns: 1.2fr 1fr 150px auto; gap: 12px; align-items: end; }
.users-table td { vertical-align: middle; }
.users-table tr.off td { color: var(--ink-3); }
.users-table td.n, .users-table th.n { text-align: center; }
.u-name { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.u-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.input.sm { min-height: 34px; padding: 4px 8px; width: auto; }
.cred { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 6px 0 12px; align-items: center; }
.cred dt { color: var(--ink-2); font-size: 13.5px; }
.cred dd { margin: 0; font-weight: 500; text-align: start; }
.secret { font: 600 19px ui-monospace, Menlo, monospace; background: var(--sunk); padding: 6px 12px; border-radius: var(--radius-s); direction: ltr; user-select: all; letter-spacing: .04em; }
@media (max-width: 760px) { .add-row { grid-template-columns: minmax(0, 1fr); } .who .me { display: none; } }

/* statistics */
.stat-filters { display: grid; gap: 12px; }
.stat-filters .filters { margin: 0; }
.seg-group { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); min-height: 36px; }
.seg-btn:hover { background: var(--sunk); }
.seg-btn[aria-pressed="true"] { background: var(--act-soft); border-color: var(--act); color: var(--act); }
.stats-body { display: grid; gap: 22px; }
.stat-summary { display: grid; gap: 16px; }
.stat-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stat-total strong { font-size: 38px; font-weight: 600; line-height: 1; }
.stat-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 18px; margin: 0; }
.stat-nums > div { border-inline-start: 3px solid var(--m); padding-inline-start: 10px; }
.stat-nums dt { font-size: 13px; color: var(--ink-2); }
.stat-nums dt i { display: none; }
.stat-nums dd { margin: 0; font-size: 24px; font-weight: 600; }
.stat-nums dd span { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.chart-head { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.legend.static { margin-bottom: 6px; }
.legend.static li { display: inline-flex; align-items: center; gap: 7px; padding: 2px 8px; font-size: 13.5px; }
.legend.static li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--m); }
.chart { width: 100%; }
svg.epi { width: 100%; height: auto; display: block; font-family: inherit; }
svg.epi .grid { stroke: var(--line); stroke-width: 1; }
svg.epi .base { stroke: var(--line-strong); stroke-width: 1; }
svg.epi text { fill: var(--ink-3); font-size: 11px; }
svg.epi .seg { fill: var(--m); }
svg.epi .hit { fill: transparent; cursor: default; }
svg.epi .col:hover .hit { fill: var(--sunk); fill-opacity: .55; }
svg.epi .hit:focus-visible { outline: none; stroke: var(--act); stroke-width: 2; }
svg.epi .col .hit { transition: fill-opacity .1s; }
svg.epi .col { isolation: isolate; }
svg.epi .col .seg { pointer-events: none; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 8px 10px; font-size: 13px; box-shadow: 0 8px 24px rgb(15 25 40 / .18); min-width: 150px; display: grid; gap: 3px; }
.tip b { font-weight: 600; margin-bottom: 2px; }
.tip-row, .tip-total { display: flex; align-items: center; gap: 7px; }
.tip-row i { width: 9px; height: 9px; border-radius: 2px; background: var(--m); }
.tip-row strong, .tip-total strong { margin-inline-start: auto; font-weight: 600; }
.tip-total { border-top: 1px solid var(--line); padding-top: 3px; margin-top: 2px; color: var(--ink-2); }
.inds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.ind { display: grid; gap: 6px; align-content: start; }
.ind-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ind-title { font-weight: 500; }
.ind-val { font-size: 22px; font-weight: 600; }
.meter { position: relative; height: 10px; background: var(--sunk); border-radius: 4px; }
.meter .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--act); border-radius: 4px; }
.meter .target { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.ind-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ind-foot .ok { color: var(--discarded); font-weight: 500; }
.ind-foot .under { color: var(--measles); font-weight: 500; }
.ind-note { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.bd h2 { margin-bottom: 12px; }
.bd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bd-list li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 34px; gap: 10px; align-items: center; padding: 3px 4px; border-radius: 4px; }
.bd-list li:hover { background: var(--paper); }
.bd-list li.muted-row .bd-name { color: var(--ink-3); }
.bd-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-track { display: block; }
.bd-bar { display: flex; gap: 2px; height: 14px; min-width: 4px; }
.bd-bar span { background: var(--m); min-width: 3px; }
.bd-bar span:first-child { border-start-start-radius: 3px; border-end-start-radius: 3px; }
.bd-bar span:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }
.bd-n { font-weight: 600; text-align: end; font-size: 14px; }
@media (max-width: 820px) { .inds, .stat-grid { grid-template-columns: minmax(0, 1fr); } }
@media (forced-colors: active) { svg.epi .seg, .bar span, .bd-bar span { forced-color-adjust: none; } }

/* keep the header on one line at common laptop widths */
.top-in { gap: 4px 16px; }
.nav a { padding: 0 9px; }
.who { gap: 8px; }
@media (max-width: 1240px) { .brand-text span { display: none; } }
@media (max-width: 1100px) { .who .me { display: none; } }
@media (max-width: 700px) {
  .top-in { padding-inline: 12px; }
  .nav { order: 3; flex: 1 0 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; min-height: 40px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex: 0 0 auto; }
}

/* email template editor */
.tpl-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.tpl-form { display: grid; gap: 14px; }
.tpl-form textarea { min-height: 80px; line-height: 1.7; }
.tpl-chips .chip-text { direction: rtl; font-weight: 500; }
.tpl-side { position: sticky; top: 80px; }
.tpl-side .mail { max-height: 70vh; }
@media (max-width: 980px) { .tpl-layout { grid-template-columns: minmax(0, 1fr); } .tpl-side { position: static; } }

/* ---- UI/UX audit fixes ---- */
/* Faint text now passes 4.5:1 on the grey surfaces too (was 3.98 and 4.25). */
:root { --ink-3: #59626d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink-3: #98a1ad; } }
:root[data-theme="dark"] { --ink-3: #98a1ad; }
.ico { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ind-foot .ok, .ind-foot .under { display: inline-flex; align-items: center; gap: 4px; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--act); color: var(--act-ink); padding: 10px 16px; border-radius: var(--radius-s); font-weight: 600; text-decoration: none; }
.skip:focus { top: 8px; }
main:focus, main h1:focus { outline: none; }
main h1:focus-visible { outline: 2px solid var(--act); outline-offset: 4px; border-radius: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 48px; }
.reveal { position: absolute; inset-inline-end: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; border-radius: var(--radius-s); }
.reveal:hover { color: var(--ink); background: var(--sunk); }
.reveal .ico { width: 20px; height: 20px; }
.field-error { margin: 6px 0 0; color: var(--measles); font-size: 13.5px; font-weight: 500; }
.input[aria-invalid="true"] { border-color: var(--measles); }
.as-table { margin-top: 10px; }
.as-table summary { cursor: pointer; color: var(--act); font-size: 14px; font-weight: 500; padding: 6px 0; }
.as-table table { margin-top: 8px; font-size: 13.5px; }
.as-table .n { text-align: center; }
a, button, summary, label, select { touch-action: manipulation; }
.auth { min-height: 100dvh; }
/* Touch screens: every control at least 44px tall; inputs at 16px so iPhone does not zoom in when a field is tapped. */
@media (pointer: coarse) {
  .btn, .btn.sm, .seg-btn, .legend button, .nav a, .check, .chip button, .input, .input.sm, .as-table summary, .hesn summary { min-height: 44px; }
  .chip-text, .chip-x { display: inline-flex; align-items: center; }
  .cases-table th button { padding-block: 12px; }
  .reveal { height: 44px; }
}
@media (max-width: 760px), (pointer: coarse) { .input, select.input, textarea.input { font-size: 16px; } }

/* email texts: one big box */
.tpl-simple { display: grid; gap: 12px; max-width: 900px; }
.tpl-box { min-height: 60vh; font-size: 15px; line-height: 1.8; resize: vertical; }
.tpl-note { margin: 0; }
.mail-line { margin: 0 0 4px; white-space: pre-wrap; }
.mail-gap-line { margin: 0; height: .8em; }
.tpl-table-note { color: var(--act); font-weight: 500; }
.tpl-box { tab-size: 18; }
.mail-table th { font-weight: 600; background: #f2f2f2; color: #111; }

/* ---- header: brand row + tabs row ---- */
.top { padding: 0; }
.top-bar { max-width: 1200px; margin: auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.top .brand { gap: 14px; min-width: 0; }
.top-logo { height: 46px; }
.brand-text { padding-inline-start: 14px; border-inline-start: 1px solid var(--line); min-width: 0; }
.brand-text b { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.brand-text span { font-size: 13px; color: var(--ink-2); }
@media (max-width: 1240px) { .brand-text span { display: block; } }
.tabs { border-top: 1px solid var(--line); }
.tabs-in { max-width: 1200px; margin: auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: flex; align-items: center; min-height: 46px; padding: 0 14px; color: var(--ink-2); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); background: var(--paper); }
.tabs a.on { color: var(--act); border-bottom-color: var(--act); font-weight: 600; }
.tabs-gap { flex: 1 0 24px; }
.user-menu { position: relative; flex: none; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; padding-inline: 5px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; min-height: 46px; background: var(--surface); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--sunk); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--act-soft); color: var(--act); font-weight: 700; font-size: 15px; flex: none; }
.user-text { display: grid; line-height: 1.25; text-align: start; }
.user-text b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.user-text span { font-size: 12px; color: var(--ink-2); }
.user-menu .chev { width: 16px; height: 16px; color: var(--ink-2); transition: transform .15s; }
.user-menu[open] .chev { transform: rotate(180deg); }
.user-menu .menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 28px rgb(15 25 40 / .16); padding: 6px; display: grid; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; border-radius: var(--radius-s); color: var(--ink); font-size: 14.5px; text-decoration: none; cursor: pointer; text-align: start; }
.menu-item:hover, .menu-item:focus-visible { background: var(--sunk); }
.menu-item .ico { color: var(--ink-2); }
.menu-item.danger, .menu-item.danger .ico { color: var(--measles); }
.menu-item.danger { border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-s) var(--radius-s); margin-top: 4px; padding-top: 10px; }
@media (max-width: 700px) {
  .top-bar { padding: 8px 12px; min-height: 60px; }
  .top-logo { height: 34px; }
  .top .brand { gap: 10px; }
  .brand-text { padding-inline-start: 10px; }
  .brand-text b { font-size: 16px; }
  .brand-text span, .user-text { display: none; }
  .user-menu summary { padding-inline: 5px 8px; }
  .tabs a { padding: 0 12px; }
}

/* ---------- electronic investigation forms ---------- */
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-s); padding: 6px 14px; min-height: 40px; cursor: pointer; font-weight: 500; color: var(--ink); }
.opt:hover { background: var(--sunk); }
.opt[aria-checked="true"] { background: var(--act); border-color: var(--act); color: var(--act-ink); }
.specify { margin-top: 8px; }
.check.single { border-radius: var(--radius-s); }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit .unit { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.q-sub { font-size: 14.5px; color: var(--act); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 6px; }
.q-note { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.q-sub.full, .q-note.full { grid-column: 1 / -1; }
.qform .form-grid { align-items: start; }
.sec-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.sec-jump a { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; text-decoration: none; color: var(--ink-2); min-height: 32px; display: inline-flex; align-items: center; }
.sec-jump a:hover { border-color: var(--act); color: var(--act); }
.ftable-wrap { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.ftable-wrap .scroll { width: 100%; }
.ftable { border-collapse: collapse; width: 100%; min-width: 560px; }
.ftable th, .ftable td { border: 1px solid var(--line); padding: 4px; vertical-align: middle; }
.ftable thead th { background: var(--sunk); font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 6px 6px; line-height: 1.4; }
.ftable .row-n { width: 34px; text-align: center; color: var(--ink-3); font-weight: 500; font-size: 13px; }
.ftable .row-head { background: var(--sunk); font-size: 13px; font-weight: 500; text-align: start; padding: 6px 8px; min-width: 110px; }
.ftable td .input { min-height: 36px; padding: 4px 8px; border-color: transparent; background: transparent; min-width: 70px; }
.ftable td .input:hover { border-color: var(--line-strong); }
.ftable td .input:focus { border-color: var(--act); background: var(--surface); }
.ftable td.col-check { text-align: center; width: 60px; }
.ftable td.col-check input { accent-color: var(--act); width: 18px; height: 18px; }
.ftable td.col-date { min-width: 150px; }
.form-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pick { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); background: var(--surface); }
.pick:hover { border-color: var(--act); background: var(--act-soft); }
.pick b { font-weight: 600; font-size: 15.5px; }
.pick span { font-size: 12.5px; color: var(--ink-2); text-align: end; }
.pick-search { max-width: 380px; margin-bottom: 16px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-row h2 { margin: 0; }
.form-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.form-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.form-list a { font-weight: 500; }
@media (max-width: 760px), (pointer: coarse) { .opt { min-height: 44px; } }

/* =========================================================
   HESN-style frame (2026-11-19): navy side menu, white title bar,
   breadcrumb, blue band, grey label/value panels, underlined tabs.
   ========================================================= */
:root {
  --side: #2c3f86; --side-ink: #ffffff; --side-dim: #c9d2ee; --side-on: rgb(255 255 255 / .14);
  --band: #33488d; --brand: #233c7c; --val: #2a58a6; --panel: #eef3f6; --panel-line: #d3dde3;
  --act: #2c468f; --act-soft: #e4eaf6;
  --paper: #f3f4f6; --radius: 6px; --radius-s: 4px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --side: #141b2c; --side-ink: #e9edf6; --side-dim: #a9b4cf; --side-on: rgb(143 168 240 / .18);
    --band: #1f2b4b; --brand: #b9c9f5; --val: #9fb9f3; --panel: #202833; --panel-line: #333e4b;
    --act: #8fa8f0; --act-soft: #1f2b4b;
  }
}
:root[data-theme="dark"] {
  --side: #141b2c; --side-ink: #e9edf6; --side-dim: #a9b4cf; --side-on: rgb(143 168 240 / .18);
  --band: #1f2b4b; --brand: #b9c9f5; --val: #9fb9f3; --panel: #202833; --panel-line: #333e4b;
  --act: #8fa8f0; --act-soft: #1f2b4b;
}
body { font-family: "Tajawal", "Geeza Pro", Tahoma, sans-serif; font-size: 15.5px; }
h1, h2, h3, b, strong, th { font-weight: 700; }

.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.layout.nav-min { grid-template-columns: 68px minmax(0, 1fr); }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; z-index: 30; }
.side-brand { display: flex; align-items: center; justify-content: center; padding: 18px 16px 16px; border-bottom: 1px solid rgb(255 255 255 / .12); min-height: 84px; }
.side-brand img { height: 50px; width: auto; display: block; }
.side ul { list-style: none; margin: 0; padding: 10px 0; }
.side li.side-sep { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgb(255 255 255 / .12); }
.side a:not(.side-brand) { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 22px; color: var(--side-dim); text-decoration: none; font-weight: 500; font-size: 15px; border-inline-start: 3px solid transparent; }
.side a:not(.side-brand):hover { color: var(--side-ink); background: rgb(255 255 255 / .06); }
.side a.on { color: var(--side-ink); background: var(--side-on); border-inline-start-color: var(--side-ink); font-weight: 700; }
.side .ico { width: 20px; height: 20px; }
.side :focus-visible { outline-color: #fff; outline-offset: -3px; }
.nav-min .side a:not(.side-brand) { justify-content: center; padding: 0; }
.nav-min .side a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nav-min .side-brand img { height: 30px; width: 36px; object-fit: cover; object-position: right; }
.scrim { display: none; }

.page { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 8px 20px; min-height: 64px; }
.menu-btn { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius-s); background: none; color: var(--brand); cursor: pointer; }
.menu-btn:hover { background: var(--sunk); }
.menu-btn .ico { width: 22px; height: 22px; }
.top-title { display: grid; line-height: 1.35; text-decoration: none; min-width: 0; margin-inline-end: auto; }
.top-title b { color: var(--brand); font-size: 18px; }
.top-title span { color: var(--val); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu summary { border-radius: var(--radius-s); }
.avatar { background: var(--act-soft); color: var(--brand); }
.crumbs { display: flex; align-items: center; gap: 8px; padding: 14px 24px; background: var(--surface); font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.crumbs a { color: var(--brand); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--ink-3); }
.band { background: var(--band); color: #fff; min-height: 40px; display: flex; align-items: center; padding: 0 24px; font-size: 13.5px; font-weight: 500; }
main { max-width: none; width: 100%; margin: 0; padding: 22px 24px 96px; flex: 1; }
.foot { text-align: center; font-size: 12.5px; color: var(--ink-2); padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); }

/* cards, headings, buttons */
.card, .sheet { border-radius: var(--radius); box-shadow: 0 1px 2px rgb(20 30 60 / .05); }
.card > h2, .head h1, main h1 { color: var(--brand); }
h1 { font-size: 22px; }
.head h1 { font-size: 22px; }
.btn { border-radius: var(--radius-s); border-color: var(--act); color: var(--act); background: var(--surface); font-weight: 500; }
.btn:hover { background: var(--act-soft); }
.btn.primary { background: var(--act); color: var(--act-ink); }
.btn.danger { border-color: var(--measles); color: var(--measles); }
th { background: var(--panel); color: var(--ink); font-weight: 700; font-size: 13.5px; }
.cases-table tbody tr:hover td { background: var(--panel); }
.input { border-radius: var(--radius-s); }
.sec-head h2 { color: var(--brand); }

/* case summary */
.case-card { display: grid; gap: 12px; padding: 20px 22px; }
.case-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.case-title { display: flex; align-items: baseline; gap: 8px 14px; flex-wrap: wrap; }
.case-title h1 { font-size: 20px; }
.case-title .val, .sum-key b { color: var(--val); font-weight: 500; }
.sum-title { font-size: 15.5px; color: var(--brand); margin-top: 8px; display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: baseline; }
.sum-key { font-size: 13.5px; color: var(--ink); font-weight: 700; }
.sum { margin: 0; background: var(--panel); border-radius: var(--radius-s); padding: 14px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); row-gap: 16px; overflow: hidden; }
.sum > div { padding: 0 18px; border-inline-end: 1px solid var(--panel-line); margin-inline-end: -1px; min-width: 0; }
.sum dt { font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.sum dd { margin: 0; color: var(--val); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sum dd.empty { color: var(--ink-3); }
.sum .full { grid-column: 1 / -1; border-inline-end: 0; }
.detail-sum { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* section tabs */
.sec-tabs { padding: 0; overflow: hidden; }
.tablist { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); padding: 0 14px; }
.tablist::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: none; cursor: pointer; padding: 0 14px; min-height: 50px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--brand); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.tab-panel { padding: 18px 22px; display: grid; gap: 12px; }
.tab-hint { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.sec-tabs .sheet-foot { border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .layout, .layout.nav-min { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; transform: translateX(100%); transition: transform .2s; visibility: hidden; }
  .nav-open .side { transform: none; visibility: visible; }
  .nav-min .side a:not(.side-brand) { justify-content: flex-start; padding: 0 22px; }
  .nav-min .side a span { position: static; width: auto; height: auto; clip-path: none; }
  .nav-min .side-brand img { height: 50px; width: auto; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(10 15 30 / .45); z-index: 25; }
}
@media (max-width: 700px) {
  .top { padding: 6px 12px; gap: 8px; min-height: 58px; }
  .top-title b { font-size: 16px; }
  .top-title span { display: none; }
  .crumbs { padding: 10px 16px; }
  .band { padding: 0 16px; font-size: 12.5px; }
  main { padding: 16px 16px 96px; }
  .case-card { padding: 16px; }
  .sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-panel { padding: 16px; }
}
@media print { .side, .top, .crumbs, .band, .foot, .tablist { display: none !important; } .layout { display: block; } }
.sum dd[dir="ltr"] { text-align: right; }
.lab-cell { display: inline-flex; align-items: center; gap: 8px; }
