/* MedPanel design system
   Foundations: self-hosted Inter (Latin) and Noto Naskh Arabic (Urdu), a calm neutral scale, one
   teal brand colour used sparingly, hairline borders with soft layered shadows, 14px interface type
   with tabular figures for data, and motion that respects reduced-motion settings. Every colour pair
   is a token so light and dark themes share one set of rules. */

@font-face { font-family:'Inter Variable'; font-style:normal; font-weight:100 900; font-display:swap;
  src:url('/fonts/inter-latin.woff2') format('woff2-variations');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter Variable'; font-style:normal; font-weight:100 900; font-display:swap;
  src:url('/fonts/inter-latin-ext.woff2') format('woff2-variations');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Noto Naskh Arabic Variable'; font-style:normal; font-weight:400 700; font-display:swap;
  src:url('/fonts/naskh-arabic.woff2') format('woff2-variations');
  unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }

:root {
  color-scheme: light dark;
  --font: 'Inter Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  /* Neutrals */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --sunken: #f1f3f6;
  --line: #e6e9ef;
  --line-strong: #d2d8e2;
  --ink: #0e1726;
  --ink-2: #3a4457;
  --muted: #5a6577;
  --faint: #8a94a6;

  /* Brand */
  --brand: #0f766e;
  --brand-hover: #115e59;
  --brand-ink: #0b5a54;
  --brand-soft: #e6f4f1;
  --brand-ring: rgb(15 118 110 / .28);
  --on-brand: #ffffff;
  --brand-gradient: linear-gradient(135deg, #14b8a6 0%, #0f766e 55%, #115e59 100%);
  /* Data marks use their own shade, validated for chroma, lightness band and 3:1 contrast on the surface. */
  --chart-1: #0d9488;

  /* Semantic */
  --ok-ink: #0b5d3a;   --ok-bg: #e7f5ed;
  --warn-ink: #8a4b00; --warn-bg: #fff4dd;
  --bad-ink: #9b1c11;  --bad-bg: #fdecea;
  --neutral-ink: #3d4a5c; --neutral-bg: #eef1f5;
  --info: #0e6aa8;

  /* Depth */
  --shadow-xs: 0 1px 2px rgb(16 24 40 / .05);
  --shadow-sm: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
  --shadow-md: 0 4px 10px -2px rgb(16 24 40 / .08), 0 2px 4px -2px rgb(16 24 40 / .06);
  --shadow-lg: 0 24px 48px -12px rgb(16 24 40 / .22);
  --scrim: rgb(9 14 24 / .55);

  /* Shape and rhythm */
  --radius-sm: .5rem;
  --radius: .75rem;
  --radius-lg: 1rem;
  --control: 2.5rem;
  --sidebar-width: 15.5rem;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Legacy names still used by the platform console stylesheet */
  --paper: var(--bg);
  --teal: var(--brand);
  --navy: var(--ink);

  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: 'cv11', 'ss03';
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e14;
    --surface: #10151d;
    --surface-2: #131923;
    --sunken: #0d1219;
    --line: #202938;
    --line-strong: #2d3748;
    --ink: #e9edf3;
    --ink-2: #c4ccd8;
    --muted: #9aa5b8;
    --faint: #6f7a8d;
    --brand: #2dd4bf;
    --brand-hover: #5eead4;
    --brand-ink: #7ce8d6;
    --brand-soft: rgb(45 212 191 / .12);
    --brand-ring: rgb(45 212 191 / .35);
    --on-brand: #042f2e;
    --brand-gradient: linear-gradient(135deg, #5eead4 0%, #2dd4bf 55%, #14b8a6 100%);
    --chart-1: #12a898;
    --ok-ink: #6ee7a8;   --ok-bg: rgb(52 211 153 / .13);
    --warn-ink: #fbbf5a; --warn-bg: rgb(251 191 36 / .13);
    --bad-ink: #ff8f85;  --bad-bg: rgb(248 113 113 / .14);
    --neutral-ink: #b7c0cf; --neutral-bg: rgb(148 163 184 / .14);
    --info: #6cb8f0;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .45), 0 1px 3px rgb(0 0 0 / .4);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / .5);
    --shadow-lg: 0 24px 48px -12px rgb(0 0 0 / .65);
    --scrim: rgb(0 0 0 / .62);
  }
}

html[lang=ur] { --font: 'Noto Naskh Arabic Variable', 'Inter Variable', ui-sans-serif, system-ui, sans-serif; line-height: 1.75; }
/* Negative tracking breaks Arabic-script letter joins. */
html[lang=ur] * { letter-spacing: normal !important; font-feature-settings: normal; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
body.menu-is-open { overflow: hidden; }
::selection { background: var(--brand-ring); }

/* Type scale */
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--ink); text-wrap: balance; }
h1 { font-size: 1.625rem; font-weight: 650; letter-spacing: -.022em; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.011em; margin-bottom: .75rem; }
h3 { font-size: .9375rem; font-weight: 650; letter-spacing: -.008em; margin: 1.35rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .85em; }
.muted { color: var(--muted); line-height: 1.55; }

/* Brand */
.brand { display: flex; align-items: center; gap: .65rem; font-size: 1.0625rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; color: inherit; }
.mark { display: block; flex: none; width: 2rem; height: 2rem; padding: .4rem; color: #fff; border-radius: .6rem; background: var(--brand-gradient);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), 0 1px 2px rgb(15 118 110 / .35); }
@media (prefers-color-scheme: dark) { .mark { color: #042f2e; } }

/* Controls */
label { display: block; margin: 1rem 0 .375rem; font-weight: 550; font-size: .8125rem; color: var(--ink-2); }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; min-height: var(--control); padding: .5rem .75rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled, select:disabled, textarea:disabled { background: var(--sunken); color: var(--faint); cursor: not-allowed; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--bad-ink); }
input:user-invalid:focus-visible, textarea:user-invalid:focus-visible { box-shadow: 0 0 0 3px rgb(220 38 38 / .22); }
select { appearance: none; padding-inline-end: 2.25rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 52%, calc(100% - .8rem) 52%; background-size: .3rem .3rem; background-repeat: no-repeat; }
[dir=rtl] select { background-position: 1.1rem 52%, .8rem 52%; }
textarea { min-height: 5.5rem; resize: vertical; line-height: 1.5; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=checkbox] { accent-color: var(--brand); }
input[type=file] { padding: .4rem; }
input[type=file]::file-selector-button { margin-inline-end: .75rem; padding: .3rem .7rem; font: inherit; font-weight: 550; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: .4rem; cursor: pointer; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--control); padding: .45rem 1rem;
  font-weight: 600; letter-spacing: -.006em; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .08s var(--ease), color .15s var(--ease);
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.operation-card .primary { max-width: 100%; white-space: normal; text-align: center; }
.primary { margin-top: 1.1rem; color: var(--on-brand); background: var(--brand); border: 1px solid var(--brand);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), var(--shadow-xs); }
.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.secondary { color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); }
.secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.quiet { width: 100%; justify-content: flex-start; color: var(--ink-2); background: transparent; border: 1px solid transparent; font-weight: 550; }
.quiet:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skip { position: absolute; z-index: 20; top: .5rem; inset-inline-start: .5rem; padding: .5rem .75rem; color: var(--ink); background: var(--surface);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); transform: translateY(-200%); }
.skip:focus { transform: none; }

/* Feedback */
.feedback { margin: .75rem 0 0; font-size: .8125rem; color: var(--bad-ink); line-height: 1.45; }
.feedback:empty { margin: 0; }
.feedback.ok { color: var(--ok-ink); }
.feedback.ok::before { content: '✓ '; font-weight: 700; }
.field-hint { margin: .35rem 0 0; font-size: .78rem; color: var(--muted); }

/* Surfaces */
.sheet { min-width: 0; padding: 1.25rem; background: var(--surface); }
.operation-card, .desk-grid .sheet { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.operation-card { align-self: start; }
.operation-card h3 { margin: 0 0 .5rem; font-size: .9375rem; }
.operation-header, .pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; }
.operation-header { justify-content: flex-end; }
.operation-header h3 { margin: 0; margin-inline-end: auto; }
.operation-result { overflow-wrap: anywhere; }
.pagination { margin-top: 1rem; justify-content: flex-end; color: var(--muted); font-size: .8125rem; }
.pagination button, .operation-header button { min-height: 2.25rem; padding: .25rem .75rem; font-size: .8125rem; }
fieldset { min-width: 0; margin: 1rem 0 0; padding: .25rem .9rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
legend { padding: 0 .35rem; font-weight: 600; font-size: .8125rem; color: var(--ink-2); }
.medicine-row { margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px dashed var(--line); }
.confirmation { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; background: var(--sunken); border-radius: var(--radius-sm); font-weight: 500; }
.confirmation input { width: 1.1rem; min-height: 1.1rem; flex-shrink: 0; box-shadow: none; }
.operation-card label > :is(input, select, textarea):not([type=checkbox]) { margin-top: .375rem; }
.picker { display: grid; margin-top: .15rem; }
.picker :is(input, select) { margin-top: .375rem; }
.picker .field-hint:empty { display: none; }

/* Sign-in */
.entry { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); width: min(62rem, calc(100% - 2rem)); min-height: 34rem;
  margin: clamp(1rem, 8vh, 5rem) auto; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: var(--shadow-lg); }
.entry-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: clamp(1.75rem, 4vw, 3rem); color: #eef6f5; isolation: isolate;
  background: radial-gradient(120% 90% at 0% 0%, #0f766e 0%, #0b4f4a 42%, #08262a 100%); }
.entry-intro::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgb(255 255 255 / .06) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .06) 1px, transparent 1px);
  background-size: 2.5rem 2.5rem; mask-image: radial-gradient(100% 80% at 0% 0%, #000, transparent 75%); }
.entry-intro .brand { color: #fff; }
.entry-intro h1 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -.028em; line-height: 1.15; }
.entry-intro > p:not(.entry-foot) { max-width: 26rem; margin: 0; font-size: 1rem; line-height: 1.6; color: #c5dedb; }
.entry-intro .mark { background: #fff; color: #0f766e; box-shadow: 0 2px 8px rgb(0 0 0 / .25); }
.entry-copy h1 { max-width: 14ch; font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; color: #fff; }
.entry-copy p { max-width: 26rem; margin: 1rem 0 0; font-size: 1rem; line-height: 1.6; color: #c5dedb; }
.entry-points { display: grid; gap: .7rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.entry-points li { display: flex; align-items: center; gap: .65rem; margin: 0; font-size: .875rem; color: #d9ebe8; }
.entry-points li::before { content: ''; flex: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: rgb(255 255 255 / .14);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .22); }
.entry-points li::after { content: '✓'; position: absolute; margin-inline-start: .22rem; font-size: .7rem; font-weight: 800; color: #9be8dc; }
.entry-foot { margin: 0; font-size: .75rem; color: #8fb6b1; }
.entry .sheet { position: relative; display: flex; flex-direction: column; justify-content: center; padding: clamp(1.75rem, 4.5vw, 3.5rem); box-shadow: none; background: var(--surface); }
.entry .sheet h2 { margin-bottom: .25rem; font-size: 1.375rem; letter-spacing: -.02em; }
.entry .sheet .primary { width: 100%; min-height: 2.75rem; margin-top: 1.5rem; }
.entry .language-toggle { position: absolute; top: 1rem; inset-inline-end: 1rem; min-height: 2.25rem; padding: .2rem .7rem; font-size: .8125rem; }

/* Centre the sign-in card in the viewport. */
#main:has(> .entry:not([hidden])) { display: grid; min-height: 100dvh; align-content: center; }
#main:has(> .entry:not([hidden])) .entry { margin-block: 1.5rem; }

/* Workspace shell */
#desk { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.workspace-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; padding: 1rem .75rem;
  background: var(--surface); border-inline-end: 1px solid var(--line); color: var(--ink); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: .25rem .5rem 1.5rem; }
.sidebar-label, .nav-group { margin: 1.1rem .65rem .4rem; font-size: .6875rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav-group:first-child { margin-top: .25rem; }
.screen-nav { display: grid; gap: 2px; align-content: start; }
.nav-item { position: relative; display: flex; justify-content: flex-start; width: 100%; min-height: 2.25rem; gap: .65rem; padding: .4rem .65rem; text-align: start;
  font-size: .875rem; font-weight: 550; color: var(--ink-2); background: transparent; border: 0; border-radius: var(--radius-sm); }
.nav-item svg { flex: 0 0 1.125rem; width: 1.125rem; height: 1.125rem; color: var(--faint); transition: color .15s var(--ease); }
.nav-item:hover { background: var(--sunken); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item[aria-current] { color: var(--brand-ink); background: var(--brand-soft); font-weight: 650; }
.nav-item[aria-current] svg { color: var(--brand); }
.nav-item[aria-current]::before { content: ''; position: absolute; inset-block: .5rem; inset-inline-start: -.75rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
[dir=rtl] .nav-item[aria-current]::before { border-radius: 3px 0 0 3px; }
.sidebar-footer { margin-top: auto; padding-top: 1rem; display: grid; gap: .5rem; }
.identity { display: flex; align-items: center; gap: .65rem; min-width: 0; padding: .6rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.avatar { display: grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; font-size: .8125rem; font-weight: 700; color: var(--brand-ink); background: var(--brand-soft);
  border-radius: .6rem; box-shadow: inset 0 0 0 1px var(--brand-ring); }
.identity-text { display: grid; min-width: 0; line-height: 1.3; }
.identity-text strong { overflow: hidden; font-size: .8125rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.identity-text span { font-size: .75rem; color: var(--muted); }
.sidebar-close { min-height: 2.25rem; padding: 0 .7rem; font-size: 1.25rem; color: var(--ink); background: transparent; border: 1px solid var(--line-strong); }
.workspace-content { min-width: 0; }
.workspace-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: .75rem; min-height: 3.5rem;
  padding: .5rem clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.workspace-bar .language-toggle { min-height: 2.25rem; padding: .2rem .75rem; font-size: .8125rem; }
.organization-control { display: flex; align-items: center; min-width: 0; }
/* The label stays for assistive technology; the control reads as a workspace switcher. */
.organization-control label { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.organization-control select { min-width: 12rem; max-width: 24rem; min-height: 2.25rem; font-weight: 600; }
.workspace-body { max-width: 96rem; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2rem); }
.page-header { margin-bottom: 1.5rem; }
#desk-title { margin: 0; }
.page-description { max-width: 46rem; margin: .35rem 0 0; font-size: .9375rem; color: var(--muted); }
.page-description:empty { display: none; }
.menu-backdrop { position: fixed; z-index: 3; inset: 0; width: 100%; border: 0; border-radius: 0; background: var(--scrim); }

/* Clinical review */
.desk-grid { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.desk-grid .reader { border-top: 3px solid var(--brand); }
.record-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.record-meta { padding-bottom: .6rem; border-bottom: 1px solid var(--line); color: var(--muted); }
dt { margin-top: .9rem; font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
dd { margin: .2rem 0 0; }
ul { padding-inline-start: 1.15rem; }
li { margin-block: .4rem; }
.encounter-tools { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.sign-tool { margin: .75rem 0 1rem; }
.sign-tool .operation-card { border-inline-start: 3px solid var(--warn-ink); }

/* Operations layout: the worklist leads and actions sit in a sticky rail beside it. */
#operations-screen { display: grid; gap: 1.25rem; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(19rem, 22.5rem); grid-template-areas: 'tables actions'; }
#operations-screen:has(> .operations-tables:empty) { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'actions'; }
#operations-screen:has(> .operations-actions:empty) { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'tables'; }
.operations-tables { grid-area: tables; }
.operations-actions { grid-area: actions; }
.operations-actions, .operations-tables { display: grid; gap: 1.25rem; min-width: 0; }
.operations-actions:empty, .operations-tables:empty { display: none; }
@media (min-width: 1181px) {
  .operations-actions { position: sticky; top: 4.75rem; max-height: calc(100dvh - 5.75rem); overflow-y: auto; padding: 2px 2px 1rem; scrollbar-width: thin; }
}
#operations-screen:has(> .operations-tables:empty) .operations-actions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); position: static; max-height: none; overflow: visible; }

/* Form-first screens (such as Clinical work) give the forms the main area and keep lists secondary. */
#operations-screen[data-layout=forms] { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'actions' 'tables'; }
#operations-screen[data-layout=forms] .operations-actions { position: static; max-height: none; overflow: visible; padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); align-items: start; }

/* Tables */
.table-scroll { margin-top: .9rem; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .8125rem; text-align: start; }
th, td { min-width: 4.5rem; padding: .65rem .9rem; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; font-size: .75rem; font-weight: 600; letter-spacing: .01em; color: var(--muted); background: var(--surface-2); text-wrap: pretty; white-space: nowrap; }
td { max-width: 18rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
tbody tr { transition: background-color .12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: end; font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: 'tnum', 'zero'; white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* The row's next step stays reachable while a wide table scrolls. */
.actions-col { position: sticky; inset-inline-end: 0; background: var(--surface); box-shadow: -1px 0 0 var(--line); white-space: nowrap; }
th.actions-col { background: var(--surface-2); }
tbody tr:hover .actions-col { background: var(--surface-2); }
[dir=rtl] .actions-col { box-shadow: 1px 0 0 var(--line); }
.ref { font-family: var(--mono); font-size: .75rem; color: var(--muted); white-space: nowrap; }
td .secondary { min-height: 2.25rem; padding: .2rem .65rem; font-size: .75rem; }
td .secondary + .secondary { margin-inline-start: .4rem; }

/* Status chips: the text states the state, colour only reinforces it. */
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; border-radius: 999px; }
.chip::before { content: ''; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.chip-draft, .chip-amber { color: var(--warn-ink); background: var(--warn-bg); }
.chip-signed, .chip-green { color: var(--ok-ink); background: var(--ok-bg); }
.chip-red { color: var(--bad-ink); background: var(--bad-bg); }
.chip-grey { color: var(--neutral-ink); background: var(--neutral-bg); }

/* Loading and empty states */
.skeleton { display: grid; gap: .6rem; margin-top: .9rem; padding: .25rem 0; }
.skeleton i { display: block; height: 2.1rem; border-radius: .4rem;
  background: linear-gradient(90deg, var(--sunken) 0%, var(--line) 45%, var(--sunken) 90%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(2) { width: 92%; } .skeleton i:nth-child(3) { width: 84%; } .skeleton i:nth-child(4) { width: 70%; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.empty-state { display: grid; justify-items: center; gap: .35rem; margin-top: .9rem; padding: 2.25rem 1rem; text-align: center; color: var(--muted);
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.empty-state svg { width: 2rem; height: 2rem; color: var(--faint); }
.empty-state strong { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.empty-state span { max-width: 28rem; font-size: .8125rem; }

/* Documents and QR */
.qr-canvas { display: block; width: min(100%, 14rem); height: auto; margin-top: .9rem; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); image-rendering: pixelated; }
.document-card form > button { margin-inline-end: .5rem; }
.document-list { padding: 0; list-style: none; }
.document-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .75rem; margin: .4rem 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* Confirmation dialog for irreversible or money-moving actions */
.confirm-dialog { width: min(30rem, calc(100% - 2rem)); padding: 1.5rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .18s var(--ease); }
.confirm-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.confirm-dialog h3 { margin: 0 0 .75rem; font-size: 1.125rem; }
.confirm-dialog dl { margin: 0 0 .9rem; padding: .25rem .9rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; margin-top: 1.1rem; }
.confirm-actions .primary { margin-top: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Platform console totals */
.platform-totals dt { margin: 0; }

/* Narrow screens */
@media (max-width: 1180px) {
  #operations-screen { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'tables' 'actions'; }
  .operations-actions { position: static; max-height: none; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
}
@media (max-width: 960px) { .desk-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  #desk { grid-template-columns: minmax(0, 1fr); }
  .workspace-sidebar { position: fixed; z-index: 4; inset-block: 0; inset-inline-start: 0; width: min(18rem, 86vw); box-shadow: var(--shadow-lg); }
  .workspace-bar { justify-content: space-between; }
  .menu-open { flex-shrink: 0; }
  .organization-control select { min-width: 0; max-width: 11rem; }
  .entry { grid-template-columns: 1fr; min-height: 0; margin-block: 1rem; }
  .entry-intro { gap: 1.25rem; }
  .entry-copy h1 { max-width: none; }
  .entry-points, .entry-foot { display: none; }
  /* On a phone the next-step buttons scroll with the row so status and amounts stay reachable. */
  .actions-col { position: static; box-shadow: none; }
  h1 { font-size: 1.4rem; }
}

/* Right-to-left: give each value its own direction from its first strong character, so a Latin date,
   amount or reference is laid out left-to-right inside an Urdu page instead of being reordered
   ("22-Nov-2026" must never read "Nov--22"). Alignment stays on the reading side. */
html[dir=rtl] :is(td, dd, .record-meta, .record-text, .field-hint, .chip, option) { unicode-bidi: plaintext; }
html[dir=rtl] :is(td:not(.num), dd, .record-meta, .record-text) { text-align: right; }
[dir=rtl] .language-toggle { direction: ltr; }

/* Dashboards: figures lead, charts support. Marks wear the brand colour; text wears text tokens. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#operations-screen[data-layout=dashboard] { display: block; }
.dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; min-height: var(--control); }
/* Period picker: one button that opens quick ranges and a custom range. */
.period { position: relative; }
.period-button { gap: .6rem; padding: .35rem .85rem; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); }
.period-button:hover { background: var(--surface-2); border-color: var(--faint); }
.period-button[aria-expanded=true] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.period-key { font-size: .8125rem; font-weight: 500; color: var(--muted); }
.period-dates { font-weight: 450; font-variant-numeric: tabular-nums; color: var(--muted); }
.period-chevron { font-size: .7rem; color: var(--muted); }
.period-popover { position: absolute; z-index: 30; inset-block-start: calc(100% + .4rem); inset-inline-start: 0; display: grid; gap: 1rem;
  width: min(23rem, calc(100vw - 2rem)); padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.period-popover[hidden] { display: none; }
.period-presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; }
.period-preset { justify-content: flex-start; min-height: 2.25rem; padding: .3rem .7rem; font-size: .875rem; font-weight: 550; color: var(--ink-2); background: transparent; border: 1px solid transparent; }
.period-preset:hover { background: var(--sunken); color: var(--ink); }
.period-preset[aria-pressed=true] { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-ring); }
.period-custom { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.period-custom-title { grid-column: 1 / -1; margin: 0; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.period-field { margin: 0; min-width: 0; }
.period-field > span { display: block; margin-bottom: .3rem; }
.period-note { grid-column: 1 / -1; margin: 0; min-height: 1.2em; font-size: .78rem; color: var(--muted); }
.period-note.is-error { color: var(--bad-ink); }
.period-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .5rem; }
.period-actions .primary { margin-top: 0; }
.dash-content { transition: opacity .15s var(--ease); }
.dash-content.is-loading { opacity: .55; pointer-events: none; }
.dash-section { margin-top: 1.75rem; }
.dash-section h2 { margin-bottom: .9rem; font-size: 1.0625rem; }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.tile { display: grid; align-content: start; gap: .35rem; min-width: 0; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.tile-label { font-size: .8125rem; font-weight: 550; color: var(--muted); }
.tile-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .4rem; font-size: 1.85rem; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: proportional-nums; }
.tile-value > * { white-space: nowrap; }
.tile-value .cur { font-size: .42em; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.tile-sub { font-size: .8125rem; color: var(--muted); }
.tile-sub:empty { display: none; }
/* Change versus the previous period: the arrow and the sign carry the meaning, colour only reinforces it. */
.tile-delta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; margin-top: .2rem; font-size: .8125rem; color: var(--muted); }
.delta { display: inline-flex; align-items: center; padding: .1rem .55rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; border-radius: 999px; }
.delta.tone-good { color: var(--ok-ink); background: var(--ok-bg); }
.delta.tone-bad { color: var(--bad-ink); background: var(--bad-bg); }
.delta.tone-neutral { color: var(--neutral-ink); background: var(--neutral-bg); }
.delta-note { color: var(--muted); }
.tile.hero .tile-delta { font-size: .875rem; }
.chart-total { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; margin: 0 0 .75rem; }
.chart-total strong { font-size: 1.6rem; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: proportional-nums; }
.chart-total-unit { font-size: .8125rem; color: var(--muted); }
.chart-total .tile-delta { margin: 0; }
.tile.hero { grid-column: span 2; border-top: 3px solid var(--brand); }
.tile.hero .tile-value { font-size: 3.45rem; letter-spacing: -.03em; }
.charts { display: grid; gap: 1.25rem; margin-top: 1.25rem; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.chart-head h3 { margin: 0; }
.chart-sub { margin: .15rem 0 0; font-size: .8125rem; color: var(--muted); }
.seg { display: inline-flex; padding: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.seg button { min-height: 1.875rem; padding: .15rem .75rem; font-size: .8125rem; font-weight: 550; color: var(--muted); background: transparent; border: 0; border-radius: .4rem; box-shadow: none; }
.seg button[aria-pressed=true] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-xs); }
.chart-host { position: relative; border-radius: var(--radius-sm); }
.chart-host:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.chart .area { fill: var(--chart-1); opacity: .1; }
svg.chart .dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
svg.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 650; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
svg.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
svg.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; z-index: 5; min-width: 9rem; padding: .55rem .7rem; pointer-events: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.chart-tip-title { margin-bottom: .2rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.chart-tip-row { display: flex; align-items: baseline; gap: .5rem; font-size: .8125rem; }
.chart-tip-row strong { font-size: .9375rem; font-variant-numeric: proportional-nums; }
.chart-tip-row span { color: var(--muted); }
.bars { padding-top: .25rem; }
.bar-list { margin: 0; padding: 0; list-style: none; }
.bar-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; align-items: center; gap: .85rem; margin: 0; padding: .6rem .5rem; border-radius: var(--radius-sm); transition: background-color .12s var(--ease); }
.bar-row:hover, .bar-row:focus-visible { background: var(--surface-2); }
.bar-name { font-size: .8125rem; color: var(--ink-2); }
.bar-track { display: block; height: .75rem; background: var(--sunken); border-radius: .25rem; }
.bar-fill { display: block; height: 100%; min-width: 0; background: var(--chart-1); border-start-end-radius: .25rem; border-end-end-radius: .25rem; transition: width .35s var(--ease); }
.bar-figures { display: grid; justify-items: end; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.bar-figures strong { color: var(--ink); }
.bar-figures span { color: var(--muted); }
/* Figures that lead somewhere */
.tile-link { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; align-content: start; justify-content: stretch; justify-items: start; gap: .35rem; min-height: 0; padding: 1.1rem 1.2rem; font: inherit; font-weight: inherit; letter-spacing: inherit; text-align: start; white-space: normal; color: inherit; cursor: pointer; }
.tile-link > * { text-align: start; }
.tile-link:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tile-link:active:not(:disabled) { transform: none; }
.tile-go { position: absolute; top: .85rem; inset-inline-end: 1rem; font-size: 1rem; color: var(--faint); transition: color .15s var(--ease), transform .15s var(--ease); }
.tile-link:hover .tile-go, .tile-link:focus-visible .tile-go { color: var(--brand); transform: translateX(2px); }
[dir=rtl] .tile-go { transform: scaleX(-1); }
[dir=rtl] .tile-link:hover .tile-go, [dir=rtl] .tile-link:focus-visible .tile-go { transform: scaleX(-1) translateX(2px); }
.bar-list li { margin: 0; }
.bar-link { width: 100%; min-height: 0; padding-block: .6rem; font: inherit; font-weight: inherit; letter-spacing: inherit; text-align: start; color: inherit; background: transparent; border: 0; box-shadow: none; cursor: pointer; white-space: normal; }
.bar-link:hover { background: var(--surface-2); }
.back-link { min-height: 2rem; margin: 0 0 .5rem; padding: .1rem .5rem .1rem 0; font-weight: 550; color: var(--muted); background: transparent; border: 0; }
.back-link:hover { color: var(--ink); }
[dir=rtl] .back-link { padding: .1rem 0 .1rem .5rem; }
[dir=rtl] .back-link span { display: inline-block; transform: scaleX(-1); }
@media (max-width: 1100px) { .charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .tile.hero { grid-column: 1 / -1; }
  .tile-value { font-size: 1.55rem; }
  .tile.hero .tile-value { font-size: 2.9rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: .6rem; }
}

/* Touch screens get larger targets everywhere. */
@media (pointer: coarse) {
  button, input, select { min-height: 2.75rem; }
  td .secondary, .pagination button, .operation-header button, .period-preset { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print { .workspace-sidebar, .workspace-bar, .menu-backdrop { display: none !important; } #desk { display: block; } }

/* Benefit cards: the employee's own card and each family member's. */
.member-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.member-card { display: grid; gap: .35rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.member-cards > h2 { grid-column: 1 / -1; margin: .5rem 0 0; font-size: 1rem; }
.member-card.is-inactive { opacity: .85; }
.member-card-top { display: flex; justify-content: space-between; gap: .75rem; font-size: .8125rem; color: var(--muted); }
.member-card-org { margin: 0; font-weight: 600; }
.member-card-relation { margin: 0; color: var(--muted); font-size: .875rem; }
.member-card-number { margin: 0; font-size: 1.125rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.member-card-status { margin: .25rem 0 0; font-weight: 600; }
.member-card-status.is-covered { color: var(--ok, #0b6b3a); }
.member-card-status.is-not-covered { color: var(--danger, #a1260f); }
@media print {
  .no-print { display: none !important; }
  body[data-print='card'] * { visibility: hidden; }
  body[data-print='card'] [data-print-target], body[data-print='card'] [data-print-target] * { visibility: visible; }
  body[data-print='card'] [data-print-target] { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 86mm; box-shadow: none; border: 1px solid #000; color: #000; background: #fff; }
}

/* Facts: a returned object (an eligibility verdict, a verified QR code) as labelled lines. */
.facts { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: .4rem 1.25rem; margin: .9rem 0 0; padding: .9rem 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.facts dt { font-size: .8125rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; unicode-bidi: plaintext; }
@media (max-width: 760px) { .facts { grid-template-columns: minmax(0, 1fr); gap: .1rem; } .facts dd { margin-bottom: .5rem; } }

/* Inline code (such as a CSV header in a hint) wraps instead of widening the page. */
code { overflow-wrap: anywhere; }

/* Hospital panel report, people search, and a fixed subject when an action opens from another screen. */
.panel-report { border-block-start: 3px solid var(--brand); }
.panel-intro { color: var(--muted); margin: .55rem 0 1.25rem; line-height: 1.5; }
.panel-period { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; padding: .9rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.panel-period label { min-width: min(100%, 10rem); margin: 0; }
.panel-period-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.panel-period-actions button { margin: 0; min-height: 2.75rem; }
.panel-page-search { max-width: 30rem; margin-block: 1rem .25rem; }
.panel-totals-label { color: var(--muted); font-size: .875rem; font-weight: 650; margin: 1rem 0 .5rem; }
.panel-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: .6rem; margin: 0; }
.panel-totals div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; min-width: 0; background: var(--surface); }
.panel-totals dt { margin: 0; color: var(--muted); font-size: .8125rem; }
.panel-totals dd { margin: .25rem 0 0; color: var(--ink); font-weight: 750; font-size: 1.2rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.collection-search { display: flex; align-items: end; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.collection-search label { flex: 1 1 14rem; max-width: 28rem; margin: 0; }
.collection-search button { min-height: 2.75rem; }
.operation-subject { padding: .55rem .75rem; background: var(--brand-soft); border-inline-start: 3px solid var(--brand); overflow-wrap: anywhere; font-weight: 650; margin: 0 0 .75rem; }
.operation-subject ~ button { margin-top: .75rem; }
.claim-actions-reset { margin-bottom: .9rem; }

/* Detail drawer: one record and its context, opened beside the list. */
dialog.drawer { position: fixed; inset-block: 0; inset-inline: auto 0; margin: 0; width: min(38rem, 100vw); height: 100dvh; max-height: 100dvh; padding: 0; border: 0; border-inline-start: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow-y: auto; }
dialog.drawer::backdrop { background: var(--scrim); }
.drawer-top { position: sticky; inset-block-start: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; background: var(--surface); border-block-end: 1px solid var(--line); }
.drawer-top h2 { margin: 0; font-size: 1.125rem; overflow-wrap: anywhere; }
.drawer-body { display: grid; gap: 1.25rem; padding: 1.25rem; }
dialog.drawer > .feedback { padding-inline: 1.25rem; }
.drawer-section h3 { margin: 0 0 .5rem; font-size: .9375rem; }
.drawer-section .facts { margin-top: .25rem; }
.drawer-section .table-scroll { margin-top: .25rem; }
@media (max-width: 760px) { dialog.drawer { width: 100vw; } }
@media print {
  dialog.drawer[data-print-target] { position: static; width: auto; height: auto; box-shadow: none; }
  dialog.drawer[data-print-target]::backdrop { display: none; }
}

/* Referral letter: built on demand, shown only when printing. */
.letter { display: none; }
@media print {
  body[data-print='card'] .letter[data-print-target] { display: block; position: absolute; inset-block-start: 0; inset-inline: 0; padding: 2cm; background: #fff; color: #000; font-size: 12pt; }
  .letter h1 { font-size: 20pt; margin: 1.5cm 0 1cm; }
  .letter dl { display: grid; grid-template-columns: 6cm 1fr; gap: .4cm 1cm; }
  .letter dt { font-weight: 600; }
  .letter .letter-sign { margin-block-start: 3cm; border-block-start: 1px solid #000; inline-size: 8cm; padding-block-start: .2cm; }
}

.nav-badge { margin-inline-start: auto; min-width: 1.25rem; padding: 0 .4rem; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .75rem; font-weight: 700; line-height: 1.25rem; text-align: center; }

.link-button { background: none; border: 0; padding: .25rem 0; min-height: 2.75rem; color: var(--brand-ink); text-decoration: underline; cursor: pointer; font: inherit; text-align: start; }

.choose { display: grid; place-items: center; min-height: 100dvh; padding: 2rem 1rem; background: var(--bg); }
.choose[hidden] { display: none; }
.choose-sheet { width: min(32rem, 100%); }
.choose-list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .6rem; }
.choose-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 3.25rem; padding: .6rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; text-align: start; }
.choose-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.unauthorized { padding: 1rem 1.25rem; border: 1px solid var(--bad-ink); border-inline-start-width: 4px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad-ink); }
.unauthorized h3 { margin: 0 0 .4rem; }
.unauthorized p { margin: .25rem 0; }

.scanner-stage { display: grid; gap: .5rem; margin-block: .5rem; }
.scanner-stage video { width: 100%; max-height: 22rem; object-fit: cover; border-radius: var(--radius-sm); background: #000; }
.scan-result { display: grid; gap: .25rem; margin-block: .75rem; padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid; border-inline-start-width: 4px; }
.scan-result strong { font-size: 1.0625rem; }
.scan-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.scan-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.scan-bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }

.matrix-cell { text-align: center; color: var(--faint); }
.matrix-cell.yes { color: var(--ok-ink); font-weight: 700; }
