/* Application styles. Tokens are in :root. Rules stay in this order so later
   page styles can still override a shared control. The public site uses landing.css. */

@font-face {
  font-family: "Nunito Sans";
  src: url("/static/fonts/nunito-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("/static/fonts/nunito-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("/static/fonts/nunito-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/nunito-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/nunito-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --saee-primary: #3d7b87;
  --saee-on-primary: #FFFFFF;
  --saee-deep-blue: #0f2c42;
  --saee-midnight-teal: #1e4e5a;
  --saee-charcoal: #3a3f47;
  --saee-gold: #b8956a;
  --saee-white: #ffffff;
  --saee-soft-gray: #f9fafb;
  --saee-border: #e5e7eb;
  --saee-medium-gray: #6b7280;
  --saee-destructive: #e84545;
  --saee-dark-red: #930606;
  --saee-success: #4caf50;
  --saee-alert: #f0a500;

  --brand: var(--saee-primary);
  --brand-hover: var(--saee-midnight-teal);
  --brand-soft: #e7f1f3;
  --on-brand: var(--saee-on-primary);
  --ink: var(--saee-charcoal);
  --muted: var(--saee-medium-gray);
  --paper: var(--saee-soft-gray);
  --surface: var(--saee-white);
  --input: var(--saee-soft-gray);
  --line: var(--saee-border);
  --danger: var(--saee-destructive);
  --danger-strong: var(--saee-dark-red);
  --danger-soft: #fdecec;
  --ok: var(--saee-midnight-teal);
  --ok-soft: #e8f5e9;
  --queue: var(--saee-gold);
  --queue-soft: #fff6e0;
  --draft: var(--saee-medium-gray);
  --finding-implant: var(--brand);
  --finding-endodontic: var(--saee-midnight-teal);
  --finding-impacted: var(--saee-gold);
  --finding-periapical: var(--saee-alert);
  --finding-root_fracture: var(--saee-dark-red);
  --finding-cyst: var(--saee-destructive);
  --finding-bone_loss: var(--saee-success);
  --finding-root_morphology: var(--saee-deep-blue);
  --finding-other: var(--saee-charcoal);
  --shadow: 0 0 0 1px var(--line);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-control: 6px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --text-title: 1.375rem;
  --text-section: 1rem;
  --text-body: 0.875rem;
  --text-small: 0.75rem;
  --text-meta: 0.6875rem;
  --control: 36px;
  --control-compact: 32px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: var(--ease-standard);
  --dur-fast: 140ms;
  --dur-ui: 180ms;
  --dur-overlay: 240ms;
  --dur-page: 220ms;
  --motion-instant: var(--dur-fast);
  --motion-hover: var(--dur-fast);
  --motion-fast: var(--dur-fast);
  --motion-button: var(--dur-fast);
  --motion-component: var(--dur-ui);
  --motion-panel: var(--dur-ui);
  --motion-modal: var(--dur-overlay);
  --motion-page: var(--dur-page);
  --motion-enter: var(--dur-ui);
  --motion-exit: 120ms;
  --float-gap: 16px;
  /* Must match painted .topbar height — sticky second-bar offset depends on it. */
  --topbar-height: 56px;
  --topbar-block: 80px;
  /* Sticky case/page header docks fully below the topbar with a small clear gap. */
  --header-sheet-top: calc(var(--float-gap) + var(--topbar-height) + var(--space-2));

  --font-ui: "Nunito Sans", "Segoe UI", sans-serif;
  --font-display: Nunito, "Nunito Sans", sans-serif;
  --weight-regular: 400;
  --weight-strong: 600;
  --weight-bold: 700;
  --leading-body: 1.45;
  --leading-tight: 1.2;
  --tracking-tight: -0.03em;
  --tracking-label: 0.04em;
  --radius-pill: 999px;
  --radius-item: 10px;
  --focus-ring: 0 0 0 2px var(--brand-soft);
  --info: var(--brand);
  --info-soft: var(--brand-soft);
  --warning: var(--saee-alert);
  --warning-soft: var(--queue-soft);
  --warning-ink: var(--saee-midnight-teal);
  --due-soon: var(--saee-midnight-teal);
  --success: var(--saee-success);
  --success-soft: var(--ok-soft);
  --success-wash: var(--ok-soft);
  --flag-soft: var(--queue-soft);
  --switch-off: #5c6e72;
  --filament: #d7e0e2;
  --filament-draft: #c5d0d3;
  --filament-submitted: #c9ddd0;
  --filament-queue: #ead89a;
  --row-hover: rgba(61, 123, 135, 0.06);
  --backdrop: rgba(15, 44, 66, 0.28);
  --backdrop-strong: rgba(15, 44, 66, 0.45);
  --shadow-menu: 0 10px 24px rgba(15, 44, 66, 0.1);
  --shadow-pop: 0 16px 40px rgba(15, 44, 66, 0.18);
  --shadow-lift: 0 2px 8px rgba(15, 44, 66, 0.08);
  --veil: rgba(255, 255, 255, 0.8);
}

/* Base */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  color-scheme: light;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 40%, var(--line)) transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 40%, var(--line)) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: var(--radius-sm);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn, .rail a, .quick a { cursor: pointer; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
a {
  transition: color var(--motion-hover) var(--ease-out);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--brand);
  color: var(--on-brand);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 20;
}
.skip:focus { top: 12px; }

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--saee-deep-blue);
  text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; display: block; flex: none; }
.brand:hover { color: var(--saee-deep-blue); }
.brand:hover .stem,
.brand:hover .ring { stroke: var(--saee-primary); }

.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px 16px;
  position: sticky;
  top: var(--float-gap);
  z-index: 40;
  margin: var(--float-gap) var(--float-gap) 0;
  /* Horizontal padding only — vertical size is the height token so sticky offsets stay exact. */
  padding: 0 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  max-height: var(--topbar-height);
  overflow: visible;
}
.topbar .brand {
  /* Fit the 44px touch target inside the fixed 56px bar (no vertical padding). */
  min-height: 44px;
}
.topbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: calc(var(--float-gap) * -1);
  right: calc(var(--float-gap) * -1);
  top: calc(var(--float-gap) * -1);
  height: var(--float-gap);
  background: var(--paper);
}
.topbar-title {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--saee-deep-blue);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}
.topbar-actions .btn { min-height: 32px; padding: 0 12px; font-size: 0.8rem; }
.icon-btn.nav-toggle { display: none; }

/* App chrome */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--backdrop);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-item);
  background: transparent;
  color: var(--ink);
}
.icon-btn:hover { background: var(--paper); }
.icon-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; }
.icon-btn, .rail a, .btn, .combo-btn, .case-card {
  transition-property: background-color, color, box-shadow, border-color, scale;
  transition-duration: var(--motion-hover);
  transition-timing-function: var(--ease-out);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(200px, 232px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: calc(100vh - 88px);
}

.rail {
  align-self: start;
  height: fit-content;
  position: sticky;
  top: calc(var(--float-gap) + var(--topbar-height) + var(--float-gap));
  z-index: 30;
  overflow: visible;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.centre-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}
.centre-name {
  text-align: center;
  font-weight: 700;
  margin: 0 0 16px;
}
.nav-label {
  margin: 16px 0 6px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.rail a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.9rem;
  border-radius: var(--radius-item);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.rail a {
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out);
}
.rail a:hover { background: var(--brand-soft); }
.rail a svg { flex: 0 0 18px; color: inherit; }
.rail-foot {
  margin: auto 0 0;
  padding: 16px 10px 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.operator-rail {
  gap: 2px;
  padding: 24px 16px 20px;
}
.operator-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--saee-deep-blue);
  box-shadow: inset 0 0 0 1px var(--line);
}
.operator-rail .centre-name {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--saee-deep-blue);
  overflow-wrap: anywhere;
}
.rail-overview {
  margin: 0 0 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--input);
}
.rail-overview h2 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-overview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.operator-rail .nav-label {
  margin: 14px 0 4px;
  padding: 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.operator-rail a.active,
.operator-rail a.active:hover,
.open-cases a.active {
  background: var(--brand-soft);
  color: var(--brand-hover);
}
.operator-rail .rail-foot {
  margin: 16px 0 0;
  padding: 12px 4px 0;
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.45;
  overflow-wrap: normal;
}

.stage {
  align-self: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  container-type: inline-size;
  container-name: stage;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.toast {
  position: fixed;
  z-index: 50;
  top: auto;
  bottom: 16px;
  right: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(24rem, calc(100vw - 32px));
  margin: 0;
  padding: 10px 8px 10px 12px;
  background: var(--ok-soft);
  color: var(--saee-midnight-teal);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border-left: 3px solid var(--success);
  animation: toast-in var(--dur-ui) var(--ease-enter);
}
.toast p {
  flex: 1;
  margin: 0;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}
.toast .icon-btn { flex: none; color: inherit; }
.toast.is-note { width: min(22rem, calc(100vw - 32px)); }
.toast.is-error {
  background: var(--danger-soft);
  color: var(--danger-strong);
  border-left-color: var(--danger);
}
.toast.is-info {
  background: var(--brand-soft);
  color: var(--brand-hover);
  border-left-color: var(--brand);
}
.toast.is-warning {
  background: var(--queue-soft);
  color: var(--saee-midnight-teal);
  border-left-color: var(--warning);
}
.sev-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  background: none;
}
.sev-icon svg { display: block; }
.toast.is-leaving { animation: motion-fade-out var(--motion-exit) var(--ease-exit) forwards; }
.error-card { max-width: 36rem; margin: 24px auto; }
.error-cause { margin: 0 0 20px; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving,
  .field-error:not([hidden]),
  .btn.is-busy::after { animation: none; }
  dialog,
  dialog::backdrop,
  .file-dialog-card,
  .confirm-dialog-card,
  .form-dialog-card,
  .combo-menu,
  .btn,
  .icon-btn,
  .combo-btn,
  .rail a,
  .case-card,
  .dropzone,
  .pill,
  .tooth-shape,
  .field input,
  .top-search input,
  .field textarea,
  .field select,
  .plain-table tbody td,
  .data-table tbody tr,
  .status-switch button,
  .chart-chip,
  .finding-option,
  .chart-quadrants button,
  .tooth-number,
  .case-tab-bar,
  .load-track span { transition: none; }
  .btn:active,
  .icon-btn:active { scale: none; }
  ::view-transition-old(saee-stage),
  ::view-transition-new(saee-stage) { animation: none; }
}

dialog {
  transition-property: display, overlay;
  transition-duration: var(--motion-exit);
  transition-timing-function: var(--ease-out);
  transition-behavior: allow-discrete;
}
dialog[open] { transition-duration: var(--motion-modal); }
dialog::backdrop {
  opacity: 0;
  transition-property: opacity, display, overlay;
  transition-duration: var(--motion-exit);
  transition-timing-function: var(--ease-out);
  transition-behavior: allow-discrete;
}
dialog[open]::backdrop {
  opacity: 1;
  transition-duration: var(--motion-modal);
}
.file-dialog-card,
.confirm-dialog-card,
.form-dialog-card {
  opacity: 0;
  transform: scale(0.98);
  transition-property: opacity, transform;
  transition-duration: var(--motion-exit);
  transition-timing-function: var(--ease-out);
}
dialog[open] .file-dialog-card,
dialog[open] .confirm-dialog-card,
dialog[open] .form-dialog-card {
  opacity: 1;
  transform: none;
  transition-duration: var(--motion-modal);
}
@starting-style {
  dialog[open]::backdrop { opacity: 0; }
  dialog[open] .file-dialog-card,
  dialog[open] .confirm-dialog-card,
  dialog[open] .form-dialog-card {
    opacity: 0;
    transform: scale(0.98);
  }
}

@view-transition { navigation: auto; }
#main { view-transition-name: saee-stage; }
::view-transition-old(root),
::view-transition-new(root) { animation: none; }
::view-transition-old(saee-stage) {
  animation: motion-leave var(--motion-exit) var(--ease-exit) both;
}
::view-transition-new(saee-stage) {
  animation: motion-rise var(--dur-page) var(--ease-enter) both;
}
@keyframes motion-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes motion-fade-out {
  to { opacity: 0; }
}
@keyframes motion-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes motion-leave {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes motion-scale {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes motion-drawer {
  from { opacity: 0; transform: translateX(-100%); }
  to { opacity: 1; transform: none; }
}
@keyframes motion-drawer-out {
  to { opacity: 0; transform: translateX(-100%); }
}

.stage > h2 {
  margin: 16px 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.2;
  text-wrap: balance;
}
.lede {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-wrap: pretty;
}

.dash-kicker {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stats.stats-month { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  min-width: 0;
}
.stat span,
.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.stat-label svg { color: var(--brand); }
.stat strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}
.stat-total { background: var(--brand-soft); }
.stat-accepted { background: var(--ok-soft); }
.stat-accepted strong,
.stat-accepted .stat-label svg { color: var(--ok); }
.stat-rejected { background: var(--danger-soft); }
.stat-rejected strong,
.stat-rejected .stat-label svg { color: var(--danger-strong); }
.stat-assigned { background: var(--brand-soft); }
.stat-review { background: var(--queue-soft); }
.stat-review strong,
.stat-review .stat-label svg { color: var(--saee-midnight-teal); }
.stat-overdue { background: var(--danger-soft); }
.stat-overdue strong,
.stat-overdue .stat-label svg { color: var(--danger-strong); }
.stat-backlog { background: var(--brand-soft); }
.stat-backlog.is-high { background: var(--queue-soft); }
.stat-backlog.is-high strong,
.stat-backlog.is-high .stat-label svg { color: var(--saee-midnight-teal); }
.stat-backlog.is-full { background: var(--danger-soft); }
.stat-backlog.is-full strong,
.stat-backlog.is-full .stat-label svg { color: var(--danger-strong); }
.stat.is-zero { background: var(--surface); }
.stat.is-zero strong,
.stat.is-zero .stat-label svg { color: var(--muted); }
.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 16px 16px;
}
.quick a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 132px;
  padding: 20px;
  background: var(--input);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.quick a:hover { background: var(--brand-soft); color: var(--brand-hover); }
.quick a {
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out);
}
.quick-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
}
.panel-lede { padding: 0 20px 12px; margin: 0; }

.panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 0 0 8px;
  margin-bottom: 16px;
  min-width: 0;
  max-width: 100%;
}
.panel:has(> .fold) { padding: 0; margin-bottom: 12px; }
.panel > .case-filters,
.panel > .note-stack,
.panel > .facts,
.panel > .empty,
.panel > .table-wrap,
.panel > .pager {
  padding-left: 16px;
  padding-right: 16px;
}
.panel > .case-filters { padding-bottom: 4px; }
.panel > .table-wrap { padding-bottom: 4px; }
.panel > .empty { padding-top: 8px; padding-bottom: 16px; }
.card > h2,
.form-card > h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
}
.panel h2 {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 8px 16px 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.case-row {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) minmax(9rem, 13rem) max-content max-content;
  gap: 16px;
  align-items: center;
  padding: 16px 16px 16px 0;
  border-top: 1px solid var(--line);
  transition: background-color var(--dur-fast) var(--ease-standard);
}
.case-row:hover { background: var(--row-hover); }
.case-row .filament {
  width: 6px;
  align-self: stretch;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--filament);
}
.case-row .filament.draft { background: var(--filament-draft); }
.case-row .filament.processing,
.case-row .filament.submitted { background: var(--filament-submitted); }
.case-row .filament.in_queue { background: var(--filament-queue); }
.case-row .filament.assigned { background: var(--brand); }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  min-height: 44px;
  padding: 12px 16px 8px;
}
.panel .panel-head h2 { padding: 0; }
.panel-head .case-filters {
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 16px;
}
.panel-head .case-filters .field {
  flex: 0 0 10rem;
  width: 10rem;
  max-width: 10rem;
}
.fold { margin: 0; }
.fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  list-style: none;
  cursor: pointer;
}
.fold > summary::-webkit-details-marker { display: none; }
.panel .fold > summary h2 { margin: 0; padding: 0; }
.fold > summary svg {
  flex: 0 0 16px;
  color: var(--muted);
  transition: transform var(--dur-fast) var(--ease-standard);
}
.fold[open] > summary svg { transform: rotate(180deg); }
.fold > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.fold-body { padding: 8px 16px 16px; }
.fold-body .log-list li { padding: 12px 0; }
.fold-body .log-what { min-width: 0; }
.fold-body .empty { padding: 16px 0; }
.fold-body .case-filters { margin-bottom: 12px; max-width: 100%; justify-content: flex-end; }
.fold-body .plain-table { min-width: 32rem; }
.fold-body > .actions {
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.fold-body > .actions form { margin: 0; }
.fold-body > .actions .btn { width: auto; min-width: 0; }
.case-filters .field.fold-search {
  width: auto;
  min-width: 0;
  flex: 1 1 12rem;
}
.case-filters .field input,
.case-filters .field input[type="search"],
.case-filters .field input[type="date"] {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.8rem;
}
.case-filters .btn {
  align-self: flex-end;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  font-size: 0.8rem;
}
.case-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0;
  max-width: 100%;
  min-width: 0;
}
.case-filters .field { width: auto; flex: 1 1 9rem; max-width: 14rem; min-width: 0; gap: 2px; }
.case-filters .field label { font-size: 0.72rem; }
.case-filters .combo-btn {
  min-height: 32px;
  padding: 4px 28px 4px 8px;
  font-size: 0.8rem;
  background-position: right 6px center;
  background-size: 14px;
}
.case-filters .combo-menu { padding: 4px; }
.case-filters .combo-menu [role="option"] {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.8rem;
}
.empty .btn { margin-top: 16px; }
.case-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 16px 16px;
}
.case-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 11.75rem) minmax(0, 6.25rem) minmax(0, 7.25rem) max-content;
  align-items: center;
  column-gap: 16px;
  min-width: 0;
  max-width: 100%;
  padding: 16px 20px;
  background: var(--input);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: background-color var(--motion-hover) var(--ease-out), box-shadow var(--motion-hover) var(--ease-out);
}
.case-card-id { min-width: 0; }
.case-card-id strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#report,
#case-overview,
#case-files,
#case-deadline,
#case-qc-review,
#case-qc-feedback {
  scroll-margin-top: calc(var(--float-gap) + var(--topbar-block) + 12px);
}
#report:focus { outline: none; }
.is-noted {
  border-radius: var(--radius-md);
  animation: note-mark var(--dur-overlay) var(--ease-standard);
}
@keyframes note-mark {
  0% { box-shadow: var(--shadow); }
  22% {
    box-shadow:
      inset 0 0 0 999px color-mix(in srgb, var(--brand) 4%, transparent),
      0 0 0 1px color-mix(in srgb, var(--brand) 32%, transparent);
  }
  100% { box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) {
  .is-noted {
    animation: none;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 32%, transparent);
  }
}
.case-card > .times,
.case-card > .case-clock,
.case-card > .pill { justify-self: start; align-self: center; min-width: 0; }
.case-card > .pill { max-width: 100%; }
.case-card-end {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}
.case-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.case-clock b {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.case-clock time { color: var(--muted); }
.case-card .times {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.case-card .times > * { min-width: 0; max-width: 100%; }
.case-card.draft { background: color-mix(in srgb, var(--draft) 2%, var(--surface)); }
.case-card.processing,
.case-card.submitted { background: color-mix(in srgb, var(--ok) 2%, var(--surface)); }
.case-card.in_queue { background: color-mix(in srgb, var(--queue) 2%, var(--surface)); }
.case-card.assigned { background: color-mix(in srgb, var(--brand) 2%, var(--surface)); }
.case-card.in_review,
.case-card.report_submitted { background: color-mix(in srgb, var(--queue) 2%, var(--surface)); }
.case-card.completed { background: color-mix(in srgb, var(--ok) 2%, var(--surface)); }
.case-card.rejected { background: color-mix(in srgb, var(--danger) 2%, var(--surface)); }
.case-card.on_hold { background: color-mix(in srgb, var(--draft) 2%, var(--surface)); }
.case-card.overdue { background: color-mix(in srgb, var(--danger) 2%, var(--surface)); }
.case-card:hover,
.case-card:focus-within {
  box-shadow: var(--shadow-lift), 0 0 0 1px color-mix(in srgb, var(--brand) 40%, var(--line));
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  background: var(--veil);
  color: var(--brand);
}
.case-card.draft .avatar { color: var(--draft); }
.case-card.processing .avatar,
.case-card.submitted .avatar { color: var(--ok); }
.case-card.in_queue .avatar { color: var(--saee-midnight-teal); }
.case-card.assigned .avatar { color: var(--brand); }
.case-card.in_review .avatar,
.case-card.report_submitted .avatar { color: var(--saee-midnight-teal); }
.case-card.completed .avatar { color: var(--ok); }
.case-card.rejected .avatar,
.case-card.overdue .avatar { color: var(--danger); }
.case-card.on_hold .avatar { color: var(--draft); }
.case-card-id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.case-card-id > div:last-child { min-width: 0; }
.case-card-id strong,
.case-id { display: block; overflow-wrap: anywhere; }
.row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-self: end;
  gap: 8px;
  width: max-content;
  max-width: 100%;
}
.row-actions form { margin: 0; width: 100%; }
.row-actions .btn {
  min-height: 32px;
  width: 100%;
  min-width: 7.5rem;
  padding: 0 10px;
  font-size: 0.8rem;
}
.btn.ghost.danger {
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}
.btn.ghost.danger:hover {
  background: var(--danger-soft);
  color: var(--danger-strong);
}
#request-step,
#dicom-step,
#upload-files {
  scroll-margin-top: 88px;
}
.stage:has(> .page-title) {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 24px;
}
.sheet {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 24px;
}
.sheet > section { padding: 8px 0 20px; border-top: 1px solid var(--line); }
.sheet > section:first-of-type { border-top: 0; }
.sheet > section.card,
.sheet > section.form-card {
  padding: 20px;
  border-top: 0;
}
.sheet h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.sheet > h2 {
  margin: 16px 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 8px;
}
.sheet-head > * { min-width: 0; }
.case-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--brand);
}
.file-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: var(--input);
  border-radius: var(--radius-md);
}
.file-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 12rem;
  color: var(--ink);
}
.file-name > div { min-width: 0; overflow-wrap: anywhere; }
.file-name svg { color: var(--brand); }
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-actions .btn { min-height: 32px; padding: 0 12px; font-size: 0.8rem; }
.file-dialog {
  width: min(28rem, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: inherit;
}
.file-dialog.has-preview { width: min(52rem, calc(100% - 32px)); }
.file-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28rem;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.file-preview[hidden] { display: none; }
#file-view-status { margin: 16px 0 0; }
.file-preview img,
.file-preview iframe {
  display: block;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: var(--surface);
}
.file-preview img {
  width: auto;
  height: auto;
  object-fit: contain;
}
.file-preview iframe { width: 100%; height: 100%; }
.file-preview img[hidden],
.file-preview iframe[hidden] { display: none; }
.pill.saved-pill { text-transform: none; }
.saved-file-name {
  margin: 8px 0 0;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.upload-saved {
  display: block;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--ok-soft);
  color: var(--saee-midnight-teal);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border-left: 3px solid var(--success);
  animation: toast-in var(--dur-ui) var(--ease-enter);
}
.upload-saved-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.upload-saved-copy {
  flex: 1;
  min-width: 0;
}
.upload-saved-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: inherit;
}
.upload-saved-name {
  margin: 4px 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.upload-saved-meta {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}
.upload-card > .upload-saved + form { margin-top: 4px; }
.file-dialog::backdrop,
.confirm-dialog::backdrop {
  background: var(--backdrop-strong);
}
.confirm-dialog {
  width: min(24rem, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: inherit;
}
.confirm-dialog-card {
  margin: 0;
  padding: 20px 24px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.confirm-dialog-card .sheet-head { margin-bottom: 12px; }
.confirm-dialog-card h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink);
}
.confirm-dialog-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.confirm-actions .btn { min-height: 32px; min-width: 32px; }
.btn.danger {
  background: var(--danger);
  color: var(--on-brand);
}
.btn.danger:hover { background: var(--danger-strong); }
.file-dialog-card {
  margin: 0;
  padding: 20px 24px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.file-dialog-card .sheet-head { margin-bottom: 16px; }
.file-dialog-card h2,
.form-dialog-card h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink);
}
.form-dialog {
  width: min(52rem, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: inherit;
  overflow: auto;
}
#edit-dialog.form-dialog[open] {
  display: flex;
  overflow: hidden;
}
#edit-dialog .form-dialog-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: hidden;
}
#edit-dialog .form-dialog-card > .sheet-head,
#edit-dialog .form-dialog-card > .alert { flex: none; }
#edit-dialog form#case-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#edit-dialog .form-dialog-body {
  overflow: auto;
  min-height: 0;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 40%, var(--line)) transparent;
}
#edit-dialog .form-dialog-body::-webkit-scrollbar { width: 8px; }
#edit-dialog .form-dialog-body::-webkit-scrollbar-track { background: transparent; }
#edit-dialog .form-dialog-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: var(--radius-sm);
}
.form-dialog::backdrop {
  background: var(--backdrop-strong);
}
.form-dialog-card {
  overflow: visible;
  margin: 0;
  padding: 20px 24px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.form-dialog .combo-menu { z-index: 80; }
.form-dialog-card .actions {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 12px 0 4px;
  background: var(--surface);
}
#edit-dialog .form-dialog-card .actions {
  position: static;
  flex: none;
  margin: 0;
  padding: 16px 8px 0 0;
  border-top: 1px solid var(--line);
}
.report-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 16px 12px;
  text-align: center;
  color: var(--brand);
}
.report-empty p { margin: 0; color: var(--muted); max-width: 28rem; }
.prep-loader {
  position: relative;
  width: 64px;
  height: 64px;
}
.prep-core {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 6px var(--brand-soft);
}
.detail-stack .panel { padding: 20px 24px 16px; }
.detail-stack .panel h2 {
  min-height: 0;
  padding: 0 0 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.detail-stack .hint { margin: 0 0 16px; }
.detail-panel > .note-body {
  margin: 0;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  line-height: 1.5;
}
.chart-readout-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.chart-readout-item {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.chart-readout-item strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.chart-readout-item span {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
}
.search-bar { padding: 0 16px 16px; }
.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.search-row input {
  flex: 1 1 10rem;
  min-width: 0;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input);
}
.search-row .btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.search-glyph { color: var(--brand); }
.open-cases {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
}
.open-case {
  font-size: 0.85rem;
}
.review-sheet {
  width: 100%;
  margin: 0 0 16px;
  text-align: left;
}
.review-sheet .page-title { margin-bottom: 16px; }
.upload-sheet { padding: 24px; }
.upload-banner .page-title { margin-bottom: 8px; }
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.upload-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.upload-card.is-locked { opacity: 0.78; }
.upload-card[hidden] { display: none; }
.upload-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.upload-card-head h2 { margin: 0 0 4px; font-size: 1.05rem; }
.upload-card-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.upload-glyph {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-item);
  background: var(--brand);
  color: var(--on-brand);
  flex: 0 0 40px;
}
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 168px;
  padding: 24px;
  text-align: center;
  background: var(--input);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: border-color var(--motion-hover) var(--ease-out), background-color var(--motion-hover) var(--ease-out);
}
.dropzone .upload-glyph { transition: transform var(--motion-hover) var(--ease-out); }
.dropzone strong { color: var(--ink); }
.dropzone.has-file [data-chosen] { color: var(--ink); font-weight: 700; }
.dropzone.is-drag {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-soft);
}
.dropzone.is-drag .upload-glyph { transform: translateY(-2px); }
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
}
.dropzone.is-disabled { cursor: not-allowed; }
.file-browse { pointer-events: none; min-height: 32px; }
.upload-picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.upload-picked[hidden],
.upload-progress[hidden],
.upload-progress-actions [hidden],
.upload-actions [hidden],
.alert[hidden] { display: none; }
.upload-picked-name {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-picked-meta { color: var(--muted); font-size: 0.75rem; }
.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}
.upload-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}
.upload-progress-bar {
  width: 0;
  height: 100%;
  background: var(--brand);
  transition: width var(--motion-component) var(--ease-out);
}
.upload-progress-status {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--brand-hover);
  font-size: 0.75rem;
}
.upload-progress-status::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}
.upload-progress-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.upload-progress-actions .btn {
  flex: 1 1 7rem;
  min-height: 44px;
}
.upload-actions { display: flex; gap: 8px; }
.upload-actions .btn { flex: 1; }
.confirm-actions form { display: contents; }
.confirm-actions form[hidden] { display: none; }
#file-view-by-row[hidden] { display: none; }
.case-id { font-size: 0.85rem; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.9rem; }
.meta b { color: var(--ink); font-weight: 600; display: block; font-size: 0.75rem; letter-spacing: 0.04em; }
.times { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: start; }
.times b {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  color: var(--muted);
}
.due-stamp {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.due-stamp time { color: var(--muted); }
.due-inline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.countdown {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--ok-soft);
  color: var(--ok);
}
.countdown.is-soon {
  background: var(--queue-soft);
  color: var(--saee-midnight-teal);
}
.countdown.is-overdue {
  background: var(--danger-soft);
  color: var(--danger-strong);
}
.plain-table {
  width: 100%;
  border-collapse: collapse;
}
.plain-table th,
.plain-table td {
  text-align: start;
  vertical-align: middle;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: normal;
  word-break: normal;
}
.plain-table th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.plain-table td { font-size: 0.8125rem; }
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  vertical-align: middle;
}
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.5; }
.plain-table tbody tr:hover td { background: var(--paper); }
.note-table tbody tr:has(input:checked) td,
.note-table tbody tr:has(input:checked):hover td {
  background: var(--brand-soft);
}
.plain-table tbody td {
  transition: background-color var(--motion-hover) var(--ease-out);
}
.plain-table.is-wide { min-width: 64rem; }
.plain-table.is-wide th,
.plain-table.is-wide td { white-space: nowrap; }
.plain-table .field {
  width: auto;
  min-width: 4.5rem;
  max-width: 6.5rem;
  margin: 0;
  gap: 0;
}
.plain-table .combo-btn {
  min-height: 32px;
  padding: 4px 26px 4px 8px;
  font-size: 0.8125rem;
  background-position: right 6px center;
  background-size: 14px;
}
.plain-table .combo-menu {
  padding: 2px;
  min-width: 0;
  max-height: none;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
}
.plain-table .combo-menu [role="option"] {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 0.8125rem;
  border-radius: 6px;
  line-height: 1.2;
}
.plain-table .combo-menu [role="option"].is-active {
  box-shadow: inset 2px 0 0 var(--brand);
}
.plain-table .pill {
  white-space: nowrap;
  min-height: 22px;
  padding: 2px 8px;
  font-size: 0.72rem;
}
.plain-table a.person-link {
  min-height: 0;
  font-size: inherit;
  font-weight: 600;
}
a.person-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.person-link .case-id {
  display: inline;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
a.person-link:hover { color: var(--brand); }
.plain-table tr:hover .person-link { color: var(--brand); }
.admin-stage { max-width: 720px; margin: 24px auto; padding: 0 16px 40px; }
.admin-stage code {
  font-size: 0.9em;
  background: var(--input);
  padding: 2px 6px;
  border-radius: var(--radius-control);
}

.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  height: auto;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--input);
  color: var(--draft);
  text-transform: capitalize;
  overflow-wrap: anywhere;
  white-space: normal;
  transition: background-color var(--motion-component) var(--ease-out), color var(--motion-component) var(--ease-out);
}
.pill.in_queue { background: var(--queue-soft); color: var(--saee-midnight-teal); }
.pill.assigned { background: var(--brand-soft); color: var(--brand-hover); }
.pill.in_review,
.pill.report_submitted {
  background: var(--queue-soft);
  color: var(--saee-midnight-teal);
  white-space: normal;
}
.pill.completed,
.pill.processing, .pill.submitted { background: var(--ok-soft); color: var(--ok); }
.pill.rejected { background: var(--danger-soft); color: var(--danger-strong); }
.pill.scan_returned { background: var(--queue-soft); color: var(--saee-midnight-teal); }
.pill.on_hold { background: var(--input); color: var(--draft); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }

/* Shared controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--brand);
  color: #FFFFFF;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--brand-hover); color: #FFFFFF; }
.btn:active { background: var(--saee-midnight-teal); color: #FFFFFF; }
/* Filled button labels are #FFFFFF. Do not change this. No text stroke. */
.btn:not(.ghost):not(.quiet):not(.is-busy),
.btn:not(.ghost):not(.quiet):not(.is-busy):hover,
.btn:not(.ghost):not(.quiet):not(.is-busy):active,
.btn:not(.ghost):not(.quiet):not(.is-busy):disabled,
.status-switch button.on {
  color: #FFFFFF;
  -webkit-text-fill-color: #FFFFFF;
  -webkit-text-stroke: 0;
}
@media (pointer: coarse) {
  .btn::after,
  .icon-btn::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
  .btn, .icon-btn { position: relative; }
}
.btn.ghost {
  background: var(--surface);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-hover); }
.btn.quiet {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  min-height: 32px;
}
.btn.quiet:hover { background: var(--input); color: var(--ink); }

.status-switch {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--input);
}
.status-switch-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 8px 0 10px;
}
.status-switch button {
  min-height: 28px;
  padding: 0 12px;
  font-size: 0.8rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out);
}
.status-switch button.on {
  background: var(--brand);
  color: #FFFFFF;
}
.status-switch button[value="0"].on {
  background: var(--switch-off);
}
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover,
.btn:disabled:active {
  background: var(--brand);
  color: #FFFFFF;
}
.btn.ghost:disabled:hover,
.btn.ghost:disabled:active {
  background: var(--surface);
  color: var(--brand);
}
.btn.quiet:disabled:hover,
.btn.quiet:disabled:active {
  background: transparent;
  color: var(--muted);
}
.btn.danger:disabled:hover,
.btn.danger:disabled:active {
  background: var(--danger);
  color: #FFFFFF;
}
.btn.ghost.danger:disabled:hover,
.btn.ghost.danger:disabled:active {
  background: var(--surface);
  color: var(--danger);
}
.btn {
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out), box-shadow var(--motion-hover) var(--ease-out), scale var(--motion-instant) var(--ease-out);
}
.btn:active:not(:disabled):not(.is-busy),
.icon-btn:active:not(:disabled) {
  scale: 0.98;
}
.btn.is-busy {
  position: relative;
  color: transparent;
  pointer-events: none;
}
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--on-brand) 35%, transparent);
  border-top-color: var(--on-brand);
  animation: saee-spin 700ms linear infinite;
}
.btn.ghost.is-busy::after,
.btn.quiet.is-busy::after {
  border-color: color-mix(in srgb, var(--brand) 35%, transparent);
  border-top-color: var(--brand);
}
@keyframes saee-spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden] { display: none; }
.field label { font-weight: 600; font-size: 0.8rem; }
.field input,
.hour-input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--motion-hover) var(--ease-out), box-shadow var(--motion-hover) var(--ease-out), background-color var(--motion-hover) var(--ease-out);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input[type="file"] { min-height: 44px; padding: 8px 10px; }
.hour-input { width: 5.5rem; }
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
}
.note-stack { display: flex; flex-direction: column; gap: 16px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}
.check-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand);
}
.note-read { margin-top: 16px; }
.note-body {
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.combo { position: relative; }
.combo-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.combo-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--control);
  padding: 6px 36px 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233D7B87' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
}
.combo-btn.is-placeholder { color: var(--muted); }
.combo-btn:hover { background-color: var(--input); }
.combo-btn[aria-expanded="true"] {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233D7B87' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15l6-6 6 6'/%3E%3C/svg%3E");
}
.field.is-invalid .combo-btn {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}
.combo-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 240px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-menu);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition-property: opacity, transform;
  transition-duration: var(--motion-exit);
  transition-timing-function: var(--ease-out);
}
.combo-menu.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition-duration: var(--motion-component);
}
.combo-menu [role="option"] {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out);
}
.combo-menu [role="option"]:hover,
.combo-menu [role="option"]:focus {
  background: var(--brand-soft);
  color: var(--brand-hover);
}
.combo-menu [role="option"].is-selected,
.combo-menu [role="option"].is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.combo-menu [role="option"].is-active {
  box-shadow: inset 3px 0 0 var(--brand);
}
.combo-menu [role="option"].is-placeholder { color: var(--muted); font-weight: 400; }
.field input:focus,
.hour-input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}
.field input:disabled,
.hour-input:disabled,
.field select:disabled,
.field textarea:disabled,
.combo-btn:disabled {
  background: var(--input);
  color: var(--muted);
  cursor: not-allowed;
}
.field.is-invalid input,
.field.is-invalid select,
.field.is-invalid textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}
.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--danger-strong);
}
.field-error:not([hidden]) { animation: saee-inline var(--motion-button) var(--ease-out); }
@keyframes saee-inline {
  from { opacity: 0; transform: translateY(-4px); }
}
.field-error::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  background: var(--danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  border-radius: var(--radius-pill);
}
.field-error[hidden] { display: none; }

.form-card, .card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  min-width: 0;
  max-width: 100%;
}
.form-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.form-head h2 { margin: 0; font-size: 1.05rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px 8px 32px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger);
  background: var(--danger-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23930606' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") 8px 8px / 16px 16px no-repeat;
  color: var(--danger-strong);
  margin-bottom: 16px;
  font-size: 0.8125rem;
}
.waiting {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--queue-soft);
  box-shadow: var(--shadow);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--saee-alert);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.waiting p { margin: 6px 0 0; color: var(--muted); }
.waiting-icon {
  display: flex;
  margin-top: 2px;
  color: var(--saee-deep-blue);
}
.waiting.deleted-banner {
  background: var(--danger-soft);
  color: var(--danger-strong);
  border-left-color: var(--danger);
}
.waiting.deleted-banner p { color: var(--danger-strong); }
.deleted-banner-icon {
  display: flex;
  margin-top: 2px;
  color: var(--danger);
}

.drop {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drop input[type="file"] {
  width: 100%;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--input);
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 32px;
  row-gap: 16px;
  margin: 0;
}
.facts > div { min-width: 0; }
.facts dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.facts .fact-span { grid-column: 1 / -1; }
.facts dd.note-body { font-weight: 400; }

.timeline, .log-list { list-style: none; margin: 0; padding: 0; }
.timeline li,
.log-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 16px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.log-what {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.log-what strong { font-weight: 600; }
.log-actor, .log-note { color: var(--muted); font-weight: 400; }
.log-list li.is-problem strong { color: var(--danger-strong); }
.log-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-card { padding: 12px 20px 8px; }
.log-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}
.log-history summary::-webkit-details-marker { display: none; }
.log-history summary h2 { margin: 0; padding: 0; }
.log-history summary svg {
  flex: 0 0 16px;
  color: var(--muted);
  transition: transform var(--dur-fast) var(--ease-standard);
}
.log-history[open] summary svg { transform: rotate(180deg); }
.log-list { margin-top: 4px; }

.login-shell { padding: 8px 16px 48px; }
.login-card {
  width: min(440px, 100%);
  margin: 48px auto 0;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 40px 36px 32px;
}
.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}
.login-card .lede { margin-bottom: 24px; }
.login-card .field { margin-bottom: 16px; }
.hint { margin-top: 12px; color: var(--muted); font-size: 0.75rem; line-height: 1.35; }

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty p { margin: 0; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-bottom: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--motion-hover) var(--ease-out);
}
.back:hover { color: var(--brand); }

.case-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px;
}
.case-head .back { margin-bottom: 0; }
.case-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
}
.case-head-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  margin-left: auto;
}
.case-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--muted);
}
.sent-back {
  color: var(--danger-strong);
  font-size: 0.85rem;
  font-weight: 700;
}
.scan-wait {
  color: var(--saee-midnight-teal);
  font-size: 0.85rem;
  font-weight: 700;
}
.scan-return-note {
  white-space: pre-wrap;
}
.shot-thumb {
  width: 40px;
  height: 40px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.shot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shot-preview {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.qc-note {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--ink);
}
.return-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}
.return-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.case-head .due-stamp { align-items: flex-end; text-align: end; }
.case-head .due-stamp b {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 8px;
}
.work-table {
  width: 100%;
  min-width: 52rem;
  border-collapse: collapse;
}
.work-table th,
.work-table td {
  text-align: start;
  vertical-align: middle;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.work-table thead th {
  border-top: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--input);
}
.work-table tbody th { font-weight: 600; }
.work-table tbody tr { transition: background-color var(--motion-hover) var(--ease-out); }
.work-table tbody tr:hover { background: var(--row-hover); }
.work-table .scan,
.work-table .when {
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.work-table .actions { white-space: nowrap; }
.work-table th,
.work-table td { overflow-wrap: anywhere; }
.work-table .due-stamp { gap: 4px; }
.work-table .countdown { white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px 16px;
}
.pager-status {
  margin: 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--saee-deep-blue);
}
.pager-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--brand);
  text-decoration: none;
  transition: background-color var(--motion-hover) var(--ease-out), color var(--motion-hover) var(--ease-out);
}
.pager-btn svg { color: inherit; }
.pager-btn:hover { background: var(--brand-soft); color: var(--brand-hover); }
.pager-btn.is-off { color: var(--muted); }

@media (max-width: 1199px) {
  .workspace { grid-template-columns: 180px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .operator-rail { padding: 16px 10px 12px; gap: 2px; }
  .operator-mark { width: 48px; height: 48px; margin-bottom: 8px; }
  .operator-rail .centre-name { margin-bottom: 8px; font-size: 0.85rem; }
  .rail a { min-height: 34px; padding: 4px 8px; gap: 8px; font-size: 0.8125rem; }
  .operator-rail .nav-label { margin: 8px 0 2px; }
  .rail-overview { padding: 8px 10px; margin-bottom: 4px; }
  .rail-foot { display: none; }
}
@media (max-width: 1023px) {
  .workspace { grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
  .rail { align-items: center; padding: 12px 8px; }
  .operator-mark { width: 40px; height: 40px; margin-bottom: 4px; border-radius: var(--radius-md); }
  .operator-mark svg { width: 20px; height: 20px; }
  .centre-name,
  .nav-label,
  .rail-overview,
  .rail-foot { display: none; }
  .open-cases { align-items: center; width: 100%; margin-bottom: 4px; }
  .rail a {
    justify-content: center;
    width: 40px;
    min-height: 40px;
    padding: 0;
    gap: 0;
    font-size: 0;
    line-height: 0;
  }
  .rail a svg { flex-basis: 18px; }
}
@media (max-width: 900px) and (min-width: 768px) {
  :root { --float-gap: 12px; }
  .topbar { margin: 12px 12px 0; }
}
@media (max-width: 767px) {
  :root {
    --float-gap: 12px;
    --topbar-height: 48px;
    --topbar-block: 68px;
    --header-sheet-top: calc(var(--float-gap) + var(--topbar-height) + var(--space-2));
  }
  .topbar {
    margin: var(--float-gap) var(--float-gap) 0;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
  }
  .icon-btn.nav-toggle { display: inline-grid; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  body.nav-open .nav-backdrop { display: block; }
  body.nav-open .topbar { z-index: 70; }
  body.nav-open .rail,
  body.nav-closing .rail {
    display: flex;
    align-items: stretch;
    position: fixed;
    z-index: 60;
    /* Sit below the sticky topbar so chrome and drawer links do not stack. */
    top: calc(var(--float-gap) + var(--topbar-height) + 8px);
    left: var(--float-gap);
    width: min(17.5rem, calc(100vw - (var(--float-gap) * 2)));
    max-height: calc(100vh - var(--float-gap) - var(--topbar-height) - 16px);
    max-height: calc(100dvh - var(--float-gap) - var(--topbar-height) - 16px);
    padding: 12px 10px;
    overflow: auto;
    scrollbar-width: none;
  }
  body.nav-open .rail {
    animation: motion-drawer var(--dur-overlay) var(--ease-enter);
  }
  body.nav-closing .rail {
    animation: motion-drawer-out var(--motion-exit) var(--ease-exit) forwards;
  }
  body.nav-open .nav-backdrop,
  body.nav-closing .nav-backdrop { animation: motion-fade var(--dur-fast) var(--ease-enter); }
  body.nav-closing .nav-backdrop { animation: motion-fade-out var(--motion-exit) var(--ease-exit) forwards; }
  body.nav-open .rail::-webkit-scrollbar { display: none; }
  body.nav-open .centre-name,
  body.nav-open .nav-label,
  body.nav-open .rail-overview { display: block; }
  body.nav-open .rail-foot { display: block; }
  body.nav-open .open-cases { align-items: stretch; }
  body.nav-open .operator-rail .centre-row {
    gap: 8px;
    margin: 0 0 8px;
    min-width: 0;
  }
  body.nav-open .operator-rail .centre-row .operator-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }
  body.nav-open .operator-rail .centre-row .operator-mark svg {
    width: 18px;
    height: 18px;
  }
  body.nav-open .operator-rail .centre-row .centre-name {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.nav-open .rail-overview {
    padding: 8px 10px;
    margin-bottom: 4px;
  }
  body.nav-open .operator-rail .nav-label {
    margin: 10px 0 2px;
  }
  body.nav-open .rail a {
    justify-content: flex-start;
    width: auto;
    min-height: 36px;
    padding: 6px 10px;
    gap: 10px;
    font-size: 0.875rem;
    line-height: 1.3;
  }
  /* One compact chrome row: hamburger, brand, search, actions. */
  .topbar {
    gap: 6px;
    padding: 0 10px;
    flex-wrap: nowrap;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
  }
  .brand {
    min-width: 40px;
    min-height: 40px;
    flex: 0 0 auto;
  }
  .topbar .brand {
    min-height: 40px;
  }
  .brand-mark { width: 24px; height: 24px; }
  .topbar-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    text-align: start;
  }
  .topbar-title--crumbs {
    justify-content: flex-start;
  }
  .topbar .crumbs {
    justify-content: flex-start;
    margin: 0;
    max-width: none;
    font-size: 0.82rem;
    gap: 6px;
  }
  .top-search {
    max-width: none;
    margin: 0;
    width: 100%;
  }
  .top-search input {
    height: 32px;
    padding: 0 8px;
    font-size: 0.8125rem;
  }
  .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 2px;
    margin-left: 0;
    max-width: none;
  }
  .topbar-actions .icon-btn,
  .note-bell .icon-btn {
    width: 36px;
    height: 36px;
  }
  .user-menu .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  .status-switch {
    padding: 2px;
    gap: 2px;
  }
  .status-switch button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.75rem;
  }
  .status-switch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
}

@media (max-width: 640px) {
  :root {
    --float-gap: 8px;
    --topbar-height: 44px;
    --topbar-block: 60px;
    --header-sheet-top: calc(var(--float-gap) + var(--topbar-height) + var(--space-2));
  }
  .topbar {
    margin: 8px 8px 0;
    padding: 0 8px;
    gap: 4px;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    max-height: var(--topbar-height);
  }
  .topbar .brand {
    min-height: 36px;
  }
  .workspace { padding: 8px; gap: 8px; }
  .brand {
    min-width: 36px;
    min-height: 36px;
  }
  .brand-mark { width: 22px; height: 22px; }
  .topbar-actions .icon-btn,
  .note-bell .icon-btn,
  .icon-btn.nav-toggle {
    width: 36px;
    height: 36px;
  }
  .top-search input {
    height: 30px;
    padding: 0 6px;
    font-size: 0.75rem;
  }
  .user-menu .avatar {
    width: 30px;
    height: 30px;
  }
  .status-switch button {
    min-height: 26px;
    padding: 0 6px;
  }
  .login-card { margin-top: 24px; padding: 24px 16px; }
  .detail-stack .panel,
  .sheet,
  .card,
  .upload-card { padding: 16px; }
  .dropzone { min-height: 140px; padding: 16px; }
}

@media (max-width: 420px) {
  .top-search input { font-size: 0.7rem; }
  .status-switch button { padding: 0 5px; font-size: 0.7rem; }
}

@container stage (max-width: 860px) {
  .stats,
  .stats.stats-month { grid-template-columns: 1fr 1fr; }
  .quick, .grid-3, .grid-2, .facts, .upload-grid { grid-template-columns: 1fr; }
  .case-row { grid-template-columns: 6px minmax(0, 1fr); }
  .case-row .meta,
  .case-row .pill,
  .case-row .btn { grid-column: 2; }
  .work-table .scan,
  .work-table .when { white-space: normal; }
}

@container stage (max-width: 1040px) {
  .case-card {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.2fr) minmax(0, 0.72fr) minmax(0, 0.78fr) max-content;
    grid-template-areas: none;
    column-gap: 10px;
    row-gap: 0;
    padding: 12px 14px;
  }
  .case-card-id,
  .case-card > .times,
  .case-card > .case-clock,
  .case-card > .pill,
  .case-card-end { grid-area: auto; }
  .case-card > .times { display: flex; width: auto; }
  .case-card .avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .case-card-id { gap: 10px; }
  .case-card-id strong { font-size: 0.9rem; }
  .case-card .case-id,
  .case-card .meta,
  .case-card .countdown,
  .case-card .pill { font-size: 0.75rem; }
  .case-card .pill { min-height: 24px; padding: 2px 8px; }
  .case-card .countdown { min-height: 22px; padding: 0 6px; }
  .case-card-end { gap: 8px; }
  .case-card .row-actions { gap: 6px; }
  .case-card .row-actions .btn {
    min-width: 0;
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.75rem;
  }
}

@container stage (max-width: 900px) {
  .return-layout { grid-template-columns: 1fr; }
}

@container stage (max-width: 640px) {
  .fold > summary { padding: 0 12px; }
  .fold-body { padding: 8px 12px 12px; }
  .case-filters .field { width: auto; flex: 1 1 8rem; }
  .panel-head { align-items: stretch; }
  .panel-head .case-filters { flex-wrap: wrap; width: 100%; }
  .panel-head .case-filters .field { flex: 1 1 8rem; width: auto; max-width: none; }
  .fold-body > .actions form { flex: 1 1 8rem; display: flex; }
  .fold-body > .actions form .btn,
  .fold-body > .actions > .btn { flex: 1 1 8rem; width: 100%; }
  .case-head .due-stamp { align-items: flex-start; text-align: start; }
  .case-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "id status"
      "id clock"
      "dates dates"
      "actions actions";
    align-items: start;
    justify-content: stretch;
    gap: 10px 12px;
    padding: 14px;
  }
  .case-card-id,
  .case-card > .times,
  .case-card > .case-clock,
  .case-card > .pill,
  .case-card-end { grid-area: auto; justify-self: stretch; }
  .case-card-id { grid-area: id; }
  .case-card > .times {
    grid-area: dates;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 8px 12px;
    width: 100%;
  }
  .case-card .times { font-size: 0.68rem; }
  .case-card .times > * { max-width: none; white-space: nowrap; }
  .case-card > .case-clock { grid-area: clock; justify-self: end; align-self: end; }
  .case-card > .pill { grid-area: status; justify-self: end; align-self: start; }
  .case-card-end { grid-area: actions; width: 100%; }
  .case-card .row-actions { flex-direction: row; width: 100%; }
  .case-card .row-actions .btn { flex: 1 1 0; width: auto; }
  .case-card-id strong { white-space: normal; }
}

@container stage (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tooth-dot.is-new,
  .chart-note-toggle::after { animation: none; transition: none; }
  .chart-note-panel,
  .chart-detail-grow { transition: none; }
  .btn, .work-table tbody tr, .case-row, .case-card { transition: none; }
  .case-card:hover,
  .case-card:focus-within { transform: none; box-shadow: var(--shadow); }
  .prep-core, .btn.is-busy::after { animation: none; }
  body.nav-open .rail,
  body.nav-closing .rail { animation: none; }
}

.odontogram {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.odontogram[hidden] { display: none; }
.odontogram > h2,
.chart-head h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.3;
  text-transform: none;
  color: var(--ink);
}
.chart-panel h3,
.chart-summary-block h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.odontogram .field { gap: 4px; }
.odontogram .field label { font-size: 0.75rem; font-weight: 600; }
.odontogram .field textarea {
  min-height: 56px;
  padding: 6px 8px;
  font-size: 0.8rem;
}
.odontogram .field-hint { font-size: 0.7rem; }
.chart-toolbar,
.chart-quadrants {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chart-chip {
  min-height: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-control);
  font-size: 0.68rem;
  font-weight: 600;
}
.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.chart-layout > * { min-width: 0; }
.chart-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}
.tooth-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.chart-face,
.chart-read {
  --surface-2: var(--surface);
  --border-strong: var(--line);
}
.chart-face {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: 0;
  container-type: inline-size;
  container-name: chart-face;
}
.chart-block { display: grid; gap: 2px; min-width: 0; }
.chart-face-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(4px, 2cqi, 8px);
}
.chart-face .chart-block-label,
.chart-face .chart-jaw-label,
.chart-face .chart-side-label {
  margin: 0;
  font-family: "Nunito Sans", "Nunito", sans-serif;
  font-size: clamp(0.58rem, 2.4cqi, 0.72rem);
  font-weight: 400;
  color: color-mix(in srgb, var(--muted) 65%, var(--surface));
}
.chart-face-labels .chart-side-label:last-child { text-align: right; }
.chart-face .chart-jaw-label { text-align: center; }
.chart-arch {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1px, 1.2cqi, 6px);
  width: 100%;
  min-width: 0;
}
.chart-arch.is-lower { align-items: flex-start; }
.chart-half {
  display: flex;
  flex: 1 1 0;
  justify-content: center;
  gap: clamp(0px, 0.3cqi, 1px);
  min-width: 0;
}
.chart-midline { flex: 0 0 clamp(4px, 2cqi, 10px); }
button.tooth {
  position: relative;
  flex: 1 1 0;
  width: auto;
  max-width: 32px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  line-height: 0;
}
.tooth-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.tooth { cursor: pointer; touch-action: manipulation; }
.tooth.is-locked { cursor: default; pointer-events: none; }
.chart-quadrants button:disabled { pointer-events: none; }
.status-switch button[hidden] { display: none; }
.tooth.is-locked .tooth-shape { opacity: 0.35; }
.tooth.is-locked .tooth-number { opacity: 0.35; }
.chart-quadrants button,
.finding-option,
.chart-chip {
  transition: background-color var(--motion-exit) var(--ease-standard), color var(--motion-exit) var(--ease-standard), border-color var(--motion-exit) var(--ease-standard);
}
.odontogram .btn:active:not(:disabled) { scale: none; }
.chart-chip:disabled { opacity: 0.4; cursor: default; }
.tooth-shape,
.tooth-number {
  transition: fill 150ms var(--ease-standard), stroke 150ms var(--ease-standard);
}
.tooth-shape {
  fill: var(--surface-2, var(--surface));
  stroke: var(--border-strong, var(--line));
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.tooth-number {
  fill: var(--muted);
  font-family: "Nunito Sans", "Nunito", sans-serif;
  font-weight: 500;
}
.tooth:hover:not(.is-locked) .tooth-shape { stroke: var(--brand); }
.tooth.is-selected .tooth-shape {
  fill: color-mix(in srgb, var(--brand) 8%, var(--surface));
  stroke: var(--brand);
  stroke-width: 2.2;
}
.tooth.is-selected .tooth-number { fill: var(--brand); font-weight: 600; }
.tooth.is-highlight .tooth-shape { stroke: var(--brand); stroke-width: 2.2; }
.tooth-dots {
  position: absolute;
  display: flex;
  gap: 2px;
  pointer-events: none;
}
.chart-arch.is-upper .tooth-dots { top: 0; right: 0; }
.chart-arch.is-lower .tooth-dots { bottom: 0; right: 0; }
.tooth-dot,
.finding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--finding-other);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent);
  flex: none;
}
.tooth-dot { width: 6px; height: 6px; }
.tooth-dot[data-finding="implant"],
.finding-dot[data-finding="implant"] { background: var(--finding-implant); }
.tooth-dot[data-finding="endodontic"],
.finding-dot[data-finding="endodontic"] { background: var(--finding-endodontic); }
.tooth-dot[data-finding="impacted"],
.finding-dot[data-finding="impacted"] { background: var(--finding-impacted); }
.tooth-dot[data-finding="periapical"],
.finding-dot[data-finding="periapical"] { background: var(--finding-periapical); }
.tooth-dot[data-finding="root_fracture"],
.finding-dot[data-finding="root_fracture"] { background: var(--finding-root_fracture); }
.tooth-dot[data-finding="cyst"],
.finding-dot[data-finding="cyst"] { background: var(--finding-cyst); }
.tooth-dot[data-finding="bone_loss"],
.finding-dot[data-finding="bone_loss"] { background: var(--finding-bone_loss); }
.tooth-dot[data-finding="root_morphology"],
.finding-dot[data-finding="root_morphology"] { background: var(--finding-root_morphology); }
.tooth-dot[data-finding="other"],
.finding-dot[data-finding="other"] { background: var(--finding-other); }
.tooth-dot.is-new { animation: tooth-dot-in 150ms var(--ease-out); }
@keyframes tooth-dot-in {
  from { transform: scale(0.6); }
  to { transform: scale(1); }
}
button.tooth:focus { outline: none; }
button.tooth:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}
.chart-quadrants button[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}
#chart-confirm .form-dialog-card,
#chart-confirm[open] .form-dialog-card {
  transform: none;
  transition-duration: 160ms;
  transition-property: opacity;
}
@starting-style {
  #chart-confirm[open] .form-dialog-card {
    opacity: 0;
    transform: none;
  }
}
.chart-panel,
.chart-summary-block,
.chart-side { display: grid; gap: 10px; }
.chart-panel[hidden] { display: none; }
.finding-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.finding-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  height: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.finding-card-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.finding-option[aria-pressed="true"] {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--ink);
}
.finding-option:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.chart-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 0.75rem;
}
.chart-check[hidden] { display: none; }
.chart-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chart-summary { white-space: pre-line; margin: 0; font-size: 0.95rem; line-height: 1.45; color: var(--ink); }
.chart-findings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.chart-request-group {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.chart-request-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.chart-request {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
}
.chart-request-actions { display: flex; gap: 8px; }
.chart-text-btn {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.chart-text-btn:hover { text-decoration: underline; }
.chart-text-btn[hidden] { display: none; }
.chart-detail { display: block; margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.4; grid-column: 1 / -1; }
.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chart-head-title,
.chart-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.chart-head-actions { align-items: flex-end; }
.chart-quick { min-width: 11rem; margin: 0; }
.chart-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.chart-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  counter-reset: chart-step;
}
.chart-steps > li {
  display: grid;
  gap: 6px;
  counter-increment: chart-step;
}
.chart-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chart-step-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.chart-step-kicker::before {
  content: counter(chart-step);
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.chart-chips,
.chart-tooth-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chart-empty-inline { margin: 0; color: var(--muted); font-size: 0.8rem; }
.chart-tooth-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
}
button.chart-tooth-chip {
  margin: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
button.chart-tooth-chip:hover { border-color: var(--brand); }
.chart-detail-field.is-quiet { opacity: 0.55; }
.chart-detail-grow {
  display: grid;
  grid-template-rows: 2.25rem;
  transition: grid-template-rows 200ms var(--ease-out);
}
.chart-detail-grow:focus-within { grid-template-rows: 5.5rem; }
.chart-detail-grow textarea {
  height: 100%;
  min-height: 0;
  resize: none;
}
#finding-add { width: 100%; }
.chart-summary-head { align-items: center; }
.chart-summary { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.chart-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px 8px;
  text-align: center;
  color: var(--muted);
  list-style: none;
}
.chart-empty p { margin: 0; font-size: 0.85rem; }
.chart-empty-icon {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 58%, transparent 0 5px, var(--muted) 5.5px 6.5px, transparent 7px),
    linear-gradient(var(--muted), var(--muted)) 50% 38% / 2px 8px no-repeat;
}
.chart-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chart-icon-btn svg { width: 16px; height: 16px; }
.chart-icon-btn:hover { background: var(--input); color: var(--ink); }
.chart-icon-btn[data-remove-kind]:hover { color: var(--danger); }
.chart-request { align-items: center; border-top: 0; padding-top: 0; }
.chart-request-title { display: flex; align-items: center; gap: 8px; }
.chart-note { border-top: 1px solid var(--line); padding-top: 8px; }
.chart-note-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.chart-note-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}
.chart-note.is-open .chart-note-toggle::after { transform: rotate(225deg); }
.chart-note-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 250ms var(--ease-out);
}
.chart-note.is-open .chart-note-panel { grid-template-rows: 1fr; }
.chart-note-inner { overflow: hidden; min-height: 0; }
.chart-note .field textarea { min-height: 72px; }

.note-bell { position: relative; }
.note-bell .icon-btn { position: relative; }
.note-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--saee-on-primary);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.note-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 50;
  box-sizing: border-box;
  width: min(22rem, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(24rem, 70vh);
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
/* Narrow / mid widths: pin to the viewport so the panel cannot clip off-screen. */
@media (max-width: 900px) {
  .note-panel {
    position: fixed;
    top: calc(var(--float-gap) + var(--topbar-height) + 8px);
    left: max(8px, var(--float-gap));
    right: max(8px, var(--float-gap));
    width: auto;
    max-width: none;
  }
}
.note-panel-head,
.note-panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 8px;
}
.note-panel-head p { margin: 0; font-weight: 700; }
.note-panel-foot a { font-size: 0.8rem; }
.note-empty { margin: 8px; color: var(--muted); font-size: 0.85rem; }
.note-panel [data-note-list] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--motion-hover) var(--ease-out), box-shadow var(--motion-hover) var(--ease-out);
}
.note-row:hover { background: var(--paper); }
.note-row.is-unread { background: var(--brand-soft); }
.note-row strong,
.note-row span span,
.note-row time { display: block; }
.note-row strong { font-size: 0.85rem; }
.note-row span span,
.note-row time { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.note-icon { width: 16px; height: 16px; color: var(--brand); }
.note-icon.is-success { color: var(--saee-midnight-teal); }
.note-icon.is-info { color: var(--brand); }
.note-icon.is-warning { color: var(--warning-ink); }
.note-icon.is-critical { color: var(--danger-strong); }
.note-row.is-success { box-shadow: inset 3px 0 0 var(--saee-success); }
.note-row.is-info { box-shadow: inset 3px 0 0 var(--brand); }
.note-row.is-warning { box-shadow: inset 3px 0 0 var(--saee-alert); }
.note-row.is-critical { box-shadow: inset 3px 0 0 var(--danger); }
.note-row.is-unread.is-warning { background: var(--queue-soft); }
.note-row.is-unread.is-critical { background: var(--danger-soft); }
.note-row.is-unread.is-success { background: var(--ok-soft); }
tr.sev-warning td:first-child { box-shadow: inset 3px 0 0 var(--saee-alert); }
tr.sev-critical td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.sev-success td:first-child { box-shadow: inset 3px 0 0 var(--saee-success); }
tr.sev-info td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.note-sev {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -2px;
}
.note-page .case-filters { margin-bottom: 16px; }
.note-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
}
tr.is-unread td { background: var(--brand-soft); }
.sheet.note-page > .note-toolbar,
.sheet.note-page > .note-board,
.sheet.note-page > .empty,
.sheet.note-page > .pager {
  padding-left: 0;
  padding-right: 0;
}
.note-board { display: grid; gap: 12px; padding-bottom: 16px; }
.note-board .table-wrap { margin: 0; }
.note-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}
.note-table th { border-bottom: 0; }
.note-table td {
  border-bottom: 0;
  background: var(--surface);
}
.note-table td:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.note-table td:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.note-board > .btn { width: auto; justify-self: start; }
.choice { display: grid; gap: 2px; padding: 4px 0; }
.choice .check-row { min-height: 36px; }
.stack-form { display: grid; gap: 12px; max-width: 36rem; padding: 4px 16px 16px; }
.stack-form .facts { margin-top: 4px; }
.settings-layout,
.section-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
  min-width: 0;
}
/* Soft elevated sheet: title + section nav. Sticky as a second bar below the topbar. */
.header-sheet,
.case-sticky {
  position: sticky;
  top: var(--header-sheet-top);
  z-index: 35;
  margin: 0 0 var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow), 0 8px 16px color-mix(in srgb, var(--saee-deep-blue) 6%, transparent);
  /* Opaque sheet — content scrolls under this bar, never under the top nav. */
  isolation: isolate;
}
.header-sheet > .page-head {
  margin: 0;
  padding: 16px 16px 8px;
}
.header-sheet > .page-head:last-child {
  padding-bottom: 16px;
}
.header-sheet > .page-head .lede { margin-top: 0; }
.header-sheet > .page-head .page-head-meta { margin-top: 6px; }
.header-sheet > .case-head,
.header-sheet > .case-head.card {
  margin: 0;
  padding: 16px 16px 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.dash-board > .header-sheet { margin-bottom: 0; }

/* In-page section labels sit with the heading — text + thin underline only. */
.settings-nav,
.section-nav {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 2px;
  margin: 0 0 var(--space-3);
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.header-sheet > .settings-nav,
.header-sheet > .section-nav,
.case-sticky > .case-tabs {
  margin: 0;
}
.settings-nav::-webkit-scrollbar,
.section-nav::-webkit-scrollbar { display: none; }
.settings-nav a,
.section-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-hover) var(--ease-out);
}
.settings-nav a:hover,
.section-nav a:hover {
  background: transparent;
  color: var(--ink);
}
.settings-nav a:focus-visible,
.section-nav a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}
.settings-nav a[aria-current="true"],
.section-nav a[aria-current="true"],
.settings-nav a[aria-current="true"]:hover,
.section-nav a[aria-current="true"]:hover {
  background: transparent;
  color: var(--brand-hover);
  font-weight: 700;
}
.section-nav-bar,
.settings-nav .section-nav-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--brand);
  transform-origin: left center;
  transition: transform var(--dur-ui) var(--ease-out);
  pointer-events: none;
}
.section-nav-bar.is-instant,
.settings-nav .section-nav-bar.is-instant { transition: none; }
.settings-block,
.section-main .card,
.section-main .panel,
.section-main > header.card,
[data-section-target],
.sheet > .card[id],
.sheet > .panel[id],
.sheet > section[id],
.dash-board [id] {
  scroll-margin-top: calc(var(--float-gap) + var(--topbar-height) + 112px);
}
.settings-block + .settings-block { margin-top: 16px; }
.settings-actions, .settings-links { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-sheet .panel h2 { text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--ink); }
.settings-block > .check-row,
.settings-block > .field-hint,
.settings-block > .lede,
.settings-block > p,
.settings-block > .facts,
.settings-block > .settings-links {
  padding-left: 16px;
  padding-right: 16px;
}
.settings-block > .settings-links,
.settings-block > .facts { margin-bottom: 12px; }
.settings-block > .field-hint,
.settings-block > p:last-child { padding-bottom: 8px; }
@media (max-width: 720px) {
  .settings-layout,
  .section-layout { gap: 12px; }
  .settings-nav,
  .section-nav {
    padding: 0 8px;
  }
  .header-sheet > .page-head,
  .header-sheet > .case-head,
  .header-sheet > .case-head.card {
    padding: 12px 12px 6px;
  }
  .header-sheet > .page-head:last-child {
    padding-bottom: 12px;
  }
  .stack-form { max-width: none; }
  .note-table thead { display: none; }
  .note-table,
  .note-table tbody,
  .note-table tr,
  .note-table td { display: block; width: 100%; }
  .note-table tr {
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
    margin-bottom: 8px;
    padding: 12px 16px;
  }
  .note-table td,
  .note-table td:first-child,
  .note-table td:last-child { border-radius: 0; background: transparent; }
  .note-table td { border: 0; padding: 4px 0; }
  .note-page .case-filters { flex-direction: column; align-items: stretch; }
  .note-page .case-filters .field { max-width: none; width: 100%; }
}

@media (max-width: 900px) {
  .chart-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .finding-options { grid-template-columns: 1fr; }
}
@container stage (max-width: 860px) {
  .chart-layout { grid-template-columns: minmax(0, 1fr); }
}
#edit-dialog .odontogram { gap: 8px; margin-top: 0; }
#edit-dialog .chart-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.operator-rail .centre-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.operator-rail .centre-row .operator-mark {
  width: 36px;
  height: 36px;
  margin: 0;
  flex: 0 0 36px;
  border-radius: var(--radius-item);
}
.operator-rail .centre-row .operator-mark svg { width: 20px; height: 20px; }
.operator-rail .centre-row .centre-name {
  flex: 1 1 auto;
  margin: 0;
  text-align: left;
  font-size: 0.9rem;
}
.rail-collapse { flex: 0 0 auto; }
.operator-rail .rail-foot {
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--saee-midnight-teal);
}
@media (min-width: 1024px) {
  .operator-rail .rail-foot { display: block; }
  body.rail-collapsed .workspace { grid-template-columns: 72px minmax(0, 1fr); }
  body.rail-collapsed .operator-rail { align-items: center; padding: 16px 8px; }
  body.rail-collapsed .centre-name,
  body.rail-collapsed .nav-label,
  body.rail-collapsed .rail-text,
  body.rail-collapsed .rail-overview,
  body.rail-collapsed .operator-rail .rail-foot { display: none; }
  body.rail-collapsed .operator-rail a {
    justify-content: center;
    width: 40px;
    min-height: 40px;
    padding: 0;
  }
  body.rail-collapsed .centre-row {
    justify-content: center;
    width: 100%;
  }
  body.rail-collapsed .rail-collapse {
    position: absolute;
    top: 40px;
    right: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: var(--radius-pill);
    translate: 50% 0;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  body.rail-collapsed .rail-collapse svg { display: none; }
  body.rail-collapsed .rail-collapse::after {
    content: "";
    box-sizing: border-box;
    width: 5px;
    height: 5px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
    translate: -1px 0;
  }
}
@media (max-width: 1023px) {
  .rail-collapse { display: none; }
}

.crumbs {
  /* Lives in the shared topbar; never a separate page row. */
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  font-size: 0.95rem;
  font-weight: 700;
}
.topbar-title--crumbs {
  justify-content: center;
  overflow: hidden;
}
.topbar .crumbs {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}
.crumbs a {
  flex: 0 0 auto;
  color: var(--saee-midnight-teal);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.crumbs a:hover { color: var(--brand-hover); }
.crumbs a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.crumbs [aria-current="page"] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--saee-deep-blue);
}
.crumbs [aria-hidden="true"] { flex: 0 0 auto; color: var(--muted); font-weight: 600; }

.case-board { display: grid; gap: 16px; min-width: 0; }
.case-board > * { min-width: 0; }
.case-board > .case-sticky,
.case-board > .header-sheet { margin-bottom: 0; }
.case-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 16px 8px;
}
.case-id-row,
.case-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.case-actions { margin-left: auto; justify-content: flex-end; }
.case-id-row h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--brand);
}
.copy-note {
  min-width: 3.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-hover);
}
.copy-note:empty { min-width: 0; }
.status-badge { gap: 6px; }
.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.status-badge.completed::before,
.status-badge.processing::before,
.status-badge.submitted::before { background: var(--saee-success); }
.status-badge.draft::before,
.status-badge.in_queue::before,
.status-badge.scan_returned::before { background: var(--saee-alert); }
.status-badge.assigned::before,
.status-badge.in_review::before,
.status-badge.report_submitted::before { background: var(--brand); }
.status-badge.rejected::before { background: var(--danger); }
.status-badge.deleted::before,
.status-badge.on_hold::before { background: var(--muted); }
.overflow { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 6;
  min-width: 10rem;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--danger-strong);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--danger-soft); }
.case-tabs {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  margin: 0;
  padding: 0 12px;
  background: transparent;
  border: 0;
  border-top: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.case-tabs::-webkit-scrollbar { display: none; }
.case-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-hover) var(--ease-out);
}
.case-tabs a:hover { color: var(--ink); background: transparent; }
.case-tabs a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}
.case-tabs a[aria-selected="true"] {
  color: var(--brand-hover);
  font-weight: 700;
  background: transparent;
}
.case-tab-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--brand);
  transform-origin: left center;
  transition: transform var(--dur-ui) var(--ease-out);
  pointer-events: none;
}
.case-tab-bar.is-instant { transition: none; }
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: 0.7rem;
  font-weight: 700;
}
.case-columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  gap: 16px;
  align-items: start;
}
.case-main,
.case-rail { display: grid; gap: 16px; align-content: start; min-width: 0; }
.case-rail {
  position: sticky;
  top: calc(var(--header-sheet-top) + 120px);
}
.info-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  min-width: 0;
}
.info-card > h2 {
  margin: 0;
  padding: 16px 16px 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.info-card-body { padding: 12px 16px 16px; min-width: 0; }
.info-card-body > .chart-read,
.fact-span dd > .chart-read,
.detail-panel > .chart-read {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  display: block;
}
.case-board [id] { scroll-margin-top: calc(var(--header-sheet-top) + 140px); }
.case-board .is-current-section {
  box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent);
}
.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin: 0;
}
.kv-stack { grid-template-columns: 1fr; }
.kv dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--saee-midnight-teal);
}
.kv dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); }
.synth-tag {
  display: inline-flex;
  margin: 12px 0 0;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--input);
  color: var(--saee-midnight-teal);
  font-size: 0.72rem;
  font-weight: 700;
}
.note-read {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--ink);
}
.card-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  color: var(--saee-midnight-teal);
}
.card-empty strong { color: var(--ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: 0.8rem;
  font-weight: 700;
}
.request-cards {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}
.request-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.request-card strong { color: var(--ink); }
.chart-read {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 0 8px;
  overflow: visible;
  aspect-ratio: auto;
}
.chart-read .tooth-shape {
  fill: var(--surface-2, var(--surface));
  stroke: color-mix(in srgb, var(--ink) 42%, var(--line));
  stroke-width: 1.85;
  stroke-linejoin: round;
}
.chart-read .tooth.is-on .tooth-shape {
  fill: var(--brand-soft);
  stroke: var(--brand);
  stroke-width: 2.2;
}
.chart-read .tooth-number,
.chart-read .chart-label {
  font-family: "Nunito Sans", Nunito, sans-serif;
  fill: var(--muted);
}
.chart-read .tooth-number { font-weight: 600; fill: var(--brand); }
.chart-read .tooth.is-on .tooth-number { fill: var(--brand); }
.chart-read .chart-label {
  font-weight: 400;
  fill: color-mix(in srgb, var(--muted) 45%, var(--ink));
}
.chart-read .tooth { cursor: default; pointer-events: none; }
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li {
  position: relative;
  padding: 0 0 16px 24px;
  color: var(--saee-midnight-teal);
}
.stepper li strong { display: block; font-size: 0.9rem; color: var(--ink); }
.stepper li p { margin: 4px 0 0; font-size: 0.85rem; line-height: 1.45; }
.stepper li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.stepper li:last-child { padding-bottom: 0; }
.stepper li:last-child::before { display: none; }
.stepper li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line);
}
.stepper li.is-done::before { background: var(--brand); }
.stepper li.is-done::after { background: var(--brand); box-shadow: none; }
.stepper li.is-current::after {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.stepper li.is-current strong { color: var(--brand-hover); }
.person-row { display: flex; align-items: center; gap: 12px; }
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: 0.8rem;
  font-weight: 700;
}
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.case-main .log-card { margin: 0; }
.case-main .log-card h2 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
}
html.case-pending .info-card,
html.case-pending .case-main .log-card {
  position: relative;
  color: transparent;
}
html.case-pending .info-card::after,
html.case-pending .case-main .log-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--input), var(--surface), var(--input));
  background-size: 200% 100%;
  animation: skeleton-sheen var(--dur-overlay) var(--ease-out) infinite;
}
html.case-entered .case-main .info-card,
html.case-entered .case-rail .info-card,
html.case-entered .case-main .log-card {
  animation: motion-rise var(--dur-ui) var(--ease-out) both;
}
html.case-entered .case-main .info-card:nth-child(2) { animation-delay: 40ms; }
html.case-entered .case-main .info-card:nth-child(3) { animation-delay: 80ms; }
html.case-entered .case-main .info-card:nth-child(4) { animation-delay: 120ms; }
html.case-entered .case-rail .info-card:nth-child(2) { animation-delay: 40ms; }
html.case-entered .case-rail .info-card:nth-child(3) { animation-delay: 80ms; }
html.case-entered .case-rail .info-card:nth-child(4) { animation-delay: 120ms; }
@keyframes skeleton-sheen {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (max-width: 1024px) {
  .case-columns { grid-template-columns: minmax(0, 1fr); }
  .case-rail { position: static; order: -1; }
}
@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; }
}
@container stage (max-width: 920px) {
  .case-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .case-rail { position: static; }
  .case-board { gap: 12px; }
  .case-hero { padding: 10px 12px 4px; gap: 8px; }
  .case-id-row h1 { font-size: 1.15rem; }
  .topbar .crumbs { font-size: 0.82rem; gap: 6px; }
  .case-tabs { padding: 0 4px; }
  .case-tabs a { padding: 8px 8px 10px; font-size: 0.78rem; gap: 4px; }
  .info-card > h2 { padding: 12px 12px 0; font-size: 0.9rem; }
  .info-card-body { padding: 8px 12px 12px; }
  .file-row { min-height: 0; padding: 8px 10px; }
  .kv { gap: 8px 12px; }
  .chart-read { width: 100%; max-width: 100%; margin-inline: 0; }
  .chart-face { max-width: 100%; }
}
@container stage (max-width: 560px) {
  .case-board { gap: 10px; }
  .kv { grid-template-columns: 1fr; }
  .case-hero { padding: 8px 8px 2px; }
  .case-id-row h1 { font-size: 1.05rem; }
  .case-actions { gap: 6px; }
  .case-sticky .status-badge { min-height: 24px; padding: 2px 8px; font-size: 0.75rem; }
  .topbar .crumbs { font-size: 0.75rem; gap: 4px; }
  .file-actions { width: 100%; }
  .request-card { padding: 8px; }
  .chart-read { width: 100%; max-width: 100%; margin-inline: 0; }
  .chart-face { max-width: 100%; }
  button.tooth { max-width: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .case-tab-bar,
  html.case-entered .info-card,
  html.case-entered .log-card,
  html.case-pending .info-card::after,
  html.case-pending .log-card::after { animation: none; transition: none; }
}

.topbar-title { display: flex; text-align: left; }
.top-search { flex: 1 1 auto; min-width: 0; max-width: 28rem; margin: 0 auto; }
.top-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color var(--motion-hover) var(--ease-out), box-shadow var(--motion-hover) var(--ease-out);
}
.top-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.user-menu { position: relative; }
.user-menu .avatar {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-weight: 700;
  cursor: pointer;
}
.case-slot { display: contents; }
.case-slot[hidden] { display: none; }
.case-slot.is-flagged .case-card { background: var(--flag-soft); }
.case-stack.is-compact { gap: 8px; padding: 0; }
.case-stack.is-compact .case-card {
  padding: 8px 12px;
  column-gap: 12px;
}
.case-stack.is-compact .case-card-id { gap: 8px; }
.case-stack.is-compact .avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}
.case-stack.is-compact .case-card .times { gap: 2px; }
.case-stack.is-compact .case-id { font-size: 0.75rem; line-height: 1.25; }
.case-stack.is-compact .case-card-id strong { font-size: 0.9rem; }
.user-menu .menu { z-index: 30; }
.menu-name { margin: 0; padding: 8px 10px; color: var(--saee-midnight-teal); font-size: 0.85rem; }
.user-menu .menu-item { color: var(--saee-midnight-teal); text-align: left; cursor: pointer; }

.dash-board { display: flex; flex-direction: column; gap: 16px; }
.page-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.page-head-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.page-head-top > .page-back { margin-left: auto; flex: 0 0 auto; }
.page-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 0;
}
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-hover) var(--ease-out), background var(--motion-hover) var(--ease-out);
}
.page-back-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: currentColor;
}
.page-back-icon svg { display: block; width: 14px; height: 14px; }
.page-back:hover {
  color: var(--saee-midnight-teal);
  background: var(--paper);
}
.page-back:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.page-head .page-title { margin: 0; min-width: 0; }
.page-head .lede { margin: 0; }
.page-head-meta .lede { flex: 1 1 12rem; min-width: 0; }
.sheet > .page-head { margin-bottom: 16px; }
.sheet > .header-sheet { margin-bottom: 16px; }
.sheet > .header-sheet > .page-head { margin-bottom: 0; }
.page-tabs {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  border-bottom: 0.5px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: var(--weight-strong);
  text-decoration: none;
  white-space: nowrap;
}
.page-tabs a:hover { color: var(--ink); }
.page-tabs a[aria-current="page"] {
  color: var(--saee-midnight-teal);
  border-bottom-color: var(--brand);
}
.page-tab-count {
  min-width: 1.25rem;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--saee-midnight-teal);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}
.page-tab-count.is-zero { background: transparent; color: var(--muted); }
.page-toolbar { margin: 0; }
.page-toolbar [hidden] { display: none; }
.page-toolbar .page-search { max-width: 28rem; }
.page-toolbar .search-row { align-items: center; }
.page-toolbar .search-row input { min-height: 36px; }
@media (max-width: 768px) {
  .page-head-top {
    gap: 8px 12px;
  }
  .page-head-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head-meta .lede { flex: 0 1 auto; }
  .page-head-actions {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }
  .page-head-actions .btn {
    flex: 1 1 auto;
    width: 100%;
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }
  .page-toolbar .page-search { max-width: none; }
}
.attention { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.attention-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 9rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--line);
  background: var(--surface);
  color: var(--saee-midnight-teal);
  text-decoration: none;
}
.attention-item strong { font-size: 1.25rem; color: var(--ink); }
.attention-item.is-warning { background: var(--flag-soft); }
.attention-item.is-success { background: var(--success-wash); }
.attention-item.is-neutral { background: var(--surface); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--saee-midnight-teal); }
.stat-card strong { font-size: 1.6rem; line-height: 1; }
.stat-card-hint { color: var(--saee-midnight-teal); font-size: 0.85rem; }
.table-card, .dash-board .info-card { border: 0.5px solid var(--line); border-radius: var(--radius-md); }
.dash-board .info-card { padding: 16px; }
.dash-board .info-card > h2 { padding: 0 0 12px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-pill {
  min-height: 32px;
  padding: 0 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--saee-midnight-teal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.filter-pill.is-on { background: var(--brand-soft); color: var(--brand-hover); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 8px; text-align: left; vertical-align: middle; }
.data-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--saee-midnight-teal);
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.data-table tbody tr:hover { background: var(--brand-soft); }
.data-table tr.is-flagged { background: var(--flag-soft); }
.row-action { text-align: right; }
.due-in.is-ok,
.due-in.is-soon,
.due-in.is-overdue {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.due-in.is-ok { background: var(--ok-soft); color: var(--ok); }
.due-in.is-soon { background: var(--queue-soft); color: var(--saee-midnight-teal); }
.due-in.is-overdue { background: var(--danger-soft); color: var(--danger-strong); }
.dash-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.load-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.load-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(4rem, 8rem) auto; gap: 12px; align-items: center; }
.load-track { display: block; height: 8px; border-radius: var(--radius-pill); background: var(--brand-soft); overflow: hidden; }
.load-track span { display: block; height: 100%; background: var(--brand); }
.mini-bars, .mini-line { width: 100%; height: auto; }
.mini-bars rect, .mini-line polyline { stroke: var(--brand); }
.mini-bars rect { fill: var(--brand); }
.mini-line polyline { stroke-width: 2; }
.mini-line circle { fill: var(--brand); }
.mini-bars text { fill: var(--saee-midnight-teal); font-size: 10px; text-anchor: middle; }
html.dash-pending .stat-card,
html.dash-pending .table-card { animation: skeleton-sheen 1.1s linear infinite; }
html.dash-entered .dash-board > * { animation: motion-rise var(--dur-ui) var(--ease-out) both; }
html.dash-entered .dash-board > *:nth-child(2) { animation-delay: 40ms; }
html.dash-entered .dash-board > *:nth-child(3) { animation-delay: 80ms; }
html.dash-entered .dash-board > *:nth-child(4) { animation-delay: 120ms; }
@media (max-width: 900px) {
  .stat-grid, .stat-grid-3, .dash-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: stretch; flex-direction: column; }
}
@media (max-width: 768px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin: 0 0 12px;
    padding: 12px;
    border: 0.5px solid var(--line);
    border-radius: var(--radius-md);
  }
  .data-table td::before, .data-table th[scope="row"]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--saee-midnight-teal);
  }
  .row-action { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .stat-card, .data-table tbody tr,
  html.dash-entered .dash-board > *,
  html.dash-pending .stat-card,
  html.dash-pending .table-card { animation: none; transition: none; }
  .stat-card:hover { transform: none; }
}

.submit-steps {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}
.submit-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  color: var(--muted);
  font-weight: var(--weight-strong);
  white-space: nowrap;
}
.submit-step a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: inherit;
  text-decoration: none;
}
.submit-step.is-current,
.submit-step.is-done { color: var(--ink); }
.submit-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}
.submit-step.is-current .submit-mark,
.submit-step.is-done .submit-mark {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}
.submit-line {
  position: relative;
  display: block;
  width: 72px;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}
.submit-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms var(--ease-out);
}
.submit-line.is-filled::after { transform: scaleX(1); }
@media (max-width: 640px) {
  .submit-line { width: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .submit-line::after { transition: none; }
}

