:root {
  /* =====================================================================
     PORTAL DESIGN TOKENS
     Primitives mirror the Tailwind CSS palette this portal was hand-built
     on; custom navy/brand colors and a `white` token round it out. Semantic
     aliases below are the role-based interface — prefer them in new/edited
     rules. Translucent (rgba) overlays/shadows are not yet tokenized.
     ===================================================================== */

  /* ---------- Primitive palette ---------- */
  /* Slate (primary neutral ramp) */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Gray (true-neutral, used on a few light surfaces) */
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;

  /* Blue (primary accent ramp) */
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;
  --blue-950: #172554;

  /* Sky / Cyan (info + live accents) */
  --sky-100: #e0f2fe;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --cyan-400: #22d3ee;

  /* Red (danger ramp) */
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;
  --red-900: #7f1d1d;
  --red-950: #450a0a;

  /* Rose (secondary danger / alert tints) */
  --rose-100: #ffe4e6;
  --rose-400: #fb7185;
  --rose-800: #9f1239;

  /* Amber / Yellow (warning ramp) */
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --amber-950: #451a03;
  --yellow-200: #fef08a;
  --yellow-300: #fde047;
  --yellow-400: #facc15;
  --yellow-500: #eab308;
  --yellow-800: #854d0e;
  --yellow-900: #713f12;
  --yellow-950: #422006;

  /* Orange (secondary warning) */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-300: #fdba74;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-900: #7c2d12;

  /* Green / Emerald (success ramp) */
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-800: #166534;
  --green-900: #14532d;
  --emerald-200: #a7f3d0;
  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;

  /* Violet / Indigo (categorical accents) */
  --violet-100: #ede9fe;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --violet-800: #5b21b6;
  --indigo-300: #a5b4fc;

  /* Custom surfaces & brand (reused / central one-offs) */
  --navy-root: #1a1a2e;
  --navy-950: #0b1220;
  --navy-900: #111b31;
  --navy-880: #16213e;
  --navy-850: #1f2a3d;
  --navy-750: #2a3a55;
  --navy-700: #1e3a5f;
  --chart-cyan: #64c8ff;
  --brand-red: #a42328;
  --brand-red-soft: #e45a5f;

  --white: #ffffff;
  --black: #000000;

  /* ---------- Semantic aliases (prefer these) ---------- */
  --color-bg: var(--navy-root);              /* app background */
  --color-surface: var(--slate-900);         /* header / cards */
  --color-surface-raised: var(--slate-800);  /* raised panels */
  --color-surface-sunken: var(--navy-950);  /* insets / wells */
  --color-border: var(--slate-700);          /* default borders & dividers */
  --color-border-strong: var(--slate-600);   /* emphasized borders */
  --color-text: var(--slate-200);            /* primary text */
  --color-text-muted: var(--slate-400);      /* secondary text */
  --color-text-subtle: var(--slate-300);     /* tertiary text */
  --color-text-faint: var(--slate-500);      /* captions / disabled */
  --color-link: var(--emerald-300);            /* links */
  --color-accent: var(--blue-500);          /* primary accent */
  --color-accent-strong: var(--blue-600);   /* accent hover / active */
  --color-info: var(--sky-400);            /* info */
  --color-success: var(--green-500);         /* success */
  --color-warning: var(--amber-500);         /* warning */
  --color-danger: var(--red-500);          /* danger / error */
  --color-danger-text: var(--red-300);     /* danger text on dark */

  /* ---------- Component & categorical colors (named; values preserved) ---------- */
  /* Customer-action buttons (categorical: activate=green, pending=amber, inactive=gray) */
  --ca-text: #d8e5ff;
  --ca-default-border: #365177;
  --ca-default-hover: #2a456d;
  --ca-activate-bg: #1b3f36;
  --ca-activate-border: #2b5b4f;
  --ca-activate-hover: #245348;
  --ca-activate-text: #cbf1e5;
  --ca-pending-bg: #4b3a1d;
  --ca-pending-border: #70572b;
  --ca-pending-hover: #5f4a25;
  --ca-pending-text: #f4e7c1;
  --ca-inactive-bg: #3a3f4b;
  --ca-inactive-border: #596173;
  --ca-inactive-hover: #4a5261;
  --ca-inactive-text: #dde3ef;
  --ca-rename-border: #4a5678;
  --ca-rename-hover: #3b4463;
  --ca-match-border: #48627e;
  --ca-match-hover: #384e66;

  /* Plug detail — status & action buttons */
  --pd-status-tagged: #00b4ff;
  --plug-complete: #ff8c00;
  --pd-status-mia: #ff3c3c;
  --pd-btn-tag: #0066cc;
  --pd-btn-tag-hover: #0077ee;
  --pd-btn-through: #cc6600;
  --pd-btn-through-hover: #dd7700;
  --pd-btn-mia: #cc0000;
  --pd-btn-mia-hover: #ee1111;

  /* Scheduler */
  --scheduler-tab-active-bg: #0b2944;
  --commitment-bg: #2f6fed;
  --commitment-border: #5b8ef6;
  --commitment-text: #eaf1ff;
  --commitment-overlap-bg: #e67e22;

  /* Job-report chart series (categorical).
     One name per measured quantity so a series keeps its colour across every
     chart that draws it. Read from JS via JR_CHART_COLORS in job-report.js —
     these are the only place a report series colour is defined.
     Weight and circulating pressure must stay in different hue families; they
     were both #ffc800 before this token set existed and were indistinguishable
     side by side. */
  --chart-depth: var(--chart-cyan);
  --chart-weight: var(--amber-400);
  --chart-circ-pressure: var(--violet-400);
  --chart-whp: var(--rose-400);
  --chart-plugs: var(--orange-500);
  --chart-plugs-mia: var(--red-400);
  --chart-sweeps: var(--cyan-400);
  --chart-alarms: var(--red-500);
  --chart-alarms-elevated: var(--amber-500);
  --chart-comments: var(--slate-400);
  --chart-rih: var(--sky-400);
  --chart-pooh: var(--orange-400);
  --chart-trend-rih: var(--emerald-400);
  --chart-trend-pooh: var(--yellow-400);
  --chart-speed-binned: var(--rose-400);
  --chart-speed-smooth: var(--red-500);
  --chart-axis: var(--slate-400);
  --chart-axis-line: var(--slate-700);
  --chart-empty-text: var(--slate-400);
  --chart-error-text: var(--red-500);
  /* Chart chrome. Values preserved from the pre-token renderers so tokenizing
     is behavior-neutral; the translucent whites are deliberate overlays rather
     than tints of a palette colour. */
  --chart-grid: rgba(255, 255, 255, 0.05);
  --chart-grid-faint: rgba(255, 255, 255, 0.04);
  --chart-marker-border: var(--slate-900);
  --chart-tooltip-bg: var(--slate-800);
  --chart-tooltip-border: var(--slate-700);
  --chart-tooltip-text: var(--slate-200);
  --chart-axis-pointer: var(--slate-600);
  --chart-brush: rgba(59, 130, 246, 0.18);
  --chart-brush-border: rgba(59, 130, 246, 0.7);
  /* Heatmap density ramp, low to high. The low anchor must stay off the chart
     background or zero-count cells disappear into it. */
  --chart-heat-1: var(--slate-500);
  --chart-heat-2: var(--sky-500);
  --chart-heat-3: var(--cyan-400);
  --chart-heat-4: var(--amber-400);
  --chart-heat-5: var(--red-500);
  /* Ordered ramp for cohort pump peers — assigned by index, so it must stay
     stable and stay clear of the named series colours above. */
  --chart-series-1: var(--cyan-400);
  --chart-series-2: var(--amber-500);
  --chart-series-3: var(--violet-400);
  --chart-series-4: var(--green-500);
  --chart-series-5: var(--red-500);
  --chart-series-6: var(--rose-400);

  /* Misc component accents */
  --tile-foot-border: #1e3050;
  --table-row-border: #2a2a4a;
  --curvature-note: #ffb347;
  --fm-chip-caution-bg: #2a1c0a;
  --tests-error-bg: #3b1111;
  --opta-btn-hover-bg: #273449;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden; /* prevent full-page scroll; inner panes own scrolling */
}
body.auth-pending .portal-layout {
  visibility: hidden;
}
body.auth-pending .auth-loading-screen {
  display: flex;
}
.auth-loading-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--color-bg);
}
.auth-loading-logo {
  width: min(260px, 65vw);
  height: auto;
  display: block;
}
/* Temporary text brand (company logos withheld until official adoption).
   Restore .auth-loading-logo / .portal-header-logo / .auth-login-logo imgs
   and remove .portal-brand-mark when branding is re-enabled. */
.portal-brand-mark {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--slate-100, #f1f5f9);
  line-height: 1.15;
  white-space: nowrap;
  user-select: none;
}
.portal-brand-mark--header {
  font-size: 1.15rem;
}
.portal-brand-mark--loading {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--color-text, #e2e8f0);
}
.portal-brand-mark--login {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  color: var(--color-text, #e2e8f0);
  margin: 0.25rem 0 0.5rem;
}
.auth-loading-screen p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* ia-11: Overview "View full Job Log" excerpt control, styled as a text link. */
.job-log-jumplink {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: var(--color-link);
  cursor: pointer;
}
.job-log-jumplink:hover { text-decoration: underline; }

.portal-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.portal-header {
  flex: 0 0 auto;
  position: relative;
  padding: 0.75rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.portal-header-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
@keyframes portal-header-banner-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.1;
  }
}
.portal-header-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  animation: portal-header-banner-fade 30s linear forwards;
}
@media (prefers-reduced-motion: reduce) {
  .portal-header-banner {
    animation: none;
    opacity: 0.1;
  }
}
.portal-header-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.portal-header-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}
.portal-header-logo-link:hover {
  text-decoration: none;
}
.portal-header-logo-link:hover .portal-brand-mark {
  color: var(--sky-300, #7dd3fc);
}
.portal-header-logo-link:focus-visible {
  outline: 2px solid var(--sky-400);
  outline-offset: 2px;
}
.portal-header-logo {
  display: block;
  height: 2.25rem;
  width: auto;
  max-width: min(200px, 40vw);
  object-fit: contain;
}
.portal-header h1 { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--slate-100); }
.auth-userbar {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  color: var(--color-text-subtle);
  font-size: 0.85rem;
  white-space: nowrap;
}
.auth-userbar button {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
}
.auth-account-menu {
  position: relative;
}
.auth-account-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 9.5rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--slate-950) 55%, transparent);
  padding: 0.3rem;
  display: grid;
  gap: 0.25rem;
  z-index: 1200;
}
.auth-account-menu-list[hidden] {
  display: none;
}
.auth-account-menu-list button {
  text-align: left;
  width: 100%;
}
.auth-change-password-modal {
  max-width: 480px;
}
.auth-change-password-grid {
  grid-template-columns: 1fr;
}
.auth-change-password-grid label {
  display: grid;
  gap: 0.35rem;
}
.portal-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.portal-sidebar {
  flex: 0 0 200px;
  padding: 0.5rem 0 0.75rem 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: flex-basis 0.2s ease;
  overflow: hidden;
}
.portal-sidebar.collapsed { flex-basis: 56px; }
.portal-sidebar-header {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.4rem;
  flex: 0 0 auto;
}
.portal-sidebar-toggle {
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.78rem;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  line-height: 1.1;
}
.portal-sidebar-toggle:hover { background: var(--slate-700); }
.portal-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /* Absorb the sidebar's remaining height and scroll — without this the
     Admin section is unreachable at short viewports (e.g. 1280x720). */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-raised) var(--color-surface);
}
.portal-sidebar nav::-webkit-scrollbar { width: 8px; }
.portal-sidebar nav::-webkit-scrollbar-track { background: var(--color-surface); }
.portal-sidebar nav::-webkit-scrollbar-thumb {
  background: var(--color-surface-raised);
  border-radius: 4px;
}
.portal-sidebar nav::-webkit-scrollbar-thumb:hover { background: var(--slate-700); }
.portal-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.portal-nav-section-title {
  margin: 0.2rem 0 0.1rem;
  padding: 0.2rem 0.9rem 0.1rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  /* Keep the group label legible while its items scroll beneath it. */
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.portal-sidebar a { display: block; padding: 0.5rem 1rem; margin: 0 0.5rem; border-radius: 6px; color: var(--color-text-muted); }
.portal-sidebar a:hover { background: var(--color-surface-raised); color: var(--color-text); }
.portal-sidebar a.active { background: var(--color-surface-raised); color: var(--emerald-300); font-weight: 500; }
.portal-sidebar.collapsed nav { gap: 0.35rem; }
.portal-sidebar.collapsed .portal-nav-section { gap: 0.35rem; }
.portal-sidebar.collapsed a {
  text-align: center;
  padding: 0.5rem 0.2rem;
  margin: 0 0.35rem;
  font-size: 0.7rem;
  line-height: 1.15;
  word-break: break-word;
}
.portal-sidebar.collapsed .portal-nav-section-title { display: none; }
.portal-sidebar.collapsed .nav-label { display: none; }
.portal-sidebar .nav-short { display: none; }
.portal-sidebar.collapsed .nav-short { display: inline; }
/* ia-9: in collapsed mode the section titles are hidden, so mark the group
   boundaries with a thin divider. :not(:first-child) keeps the top of the rail clean. */
.portal-sidebar.collapsed .portal-nav-section:not(:first-child) {
  border-top: 1px solid var(--color-border);
  padding-top: 0.35rem;
}
.portal-main {
  flex: 1;
  overflow: hidden;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.unauthenticated .portal-sidebar {
  display: none;
}
.unauthenticated .portal-main {
  padding: 1.25rem;
  justify-content: center;
  align-items: center;
}
.unauthenticated #auth-login {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-login-wrap {
  width: min(560px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.auth-login-logo {
  width: auto;
  height: 50vh;
  max-width: 92vw;
  max-height: 82vh;
  display: block;
}
.auth-login-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem;
}
.auth-login-card h2 {
  margin: 0 0 0.35rem 0;
  font-size: 1.25rem;
}
.auth-login-card label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.auth-login-card input[type="text"],
.auth-login-card input[type="password"] {
  width: 100%;
  background: var(--gray-900);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.55rem;
}
.auth-login-card button {
  margin-top: 0.35rem;
}
.auth-login-card #auth-login-status {
  margin: 0.35rem 0 0 0;
  min-height: 1.1rem;
}

section { margin-bottom: 0; min-height: 0; }
/* Customer API page owns its own vertical scroll (portal-main clips overflow). */
#customer-api {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
/* Job Editor page owns its own vertical scroll (portal-main clips overflow). It
   renders display:block (not a flexPage), so without this the channel-type
   section below the fold is unreachable. Mirrors #customer-api. */
#job-editor {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#dashboard {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.2rem;
}
#dashboard > h2,
#dashboard > #live-jobs-filters,
#dashboard > #devices-status {
  flex: 0 0 auto;
}
#dashboard > #live-jobs-layout,
#dashboard > #group-detail,
#dashboard > #device-detail {
  flex: 1 1 auto;
  min-height: 0;
}
#dashboard > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
#dashboard > #devices-status {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}

/* Device detail: list chrome (filters + count + page heading) sits above
   #device-detail in the DOM but is irrelevant while drilling into one device —
   hide to give the detail view the full content area. */
#dashboard.dashboard--device-detail > h2,
#dashboard.dashboard--device-detail > #live-jobs-filters,
#dashboard.dashboard--device-detail > #devices-status {
  display: none;
}

/* Completed Jobs detail: same treatment for the jobs section when viewing
   either an individual job (#job-detail) or a cohort (#cohort-detail). */
#jobs.jobs--job-detail > .jobs-header-row,
#jobs.jobs--job-detail > #jobs-filters,
#jobs.jobs--job-detail > #jobs-status,
#jobs.jobs--job-detail > #job-list,
#jobs.jobs--job-detail > #jobs-pagination {
  display: none;
}
.stationary-test-banner {
  margin: 0 0 0.25rem 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  background: var(--amber-900);
  color: var(--orange-300);
  border-radius: 4px;
  border: 1px solid var(--amber-700);
}
.stationary-test-banner code { font-size: 0.9em; }
#incomplete {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
#incomplete > h2 { margin: 0; font-size: 1.35rem; line-height: 1.2; }
#incomplete-status { margin: 0; font-size: 0.9rem; flex: 0 0 auto; }
#incomplete-hint { margin: 0 0 0.5rem 0; font-size: 0.85rem; color: var(--color-text-muted); flex: 0 0 auto; }
#incomplete-jobs-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
#data-query {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.data-query-header {
  flex: 0 0 auto;
}
.data-query-header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.data-query-subtitle {
  margin: 0.25rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.data-query-status {
  margin: 0;
  flex: 0 0 auto;
}
.data-query-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
}
.data-query-card {
  min-height: 0;
  overflow: auto;
  /* Visible scroll affordance so a clipped section heading reads as
     "more below" rather than a broken layout (mirrors .lc-sidebar-scroll). */
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-raised) var(--color-surface-sunken);
}
.data-query-card::-webkit-scrollbar { width: 8px; }
.data-query-card::-webkit-scrollbar-track { background: var(--color-surface-sunken); }
.data-query-card::-webkit-scrollbar-thumb { background: var(--color-surface-raised); border-radius: 4px; }
.data-query-card::-webkit-scrollbar-thumb:hover { background: var(--slate-700); }
/* Results column: fill remaining grid height; scroll inside the table wrapper only. */
.data-query-card--results {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.data-query-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.data-query-results-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.data-query-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.data-query-card-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.data-query-shell-placeholder {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.data-query-status-error {
  color: var(--color-danger-text);
}
.data-query-builder-root {
  margin-top: 0.5rem;
  min-height: 2rem;
}
.data-query-results-root {
  margin-top: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.data-query-primary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}
.data-query-primary-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}
.data-query-primary-filters .data-query-aggregate-toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
}
.data-query-primary-filters .form-input,
.data-query-primary-filters .form-select {
  min-width: 12rem;
}
.data-query-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}
.data-query-hint code {
  font-size: 0.85em;
  color: var(--color-text);
}
.data-query-filters-section {
  margin-bottom: 1rem;
}
.data-query-filters-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--color-text);
}
.data-query-filters-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.data-query-filter-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(90px, 110px) minmax(120px, 1.2fr) auto;
  gap: 0.35rem;
  align-items: center;
}
@media (max-width: 700px) {
  .data-query-filter-row {
    grid-template-columns: 1fr;
  }
}
.dq-filter-remove {
  background: var(--slate-700);
  color: var(--color-text);
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  line-height: 1;
}
.dq-filter-remove:hover {
  background: var(--slate-600);
}
.data-query-column-panel {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}
.data-query-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.data-query-presets-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.data-query-preset-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}
.data-query-include-well-label {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.65rem;
  cursor: pointer;
}
.data-query-col-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
}
.data-query-col-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  min-height: 0;
}
.data-query-col-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}
.data-query-col-group-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.data-query-col-group-actions button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--blue-400);
  cursor: pointer;
  text-decoration: underline;
}
.data-query-col-group-actions button:hover {
  color: var(--blue-300);
}
.data-query-col-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 220px;
  overflow: auto;
  font-size: 0.8rem;
}
.data-query-col-item {
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
  cursor: pointer;
  color: var(--color-text-subtle);
}
.data-query-col-item input {
  margin-top: 0.15rem;
}
/* Drop the builder card's bottom padding (only the builder, not the results
   card) so the sticky action row can sit flush at the true bottom edge with
   no padding gap for scrolling content to show through. */
.data-query-card:not(.data-query-card--results) {
  padding-bottom: 0;
}
.data-query-actions {
  /* Pin the Run-query CTA to the bottom of the scrolling builder card so it
     is always visible. The -1rem horizontal margins pull the row out to the
     card edges (.diagnostic-card side padding is 1rem) so its opaque
     background fully covers content scrolling behind it. */
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 1rem -1rem 0;
  padding: 0.6rem 1rem 0.7rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* Fade the scrolling content into the sticky row so a clipped heading above
   reads as "more below". pointer-events:none keeps the last filter buttons
   clickable. */
.data-query-actions::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 1.5rem;
  background: linear-gradient(to top, var(--color-surface), transparent);
  pointer-events: none;
}
.data-query-loading,
.data-query-empty,
.data-query-error {
  margin: 0.5rem 0 0;
}
.data-query-error {
  color: var(--color-danger-text);
}
.data-query-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-top: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.data-query-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-query-results-table th,
.data-query-results-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.data-query-results-table tbody tr[data-job-id] {
  cursor: pointer;
}
.data-query-results-table tbody tr:hover {
  background: var(--color-surface-raised);
}
.data-query-results-table tfoot td {
  border-top: 2px solid var(--color-border);
  vertical-align: top;
  background: var(--color-surface);
}
.data-query-agg-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}
.data-query-th-sortable {
  padding: 0;
}
.data-query-sort-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  font: inherit;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}
.data-query-sort-btn:hover {
  background: var(--slate-700);
}
.data-query-th-active .data-query-sort-btn {
  color: var(--blue-300);
}
@media (max-width: 1100px) {
  .data-query-layout {
    grid-template-columns: 1fr;
  }
}
#jobs {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
#archive {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
#reviews-manage {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#customers {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
#users {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
#scheduler,
#scheduler-events,
#crew,
#equipment,
#certifications {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
#scheduler > h2,
#scheduler > #scheduler-controls-toggle-row,
#scheduler > #scheduler-controls-shell,
#scheduler > #scheduler-tab-row,
#scheduler > #scheduler-status {
  flex: 0 0 auto;
}
#scheduler > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
#scheduler-controls-toggle-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
#scheduler-controls-shell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.scheduler-controls-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
#scheduler.scheduler-controls-collapsed #scheduler-controls-shell {
  display: none;
}
#scheduler-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
#crew-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.35rem;
}
#equipment-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.35rem;
}
#certifications-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.35rem;
  width: 100%;
}
.scheduler-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 8px;
  padding: 0.38rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.scheduler-tab:hover {
  border-color: var(--color-border-strong);
  background: var(--navy-900);
}
.scheduler-tab.active {
  border-color: var(--sky-500);
  color: var(--sky-100);
  background: var(--scheduler-tab-active-bg);
}
#scheduler-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#crew-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#equipment-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#certifications-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.scheduler-tab-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.scheduler-tab-panel.active {
  display: flex;
  flex-direction: column;
}
#certifications > h2,
#certifications > .certifications-page-toolbar,
#certifications > #certifications-tab-row,
#certifications > #certifications-status {
  flex: 0 0 auto;
}
#certifications > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.certifications-page-toolbar {
  justify-content: flex-end;
}
#certifications-export-status {
  margin-left: 0.35rem;
}
.cert-equipment-summary-strip {
  flex: 0 0 auto;
  margin: 0.2rem 0 0.45rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--color-surface) 100%);
  color: var(--color-text-subtle);
  font-size: 0.82rem;
  line-height: 1.35;
}
.cert-equipment-summary-strip .cert-summary-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
}
.cert-equipment-summary-strip .cert-summary-total {
  font-weight: 700;
  color: var(--color-text);
  margin-right: 0.25rem;
}
.cert-equipment-summary-strip .cert-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  font-size: 0.78rem;
}
.cert-equipment-modal-content {
  width: min(1200px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.cert-equipment-modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.cert-equipment-modal-panels {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cert-equipment-modal-panel {
  display: none;
}
.cert-equipment-modal-panel.active {
  display: block;
}
.cert-equipment-editor-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
#cert-attachments-panel {
  margin-top: 0.2rem;
}
#cert-equipment-audit pre {
  white-space: pre-wrap;
}
.cert-attachment-metadata-register {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
}
.cert-attachment-record-create {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
}
.cert-attachment-metadata-register h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--color-text);
}
.cert-attachment-record-create h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--color-text);
}
.cert-attachment-help {
  margin: 0 0 0.5rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.cert-attachment-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.5rem;
}
.cert-attachment-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.cert-attachment-form-grid input {
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.84rem;
}
.cert-attachment-register-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
#cert-attach-record-inline-status {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
#cert-attach-record-inline-status.error {
  color: var(--color-danger-text);
}
#cert-attach-upload-inline-status {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
#cert-attach-upload-inline-status.error {
  color: var(--color-danger-text);
}
#cert-equipment-list,
#cert-group-list,
#cert-unit-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#customers > h2,
#customers > .users-toolbar-row,
#customers > #customers-status {
  flex: 0 0 auto;
}
#users > h2,
#users > .users-toolbar-row,
#users > #users-status {
  flex: 0 0 auto;
}
#customers > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
#users > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
#customers-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#users-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  width: 100%;
}
#scheduler-list,
#scheduler-events-list,
#crew-list,
#equipment-alias-list,
#equipment-discovered-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#scheduler-timeline,
#scheduler-utilization,
#scheduler-personnel {
  flex: 1 1 auto;
  min-height: 0;
}
#scheduler-timeline,
#scheduler-personnel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Toolbar + status lines stay fixed height; timeline wrap fills remainder and scrolls inside .scheduler-timeline-grid */
#scheduler-personnel > .customers-toolbar,
#scheduler-personnel > p {
  flex: 0 0 auto;
}
#scheduler-utilization {
  overflow: auto;
}
.scheduler-utilization-filter-note {
  margin: 0.25rem 0 0.4rem;
}
.scheduler-utilization-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  margin: 0.35rem 0 0.55rem;
}
.scheduler-utilization-controls label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
.scheduler-utilization-controls input[type="number"],
.scheduler-utilization-controls select {
  min-width: 7.5rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
}
.scheduler-utilization-grid {
  margin-top: 0.35rem;
}
.scheduler-utilization-note {
  margin-top: 0.45rem;
  font-size: 0.78rem;
}
.scheduler-util-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.scheduler-util-kpi-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.scheduler-util-kpi-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}
.scheduler-util-kpi-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}
.scheduler-util-kpi-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.scheduler-util-compact-card {
  min-width: 0;
}
.scheduler-util-half-block {
  grid-column: span 2;
}
.scheduler-util-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.scheduler-util-compact-card .jobs-table {
  min-width: 0;
  table-layout: fixed;
}
.scheduler-util-compact-card .jobs-table th,
.scheduler-util-compact-card .jobs-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .scheduler-util-half-block {
    grid-column: span 1;
  }
}

.scheduler-timeline-wrap {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  margin-bottom: 0.5rem;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.scheduler-timeline-header {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.scheduler-timeline-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.6rem;
}
.scheduler-timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--color-text-subtle);
}
.scheduler-timeline-legend-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  border: 1px solid transparent;
}
.scheduler-timeline-legend-swatch.transit {
  background: var(--violet-600);
  border-color: var(--violet-400);
}
.scheduler-timeline-legend-swatch.downtime {
  background: repeating-linear-gradient(
    135deg,
    var(--red-900) 0px,
    var(--red-900) 4px,
    var(--rose-800) 4px,
    var(--rose-800) 8px
  );
  border-color: var(--rose-400);
}
.scheduler-timeline-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.scheduler-date-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  border-bottom: 1px solid var(--color-border);
  min-height: 28px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--color-surface);
}
.scheduler-date-row-label {
  border-right: 1px solid var(--slate-800);
  padding: 0.35rem 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}
.scheduler-date-track {
  position: relative;
  min-height: 28px;
}
.scheduler-date-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid color-mix(in srgb, var(--slate-400) 26%, transparent);
  display: flex;
  align-items: center;
  padding-left: 0.25rem;
  color: var(--color-text-subtle);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
}
.scheduler-lane {
  display: grid;
  grid-template-columns: 190px 1fr;
  border-bottom: 1px solid var(--slate-800);
  min-height: 44px;
}
.scheduler-lane:last-child {
  border-bottom: none;
}
.scheduler-lane-label {
  border-right: 1px solid var(--slate-800);
  padding: 0.35rem 0.5rem;
  color: var(--color-text-subtle);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scheduler-lane-label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scheduler-lane-group-toggle {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 4px;
  cursor: pointer;
  width: 1.3rem;
  height: 1.3rem;
  line-height: 1.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.scheduler-lane-group-toggle:hover {
  background: var(--color-surface-raised);
}
.scheduler-lane-group-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--blue-300);
  flex: 0 0 auto;
}
.scheduler-lane-child-prefix {
  color: var(--blue-300);
  flex: 0 0 auto;
}
.scheduler-lane.scheduler-lane-group-child .scheduler-lane-label {
  padding-left: 1.1rem;
  color: var(--blue-200);
}
.scheduler-lane-track {
  position: relative;
  min-height: 42px;
  background: var(--navy-950);
}
.scheduler-personnel-timeline-grid {
  border-top: 1px solid var(--color-border);
}
.scheduler-personnel-lane .scheduler-lane-label {
  align-items: center;
  border-right: none;
  border-radius: 4px;
  margin: 0.2rem;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--slate-900) 45%, transparent);
  cursor: context-menu;
}
.scheduler-personnel-label-main {
  min-width: 0;
}
.scheduler-personnel-name {
  display: inline-block;
  width: 100%;
  color: var(--color-text);
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduler-personnel-lane.scheduler-personnel-lane-available .scheduler-lane-label {
  border-color: var(--green-600);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green-500) 32%, transparent);
}
.scheduler-personnel-lane.scheduler-personnel-lane-off-duty .scheduler-lane-label {
  border-color: var(--red-600);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red-500) 38%, transparent);
}
.scheduler-personnel-lane .scheduler-lane-track {
  min-height: 42px;
}
.scheduler-personnel-unavailable-window {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 28px;
  background: rgba(179, 27, 27, 0.35);
  border: 1px solid rgba(179, 27, 27, 0.55);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  color: var(--red-100);
  font-size: 0.72rem;
  z-index: 1;
  overflow: hidden;
  cursor: context-menu;
}
.scheduler-personnel-unavailable-text {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.scheduler-personnel-commitment {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: 6px;
  background: var(--commitment-bg);
  border: 1px solid var(--commitment-border);
  color: var(--commitment-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  z-index: 2;
  overflow: hidden;
}
.scheduler-personnel-commitment.scheduler-personnel-commitment-overlap {
  background: var(--commitment-overlap-bg);
  border-color: var(--amber-500);
  color: var(--orange-50);
}
.scheduler-personnel-commitment-text {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.scheduler-personnel-dialog-overlay {
  z-index: 10040;
}
.scheduler-personnel-dialog {
  min-width: min(760px, calc(100vw - 2rem));
  max-width: 980px;
}
.scheduler-personnel-crew-picker {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  overflow: hidden;
  max-height: 320px;
}
.scheduler-personnel-crew-picker-header {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1.3fr 0.6fr;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--navy-900);
}
.scheduler-personnel-crew-picker-list {
  max-height: 250px;
  overflow-y: auto;
}
.scheduler-personnel-crew-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--slate-800);
  background: transparent;
  color: var(--color-text);
  display: grid;
  grid-template-columns: 1.8fr 1fr 1.3fr 0.6fr;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  text-align: left;
  cursor: pointer;
}
.scheduler-personnel-crew-row:last-child {
  border-bottom: none;
}
.scheduler-personnel-crew-row:hover {
  background: var(--blue-950);
}
.scheduler-personnel-crew-row.selected {
  background: color-mix(in srgb, var(--blue-500) 24%, transparent);
  box-shadow: inset 0 0 0 1px var(--blue-500);
}
.scheduler-personnel-pool-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.4rem 0 0.8rem 0;
}
.scheduler-personnel-pool-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-text);
  cursor: pointer;
}
.scheduler-personnel-pool-option input[type="radio"] {
  accent-color: var(--blue-500);
}
.scheduler-personnel-planner-summary {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 0.45rem 0;
}
.scheduler-personnel-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid transparent;
}
.scheduler-personnel-pill-planned {
  color: var(--blue-200);
  background: color-mix(in srgb, var(--blue-800) 25%, transparent);
  border-color: color-mix(in srgb, var(--blue-400) 40%, transparent);
}
.scheduler-personnel-pill-failed {
  color: var(--red-200);
  background: color-mix(in srgb, var(--red-900) 28%, transparent);
  border-color: color-mix(in srgb, var(--red-400) 45%, transparent);
}
.scheduler-personnel-transition-list,
.scheduler-personnel-failure-rollup {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  padding: 0.45rem 0.55rem;
  margin: 0 0 0.45rem 0;
}
.scheduler-personnel-transition-list-header,
.scheduler-personnel-failure-rollup-header {
  font-size: 0.76rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.scheduler-personnel-transition-list-header-collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.scheduler-personnel-transition-row,
.scheduler-personnel-failure-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-top: 1px solid color-mix(in srgb, var(--slate-700) 45%, transparent);
  font-size: 0.78rem;
  color: var(--color-text);
}
.scheduler-personnel-transition-row:first-of-type,
.scheduler-personnel-failure-row:first-of-type {
  border-top: none;
}
.scheduler-personnel-transition-actions {
  display: inline-flex;
  gap: 0.35rem;
}
.scheduler-personnel-mini-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}
.scheduler-personnel-mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.66rem;
  border: 1px solid transparent;
}
.scheduler-personnel-mini-badge-planned {
  color: var(--blue-200);
  background: color-mix(in srgb, var(--blue-800) 22%, transparent);
  border-color: color-mix(in srgb, var(--blue-400) 35%, transparent);
}
.scheduler-personnel-mini-badge-incoming {
  color: var(--amber-200);
  background: color-mix(in srgb, var(--yellow-900) 28%, transparent);
  border-color: color-mix(in srgb, var(--amber-400) 35%, transparent);
}
.scheduler-personnel-mini-badge-failed {
  color: var(--red-200);
  background: color-mix(in srgb, var(--red-900) 32%, transparent);
  border-color: color-mix(in srgb, var(--red-400) 42%, transparent);
}
.scheduler-personnel-transition-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 14px;
  border-radius: 5px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--slate-900) 65%, transparent);
}
.scheduler-personnel-transition-marker-planned {
  background: color-mix(in srgb, var(--blue-500) 88%, transparent);
}
.scheduler-personnel-transition-marker-failed {
  background: color-mix(in srgb, var(--red-400) 95%, transparent);
}
.scheduler-personnel-transition-marker-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.52rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--sky-100) 95%, transparent);
}
.scheduler-personnel-transition-marker-failed .scheduler-personnel-transition-marker-text {
  color: color-mix(in srgb, var(--red-100) 95%, transparent);
}
.scheduler-personnel-lane.scheduler-personnel-lane-failed .scheduler-lane-label {
  border-color: color-mix(in srgb, var(--red-400) 85%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red-400) 40%, transparent);
}
.scheduler-transition-collision-panel {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--navy-950);
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
}
.scheduler-transition-collision-title {
  margin: 0;
  font-size: 0.74rem;
  color: var(--color-text-subtle);
  font-weight: 600;
}
.scheduler-transition-collision-detail {
  margin: 0.28rem 0 0.45rem 0;
  font-size: 0.78rem;
  color: var(--color-text);
}
.scheduler-transition-collision-list {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
  color: var(--color-danger-text);
  font-size: 0.75rem;
}
.scheduler-day-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--slate-400) 20%, transparent);
  pointer-events: none;
  z-index: 0;
}
.scheduler-block {
  position: absolute;
  top: 3px;
  height: 36px;
  border-radius: 4px;
  background: var(--blue-700);
  color: var(--blue-100);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--blue-500);
  min-width: 18px;
  user-select: none;
  z-index: 1;
}
.scheduler-block.scheduler-status-draft {
  background: var(--gray-600);
  border-color: var(--gray-400);
  color: var(--gray-100);
}
.scheduler-block.scheduler-status-scheduled {
  background: var(--blue-200);
  border-color: var(--blue-400);
  color: var(--blue-900);
}
.scheduler-block.scheduler-status-in-progress {
  background: var(--amber-100);
  border-color: var(--amber-400);
  color: var(--yellow-800);
}
.scheduler-block.scheduler-status-completed {
  background: var(--green-800);
  border-color: var(--green-500);
  color: var(--green-100);
}
.scheduler-block.scheduler-status-cancelled {
  background: var(--red-900);
  border-color: var(--red-500);
  color: var(--red-100);
}
.scheduler-block.scheduler-block-conflict {
  background: var(--orange-900);
  border-color: var(--orange-500);
  color: var(--orange-100);
}
.scheduler-block.scheduler-entry-block.scheduler-block-type-transit {
  background: var(--violet-700);
  border-color: var(--violet-400);
  color: var(--violet-100);
}
.scheduler-block.scheduler-entry-block.scheduler-block-type-downtime {
  background: repeating-linear-gradient(
    135deg,
    var(--red-900) 0px,
    var(--red-900) 4px,
    var(--rose-800) 4px,
    var(--rose-800) 8px
  );
  border-color: var(--rose-400);
  color: var(--rose-100);
}
.scheduler-origin-badge {
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
}
.scheduler-block.scheduler-block-auto {
  border-style: dashed;
}
.scheduler-block.scheduler-entry-block .scheduler-block-handle {
  cursor: default;
}
.scheduler-block.scheduler-entry-block .scheduler-block-body {
  cursor: default;
}
.scheduler-block-title {
  width: 100%;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  line-height: 1.1;
}
.scheduler-block-handle {
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  flex-shrink: 0;
}
.scheduler-block-handle.left {
  border-right: 1px solid color-mix(in srgb, var(--white) 18%, transparent);
}
.scheduler-block-handle.right {
  border-left: 1px solid color-mix(in srgb, var(--white) 18%, transparent);
}
.scheduler-block-body {
  flex: 1;
  min-width: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0 0.15rem;
  cursor: grab;
}
.scheduler-block.scheduler-dragging .scheduler-block-body {
  cursor: grabbing;
}
.scheduler-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 170px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--navy-950);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--slate-950) 55%, transparent);
  padding: 0.25rem;
}
.scheduler-context-menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.scheduler-context-menu-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-subtle);
  text-align: left;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.scheduler-context-menu-item:hover {
  border-color: var(--color-border);
  background: var(--blue-950);
  color: var(--blue-100);
}
.scheduler-context-menu-item.danger {
  color: var(--red-200);
}
.scheduler-context-menu-item.danger:hover {
  border-color: var(--red-900);
  background: var(--red-950);
  color: var(--red-100);
}
/* Separator for the channel-row right-click menu (reuses .scheduler-context-menu shell). */
.lc-channel-ctx-menu .lc-channel-ctx-sep {
  height: 1px;
  margin: 0.25rem 0.15rem;
  background: var(--color-surface-raised);
}
/* Channel-sidebar and digital-readout menus must stack above any maximized
   panel overlay (.is-maximized = z-index 9000) but below modal overlays
   (.modal-overlay = 9999). */
.lc-channel-ctx-menu,
.lc-digital-ctx-menu {
  z-index: 9500;
}
.scheduler-readiness {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.scheduler-readiness-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}
.scheduler-readiness-ok {
  background: var(--green-900);
  border-color: var(--green-500);
  color: var(--green-200);
}
.scheduler-readiness-missing {
  background: var(--red-900);
  border-color: var(--red-500);
  color: var(--red-200);
}
.scheduler-readiness-table .scheduler-readiness-cue {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.7rem;
}
.scheduler-readiness-timeline .scheduler-readiness-cue {
  width: 0.95rem;
  height: 0.95rem;
  font-size: 0.58rem;
}
.scheduler-readiness.scheduler-readiness-timeline {
  justify-content: center;
}
.crew-contact-readiness {
  justify-content: center;
}
.scheduler-lane.scheduler-crew-lane .scheduler-lane-label {
  color: var(--emerald-200);
}
.editor-row {
  background: color-mix(in srgb, var(--slate-800) 55%, transparent);
}
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.4rem;
  margin: 0.35rem 0;
}
.editor-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}
.editor-grid input,
.editor-grid select,
.editor-grid textarea {
  width: 100%;
}
.scheduler-create-grid {
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 0.55rem;
}
.scheduler-create-grid > label {
  grid-column: span 2;
}
.scheduler-create-grid > .full-width,
.scheduler-create-grid > label.full-width {
  grid-column: 1 / -1;
}
.scheduler-create-grid > label.scheduler-create-half {
  grid-column: span 3;
}
.scheduler-create-grid > label.scheduler-toggle-label {
  grid-column: span 2;
}
.scheduler-create-grid textarea {
  min-height: 7rem;
}
.scheduler-toggle-label {
  justify-content: flex-start;
  align-items: center;
  flex-direction: row !important;
  gap: 0.4rem !important;
  color: var(--color-text-subtle);
  margin-top: 1.25rem;
}
.scheduler-toggle-label input[type="checkbox"] {
  width: auto;
}
@media (max-width: 1100px) {
  .scheduler-create-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .scheduler-create-grid > label,
  .scheduler-create-grid > label.scheduler-create-half,
  .scheduler-create-grid > label.scheduler-toggle-label {
    grid-column: span 1;
  }
}
.scheduler-string-context {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  min-height: 1rem;
}
.scheduler-wells-field {
  grid-column: 1 / -1;
}
.scheduler-wells-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0.25rem 0 0.4rem 0;
  font-weight: normal;
}
.scheduler-location-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  margin: 0.35rem 0;
  border: 1px solid color-mix(in srgb, var(--slate-400) 20%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--slate-800) 30%, transparent);
}
.scheduler-location-summary-label {
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  font-weight: 500;
}
.scheduler-location-summary-text {
  flex: 1 1 220px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduler-location-summary-text.scheduler-location-summary-has-pin {
  color: var(--color-text-subtle);
}
.scheduler-location-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem 0;
  font-weight: normal;
}
.scheduler-location-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.3rem 0;
}
.scheduler-location-row > input[type="text"] {
  flex: 1 1 320px;
  min-width: 240px;
}
.scheduler-location-coords {
  align-items: flex-end;
}
.scheduler-location-coord-label {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--color-text-subtle);
  gap: 0.15rem;
}
.scheduler-location-coord-label input {
  width: 9rem;
}
.scheduler-location-status {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  min-height: 1rem;
  flex: 1 1 auto;
}
.scheduler-location-status.scheduler-location-status-error {
  color: var(--red-400);
}
.scheduler-location-status.scheduler-location-status-ok {
  color: var(--green-300);
}
.scheduler-location-map {
  height: 360px;
  width: 100%;
  border-radius: 6px;
  margin-top: 0.5rem;
  background: color-mix(in srgb, var(--slate-900) 60%, transparent);
}
/* Nested above the scheduler create/edit modals (.modal-overlay = 9999). */
.scheduler-location-modal-overlay {
  z-index: 10100;
}
.scheduler-location-modal-content {
  max-width: 720px;
  width: min(720px, 92vw);
}
.scheduler-wells-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.35rem 0;
}
.scheduler-wells-rows.scheduler-wells-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.scheduler-well-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.scheduler-well-row .scheduler-well-name-input {
  flex: 1 1 180px;
  min-width: 140px;
}
.scheduler-well-row .scheduler-well-status {
  width: auto;
  min-width: 8rem;
}
.scheduler-well-remove {
  padding: 0.1rem 0.45rem;
  font-size: 1.1rem;
  line-height: 1;
}
.scheduler-job-table .scheduler-well-cell {
  vertical-align: top;
}
.scheduler-entry-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.scheduler-entry-pill.scheduler-entry-job {
  background: var(--color-surface);
  color: var(--color-text-subtle);
}
.scheduler-entry-pill.scheduler-entry-transit {
  background: var(--violet-800);
  border-color: var(--violet-500);
  color: var(--violet-100);
}
.scheduler-entry-pill.scheduler-entry-downtime {
  background: var(--red-900);
  border-color: var(--rose-400);
  color: var(--rose-100);
}
.scheduler-job-parent-row.scheduler-block-row td {
  background: color-mix(in srgb, var(--slate-700) 16%, transparent);
}
.scheduler-block-transit-associations {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.scheduler-block-transit-associations.scheduler-hidden {
  display: none;
}
.scheduler-block-transit-associations label {
  margin: 0;
}
.scheduler-block-transit-field.scheduler-hidden {
  display: none;
}
.scheduler-block-time-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.scheduler-block-time-row label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}
.scheduler-well-title {
  margin-left: 0.25rem;
}
.scheduler-cohort-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0 0.2rem;
  margin-right: 0.15rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.75rem;
}
.scheduler-cohort-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.35rem;
}
.scheduler-cohort-live-badge {
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
}
.scheduler-cohort-live-unresolved {
  background: color-mix(in srgb, var(--orange-400) 20%, transparent);
  color: var(--orange-300);
  border: 1px solid color-mix(in srgb, var(--orange-400) 45%, transparent);
}
.scheduler-cohort-live-resolved {
  background: color-mix(in srgb, var(--emerald-400) 15%, transparent);
  color: var(--emerald-300);
  border: 1px solid color-mix(in srgb, var(--emerald-400) 35%, transparent);
}
.scheduler-well-counts {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.scheduler-cohort-child-cell {
  padding: 0.25rem 0.5rem 0.45rem 2rem !important;
  background: var(--color-surface);
  border-top: 1px solid var(--slate-800);
}
.scheduler-cohort-child-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.scheduler-cohort-child-name {
  font-weight: 600;
  color: var(--color-text);
}
.scheduler-cohort-child-status {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: lowercase;
}
.scheduler-child-live code {
  font-size: 0.75rem;
  color: var(--sky-300);
}
.scheduler-child-live.muted {
  color: var(--color-text-faint);
}
#scheduler-status.scheduler-warning {
  color: var(--amber-500);
}
.scheduler-audit-list {
  max-height: 52vh;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
}
.scheduler-audit-list .jobs-table td pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  max-width: 520px;
}
.scheduler-status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
}
.scheduler-status-pill.scheduler-status-draft {
  background: var(--gray-700);
  color: var(--gray-200);
}
.scheduler-status-pill.scheduler-status-scheduled {
  background: var(--blue-100);
  color: var(--blue-800);
}
.scheduler-status-pill.scheduler-status-in-progress {
  background: var(--amber-100);
  color: var(--yellow-800);
}
.scheduler-status-pill.scheduler-status-completed {
  background: var(--green-900);
  color: var(--green-200);
}
.scheduler-status-pill.scheduler-status-cancelled {
  background: var(--red-900);
  color: var(--red-200);
}
.editor-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.assignment-pane-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.55rem;
}
.assignment-pane {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--slate-900) 55%, transparent);
}
.assignment-pane h4 {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
}
.crew-assignment-slot {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--slate-900) 48%, transparent);
  margin-bottom: 0.45rem;
}
.crew-assignment-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.crew-assignment-slot-header h5 {
  margin: 0;
  font-size: 0.8rem;
}
.crew-assignment-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.45rem;
}
.crew-assignment-list {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem;
  background: color-mix(in srgb, var(--slate-900) 40%, transparent);
}
.crew-assignment-list h6 {
  margin: 0 0 0.3rem;
  font-size: 0.76rem;
}
.crew-assignment-list label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.76rem;
}
.crew-assignment-available-scroll {
  max-height: min(42vh, 22rem);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 0.15rem;
  -webkit-overflow-scrolling: touch;
}
.crew-assignment-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.crew-assignment-item-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.3rem 0.35rem;
}
.crew-assignment-item-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.crew-assignment-conflict-badge {
  border: 1px solid color-mix(in srgb, var(--yellow-400) 50%, transparent);
}
.crew-staffing-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.crew-warning-badge {
  border: 1px solid color-mix(in srgb, var(--yellow-400) 45%, transparent);
}
.crew-equipment-cell-empty {
  color: var(--color-text-faint);
  font-size: 0.9rem;
}
.crew-equipment-cell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  max-width: min(36rem, 52vw);
}
.crew-route-target {
  outline: 2px solid var(--blue-400);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue-300) 35%, transparent);
}
.crew-link-confirm-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem !important;
  margin-top: 1.25rem;
}
.crew-link-confirm-label input[type="checkbox"] {
  width: auto;
}
.crew-link-suggestions-wrap {
  margin: 0.2rem 0 0.35rem;
}
.crew-link-help {
  margin: 0 0 0.2rem;
}
.crew-link-suggestion-status {
  min-height: 1rem;
  margin: 0 0 0.3rem;
}
.crew-link-suggestion-status.error {
  color: var(--red-200);
}
.crew-link-suggestion-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.crew-link-suggestion-list li {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  background: color-mix(in srgb, var(--slate-900) 48%, transparent);
  display: grid;
  gap: 0.2rem;
}
.crew-link-suggestion-title {
  font-weight: 600;
  color: var(--color-text);
}
.crew-link-suggestion-meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.crew-link-suggestion-list button {
  justify-self: start;
}
.member-picker {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--slate-900) 40%, transparent);
}
.member-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.3rem 0.5rem;
}
.member-pill {
  display: inline-block;
  margin-right: 0.3rem;
  margin-bottom: 0.2rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue-500) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue-500) 55%, transparent);
  font-size: 0.76rem;
}
#user-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#user-detail > p {
  margin: 0 0 0.5rem 0;
}
#user-detail-content {
  margin: 0;
}
.user-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(300px, 1fr);
  gap: 1rem;
}
.user-detail-pane h4 {
  margin: 0 0 0.5rem 0;
  color: var(--color-text);
}
.user-detail-line {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}
.user-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.user-customer-list {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--color-surface);
}
.user-customer-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0;
  font-size: 0.9rem;
}
@media (max-width: 1000px) {
  .user-detail-grid {
    grid-template-columns: 1fr;
  }
}
.users-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}
.users-toolbar-left {
  flex: 1 1 auto;
  justify-content: flex-start;
}
.users-toolbar-right {
  flex: 1 1 auto;
  justify-content: flex-end;
}
@media (max-width: 1300px) {
  .users-toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }
  .users-toolbar-right {
    justify-content: flex-start;
  }
}
#jobs > .jobs-header-row,
#jobs > #jobs-filters,
#jobs > #jobs-status,
#archive > .jobs-header-row,
#archive > #archive-filters,
#archive > #archive-status,
#reviews-manage > .jobs-header-row,
#reviews-manage > .customers-toolbar,
#reviews-manage > .customers-create,
#reviews-manage > #reviews-manage-status,
#reviews-manage > #reviews-manage-queue-panel {
  flex: 0 0 auto;
}
.jobs-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.jobs-header-row > h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.jobs-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  margin: 0.5rem 0;
  padding: 0.5rem 0;
}
.jobs-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.jobs-filters input[type="text"] {
  padding: 0.35rem 0.5rem;
  min-width: 10rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.9rem;
}
.jobs-filters select {
  padding: 0.35rem 0.5rem;
  min-width: 10rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.9rem;
}
.jobs-filters input[type="text"]::placeholder {
  color: var(--color-text-faint);
}
.jobs-filters input[type="text"]:focus {
  outline: none;
  border-color: var(--emerald-300);
}

.customers-toolbar,
.customers-create {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.2rem 0;
  width: 100%;
}

.customers-toolbar label,
.customers-create label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.customers-toolbar input[type="text"],
.customers-create input[type="text"],
.customers-toolbar select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
}

.customer-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.customer-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  background: var(--navy-700);
  border: 1px solid var(--ca-default-border);
  color: var(--ca-text);
}
.customer-actions button:hover {
  background: var(--ca-default-hover);
}
.customer-actions button[data-customer-action="activate"] {
  background: var(--ca-activate-bg);
  border-color: var(--ca-activate-border);
  color: var(--ca-activate-text);
}
.customer-actions button[data-customer-action="activate"]:hover {
  background: var(--ca-activate-hover);
}
.customer-actions button[data-customer-action="pending"] {
  background: var(--ca-pending-bg);
  border-color: var(--ca-pending-border);
  color: var(--ca-pending-text);
}
.customer-actions button[data-customer-action="pending"]:hover {
  background: var(--ca-pending-hover);
}
.customer-actions button[data-customer-action="inactive"] {
  background: var(--ca-inactive-bg);
  border-color: var(--ca-inactive-border);
  color: var(--ca-inactive-text);
}
.customer-actions button[data-customer-action="inactive"]:hover {
  background: var(--ca-inactive-hover);
}
.customer-actions button[data-customer-action="rename"] {
  background: var(--navy-750);
  border-color: var(--ca-rename-border);
  color: var(--ca-text);
}
.customer-actions button[data-customer-action="rename"]:hover {
  background: var(--ca-rename-hover);
}
.customer-actions button[data-customer-action="match"] {
  background: var(--navy-750);
  border-color: var(--ca-match-border);
  color: var(--ca-text);
}
.customer-actions button[data-customer-action="match"]:hover {
  background: var(--ca-match-hover);
}
.customer-merge-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: color-mix(in srgb, var(--black) 45%, transparent);
  align-items: center;
  justify-content: center;
}
.customer-merge-dialog-panel {
  width: min(560px, 92vw);
  background: var(--navy-900);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.customer-merge-dialog-panel h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}
.customer-merge-dialog-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.customer-merge-dialog-panel input[type="text"] {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}
.customer-merge-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Add customer modal */
.customer-add-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: color-mix(in srgb, var(--black) 45%, transparent);
  display: none;
  align-items: center;
  justify-content: center;
}
.customer-add-dialog-panel {
  width: min(520px, 92vw);
  background: var(--navy-900);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.customer-add-dialog-panel h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}
.customer-add-dialog-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.customer-add-dialog-panel input[type="text"] {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}
.customer-add-dialog-panel textarea {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.55rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  min-height: 10rem;
  resize: vertical;
}
.customer-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Add comment modal (styled like customer-merge) */
.add-comment-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: color-mix(in srgb, var(--black) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.add-comment-dialog-panel {
  width: min(480px, 92vw);
  background: var(--navy-900);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.add-comment-dialog-panel h4 { margin: 0; font-size: 1rem; color: var(--color-text); }
.add-comment-dialog-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.add-comment-dialog-panel input[type="datetime-local"] {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
}
.add-comment-dialog-panel textarea {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  min-height: 80px;
  resize: vertical;
}
.add-comment-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Running footage by-day modal */
.running-footage-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: color-mix(in srgb, var(--black) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.running-footage-dialog-panel {
  width: min(520px, 92vw);
  max-height: 80vh;
  background: var(--navy-900);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.running-footage-dialog-panel h4 { margin: 0; font-size: 1rem; color: var(--color-text); }
.running-footage-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.running-footage-filter input {
  width: 7rem;
  padding: 0.3rem 0.4rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
}
.running-footage-filter button { padding: 0.3rem 0.6rem; }
.running-footage-summary {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.running-footage-summary strong { color: var(--color-text); }
.running-footage-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.running-footage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.running-footage-table th,
.running-footage-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--navy-850);
  color: var(--color-text);
}
.running-footage-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}
.running-footage-table td.footage-cell { text-align: right; font-variant-numeric: tabular-nums; }
.running-footage-empty { padding: 0.75rem 0.6rem; color: var(--color-text-muted); font-size: 0.9rem; }
.running-footage-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.job-log-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.job-log-card-header h4 { margin: 0; }

#jobs > #jobs-status {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}
#archive > #archive-status {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}
#job-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#archive-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* Manage Review layout (perf-2): the jobs table is the sole grow item
   (dominant work surface) with its own scroll; the Queue Monitor stays a
   compact, non-growing capped monitor below it. Both lists scroll (incl.
   horizontally) so the Queue Error column is reachable, not clipped. */
#reviews-manage-list {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow: auto;
}
#reviews-manage-queue-panel {
  flex: 0 0 auto;
  margin-top: 0.25rem;
}
#reviews-manage-queue-list {
  max-height: 12rem;
  overflow: auto;
}
.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.jobs-table thead {
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.jobs-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}
.jobs-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--slate-800);
  color: var(--color-text);
  vertical-align: middle;
}
.jobs-table tbody tr:hover {
  background: var(--color-surface-raised);
}
.jobs-table tbody tr:last-child td {
  border-bottom: none;
}
.jobs-table-job-link {
  color: var(--blue-400);
  font-weight: 500;
}
.jobs-table-job-link:hover {
  text-decoration: underline;
}
.jobs-table-num {
  text-align: right;
  white-space: nowrap;
}
.archive-row-action-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}
.archive-bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.5rem;
}
.archive-bulk-actions .empty {
  color: var(--color-text-muted);
  margin-right: 0.25rem;
}
.archive-select-col {
  width: 2.2rem;
  text-align: center;
}
.archive-select-col input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.archive-confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 3100;
  background: color-mix(in srgb, var(--black) 45%, transparent);
  align-items: center;
  justify-content: center;
}
.archive-confirm-dialog-panel {
  width: min(520px, 92vw);
  background: var(--navy-900);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.archive-confirm-dialog-panel h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}
.archive-confirm-dialog-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.archive-confirm-dialog-panel textarea {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  min-height: 80px;
  resize: vertical;
}
.archive-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.jobs-cohort-row:hover {
  background: var(--color-surface-raised);
}
.cohort-info {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.cohort-info p {
  margin: 0.25rem 0;
  color: var(--color-text-subtle);
}
.jobs-filter-type-label {
  position: relative;
}
.jobs-filter-type-dropdown {
  position: relative;
  display: inline-block;
}
.jobs-filter-type-toggle {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 120px;
  text-align: left;
}
.jobs-filter-type-toggle:hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}
.jobs-filter-type-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.5rem;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 6px color-mix(in srgb, var(--black) 30%, transparent);
}
.jobs-filter-type-option {
  display: block;
  padding: 0.4rem 0.5rem;
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.9rem;
}
.jobs-filter-type-option:hover {
  background: var(--color-surface-raised);
}
.jobs-filter-type-option input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
}
.crew-multiselect-field {
  position: relative;
}
.crew-multiselect-wrap {
  position: relative;
  min-width: 11rem;
}
.crew-multiselect-toggle {
  width: 100%;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  text-align: left;
  cursor: pointer;
}
.crew-multiselect-toggle:hover {
  border-color: var(--color-border-strong);
  background: var(--navy-900);
}
.crew-multiselect-toggle:disabled {
  cursor: not-allowed;
  color: var(--color-text-faint);
  background: var(--color-surface-sunken);
}
.crew-multiselect-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 12rem;
  max-height: 14rem;
  overflow: auto;
  z-index: 30;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--slate-950) 45%, transparent);
  padding: 0.35rem;
}
.crew-multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-text);
  font-size: 0.82rem;
  padding: 0.28rem 0.3rem;
  border-radius: 6px;
}
.crew-multiselect-option:hover {
  background: var(--color-surface-raised);
}
.crew-multiselect-option input[type="checkbox"] {
  margin: 0;
}
.crew-multiselect-wrap.is-disabled .crew-multiselect-menu {
  display: none !important;
}
.crew-toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.crew-qualification-readiness,
.crew-cdl-readiness {
  justify-content: center;
}
.jobs-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 0.75rem;
}
.jobs-pagination-info {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.jobs-pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.jobs-pagination-btn {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 2.5rem;
  text-align: center;
}
.jobs-pagination-btn:hover:not([disabled]) {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}
.jobs-pagination-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.jobs-pagination-btn.active {
  background: var(--blue-800);
  border-color: var(--blue-500);
  color: var(--white);
  font-weight: 600;
}
.jobs-pagination-ellipsis {
  color: var(--color-text-faint);
  padding: 0 0.25rem;
  font-size: 0.9rem;
}
#job-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#job-detail > p {
  margin: 0 0 0.2rem 0;
  line-height: 1.2;
}
#job-detail-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#job-detail-content > h3 {
  margin: 0 0 0.35rem 0;
  font-size: 1.1rem;
  line-height: 1.15;
}
/* Option A header + grouped tab strip on the completed-job detail page. The
   page is not wrapped in .optA-device, so re-assert that the header and tab
   strip keep their height (never compress) above the scrolling tab panes, and
   supply the vertical rhythm that .optA-device's flex gap provides on the live
   device page. */
#job-detail-content > .optA-header,
#job-detail-content > .optA-tabs {
  flex-shrink: 0;
  margin: 0 0 0.75rem;
}
#job-detail-content #job-tab-overview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#job-detail-content #job-tab-job-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#job-detail-content #job-tab-alarms {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#job-detail-content #job-tab-data {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0; /* allow flex children to shrink instead of overflowing the window */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#job-tab-data .data-view-section {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#job-detail-content #job-tab-chart {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#job-detail-content #job-tab-force-monitor {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
/* Fatigue tab fills the content area so its chart flex-grows like the Chart tab,
   rather than collapsing to the chart host's min-height floor. */
#job-detail-content #job-tab-fatigue {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#job-tab-fatigue .fatigue-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#device-tab-job-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.device-job-info-wrap {
  flex-shrink: 0;
}
.device-job-info-wrap:empty {
  display: none;
}
.job-log-list-wrap {
  max-height: 100%;
}
.job-log-list .job-log-ts {
  color: var(--color-text-subtle);
}
.job-log-list .job-log-author {
  color: var(--blue-300);
}
.job-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.job-log-table th,
.job-log-table td {
  padding: 0.35rem 0.6rem;
  text-align: left;
  border: 1px solid var(--color-border);
}
.job-log-table th {
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 600;
}
.job-log-table .job-log-ts {
  color: var(--color-text-subtle);
  white-space: nowrap;
}
.job-log-table .job-log-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.job-log-table .job-log-author {
  color: var(--blue-300);
}
/* Collapsible Job Info header (job detail) */
.job-info-section {
  margin: 0 0 1rem 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface-raised);
  overflow: hidden;
  flex-shrink: 0; /* don't shrink so content stays visible in flex layout */
  min-height: min-content;
}
.job-info-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: none;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.job-info-toggle:hover {
  background: var(--color-surface-raised);
}
.job-info-toggle-icon {
  font-size: 0.7rem;
  opacity: 0.9;
}
.job-info-body {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
}
.job-info-section.collapsed .job-info-body {
  display: none;
}
.job-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem 1.5rem;
}
.job-info-grid-standard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem 1.5rem;
  align-content: start;
  min-width: min(100%, 800px);
}
.job-info-body .job-info-grid-standard {
  overflow-x: auto;
}
.job-info-column {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.job-info-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}
.job-info-item .label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.job-info-item .label::after {
  content: ' ';
}
.job-info-item .value {
  color: var(--color-text);
}
/* Workstring Modifications: full-width row below the 5-column grid so long text doesn't wrap in one column */
.job-info-mods-full {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
}
.job-info-mods-full .job-info-item {
  max-width: 100%;
}
/* ---- Live Jobs layout: cards + activity sidebar ---- */
#live-jobs-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

/* Live devices: row height from content (auto rows); tiles stretch for equal height per row; #device-list scrolls when needed */
#device-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  grid-auto-rows: auto;
  align-items: start;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 0.75rem 1rem;
}

/* ---- Redesigned card (main-system-tile) ---- */
.main-system-tile {
  background: linear-gradient(180deg, color-mix(in srgb, var(--white) 1.5%, transparent) 0%, transparent 60%), var(--navy-880);
  border-radius: 8px;
  padding: 0.875rem 0.9rem 0.75rem;
  border: 1px solid var(--navy-750);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  overflow: visible;
  transition: border-color 0.15s, transform 0.15s;
}
.main-system-tile.tile-link-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.main-system-tile.tile-link-card:hover {
  border-color: var(--blue-500);
  transform: translateY(-1px);
}
.main-system-tile.tile-link-card.tile-inactive:hover { border-color: var(--red-400); transform: none; }
.main-system-tile.tile-link-card.tile-partial-offline:hover { border-color: var(--amber-400); }
.main-system-tile.tile-link-card:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 2px;
}
.main-system-tile.tile-inactive { border-color: var(--red-400); }
.main-system-tile.tile-partial-offline { border-color: var(--amber-400); }
.main-system-tile.tile-incomplete-offline { border-color: var(--slate-400); }
.main-system-tile.tile-stationary { background-color: var(--orange-900); border-color: var(--amber-700); }

/* Card head: title block + status pill */
.main-system-tile .tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.main-system-tile .tile-head-info {
  min-width: 0;
  flex: 1;
}
.main-system-tile .tile-device-meta {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-system-tile .tile-device-count {
  color: var(--slate-600);
}
.main-system-tile h3.group-title {
  font-size: 0.95rem;
  color: var(--color-text);
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Well location under the job title; omitted entirely when the linked well has
   no Location/State/County, so it must not reserve vertical space. */
.main-system-tile .tile-job-location {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status pill */
.tile-status-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tile-status-online {
  background: color-mix(in srgb, var(--green-500) 12%, transparent);
  color: var(--green-300);
  border-color: color-mix(in srgb, var(--green-500) 35%, transparent);
}
.tile-status-online::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 6px color-mix(in srgb, var(--green-500) 80%, transparent); }
.tile-status-offline {
  background: color-mix(in srgb, var(--slate-400) 10%, transparent);
  color: var(--color-text-muted);
  border-color: color-mix(in srgb, var(--slate-400) 25%, transparent);
}
.tile-status-offline::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--slate-500); }
.tile-status-partial {
  background: color-mix(in srgb, var(--amber-400) 12%, transparent);
  color: var(--amber-300);
  border-color: color-mix(in srgb, var(--amber-400) 35%, transparent);
}
.tile-status-partial::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber-500); }
.tile-status-standby {
  background: color-mix(in srgb, var(--sky-400) 12%, transparent);
  color: var(--sky-300);
  border-color: color-mix(in srgb, var(--sky-400) 35%, transparent);
}
.tile-status-standby::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--sky-400); }

/* Key-value channel grid inside cards */
.main-system-tile .tile-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.4rem 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px dashed var(--navy-750);
}
.main-system-tile .tile-kv-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.main-system-tile .tile-kv-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-system-tile .tile-kv-val {
  font-size: 0.875rem;
  color: var(--color-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.main-system-tile .tile-kv-unit {
  font-size: 0.72rem;
  color: var(--color-text-faint);
  margin-left: 2px;
}

/* Card footer */
.main-system-tile .tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--tile-foot-border);
  font-size: 0.75rem;
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
}
.main-system-tile .tile-device-list {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Legacy aliases kept for compat */
.main-system-tile .tile-key-channels { margin: 0 0 0.25rem 0; padding: 0.4rem 0; border-top: 1px dashed var(--navy-750); }
.main-system-tile .tile-key-row { margin: 0.2rem 0 0 0; font-size: 0.83rem; }
.main-system-tile .tile-key-row:first-child { margin-top: 0; }
.main-system-tile .tile-key-label { color: var(--color-text-muted); }
.main-system-tile .tile-key-val { color: var(--color-text); font-weight: 500; }
.main-system-tile .tile-key-device { color: var(--color-text-faint); font-size: 0.8em; font-weight: normal; }
.main-system-tile .tile-spacer { flex: 1 1 auto; min-height: 0; }
.main-system-tile .tile-bottom-row { display: flex; justify-content: flex-end; align-items: center; margin-top: 0.25rem; gap: 0.5rem; }
.main-system-tile .tile-diagnostic { font-size: 0.78rem; color: var(--color-text-muted); flex-shrink: 0; }
.main-system-tile.tile-inactive .tile-diagnostic { color: var(--red-400); }
.main-system-tile.tile-partial-offline .tile-diagnostic { color: var(--amber-400); }
.main-system-tile.tile-stationary .tile-diagnostic { color: var(--orange-300); }
.main-system-tile .current-job { margin: 0 0 0.5rem 0; font-size: 0.85rem; color: var(--indigo-300); }
.main-system-tile .tile-device-types-summary { margin: 0 0 0.35rem 0; font-size: 0.83rem; color: var(--color-text-muted); }
.main-system-tile .tile-types-label { color: var(--color-text-faint); }
.main-system-tile .device-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.main-system-tile .card { background: var(--color-surface); border-radius: 6px; padding: 0.75rem; border: 1px solid var(--color-border); }
.main-system-tile .card h3 { margin: 0 0 0.35rem 0; font-size: 0.95rem; }
.main-system-tile .card p { margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }

/* ---- Activity Feed Sidebar ---- */
.live-activity-sidebar {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--slate-800);
  background: var(--color-surface);
  min-height: 0;
  overflow: hidden;
}
.activity-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.875rem 0.5rem;
  border-bottom: 1px solid var(--slate-800);
  flex-shrink: 0;
}
.activity-feed-title {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--slate-600);
  font-weight: 600;
}
.activity-feed-live-pill {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-300);
  font-weight: 600;
}
.activity-feed-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.activity-feed-empty {
  margin: 0.5rem 0;
  font-size: 0.82rem;
}
.activity-feed-item {
  padding: 0.45rem 0.6rem;
  background: var(--navy-880);
  border: 1px solid var(--slate-800);
  border-radius: 4px;
  border-left: 3px solid var(--blue-500);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
/* disc-5: feed items are real links to the device Job Log; keep the item's own
   text colors (don't inherit the global link color) and add a subtle hover. */
a.activity-feed-item {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-left-color 0.12s, background 0.12s;
}
a.activity-feed-item:hover {
  text-decoration: none;
  background: var(--slate-800);
  border-left-color: var(--blue-400);
}
.activity-feed-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}
.activity-feed-device {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-feed-time {
  font-size: 0.68rem;
  color: var(--slate-600);
  white-space: nowrap;
  flex-shrink: 0;
}
.activity-feed-text {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.btn-mark-complete {
  background: transparent;
  color: var(--sky-400);
  border: 1px solid var(--sky-400);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-mark-complete:hover { background: var(--sky-400); color: var(--slate-900); }
#incomplete-jobs-section { margin-top: 1.5rem; }
.incomplete-jobs-heading { font-size: 1.1rem; color: var(--color-text); margin: 0 0 0.25rem 0; }
.incomplete-jobs-hint { font-size: 0.85rem; color: var(--color-text-muted); margin: 0 0 0.5rem 0; }
.incomplete-jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.cohort-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: middle;
}
.card { background: var(--navy-880); border-radius: 8px; padding: 1rem; min-width: 0; }
.card h3 { margin: 0 0 0.5rem 0; font-size: 1rem; }
.card p { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.online { color: var(--emerald-300); }
.offline { color: var(--red-400); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--table-row-border); }
th { color: var(--color-text-muted); }
.value { font-family: ui-monospace, monospace; }
.empty { color: var(--color-text-faint); font-style: italic; }
.error { color: var(--red-400); }

/* Diagnostics page */
#diagnostics { flex-direction: column; overflow: auto; }
.diagnostics-updated { font-size: 0.85rem; color: var(--color-text-muted); margin: 0 0 0.5rem 0; }
.diagnostics-content { flex: 1 1 auto; min-height: 0; width: 100%; min-width: 0; }
.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
  width: 100%;
}
/* Wrappers used to preserve chart DOM on poll; do not create grid cells so blocks flow as before */
#diagnostics-content-top,
#diagnostics-content-charts {
  display: contents;
}
@media (max-width: 900px) {
  .diagnostics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 500px) {
  .diagnostics-grid { grid-template-columns: 1fr; }
}
.diagnostics-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  min-width: 0;
}
.diagnostics-block-wide { grid-column: 1 / -1; }
.diagnostics-block h3 { margin: 0 0 0.5rem 0; font-size: 1rem; color: var(--color-text); }
.diagnostics-list { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.diagnostics-list li { margin: 0.35rem 0; }
.diagnostics-list li.diagnostics-separator { margin: 0.6rem 0 0.3rem 0; border-top: 1px solid var(--color-border); padding-top: 0.3rem; }
.diagnostics-list .label { color: var(--color-text-muted); }
.diagnostics-list .value { color: var(--color-text); }
.diagnostics-list .value.ok { color: var(--emerald-300); }
.diagnostics-list .value.error { color: var(--red-400); }
.diagnostics-list .muted { color: var(--color-text-faint); font-size: 0.85em; }
.diagnostics-stale {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--amber-700);
  color: var(--white);
}

/* Phase 5 (2026-04-22): removed #device-recording-stats rules — DOM node
   deleted in Phase 2 (recording stats refactor); rules were dead selectors. */
button { background: var(--blue-500); color: var(--white); border: none; padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; }
button:hover { background: var(--blue-600); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
#device-detail, #group-detail, #job-detail { display: none; }
#group-detail {
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
#group-detail > p { margin: 0 0 0.2rem 0; line-height: 1.2; }
#group-detail-title { margin: 0 0 0.5rem 0; line-height: 1.15; }
.group-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.group-device-grid .card { background: var(--color-surface); border-radius: 6px; padding: 0.75rem; border: 1px solid var(--color-border); }
.group-device-grid .card h3 { margin: 0 0 0.35rem 0; font-size: 0.95rem; }
.group-device-grid .card p { margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }
#device-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
/* Phase 5 (2026-04-22): removed #device-detail > p and #device-detail-title
   rules. The Option A layout places these nodes inside .optA-device / .optA-header
   (Phase 1 restructure), so the direct-child selector no longer matches and the
   ID rule was an accidental specificity-bump fighting .optA-device-name. */
#device-tab-overview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#device-tab-alarms { min-height: 0; overflow: auto; }
#device-tab-data {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0; /* allow flex children to shrink instead of overflowing the window */
  flex: 1;
  overflow: hidden;
}
#device-recorded-data-section {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Data export (CSV) section */
.data-view-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
.data-view-section h4 { margin: 0 0 0.5rem 0; font-size: 1rem; color: var(--color-text); }
.data-table-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.data-table-nav .rows-label { color: var(--color-text-muted); font-size: 0.9rem; }
.chart-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.chart-panel-row {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.chart-sidebar {
  flex: 0 0 25%;
  min-width: 160px;
  max-width: 320px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  transition: flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease;
}
.chart-sidebar.collapsed {
  flex: 0 0 40px;
  min-width: 40px;
  max-width: 40px;
}
.chart-sidebar.collapsed .chart-sidebar-body { display: none; }
.chart-sidebar-toggle {
  flex: 0 0 auto;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: var(--color-surface-raised);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 36px;
}
.chart-sidebar-toggle:hover { background: var(--slate-700); }
.chart-sidebar.collapsed .chart-sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  min-height: 80px;
}
.chart-sidebar.collapsed .chart-sidebar-toggle .sidebar-toggle-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.chart-sidebar.collapsed .chart-sidebar-toggle .sidebar-toggle-expand {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  opacity: 0.9;
}
.chart-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: hidden;
}
.chart-sidebar-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.chart-sidebar-controls button, .chart-sidebar-controls select {
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
}
.chart-yaxes-toggle { background: var(--slate-700); color: var(--color-text); border: none; border-radius: 4px; cursor: pointer; }
.chart-yaxes-toggle:hover { background: var(--slate-600); }
.chart-sidebar .channel-picker {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  background: var(--gray-900);
}
.channel-picker-row {
  margin: 0.4rem 0;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--slate-800);
}
.channel-picker-row:last-child { border-bottom: none; }
.chart-sidebar .channel-picker .channel-picker-label {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-subtle);
}
.chart-sidebar .channel-picker .channel-picker-label input[type="checkbox"] { flex-shrink: 0; }
.channel-color-picker {
  width: 22px; height: 22px;
  border: none; padding: 0;
  cursor: pointer; border-radius: 3px;
  background: none;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.chart-sidebar .channel-picker .channel-picker-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
  gap: 0.08rem;
}
.chart-sidebar .channel-picker .channel-picker-device {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-sidebar .channel-picker .channel-picker-channel {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-sidebar .channel-picker .channel-picker-meta {
  color: var(--color-text-subtle);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-sidebar .channel-picker .channel-picker-digital {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.chart-sidebar .channel-picker .channel-picker-digital input { flex-shrink: 0; }
.chart-sidebar .channel-picker .channel-picker-precision {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.chart-sidebar .channel-picker .channel-picker-precision input[type="number"] {
  width: 3.25ch;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 3px;
}
.chart-sidebar .channel-picker .channel-picker-range {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 1.25rem;
  margin-top: 0.2rem;
}
.chart-sidebar .channel-picker .channel-picker-y {
  font-size: 0.75rem;
  color: var(--color-text-faint);
}
.chart-sidebar .channel-picker .channel-picker-range input[type="number"] {
  width: 52px;
  padding: 0.2rem 0.3rem;
  font-size: 0.8rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
}
.chart-sidebar .channel-picker label {
  display: block;
  margin: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}
.chart-comments-sidebar {
  flex: 0 0 22%;
  min-width: 180px;
  max-width: 280px;
}
.chart-comments-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: 0.82rem;
  color: var(--color-text);
  padding: 0.35rem 0;
}
.chart-comments-list .comment-item {
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  border-left: 3px solid transparent;
  background: transparent;
}
.chart-comments-list .comment-item.comment-in-range {
  background: color-mix(in srgb, var(--blue-500) 12%, transparent);
  border-left-color: var(--blue-500);
}
.chart-comments-list .comment-ts { color: var(--color-text-muted); font-size: 0.75rem; margin-bottom: 0.15rem; }
.chart-comments-list .comment-text { color: var(--color-text); word-break: break-word; }
.chart-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0.75rem;
  overflow: hidden;
  width: 0;
}
.chart-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.chart-main .chart-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.max-samples-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.wi-show-plugs-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.wi-curvature-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.wi-curvature-controls input[type="number"] {
  width: 4em;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  padding: 0.15rem 0.3rem;
  font-size: 0.82rem;
}
/* On-canvas annotation shown when lateral exaggeration is active (or
   unavailable), so screenshots can't be misread as true geometry. */
.wi-curvature-note {
  position: absolute;
  top: 2.6rem;
  left: 0.9rem;
  z-index: 5;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--curvature-note);
  pointer-events: none;
  text-shadow: 0 1px 3px color-mix(in srgb, var(--black) 80%, transparent);
}
.max-samples-label input[type="number"] {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  padding: 0.15rem 0.3rem;
  font-size: 0.82rem;
}
.chart-main .chart-readouts {
  flex-shrink: 0;
}
.chart-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}
.chart-readout-card {
  min-width: 100px;
  padding: 0.4rem 0.6rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.chart-readout-card .readout-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}
.chart-readout-card .readout-meta { color: var(--color-text-muted); font-size: 0.8rem; }

/* Live-window segmented toggle (replaces Window: <select> dropdown) */
.chart-main .chart-actions-row #device-chart-status.chart-status {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lc-window-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  border-radius: 5px;
  overflow: hidden;
  margin-left: auto;
  flex: 0 0 auto;
}
.lc-window-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  padding: 5px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-right: 1px solid var(--navy-850);
  min-width: 38px;
}
.lc-window-toggle button:last-child { border-right: none; }
.lc-window-toggle button:hover { color: var(--color-text); background: var(--color-surface-raised); }
.lc-window-toggle button.active {
  background: var(--navy-700);
  color: var(--color-text);
  font-weight: 600;
}
.lc-window-toggle button:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: -2px;
}

/* ---------- Live chart redesigned sidebar + digital strip (.lc-*) ---------- */

/* Digital readout strip above the chart. Reserve a tile-sized min-height so
   adding/removing the first pin doesn't reflow the chart below. */
#device-chart-readouts.chart-readouts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 14px 12px;
  background: var(--color-surface-sunken);
  border: 1px solid var(--navy-850);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  min-height: 66px;
  box-sizing: border-box;
}
#device-chart-readouts.chart-readouts:empty { display: none; }
.lc-digital-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding-right: 0.25rem;
}
.lc-digital-tile {
  min-width: 110px;
  padding: 6px 12px;
  border: 1px solid var(--navy-850);
  background: var(--color-surface);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lc-digital-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.lc-digital-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.lc-digital-unit {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-left: 0.25rem;
  font-weight: 400;
}
/* Canonical .lc-digital-empty, deduped 2026-07: earlier equal-specificity twin (font-size 11.5px,
   no font-family) removed — it was dead, silently overridden by this monospace variant. */
.lc-digital-empty {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--color-text-faint);
  font-style: italic;
}

/* Sidebar shell — picker fills entire chart-sidebar-body when the new sidebar is active.
   Applies to both the live device chart and the completed-job chart pickers via .lc-active. */
.chart-sidebar .channel-picker.lc-active {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  overflow: hidden;
  height: 100%;
  min-height: 320px;
}

/* Sidebar head */
.lc-sidebar-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--navy-850);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.lc-sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lc-sidebar-title-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
}
.lc-sidebar-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  border-radius: 3px;
}

/* Search */
.lc-search {
  position: relative;
  display: flex;
  align-items: center;
}
.lc-search-icon {
  position: absolute;
  left: 8px;
  display: inline-flex;
  color: var(--color-text-faint);
  pointer-events: none;
}
.lc-search-input {
  width: 100%;
  padding: 7px 28px 7px 30px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.lc-search-input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-red) 18%, transparent);
}
.lc-search-clear {
  position: absolute;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: 3px;
}
.lc-search-clear:hover { background: var(--color-surface-raised); color: var(--color-text); }

/* Action row */
.lc-sidebar-actions {
  display: flex;
  gap: 6px;
}
.lc-btn-action {
  flex: 1 1 auto;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-subtle);
  border-radius: 4px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}
.lc-btn-action:not(:disabled):hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.lc-btn-action:disabled { opacity: 0.45; cursor: not-allowed; }

/* Scroll region */
.lc-sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.lc-sidebar-scroll::-webkit-scrollbar { width: 8px; }
.lc-sidebar-scroll::-webkit-scrollbar-track { background: var(--color-surface-sunken); }
.lc-sidebar-scroll::-webkit-scrollbar-thumb { background: var(--color-surface-raised); border-radius: 4px; }
.lc-sidebar-scroll::-webkit-scrollbar-thumb:hover { background: var(--slate-700); }

/* Sections */
.lc-section { padding: 4px 0 8px; }
.lc-section-plotted {
  background: color-mix(in srgb, var(--brand-red) 4%, transparent);
  border-bottom: 1px solid var(--navy-850);
}
.lc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
}
.lc-section-head-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
  border-bottom: 1px solid var(--navy-850);
}
.lc-section-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lc-section-pin { color: var(--brand-red-soft); font-size: 9px; }
.lc-section-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--color-text-faint);
  letter-spacing: 0.1em;
}
.lc-section-empty {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--color-text-faint);
  padding: 6px 12px 8px;
  font-style: italic;
}

/* Plotted row */
.lc-plotted-row {
  display: grid;
  grid-template-columns: 4px 1fr auto auto;
  gap: 8px;
  padding: 6px 10px 6px 0;
  margin: 0 6px;
  border-radius: 3px;
  align-items: center;
  cursor: pointer;
}
.lc-plotted-row:hover { background: var(--color-surface-raised); }
.lc-plotted-stripe {
  width: 4px;
  height: 22px;
  border-radius: 0 2px 2px 0;
}
.lc-plotted-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lc-plotted-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-plotted-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}
.lc-plotted-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--color-text);
  white-space: nowrap;
}
.lc-plotted-x {
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.lc-plotted-x:hover {
  color: var(--color-danger-text);
  background: color-mix(in srgb, var(--red-500) 8%, transparent);
  border-color: color-mix(in srgb, var(--red-500) 40%, transparent);
}

/* Group (per-device) */
.lc-group { display: block; }
.lc-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--navy-850);
  border-bottom: 1px solid var(--navy-850);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.lc-group-head:hover { background: var(--color-surface-raised); }
.lc-group-chev {
  display: inline-block;
  transition: transform 120ms ease;
  color: var(--color-text-muted);
  font-size: 10px;
  width: 10px;
}
.lc-group-chev.open { transform: rotate(90deg); }
.lc-group-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
}
.lc-group-spacer { flex: 1 1 auto; }
.lc-group-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
}
.lc-group-count-sel { color: var(--brand-red-soft); }
.lc-group-body { padding: 4px 0; }

/* Channel row */
.lc-row {
  margin: 0 6px;
  border-radius: 3px;
}
.lc-row.is-expanded {
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
}
.lc-row-main {
  display: grid;
  grid-template-columns: 4px 1fr auto 24px;
  gap: 8px;
  padding: 6px 4px 6px 0;
  align-items: center;
  cursor: pointer;
  border-radius: 3px;
}
.lc-row-main:hover { background: var(--color-surface-raised); }
.lc-row.is-plotted .lc-row-main { background: color-mix(in srgb, var(--brand-red) 5%, transparent); }
.lc-row.is-plotted .lc-row-main:hover { background: color-mix(in srgb, var(--brand-red) 10%, transparent); }
.lc-row-stripe {
  width: 4px;
  height: 22px;
  border-radius: 0 2px 2px 0;
  align-self: center;
}
.lc-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.lc-row-line1 { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.lc-row-line2 { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.lc-row-dev {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.lc-row-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-row.is-plotted .lc-row-name { color: var(--color-text); }
.lc-row-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.lc-row-unit {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--color-text-faint);
  flex-shrink: 0;
}
.lc-row-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.lc-row.is-plotted .lc-row-val { color: var(--color-text-subtle); }
.lc-row-val-unit {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}
.lc-row-expand {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, color 120ms ease;
}
.lc-row-expand:hover { background: var(--color-surface-raised); }
.lc-row-expand.open { transform: rotate(90deg); color: var(--brand-red-soft); }

/* Drawer */
.lc-row-drawer {
  padding: 8px 12px 10px;
  background: color-mix(in srgb, var(--black) 25%, transparent);
  border-top: 1px dashed var(--navy-850);
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lc-drawer-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 8px;
}
.lc-drawer-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.lc-drawer-color-wrap { display: inline-flex; align-items: center; gap: 8px; }
.lc-drawer-color {
  width: 28px;
  height: 22px;
  border: 1px solid var(--color-border);
  background: transparent;
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
}
.lc-drawer-color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}
.lc-drawer-range { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lc-drawer-num {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  outline: none;
}
.lc-drawer-num:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-red) 18%, transparent);
}
.lc-drawer-num-dp { width: 3.25ch; padding: 4px 4px; text-align: center; }
.lc-drawer-num-line-weight { width: 5.25ch; padding: 4px 4px; text-align: center; }
/* Hide native browser number spinners on stepper-wrapped inputs so the custom
   ◂/▸ buttons own the increment UI. */
.lc-drawer-stepper input[type="number"]::-webkit-outer-spin-button,
.lc-drawer-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.lc-drawer-stepper input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.lc-drawer-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lc-drawer-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  user-select: none;
}
.lc-drawer-step:hover { background: var(--color-surface-raised); color: var(--slate-100); border-color: var(--color-border-strong); }
.lc-drawer-step:active { background: var(--color-surface-sunken); }
.lc-drawer-step:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 1px;
}
.lc-drawer-sep {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--color-text-faint);
}
.lc-drawer-unit {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--color-text-faint);
  letter-spacing: 0.1em;
}
.lc-drawer-desc {
  font-size: 11.5px;
  color: var(--color-text-subtle);
}
.lc-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.lc-drawer-toggle:hover { background: var(--color-surface-raised); color: var(--color-text-subtle); }
.lc-drawer-toggle.on {
  background: color-mix(in srgb, var(--brand-red) 18%, transparent);
  border-color: var(--brand-red);
  color: var(--color-text);
}
.lc-drawer-toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate-600);
}
.lc-drawer-toggle.on .lc-drawer-toggle-dot {
  background: var(--brand-red-soft);
  box-shadow: 0 0 6px color-mix(in srgb, var(--brand-red-soft) 60%, transparent);
}
.lc-drawer-precision { display: inline-flex; align-items: center; gap: 8px; }
.lc-drawer-line-weight { display: inline-flex; align-items: center; gap: 8px; }
.lc-drawer-precision-hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--color-text-faint);
  letter-spacing: 0.05em;
}
.lc-drawer-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  background: var(--color-surface-sunken);
  border: 1px solid var(--navy-850);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  word-break: break-all;
}

.chart-status { color: var(--color-text-muted); font-size: 0.85rem; }
.chart-canvas {
  flex: 1;
  min-height: 200px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  width: 100%;
}
/* Phase 5 (2026-04-22): removed .device-tabs-row — the only consumer was the
   Option A device tab nav (index.html:199), where it fought the .optA-tabs
   flex layout (extra flex-wrap, margin, space-between). No other pages
   reference .device-tabs-row. */
/* .device-tabs is KEPT but its nested selectors were RESCOPED. The
   completed-job-detail page (app.js renders <div class="device-tabs"> with
   .job-tab children) still relies on these. On the Device page the .device-tabs
   wrapper is a Phase-1 compatibility shim with style="display: contents;" so
   the `display: flex` declaration below is inert there; the button rules would
   otherwise bleed into .device-tab buttons and override .optA-tab background /
   padding via descendant combinator. Scoping with :not(.optA-device ...) keeps
   the job-detail appearance intact while staying out of Option A's cascade. */
.device-tabs { display: flex; gap: 0.25rem; }
.device-tabs:not(.optA-device .device-tabs) button { background: var(--slate-700); padding: 0.35rem 0.75rem; font-size: 0.9rem; }
.device-tabs:not(.optA-device .device-tabs) button.active { background: var(--blue-500); }
.device-add-comment-btn {
  background: var(--navy-700);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}
.device-add-comment-btn:hover:not(:disabled) { background: var(--blue-600); border-color: var(--blue-500); }
.device-add-comment-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.diagnostic-card {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.diagnostic-card h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: var(--color-text); }
.diagnostic-card .line { margin: 0.2rem 0; font-size: 0.9rem; }
.diagnostic-card .label { color: var(--color-text-muted); }
.diagnostic-card .value { color: var(--color-text); font-weight: 500; }
.job-subsection { margin: 0.75rem 0 0.5rem 0; color: var(--color-text); font-size: 0.95rem; }
.diag-list { margin: 0; padding-left: 1.15rem; }
.diag-list li { margin: 0.25rem 0; }

/* Force Monitor */
.fm-tab-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.fm-layout {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.fm-sidebar {
  width: 260px;
  min-width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  transition: flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease;
}
.fm-sidebar.collapsed {
  flex: 0 0 40px;
  min-width: 40px;
  max-width: 40px;
}
.fm-sidebar.collapsed .fm-sidebar-body { display: none; }
.fm-sidebar-toggle {
  flex: 0 0 auto;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: var(--color-surface-raised);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 36px;
}
.fm-sidebar-toggle:hover { background: var(--slate-700); }
.fm-sidebar.collapsed .fm-sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  min-height: 80px;
}
.fm-sidebar.collapsed .fm-sidebar-toggle .fm-sidebar-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.fm-sidebar.collapsed .fm-sidebar-toggle .fm-sidebar-expand {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  opacity: 0.9;
}
.fm-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  overflow: auto;
}
.fm-chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.fm-chart-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
}
.fm-model-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.fm-model-actions button {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
}
.fm-current-wrap {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.fm-adj-row {
  margin: 0.35rem 0;
}
.fm-adj-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.fm-adj-row input[type="number"] {
  width: 100px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Well Info */
#job-detail-content #job-tab-well-info {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.wi-tab-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.wi-layout {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.wi-sidebar {
  width: 280px;
  min-width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  transition: flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease;
}
.wi-sidebar.collapsed {
  flex: 0 0 40px;
  min-width: 40px;
  max-width: 40px;
}
.wi-sidebar.collapsed .wi-sidebar-body { display: none; }
.wi-sidebar-toggle {
  flex: 0 0 auto;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: var(--color-surface-raised);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 36px;
}
.wi-sidebar-toggle:hover { background: var(--slate-700); }
.wi-sidebar.collapsed .wi-sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  min-height: 80px;
}
.wi-sidebar.collapsed .wi-sidebar-toggle .wi-sidebar-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.wi-sidebar.collapsed .wi-sidebar-toggle .wi-sidebar-expand {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  opacity: 0.9;
}
.wi-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  overflow: auto;
}
.wi-main-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  gap: 0.5rem;
}
.wi-3d-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;  /* anchors .wi-curvature-note over the canvas */
}
.wi-sweep-resizer {
  flex-shrink: 0;
  height: 6px;
  min-height: 6px;
  cursor: ns-resize;
  background: var(--color-surface-raised);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}
.wi-sweep-resizer:hover,
.wi-sweep-resizer:active {
  background: var(--slate-700);
}
.wi-sweep-resizer.hidden {
  display: none;
}
.wi-sweep-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  height: var(--wi-sweep-panel-height, 280px);
  min-height: 80px;
  max-height: 70vh;
  transition: height 0.2s ease;
}
.wi-sweep-panel.collapsed {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
}
.wi-sweep-panel.collapsed .wi-sweep-panel-body { display: none; }
.wi-sweep-panel-toggle {
  flex: 0 0 auto;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: var(--color-surface-raised);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 36px;
}
.wi-sweep-panel-toggle:hover { background: var(--slate-700); }
.wi-sweep-panel.collapsed .wi-sweep-panel-toggle {
  border-bottom: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 44px;
}
.wi-sweep-panel.collapsed .wi-sweep-panel-toggle .wi-sweep-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.75rem;
}
.wi-sweep-panel.collapsed .wi-sweep-panel-toggle .wi-sweep-expand { font-size: 0.7rem; opacity: 0.9; }
.wi-sweep-panel-body {
  flex: 1;
  min-height: 0;
  padding: 0.5rem;
  overflow: auto;
}
.wi-3d-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
}
.wi-form-row {
  margin: 0.35rem 0;
}
.wi-form-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.wi-form-row input[type="number"] {
  width: 90px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.wi-form-row select {
  width: 130px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Plug Detail */
.pd-tab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.pd-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0.75rem;
}
.pd-charts {
  flex: 3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.5rem;
}
.pd-chart-canvas {
  flex: 1;
  min-height: 180px;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.pd-sidebar {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}
.pd-nav-label {
  font-weight: 600;
  color: var(--color-text);
  padding: 0 0.5rem;
}
.pd-table-wrap {
  max-height: 220px;
  overflow-y: auto;
}
.pd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.pd-table th, .pd-table td {
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--slate-800);
  text-align: left;
  color: var(--color-text-subtle);
}
.pd-table th {
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
  background: var(--color-surface-raised);
}
.pd-row-selected {
  background: var(--navy-700) !important;
}
.pd-table tr:hover {
  background: var(--color-surface-raised);
  cursor: pointer;
}
.pd-status-tagged { color: var(--pd-status-tagged); }
.pd-status-complete { color: var(--plug-complete); }
.pd-status-mia { color: var(--pd-status-mia); }
.pd-backdated {
  font-size: 0.75rem;
  color: var(--amber-500);
  margin-left: 0.25rem;
}
.pd-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.pd-btn-tag {
  background: var(--pd-btn-tag);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.pd-btn-tag:hover { background: var(--pd-btn-tag-hover); }
.pd-btn-through {
  background: var(--pd-btn-through);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.pd-btn-through:hover { background: var(--pd-btn-through-hover); }
.pd-btn-mia {
  background: var(--pd-btn-mia);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.pd-btn-mia:hover { background: var(--pd-btn-mia-hover); }

/* Cycles tab */
.cyc-tab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.cyc-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.cyc-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.cyc-header h4 {
  margin: 0;
  color: var(--color-text);
}
.cyc-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cyc-summary-counts {
  font-size: 1.1rem;
  color: var(--color-text-subtle);
}
.cyc-count {
  font-weight: 700;
}
.cyc-count-full { color: var(--orange-500); }
.cyc-count-partial { color: var(--yellow-500); }
.cyc-count-micro { color: var(--sky-400); }
.cyc-summary-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.cyc-gap-note {
  color: var(--amber-500);
}
.cyc-profile-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.cyc-profile-chart {
  width: 100%;
  height: 120px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.cyc-profile-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.cyc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cyc-legend-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
  border: 1px solid var(--slate-800);
}
.cyc-note {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-muted);
}
.cyc-table-wrap {
  max-height: 260px;
  overflow-y: auto;
}
.cyc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.cyc-table th, .cyc-table td {
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--slate-800);
  text-align: left;
  color: var(--color-text-subtle);
}
.cyc-table th {
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
  background: var(--color-surface-raised);
}
.cyc-table tr.cyc-row:hover {
  background: var(--color-surface-raised);
  cursor: pointer;
}
.cyc-row-selected {
  background: var(--navy-700) !important;
}
.cyc-empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}
.cyc-sev {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.cyc-sev-high {
  background: color-mix(in srgb, var(--red-700) 22%, transparent);
  color: var(--color-danger-text);
}
.cyc-sev-excess {
  background: color-mix(in srgb, var(--orange-500) 20%, transparent);
  color: var(--orange-300);
}
.cyc-sev-baseline {
  background: color-mix(in srgb, var(--green-500) 18%, transparent);
  color: var(--green-300);
}
.cyc-sev-partial {
  background: color-mix(in srgb, var(--yellow-500) 18%, transparent);
  color: var(--yellow-300);
}
.cyc-sev-micro {
  background: color-mix(in srgb, var(--sky-400) 18%, transparent);
  color: var(--sky-300);
}
.cyc-sev-none {
  background: color-mix(in srgb, var(--slate-400) 16%, transparent);
  color: var(--color-text-muted);
}
.cyc-qc-mode {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.cyc-qc-mode-btn {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: none;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.4;
}
.cyc-qc-mode-btn + .cyc-qc-mode-btn {
  border-left: 1px solid var(--color-border);
}
.cyc-qc-mode-btn:hover {
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
}
.cyc-qc-mode-btn.cyc-qc-mode-active {
  background: var(--navy-700);
  color: var(--color-text);
}
.cyc-qc-mode-btn:focus-visible {
  outline: 2px solid var(--sky-400);
  outline-offset: -2px;
}
.cyc-qc-chart {
  width: 100%;
  height: 360px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

/* Job Report — one scrolling document ordered by subject.
   The report tab is a header strip (provenance + actions), a contents rail,
   and a scrolling document of sections. Each section owns a subject and
   carries its chart and its figures together. */
.jr-tab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- header strip ---- */
.jr-prov {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.25rem 0.55rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.6rem;
}
.jr-prov-facts {
  margin: 0;
  flex: 1 1 16rem;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.jr-prov-facts b {
  color: var(--color-text-subtle);
  font-weight: 600;
}
.jr-prov-sep {
  color: var(--color-border-strong);
  margin: 0 0.45rem;
}
.jr-prov-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.jr-doc-status {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex: 0 1 auto;
}
.jr-doc-status.is-error { color: var(--color-danger-text); }
.jr-quiet-btn {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-subtle);
  border-radius: 6px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.jr-quiet-btn:hover {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.jr-quiet-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---- review chip + popovers ---- */
.jr-pop-host { position: relative; display: inline-flex; }
.jr-review-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.jr-review-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.jr-review-chip.is-approved {
  background: color-mix(in srgb, var(--color-success) 13%, transparent);
  color: var(--green-400);
  border-color: color-mix(in srgb, var(--color-success) 32%, transparent);
}
.jr-review-chip.is-issues {
  background: color-mix(in srgb, var(--color-warning) 13%, transparent);
  color: var(--amber-400);
  border-color: color-mix(in srgb, var(--color-warning) 32%, transparent);
}
.jr-review-chip.is-none {
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.jr-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 300px;
  max-width: calc(100vw - 2rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 9px;
  box-shadow: 0 12px 34px color-mix(in srgb, var(--black) 55%, transparent);
  padding: 0.7rem 0.8rem;
  z-index: 40;
  font-size: 0.79rem;
}
.jr-pop[hidden] { display: none; }
.jr-pop h5 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 650;
}
.jr-pop label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin: 0.45rem 0 0.18rem;
}
.jr-pop select,
.jr-pop textarea,
.jr-pop input[type='number'] {
  width: 100%;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 5px;
  padding: 0.28rem 0.4rem;
  font-size: 0.78rem;
  resize: vertical;
}
.jr-pop-note {
  margin: 0.55rem 0 0;
  font-size: 0.71rem;
  color: var(--color-text-faint);
}
.jr-pop-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.jr-pop-actions > * { flex: 1; }
.jr-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 1.1rem;
}

/* ---- layout: rail + document ---- */
.jr-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 0.75rem;
}
.jr-rail {
  flex: 0 0 208px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  transition: flex-basis 0.2s ease;
}
.jr-rail.collapsed { flex-basis: 40px; }
.jr-rail.collapsed .jr-rail-list { display: none; }
.jr-rail-toggle {
  flex: 0 0 auto;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  background: var(--color-surface-raised);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 34px;
}
.jr-rail-toggle:hover { background: var(--slate-700); }
.jr-rail.collapsed .jr-rail-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  min-height: 96px;
}
.jr-rail.collapsed .jr-rail-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.74rem;
}
.jr-rail.collapsed .jr-rail-expand {
  margin-top: 0.25rem;
  font-size: 0.7rem;
}
.jr-rail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.4rem 0.3rem 0.7rem;
}
.jr-rail-group {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 700;
  padding: 0.7rem 0.55rem 0.25rem;
}
.jr-rail-group:first-child { padding-top: 0.15rem; }
.jr-rail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  color: var(--color-text-muted);
  text-align: left;
  padding: 0.32rem 0.55rem;
  font-size: 0.81rem;
  cursor: pointer;
  border-radius: 0 5px 5px 0;
}
.jr-rail-item:hover {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.jr-rail-item.current {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border-left-color: var(--color-accent);
  color: var(--blue-400);
  font-weight: 600;
}
.jr-rail-count {
  font-size: 0.72rem;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}
.jr-rail-item.current .jr-rail-count { color: var(--blue-400); }

.jr-doc {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  padding: 0 1rem 3rem;
  scroll-behavior: smooth;
}

/* ---- headline band: the job's own trace of key numbers ---- */
.jr-section { scroll-margin-top: 0.5rem; padding-bottom: 1.6rem; }
.jr-section-headline { padding-bottom: 1.1rem; }
.jr-headline {
  margin: 0.8rem 0 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--navy-880) 0%, var(--color-surface-sunken) 100%);
  overflow: hidden;
}
.jr-headline-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.jr-headline-tile {
  padding: 0.7rem 0.95rem 0.75rem;
  border-right: 1px solid var(--color-border);
}
.jr-headline-tile:last-child { border-right: none; }
.jr-headline-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: -0.012em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--chart-depth);
}
.jr-headline-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ---- section header ---- */
.jr-sec-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.45rem 0 0.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.7rem;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 5;
}
.jr-sec-index {
  font-size: 0.68rem;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.jr-sec-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.jr-sec-spacer { flex: 1 1 auto; }
.jr-sec-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: 5px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  cursor: pointer;
}
.jr-sec-btn:hover:not(:disabled) {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.jr-sec-btn:disabled { opacity: 0.45; cursor: default; }
.jr-sec-select {
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 5px;
  padding: 0.2rem 0.35rem;
  font-size: 0.76rem;
}
.jr-sec-note {
  margin: 0.5rem 0 0;
  font-size: 0.76rem;
  color: var(--color-text-faint);
}
.jr-linklike {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-link);
  cursor: pointer;
  text-decoration: underline;
}

/* ---- charts ---- */
.jr-chart {
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface-raised);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.jr-chart.is-error {
  background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface-raised));
  border-color: color-mix(in srgb, var(--color-danger) 34%, transparent);
}
.jr-chart-placeholder { min-height: 1px; }
.jr-chart-canvas {
  width: 100%;
  height: 420px;
}
.jr-chart--tall .jr-chart-canvas { height: 520px; }

/* Per-chart full screen.
   The document gives every chart a fixed, modest height, so the tab-level
   Maximize only makes the document taller. This promotes one section to a
   fixed full-viewport box *in place* — the ECharts instance never moves in the
   DOM, it just gets a bigger box and a resize(). */
.jr-section.is-chart-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  margin: 0;
  padding: 0.5rem 1rem 1rem;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.jr-section.is-chart-maximized .jr-sec-head {
  position: static;
  flex: 0 0 auto;
}
/* Figures and cross-references would only steal height from the chart. */
.jr-section.is-chart-maximized .jr-figs,
.jr-section.is-chart-maximized .jr-subhead,
.jr-section.is-chart-maximized .jr-sec-note {
  display: none;
}
.jr-section.is-chart-maximized .jr-chart {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.jr-section.is-chart-maximized .jr-chart-placeholder {
  flex: 1;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}
.jr-section.is-chart-maximized .jr-chart-canvas {
  flex: 1;
  height: auto;
  min-height: 0;
}
body.jr-chart-maximized { overflow: hidden; }
.jr-sec-max .cf-icon { margin-right: 0.25rem; }

/* Cycle strip: one shallow band, so it needs far less height than a plot. */
.jr-chart--strip .jr-chart-canvas { height: 150px; }
.jr-chart.is-empty {
  background: transparent;
  border-style: dashed;
}
.jr-chart-note {
  margin: 0;
  padding: 0.85rem;
  font-size: 0.79rem;
  color: var(--color-text-faint);
}
.jr-cycle-legend {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.75rem 0.5rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.jr-cycle-legend-item { display: inline-flex; align-items: center; gap: 0.32rem; }
.jr-cycle-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
/* Maximizing a strip should not stretch a 150px band over the whole screen. */
.jr-section.is-chart-maximized .jr-chart--strip .jr-chart-canvas {
  flex: 0 0 auto;
  height: 260px;
}

/* ---- all-statistics modal ----
   Id-qualified because the shared `.modal-content` (500px cap, own scroll) is
   declared later in this sheet and would otherwise win on source order,
   squeezing the card wall into a single column — which is the one thing this
   modal exists to avoid. */
#jr-stats-modal .modal-content {
  min-width: 0;
  max-width: min(1400px, 94vw);
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0 0;
  overflow: hidden;
}
#jr-stats-modal .modal-header { padding: 0 1rem; }
.jr-stats-modal-hint {
  margin: 0;
  padding: 0 1rem 0.6rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.jr-stats-modal-body {
  overflow-y: auto;
  padding: 0 1rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.75rem;
  align-content: start;
}
.jr-empty-inline {
  color: var(--color-text-faint);
  font-size: 0.85rem;
  padding: 1rem;
}
.jr-card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  min-width: 0;
}
.jr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 8px 8px 0 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.jr-card-header:hover { background: var(--slate-700); }
.jr-card-header:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: -2px;
}
.jr-card-jump { color: var(--color-text-faint); font-size: 0.8rem; }
.jr-card-header:hover .jr-card-jump { color: var(--color-link); }
.jr-card-body { padding: 0.45rem 0.75rem 0.55rem; }
.jr-stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.jr-stat-table td { padding: 0.15rem 0; }
.jr-stat-label { color: var(--color-text-muted); }
.jr-stat-value {
  color: var(--color-text);
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.jr-chart-error {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.85rem;
  font-size: 0.82rem;
  color: var(--color-danger-text);
}

/* ---- figures ---- */
.jr-figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 1.5rem;
}
.jr-fig {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.81rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
}
.jr-fig-label { color: var(--color-text-muted); }
.jr-fig-value {
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.jr-subhead {
  font-size: 0.67rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 700;
  margin: 0.85rem 0 0.3rem;
}

/* ---- empty / failure ---- */
.jr-empty {
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  padding: 2.2rem 1.4rem;
  text-align: center;
  background: var(--color-surface-sunken);
  margin: 1rem 0;
}
.jr-empty h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}
.jr-empty p {
  margin: 0 auto 0.9rem;
  font-size: 0.83rem;
  color: var(--color-text-muted);
  max-width: 54ch;
  line-height: 1.5;
}

/* ---- Overview overlay toggles ---- */
.jr-overview-toggles {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
}
.jr-overview-toggle-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 700;
  margin-left: 0.6rem;
}
.jr-overview-toggle-label:first-child { margin-left: 0; }
.jr-overview-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.73rem;
  cursor: pointer;
}
.jr-overview-toggle.on {
  border-color: var(--jr-toggle-color, var(--chart-depth));
  color: var(--jr-toggle-color, var(--chart-depth));
  background: color-mix(in srgb, var(--jr-toggle-color, var(--chart-depth)) 13%, transparent);
}

/* ---- live device Job Summary: one picker-driven chart, no statistics ---- */
.dev-js-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dev-js-panel[hidden] { display: none; }
.dev-js-sec-head { position: static; padding-left: 0.25rem; }
.dev-js-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--color-text-muted);
}
.dev-js-charts-host {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface-raised);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dev-js-charts-host .jr-chart-canvas { flex: 1; height: auto; min-height: 320px; }
.dev-js-note { padding: 0 0.25rem; }
.jr-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-info);
  background: color-mix(in srgb, var(--color-info) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-info) 30%, transparent);
  border-radius: 999px;
  padding: 0.14rem 0.6rem;
}
.jr-live-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---- keyboard focus ---- */
.jr-rail-item:focus-visible,
.jr-rail-toggle:focus-visible,
.jr-sec-btn:focus-visible,
.jr-quiet-btn:focus-visible,
.jr-review-chip:focus-visible,
.jr-linklike:focus-visible,
.jr-overview-toggle:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .jr-rail { flex-basis: 168px; }
  .jr-chart-canvas { height: 360px; }
  .jr-chart--tall .jr-chart-canvas { height: 440px; }
}
@media (max-width: 900px) {
  /* Below this the rail costs more width than it earns; lay it across the top
     as a horizontal strip so the document keeps the full width. */
  .jr-layout { flex-direction: column; gap: 0.5rem; }
  .jr-rail { flex: 0 0 auto; }
  .jr-rail.collapsed { flex-basis: auto; }
  .jr-rail.collapsed .jr-rail-toggle { flex-direction: row; min-height: 34px; }
  .jr-rail.collapsed .jr-rail-vertical { writing-mode: horizontal-tb; transform: none; }
  .jr-rail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-height: 6.5rem;
  }
  .jr-rail-group { display: none; }
  .jr-rail-item {
    width: auto;
    border-left: none;
    border-radius: 5px;
    border: 1px solid var(--color-border);
  }
  .jr-rail-item.current { border-color: var(--color-accent); }
}
@media (max-width: 700px) {
  .jr-doc { padding: 0 0.4rem 2rem; }
  .jr-figs { grid-template-columns: 1fr; }
  .jr-headline-tile { border-right: none; border-bottom: 1px solid var(--color-border); }
  .jr-chart-canvas { height: 300px; }
  .jr-chart--tall .jr-chart-canvas { height: 380px; }
  .jr-prov-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .jr-doc { scroll-behavior: auto; }
  .jr-rail { transition: none; }
}

/* Plugs report tab: row-per-plug table with in-row mini bars (see plugs-table.js).
   The table renders straight into the Plugs section's chart host, so it is
   height-bounded there rather than filling a dedicated pane. */
/* `:not(.is-chart-maximized)` rather than a specificity bump on the maximize
   rule: this pair sits later in the sheet and would otherwise win on source
   order, capping the maximized table at 520px. */
.jr-section:not(.is-chart-maximized) .jr-chart-placeholder:has(.jr-plugs-table),
.dev-js-charts-host .jr-chart-placeholder:has(.jr-plugs-table) {
  display: flex;
  max-height: 520px;
  min-height: 260px;
}
.jr-plugs-table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--color-surface);
  font-size: 0.78rem;
  color: var(--color-text-subtle);
}
.jr-plugs-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--slate-800);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.jr-plugs-table-summary {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.85rem;
}
.jr-plugs-table-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.jr-plugs-table-filters {
  display: flex;
  gap: 0.3rem;
}
.jr-plugs-table-filter {
  background: transparent;
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
}
.jr-plugs-table-filter:hover {
  color: var(--color-text-subtle);
  border-color: var(--color-border-strong);
}
.jr-plugs-table-filter.active {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
/* Frac-order toggle: shares the filter chip shape, accented when engaged so
   it reads as a mode switch rather than another filter. */
.jr-plugs-table-frac {
  background: transparent;
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.jr-plugs-table-frac:hover {
  color: var(--color-text-subtle);
  border-color: var(--color-border-strong);
}
.jr-plugs-table-frac.active {
  background: var(--sky-500);
  border-color: var(--sky-500);
  color: var(--white);
}
/* "Frac #" needs more room in the header than the bare "#". */
.jr-plugs-table.frac-order .jr-plugs-col-num {
  width: 4.2rem;
}
.jr-plugs-total-modal .modal-content {
  min-width: 22rem;
  max-width: 28rem;
}
.jr-plugs-total-help {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0 0 0.9rem;
}
.jr-plugs-total-input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  width: 100%;
  font-family: inherit;
}
.jr-plugs-total-input:focus {
  outline: none;
  border-color: var(--sky-500);
}
.jr-plugs-total-error {
  color: var(--color-danger-text);
  font-size: 0.75rem;
  min-height: 1.1rem;
  margin-top: 0.35rem;
}
.jr-plugs-total-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.jr-plugs-table-search {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  width: 8rem;
  font-family: inherit;
}
.jr-plugs-table-search:focus {
  outline: none;
  border-color: var(--sky-500);
}
.jr-plugs-table-status {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-surface-sunken);
  border-bottom: 1px solid var(--slate-800);
}
.jr-plugs-table-headers {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--slate-800);
  background: var(--color-surface-sunken);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.jr-plugs-table-th {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.jr-plugs-table-th.sortable {
  cursor: pointer;
}
.jr-plugs-table-th.sortable:hover {
  color: var(--color-text-subtle);
}
.jr-plugs-table-th.active {
  color: var(--color-text);
}
.jr-plugs-table-th.align-right {
  justify-content: flex-end;
  text-align: right;
}
.jr-plugs-table-th-arrow {
  font-size: 0.6rem;
}
.jr-plugs-table-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.jr-plugs-empty {
  padding: 1.5rem;
  color: var(--color-text-faint);
  text-align: center;
  font-style: italic;
}
.jr-plugs-row {
  display: flex;
  align-items: center;
  border-left: 2px solid transparent;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--color-text-subtle);
}
.jr-plugs-row.even {
  background: var(--color-surface-sunken);
}
.jr-plugs-row.odd {
  background: transparent;
}
.jr-plugs-row.outlier {
  border-left-color: var(--red-500);
}
.jr-plugs-row.mia {
  border-left-color: var(--gray-500);
  color: var(--color-text-faint);
  opacity: 0.65;
}
.jr-plugs-row:hover {
  background: var(--color-surface-raised);
}
.jr-plugs-row:focus-visible {
  outline: 2px solid var(--sky-500);
  outline-offset: -2px;
}
.jr-plugs-cell {
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-sizing: border-box;
}
.jr-plugs-cell.align-right {
  justify-content: flex-end;
  text-align: right;
}
.jr-plugs-num {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.jr-plugs-bar-value {
  width: 2.6rem;
  flex-shrink: 0;
  color: var(--color-text);
}
.jr-plugs-bar-value.outlier {
  color: var(--color-danger-text);
}
.jr-plugs-row.mia .jr-plugs-bar-value {
  color: inherit;
}

/* Column widths — mirror the th and the row cell so they align without a real <table>. */
.jr-plugs-col-num {
  width: 3.2rem;
  flex-shrink: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.jr-plugs-row.outlier .jr-plugs-col-num {
  color: var(--color-danger-text);
}
.jr-plugs-col-status {
  width: 4.5rem;
  flex-shrink: 0;
}
.jr-plugs-status {
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.jr-plugs-status.complete {
  background: color-mix(in srgb, var(--green-500) 15%, transparent);
  color: var(--green-400);
  border: 1px solid color-mix(in srgb, var(--green-500) 30%, transparent);
}
.jr-plugs-status.mia {
  background: color-mix(in srgb, var(--gray-500) 20%, transparent);
  color: var(--gray-400);
  border: 1px solid var(--gray-700);
}
.jr-plugs-col-depth {
  width: 7rem;
  flex-shrink: 0;
}
.jr-plugs-col-bar {
  flex: 1.5 1 0;
  min-width: 0;
}
.jr-plugs-col-cum {
  width: 5.5rem;
  flex-shrink: 0;
}
.jr-plugs-col-lateral {
  width: 7rem;
  flex-shrink: 0;
}

/* In-row bar chart */
.jr-plugs-bar {
  position: relative;
  flex: 1;
  height: 14px;
  background: color-mix(in srgb, var(--white) 4%, transparent);
  border-radius: 2px;
  min-width: 30px;
  overflow: hidden;
}
.jr-plugs-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 2px;
}
.jr-plugs-bar-mill { background: var(--plug-complete); }
.jr-plugs-bar-p2p { background: var(--cyan-400); }
.jr-plugs-bar-dist { background: var(--violet-400); }
.jr-plugs-bar-outlier { background: var(--red-500); }
.jr-plugs-bar-ref {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 1px;
  background: color-mix(in srgb, var(--white) 40%, transparent);
}

/* Lateral position dot */
.jr-plugs-lateral {
  position: relative;
  width: 100%;
  height: 14px;
}
.jr-plugs-lateral-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 2px;
  background: color-mix(in srgb, var(--violet-400) 25%, transparent);
  border-radius: 1px;
}
.jr-plugs-lateral-dot {
  position: absolute;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--violet-400);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--violet-400) 20%, transparent);
}

.jr-plugs-table-footer {
  padding: 0.4rem 0.75rem;
  color: var(--color-text-faint);
  font-size: 0.65rem;
  font-style: italic;
  border-top: 1px solid var(--slate-800);
  flex-shrink: 0;
}

/* `.dev-js-charts-host` and the rest of the live Job Summary panel are defined
   with the Job Report block above, which they share components with. */

/* ---- Wells ---- */
#wells {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}
#wells-list-view,
#wells-detail-view {
  flex: 1 1 auto;
  min-height: 0;
}
#wells-list-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#wells-list-view > h2,
#wells-list-view > .wells-sort-hint,
#wells-list-view > .wells-toolbar {
  flex: 0 0 auto;
}
#wells-table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#wells-table-container table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}
#wells-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised);
  box-shadow: 0 1px 0 var(--slate-700);
}
#wells-list-view > #wells-pagination {
  flex: 0 0 auto;
}
#wells-detail-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wells-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.wells-sort-hint {
  margin: 0.35rem 0 0.6rem 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.wells-toolbar input,
.wells-toolbar select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
#wells-table .clickable { cursor: pointer; }
#wells-table .clickable:hover td { background: var(--color-surface-raised); }

/* Structured-data completeness chips in the Wells list Data column. */
.wells-data-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.wells-data-badge {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.wells-data-badge--on {
  background: var(--green-800, #14532d);
  color: var(--green-200, #bbf7d0);
  border-color: rgba(34, 197, 94, 0.35);
}
.wells-data-badge--off {
  background: var(--slate-800, #1e293b);
  color: var(--color-text-muted, #94a3b8);
  border-color: var(--slate-700, #334155);
  opacity: 0.85;
}

/* Job Well Info — Well Identity card + link-catalog modal */
.wi-identity-card .wi-identity-link-status {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
}
.wi-identity-card .wi-identity-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted, #94a3b8);
}
.wi-identity-dl {
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  font-size: 0.85rem;
}
.wi-identity-dl dt {
  margin: 0;
  color: var(--color-text-muted, #94a3b8);
  font-weight: 500;
}
.wi-identity-dl dd {
  margin: 0;
  word-break: break-word;
}
.wi-link-well-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.wi-link-well-modal[hidden] {
  display: none !important;
}
.wi-link-well-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
}
.wi-link-well-dialog {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  max-height: min(85vh, 40rem);
  overflow: auto;
  background: var(--color-surface-raised, #1e293b);
  border: 1px solid var(--color-border, #334155);
  border-radius: 8px;
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.wi-link-well-dialog h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.wi-link-well-help {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted, #94a3b8);
}
.wi-link-well-search-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.wi-link-well-results {
  min-height: 8rem;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--color-border, #334155);
  border-radius: 4px;
  background: var(--color-surface, #0f172a);
}
.wi-link-well-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--color-border, #334155);
  background: transparent;
  color: inherit;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font: inherit;
}
.wi-link-well-row:last-child {
  border-bottom: 0;
}
.wi-link-well-row:hover,
.wi-link-well-row:focus-visible {
  background: var(--color-surface-raised, #1e293b);
  outline: none;
}
.wi-link-well-row.is-selected {
  background: rgba(37, 99, 235, 0.25);
  box-shadow: inset 3px 0 0 var(--color-primary, #3b82f6);
}
.wi-link-well-row-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.wi-link-well-row-meta {
  font-size: 0.78rem;
  color: var(--color-text-muted, #94a3b8);
  margin-top: 0.15rem;
}
.wi-link-well-selected {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}
.wi-link-well-error {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--red-300, #fca5a5);
}
.wi-link-well-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.wells-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.wells-detail-header h2 { flex: 1; margin: 0; }
.wells-detail-actions { display: flex; gap: 0.5rem; }

.wells-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}
.wells-tab {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.wells-tab:hover { color: var(--color-text); }
.wells-tab.active {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
}

.wells-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#wells-tab-survey {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#wells-tab-tubulars {
  overflow: hidden;
}
#wells-tab-model {
  overflow: hidden;
}

.wells-structured-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
}
.wells-structured-heading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}
.wells-structured-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted, #9aa3ad);
  max-width: 48rem;
}
.wells-wd-lookup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.wells-wd-lookup-row .status-text {
  font-size: 0.85rem;
}
.wi-link-well-row-score {
  float: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
}
.wi-link-well-row.is-selected .wi-link-well-row-score {
  color: inherit;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.form-grid label.full-width { grid-column: 1 / -1; }
.form-grid label.reel-checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}
.form-grid label.reel-checkbox-label input[type="checkbox"] {
  margin: 0;
}
.form-input {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}
.form-input:focus {
  outline: none;
  border-color: var(--blue-500);
}
.form-select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.tubular-section {
  border: 1px solid var(--slate-800);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.tubular-section h4 {
  margin: 0 0 0.5rem;
  color: var(--color-text);
  font-size: 0.95rem;
}
.tubular-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.wells-tubulars-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  flex-wrap: nowrap;
  height: 100%;
  min-height: 0;
}
.wells-schematic-pane {
  flex: 0 0 33%;
  min-width: 0;
  border: 1px solid var(--slate-800);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--color-surface);
  min-height: 0;
  overflow: hidden;
}
.wells-tubulars-pane {
  flex: 1 1 67%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.well-tubular-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.well-tubular-tab {
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}
.well-tubular-tab:hover {
  background: var(--slate-700);
}
.well-tubular-tab.active {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: var(--white);
}
.well-tubular-tab-content {
  min-height: 0;
}
.tubular-actions-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.wells-survey-toolbar,
.wells-model-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.wells-model-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.wells-model-fields {
  margin-bottom: 0.6rem;
  /* Four compact fields in one row when width allows; avoids full-width stretch. */
  grid-template-columns: repeat(auto-fill, minmax(10rem, 13rem));
  justify-content: start;
}
.wells-model-chart {
  flex: 1 1 auto;
  min-height: 260px;
  width: 100%;
}
.status-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.depth-markers {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}
.depth-markers .marker b { color: var(--color-text-muted); }
#well-survey-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface-raised);
}
.wells-survey-body {
  display: flex;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
}
.wells-survey-table-pane {
  flex: 0 0 45%;
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
}
.wells-survey-charts-pane {
  flex: 1 1 55%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.well-survey-chart-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.well-survey-chart-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.well-survey-chart-tab:hover {
  background: var(--slate-700);
}
.well-survey-chart-tab.active {
  color: var(--blue-500);
  border-color: var(--blue-500);
  background: var(--color-surface);
}
.wells-survey-chart-canvas {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.btn { border: none; border-radius: 4px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem; }
/* .btn-primary is defined canonically near the Tests-page section (deduped 2026-07). */
.btn-secondary { background: var(--slate-700); color: var(--color-text); }
.btn-secondary:hover { background: var(--slate-600); }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { color: var(--color-text); }
.btn-danger { background: var(--red-500); color: var(--white); }
.btn-danger:hover { background: var(--red-600); }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: color-mix(in srgb, var(--black) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal {
  background: var(--color-surface-raised);
  border-radius: 8px;
  padding: 1.5rem;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px color-mix(in srgb, var(--black) 40%, transparent);
}

/* ---- CT Strings ---- */
.strings-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.strings-toolbar input,
.strings-toolbar select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
#strings-table .clickable { cursor: pointer; }
#strings-table .clickable:hover td { background: var(--color-surface-raised); }

#strings {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
#strings-section-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
  flex: 0 0 auto;
}
.strings-section-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 8px;
  padding: 0.38rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.strings-section-tab:hover {
  border-color: var(--color-border-strong);
  background: var(--navy-900);
}
.strings-section-tab.active {
  border-color: var(--sky-500);
  color: var(--sky-100);
  background: var(--scheduler-tab-active-bg);
}
.strings-section-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.strings-section-panel.active {
  display: flex;
  flex-direction: column;
}
#strings-list-view,
#strings-detail-view {
  flex: 1 1 auto;
  min-height: 0;
}
#strings-list-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.75rem;
}
#strings-list-view > h2,
#strings-list-view > .strings-toolbar {
  flex: 0 0 auto;
}
#strings-table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#strings-table-container table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}
#strings-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised);
  box-shadow: 0 1px 0 var(--slate-700);
}

.strings-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.strings-detail-header h2 { flex: 1; margin: 0; }
.strings-detail-actions { display: flex; gap: 0.5rem; }

#strings-detail-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.strings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}
.strings-tab {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.strings-tab:hover { color: var(--color-text); }
.strings-tab.active {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
}

.strings-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.pickup-requests-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.pickup-requests-list-panel,
.pickup-request-detail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.85rem;
  min-height: 0;
}
.pickup-requests-list-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0.65rem;
  overflow: hidden;
}
.pickup-requests-list-toolbar,
.pickup-request-detail-header,
.pickup-request-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pickup-requests-list-toolbar h2,
.pickup-request-detail-header h3,
.pickup-request-attachments h4 {
  margin: 0;
}
.pickup-requests-list-toolbar,
.pickup-requests-list-panel > .form-input,
.pickup-requests-list-panel > .btn {
  flex: 0 0 auto;
}
.pickup-requests-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pickup-request-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  color: var(--color-text);
  padding: 0.65rem;
  cursor: pointer;
}
.pickup-request-row:hover,
.pickup-request-row.active {
  border-color: var(--sky-500);
  background: var(--navy-900);
}
.pickup-request-row span {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.pickup-request-row strong {
  color: var(--color-text);
}
.pickup-request-detail-card {
  overflow: auto;
}
.pickup-request-detail-actions,
.pickup-request-attachments-header {
  display: flex;
  gap: 0.5rem;
}
.pickup-request-editor-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem;
}
.pickup-request-grid-heading {
  grid-column: 1 / -1;
  margin: 0.45rem 0 0;
  color: var(--color-text);
  font-size: 0.95rem;
}
.pickup-request-readonly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.pickup-request-readonly-field {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  padding: 0.6rem;
  min-width: 0;
}
.pickup-request-readonly-field span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}
.pickup-request-readonly-field strong {
  display: block;
  color: var(--color-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pickup-request-attachments {
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
}
.pickup-request-upload-label {
  cursor: pointer;
}
.pickup-request-attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem;
  margin-top: 0.5rem;
}
.pickup-request-attachment-download {
  background: transparent;
  border: 0;
  color: var(--color-text);
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.pickup-request-attachment-download strong,
.pickup-request-attachment-download span {
  display: block;
}
.pickup-request-attachment-download span {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}
.pickup-request-confirm-panel {
  max-width: 520px;
}

@media (max-width: 900px) {
  .pickup-requests-shell {
    grid-template-columns: 1fr;
  }
}

.strings-summary-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  min-width: 140px;
}
.summary-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}
.summary-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.strings-jobs-summary { margin-bottom: 0.5rem; }

.strings-design-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.strings-design-subtabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.strings-design-subtab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.strings-design-subtab.active {
  background: var(--blue-800);
  border-color: var(--blue-500);
  color: var(--blue-100);
}
.strings-design-subtab-content {
  min-height: 0;
}
#strings-design-subtab-load-chart {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#strings-design-subtab-fatigue {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#strings-design-subtab-sections {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#strings-design-subtab-sections .strings-design-panel-details {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#strings-design-subtab-sections .strings-design-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
.strings-design-status { margin: 0 0 0.5rem 0; }
.strings-design-loading {
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.strings-design-error {
  background: var(--red-950);
  border: 1px solid var(--red-800);
  color: var(--red-200);
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.strings-design-error ul { margin: 0.5rem 0 0 1.25rem; }
.strings-design-empty {
  padding: 1rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
/* Design tab content shell */
#strings-tab-design {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#strings-tab-design .strings-design-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0;
}

#strings-tab-design > .strings-design-subtabs {
  flex-shrink: 0;
}

#strings-design-subtab-design {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#strings-design-subtab-history {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#strings-design-subtab-history .strings-design-lc-hint,
#strings-design-subtab-history .strings-design-toolbar,
#strings-design-subtab-history .strings-design-status {
  flex-shrink: 0;
}
#strings-design-subtab-history .strings-design-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
#strings-design-subtab-history .strings-design-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
}

.strings-design-editor-region {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.strings-design-collapse-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--slate-800);
}

.strings-design-collapse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--color-text-subtle);
  padding: 0.2rem 0.35rem;
  margin: 0;
}

.strings-design-collapse-chevron {
  display: inline-block;
  transition: transform 0.18s ease;
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.strings-design-shell.strings-design-preview-collapsed .strings-design-collapse-chevron {
  transform: rotate(-90deg);
}

.strings-design-top {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.strings-design-top .strings-design-panel-preview {
  flex: 0 0 auto;
}

.strings-design-top .strings-design-panel-editor {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.strings-design-shell.strings-design-preview-collapsed .strings-design-collapse-bar {
  margin-bottom: 0;
  padding-bottom: 0.25rem;
  border-bottom: none;
}

.strings-design-shell.strings-design-preview-collapsed #strings-design-preview-panel {
  display: none;
}

.strings-design-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 960px) {
  .strings-design-split { grid-template-columns: 1fr; }
}
.strings-design-panel h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  color: var(--color-text);
  flex-shrink: 0;
}
.strings-design-panel-editor,
.strings-design-panel-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.strings-design-panel-details {
  margin-top: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.75rem;
}
.strings-design-details-table td,
.strings-design-history-table td {
  vertical-align: middle;
}
.strings-design-row-butt-weld td {
  background: color-mix(in srgb, var(--red-500) 20%, transparent);
}
.strings-design-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.strings-design-meta-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}
.strings-design-meta-grid .form-select {
  width: 100%;
  min-width: 0;
}
.strings-design-lengths {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.strings-design-length-card {
  background: var(--gray-900);
  border: 1px solid var(--gray-700);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.strings-design-length-label {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}
.strings-design-length-card strong {
  color: var(--gray-200);
  font-size: 0.95rem;
}
.strings-design-editor-section {
  margin-bottom: 0.8rem;
}
.strings-design-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.strings-design-editor-header h5 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-subtle);
}
.strings-design-table-wrap {
  max-height: 280px;
  overflow: auto;
}
.strings-design-editor-table td {
  vertical-align: middle;
}
.strings-design-editor-table .form-input,
.strings-design-editor-table .form-select {
  width: 100%;
  min-width: 6rem;
}
.strings-design-wall-pair {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.strings-design-wall-pair .strings-design-wall-select {
  min-width: 4.5rem;
}
.strings-design-editor-table .strings-design-row-actions {
  text-align: right;
}
.strings-design-svg-wrap {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--slate-950);
  flex: 1 1 auto;
  min-height: 260px;
  margin-bottom: 0;
  overflow: auto;
}
.strings-design-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}
.strings-design-warnings {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--yellow-950);
  border: 1px solid var(--amber-700);
  border-radius: 6px;
  color: var(--amber-200);
  font-size: 0.88rem;
}
.strings-design-warnings ul { margin: 0.35rem 0 0 1.1rem; }
.strings-design-warnings-list {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.strings-design-warning-item {
  border: 1px solid var(--amber-500);
  border-radius: 6px;
  background: color-mix(in srgb, var(--amber-600) 20%, transparent);
  padding: 0.35rem 0.5rem;
}

.strings-design-load-chart-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  padding-top: 0.25rem;
}

.strings-design-fatigue-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  padding-top: 0.25rem;
}

.strings-design-fatigue-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.strings-design-fatigue-card {
  border: 1px solid var(--slate-800);
  border-radius: 8px;
  background: var(--color-surface-sunken);
  padding: 0.55rem 0.7rem;
}

.strings-design-fatigue-card h5 {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.strings-design-fatigue-card-value {
  margin: 0.25rem 0 0 0;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
}

.strings-design-fatigue-card-subtext {
  margin: 0.2rem 0 0 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* String detail Fatigue tab: admin/super_admin cumulative view + per-job list. */
.strings-fatigue-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.strings-fatigue-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
}

.strings-fatigue-advisory {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.strings-fatigue-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.25rem 0 0.5rem 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.strings-fatigue-stepper input[type="range"] {
  flex: 1 1 auto;
  max-width: 420px;
}

.strings-fatigue-step-label {
  color: var(--color-text);
  white-space: nowrap;
}

#string-fatigue-chart {
  min-height: 420px;
  margin-bottom: 0.5rem;
}

.string-fatigue-row-missing td {
  color: var(--color-text-muted);
}

.string-fatigue-missing {
  color: var(--amber-400, #fbbf24);
  font-weight: 600;
}

.string-fatigue-row-current td {
  background: rgba(14, 165, 233, 0.12);
}

.strings-design-load-chart-section h4 {
  margin: 0 0 0.35rem 0;
  font-size: 1rem;
  color: var(--color-text);
  flex-shrink: 0;
}

.strings-design-lc-hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  max-width: 52rem;
  flex-shrink: 0;
}

.strings-design-load-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.strings-design-load-chart-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.strings-design-lc-status {
  margin: 0.25rem 0 0.5rem 0;
  font-size: 0.85rem;
}

.strings-design-load-chart-host {
  width: 100%;
  flex: 1 1 auto;
  min-height: 300px;
  background: var(--slate-950);
  border-radius: 8px;
  border: 1px solid var(--slate-800);
}

.strings-design-conflict-actions {
  margin: 0.75rem 0 0 0;
}

.strings-design-cut-form {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.strings-design-cut-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}

.strings-design-cut-form .form-input {
  width: 100%;
}

#strings-design-cut-description {
  min-height: 110px;
  resize: vertical;
}

#strings-design-cut-char-count,
#strings-design-cut-status {
  margin: 0;
}

.strings-design-cut-actions {
  justify-content: flex-end;
  margin-top: 0.25rem;
}

@media (max-width: 820px) {
  .strings-design-meta-grid,
  .strings-design-lengths {
    grid-template-columns: 1fr;
  }
}

/* Districts modal */
.modal-content {
  background: var(--color-surface-raised);
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px color-mix(in srgb, var(--black) 40%, transparent);
}
.modal-content-wide {
  min-width: 760px;
  max-width: 920px;
}
#scheduler-new-devices-select,
#scheduler-new-crews-select,
#scheduler-new-equipment-select,
#scheduler-edit-devices-select,
#scheduler-edit-crews-select,
#scheduler-edit-equipment-select {
  min-height: 140px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-header h3 { margin: 0; }
.districts-create-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.district-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}
.district-name { flex: 1; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; }
.badge-green { background: var(--green-800); color: var(--green-200); }
.badge-yellow { background: var(--yellow-800); color: var(--yellow-200); }
.badge-gray { background: var(--slate-700); color: var(--color-text-muted); }

/* ---- CT Reels ---- */
#reels {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
#reels-list-view,
#reels-detail-view {
  flex: 1 1 auto;
  min-height: 0;
}
#reels-list-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.75rem;
}
#reels-list-view > h2,
#reels-list-view > .reels-toolbar {
  flex: 0 0 auto;
}
#reels-table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#reels-table-container table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}
#reels-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised);
  box-shadow: 0 1px 0 var(--slate-700);
}
#reels-detail-view {
  display: flex;
  flex-direction: column;
  /* Flat (non-tabbed) detail form: own the vertical scroll so the lower
     sections (wrap estimator, fatigue) stay reachable when the form is taller
     than the viewport. portal-main clips overflow, so the scroll must live here. */
  overflow-x: hidden;
  overflow-y: auto;
}
.reels-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.reels-toolbar input,
.reels-toolbar select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
#reels-table .clickable { cursor: pointer; }
#reels-table .clickable:hover td { background: var(--color-surface-raised); }

.reels-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.reels-detail-header h2 { flex: 1; margin: 0; }
.reels-detail-actions { display: flex; gap: 0.5rem; }

.reels-detail-body {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.reels-detail-left {
  flex: 1 1 340px;
  min-width: 300px;
}
.reels-detail-right {
  flex: 0 1 420px;
  min-width: 280px;
}

.reel-section-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 1.2rem 0 0.5rem;
}

.reel-assignment-current {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.reel-assignment-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.reel-capacity-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-top: 1rem;
}
.reel-capacity-fieldset legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0 0.4rem;
}
.reel-capacity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  align-items: end;
}
.reel-capacity-grid label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.reel-capacity-grid input {
  width: 100%;
  margin-top: 0.15rem;
}
.reel-capacity-result {
  grid-column: 1 / -1;
  font-size: 1rem;
  padding-top: 0.4rem;
}
.reel-capacity-result strong {
  color: var(--blue-500);
  font-size: 1.1rem;
}
.reel-capacity-note {
  margin: 0.4rem 0 0;
  font-size: 0.7rem;
  color: var(--color-text-faint);
  font-style: italic;
}

.reel-svg-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reel-svg {
  width: 100%;
  max-height: 400px;
}

.reel-wrap-estimator-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-top: 1rem;
}
.reel-wrap-estimator-fieldset legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0 0.4rem;
}
.reel-wrap-estimator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  align-items: end;
}
.reel-wrap-estimator-grid label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.reel-wrap-estimator-grid input[type="number"] {
  width: 100%;
  margin-top: 0.15rem;
}
.reel-wrap-estimator-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
}
.reel-wrap-estimator-checkbox input[type="checkbox"] {
  margin: 0;
}
.reel-wrap-warning {
  margin-top: 0.7rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--amber-900);
  background: var(--amber-950);
  color: var(--amber-300);
  font-size: 0.82rem;
}
.reel-wrap-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 0.8rem;
  margin-top: 0.65rem;
}
.reel-wrap-metric {
  font-size: 0.9rem;
  color: var(--color-text-subtle);
}
.reel-wrap-metric strong {
  color: var(--blue-400);
}

.reel-fatigue-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-top: 1rem;
}
.reel-fatigue-fieldset legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0 0.4rem;
}
.reel-fatigue-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  align-items: end;
}
.reel-fatigue-input-grid label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.reel-fatigue-input-grid input[type="number"] {
  width: 100%;
  margin-top: 0.15rem;
}
.reel-fatigue-status {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--color-text-faint);
  min-height: 1rem;
}
.reel-fatigue-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem 1rem;
  margin-top: 0.5rem;
}
.reel-fatigue-output {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
}
.reel-fatigue-output-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.reel-fatigue-output strong {
  font-size: 1.3rem;
  color: var(--blue-400);
}
.reel-fatigue-output-total {
  border-color: var(--blue-500);
}
.reel-fatigue-output-total strong {
  color: var(--blue-500);
}
.reel-fatigue-resolved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.35rem 0.8rem;
  margin-top: 0.75rem;
}

/* ================================================================
   Custom Chart
   ================================================================ */

.cc-tab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.cc-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

/* Sidebar */
.cc-sidebar {
  width: 280px;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  background: var(--gray-900);
  border-right: 1px solid var(--slate-800);
  overflow: hidden;
  transition: width 0.15s;
}
.cc-sidebar.collapsed {
  width: 44px;
}
.cc-sidebar-toggle {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-800);
  width: 100%;
}
.cc-sidebar.collapsed .cc-sidebar-toggle {
  border-bottom: none;
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.cc-sidebar-toggle:hover { color: var(--color-text); }
.cc-sidebar-expanded { display: inline; }
.cc-sidebar-collapsed { display: none; flex-direction: column; align-items: center; gap: 6px; }
.cc-sidebar.collapsed .cc-sidebar-collapsed { display: flex; }
.cc-sidebar-vertical {
  writing-mode: vertical-rl;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.cc-sidebar-expand {
  font-size: 0.7rem;
  color: var(--slate-600);
}
.cc-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}
.cc-sidebar-section {
  margin-bottom: 1rem;
}
.cc-sidebar-section h5 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}

/* Saved charts list */
.cc-saved-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
  gap: 0.25rem;
}
.cc-saved-item:hover { background: var(--color-surface-raised); }
.cc-saved-item.active { background: var(--navy-700); }
.cc-saved-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-saved-meta { font-size: 0.7rem; color: var(--color-text-faint); width: 100%; }
.cc-saved-actions {
  display: flex; gap: 0.1rem; margin-left: auto;
}
.cc-saved-rename,
.cc-saved-duplicate,
.cc-saved-delete {
  background: none; border: none; color: var(--color-text-faint); cursor: pointer; font-size: 0.85rem; padding: 0 4px;
}
.cc-saved-rename:hover,
.cc-saved-duplicate:hover { color: var(--color-text); }
.cc-saved-delete:hover { color: var(--red-400); }
.cc-new-btn { margin-top: 0.35rem; width: 100%; font-size: 0.8rem; }

/* Channel picker */
.cc-channel-row {
  margin-bottom: 0.35rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--slate-800);
}
.cc-channel-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--color-text);
  cursor: pointer;
}
.cc-channel-toggle input[type=checkbox] { margin: 0; }
.cc-color-picker {
  width: 22px; height: 22px;
  border: none; padding: 0;
  cursor: pointer; border-radius: 3px;
  background: none;
}
.cc-channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-channel-units { color: var(--color-text-faint); font-size: 0.75rem; white-space: nowrap; }
.cc-channel-opts {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.2rem;
  padding-left: 1.5rem;
  flex-wrap: wrap;
}
.cc-channel-opts label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.cc-channel-opts input[type=number] {
  width: 58px; padding: 2px 4px;
  background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text);
  border-radius: 3px; font-size: 0.75rem;
}
.cc-channel-opts select {
  padding: 2px 4px;
  background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text);
  border-radius: 3px; font-size: 0.75rem;
}
.cc-channel-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--slate-800);
}
.cc-combine-toggle {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; color: var(--color-text-muted); cursor: pointer;
  margin-bottom: 0.5rem;
}

/* Annotations list */
.cc-ann-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.25rem 0.3rem;
  border-bottom: 1px solid var(--slate-800);
  gap: 0.25rem;
  font-size: 0.8rem;
}
.cc-ann-text {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--color-text);
}
.cc-ann-meta { font-size: 0.7rem; color: var(--color-text-faint); width: 100%; }
.cc-ann-actions { display: flex; gap: 0.2rem; }
.cc-ann-actions button {
  background: none; border: none; color: var(--color-text-faint); cursor: pointer;
  font-size: 0.85rem; padding: 0 3px;
}
.cc-ann-actions button:hover { color: var(--color-text); }
.cc-import-btn { margin-top: 0.35rem; width: 100%; font-size: 0.8rem; }

/* Main area */
.cc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.cc-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--gray-900);
  border-bottom: 1px solid var(--slate-800);
  flex-wrap: wrap;
}
.cc-title-input {
  flex: 0 0 220px;
  padding: 0.3rem 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 0.9rem;
}
.cc-toolbar-sep {
  width: 1px;
  height: 1.2rem;
  background: var(--slate-700);
  margin: 0 0.25rem;
}
.cc-page-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.cc-page-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.cc-page-select {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
}
.cc-page-btn {
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}
.cc-page-btn:hover { background: var(--slate-700); color: var(--slate-100); }
.cc-page-indicator {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  min-width: 5rem;
  text-align: center;
  white-space: nowrap;
}
.cc-chart-status {
  flex: 1;
  text-align: right;
  font-size: 0.78rem;
  color: var(--color-text-faint);
}
.cc-chart-canvas {
  flex: 1;
  min-height: 300px;
}

/* Modal overlay (annotation dialog, import dialog, export dialog) */
.cc-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--black) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.cc-modal {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  min-width: 340px;
  max-width: 480px;
  color: var(--color-text);
  box-shadow: 0 8px 32px color-mix(in srgb, var(--black) 50%, transparent);
}
.cc-modal-wide {
  min-width: 440px;
  max-width: 600px;
}
.cc-modal h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.cc-modal-field {
  margin-bottom: 0.6rem;
}
.cc-modal-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}
.cc-modal-field textarea,
.cc-modal-field input[type=text],
.cc-modal-field input[type=number],
.cc-modal-field select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 0.85rem;
  box-sizing: border-box;
}
.cc-modal-field textarea { resize: vertical; }
.cc-modal-value { font-size: 0.82rem; color: var(--color-text-muted); }
.cc-modal-select {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  width: 100%;
}
.cc-modal-select:focus { border-color: var(--blue-500); outline: none; }
.cc-modal-yrow-inputs { display: flex; gap: 0.4rem; align-items: center; }
.cc-modal-yrow-inputs input[type=number] { flex: 1; }
.cc-modal-yrow-inputs button { flex: 0 0 auto; }
.cc-modal-hint { font-size: 0.7rem; color: var(--color-text-faint); font-weight: normal; margin-left: 0.3rem; }
.cc-modal-checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.cc-modal-checkbox-row label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--color-text-subtle); cursor: pointer; }
.cc-modal-checkbox-row input[type="checkbox"] { accent-color: var(--blue-500); }
.cc-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}
.cc-modal-spacer { flex: 1; }

/* Import comments list */
.cc-import-hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 0.25rem 0 0.5rem; }
.cc-import-list {
  max-height: 280px;
  overflow-y: auto;
  margin: 0.5rem 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.25rem;
}
.cc-import-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.3rem 0.25rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--slate-800);
}
.cc-import-row:hover { background: var(--color-surface); }
.cc-import-time { color: var(--color-text-faint); white-space: nowrap; font-size: 0.75rem; min-width: 130px; }
.cc-import-text { flex: 1; color: var(--color-text-subtle); }

/* Shared button styles for custom chart (avoid conflict with existing .btn-primary) */
.cc-tab-wrap .btn-primary,
.cc-modal .btn-primary {
  background: var(--blue-600);
  color: var(--white);
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
}
.cc-tab-wrap .btn-primary:hover,
.cc-modal .btn-primary:hover { background: var(--blue-700); }
.cc-tab-wrap .btn-primary:disabled,
.cc-modal .btn-primary:disabled { opacity: 0.5; cursor: default; }
.cc-tab-wrap .btn-secondary,
.cc-modal .btn-secondary {
  background: var(--slate-700);
  color: var(--color-text);
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
}
.cc-tab-wrap .btn-secondary:hover,
.cc-modal .btn-secondary:hover { background: var(--slate-600); }
.cc-modal .btn-danger {
  background: var(--red-800);
  color: var(--red-200);
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
}
.cc-modal .btn-danger:hover { background: var(--red-700); }

/* ---- Tests page ---- */
#tests { flex-direction: column; overflow: auto; padding: 1.5rem; gap: 1.25rem; }
.tests-card {
  background: var(--color-surface-raised);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-width: 72rem;
}
.tests-card h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.tests-card-desc { color: var(--color-text-muted); font-size: 0.85rem; margin: 0 0 1rem; }
.tests-form { display: flex; flex-direction: column; gap: 0.6rem; }
.tests-form-row label { display: block; font-size: 0.82rem; color: var(--color-text-subtle); margin-bottom: 0.2rem; }
.tests-form-row input[type="text"],
.tests-form-row input[type="number"] {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 4px;
  color: var(--color-text); padding: 0.35rem 0.5rem; font-size: 0.85rem; width: 100%;
}
.tests-form-row--inline { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.tests-form-row--inline > div { flex: 1 1 10rem; }
.tests-hint { font-size: 0.75rem; color: var(--color-text-faint); }

.tests-status { padding: 0.5rem 0.75rem; border-radius: 4px; font-size: 0.85rem; background: var(--navy-700); color: var(--blue-300); margin-top: 0.5rem; }
.tests-status--error { background: var(--tests-error-bg); color: var(--color-danger-text); }

.tests-summary { font-size: 0.95rem; margin-bottom: 0.75rem; color: var(--color-text); }
.tests-summary-total { font-size: 1.05rem; }

.tests-results { margin-top: 0.75rem; }
.tests-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tests-table th { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--color-border); color: var(--color-text-muted); font-weight: 600; }
.tests-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--slate-800); vertical-align: top; }
.tests-table-group td { background: var(--color-surface); font-size: 0.85rem; padding: 0.4rem 0.5rem; }
.tests-ch-key { font-family: monospace; white-space: nowrap; }
.tests-breakdown { font-size: 0.78rem; color: var(--color-text-muted); }

.tests-raw-json { margin-top: 0.75rem; font-size: 0.8rem; color: var(--color-text-muted); }
.tests-raw-json summary { cursor: pointer; }
.tests-raw-json pre { max-height: 24rem; overflow: auto; background: var(--color-surface); padding: 0.75rem; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }

/* Canonical shared button styles (.btn-sm / .btn-primary / .btn-outline), portal-wide —
   not Tests-page-specific despite following the .tests-* block. Dedup 2026-07: the earlier
   equal-specificity .btn-primary (was blue-500) and .btn-sm twins were deleted as dead code
   (silently overridden by these). .btn-outline had no twin; it is simply defined here. */
.btn-sm { padding: 0.35rem 0.85rem; border-radius: 4px; font-size: 0.82rem; cursor: pointer; border: none; }
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--color-border-strong); color: var(--color-text-subtle); }
.btn-outline:hover { background: var(--color-surface-raised); }

/* ---- Device config catalog page ---- */
#device-configs {
  flex-direction: column;
  overflow: auto;
  padding: 1.5rem;
  gap: 1rem;
}
.device-configs-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}
.device-configs-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.device-configs-controls input,
.device-configs-controls select {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  padding: 0.35rem 0.5rem;
}
.device-configs-controls button {
  align-self: end;
}
.device-configs-layout {
  display: grid;
  grid-template-columns: minmax(20rem, 1fr) minmax(22rem, 1fr);
  gap: 0.9rem;
}
.device-configs-list,
.device-configs-detail {
  background: var(--color-surface-raised);
  border-radius: 8px;
  padding: 0.8rem;
  min-height: 18rem;
}
.device-configs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.device-configs-table th,
.device-configs-table td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.device-configs-table tbody tr {
  cursor: pointer;
}
.device-configs-table tbody tr:hover {
  background: var(--color-surface);
}
.device-configs-table tbody tr.active {
  background: var(--blue-700);
}
.device-configs-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
}
.device-configs-detail-grid dt {
  color: var(--color-text-muted);
}
.device-configs-json {
  margin: 0;
  background: var(--color-surface);
  border-radius: 6px;
  padding: 0.7rem;
  max-height: 24rem;
  overflow: auto;
  font-size: 0.78rem;
}
@media (max-width: 980px) {
  .device-configs-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- Field PC status admin page ---- */
#field-pc-status {
  flex-direction: column;
  overflow: auto;
  padding: 1.5rem;
  gap: 1rem;
}
.field-pc-status-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}
.field-pc-status-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 18rem;
  font-size: 0.85rem;
}
.field-pc-status-controls input[type="text"] {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  padding: 0.35rem 0.5rem;
}
.field-pc-status-controls .field-pc-status-show-all-label {
  align-items: center;
  flex-direction: row;
  gap: 0.45rem;
  min-width: auto;
  padding-bottom: 0.35rem;
}
.field-pc-status-controls .field-pc-status-show-all-label input[type="checkbox"] {
  accent-color: var(--blue-500);
}
.field-pc-status-layout {
  display: grid;
  grid-template-columns: minmax(42rem, 1.45fr) minmax(24rem, 0.85fr);
  gap: 0.9rem;
  min-height: 22rem;
}
.field-pc-status-list,
.field-pc-status-detail {
  background: var(--color-surface-raised);
  border-radius: 8px;
  padding: 0.8rem;
  min-height: 18rem;
  overflow: auto;
}
.field-pc-status-table,
.field-pc-status-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.field-pc-status-table th,
.field-pc-status-table td,
.field-pc-status-logs-table th,
.field-pc-status-logs-table td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.field-pc-status-table tbody tr {
  cursor: pointer;
}
.field-pc-status-table tbody tr:hover {
  background: var(--color-surface);
}
.field-pc-status-table tbody tr.active {
  background: var(--blue-700);
}
.field-pc-status-table tbody tr.field-pc-status-row-behind {
  background: color-mix(in srgb, var(--amber-500) 10%, transparent);
}
.field-pc-status-table tbody tr.field-pc-status-row-behind.active {
  background: color-mix(in srgb, var(--blue-700) 78%, var(--amber-500));
}
.field-pc-status-detail-header,
.field-pc-status-logs-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.field-pc-status-detail-header h3,
.field-pc-status-logs-header h4 {
  margin: 0;
}
.field-pc-status-detail-header p {
  margin: 0.2rem 0 0;
}
.field-pc-status-detail-badges,
.field-pc-status-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.field-pc-status-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.field-pc-status-detail-grid dt {
  color: var(--color-text-muted);
}
.field-pc-status-detail-grid dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}
.field-pc-status-metrics-heading {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}
.field-pc-status-metrics-grid {
  margin-bottom: 1rem;
}
.field-pc-status-metric-warn {
  color: var(--amber-500);
  font-weight: 600;
}
.field-pc-status-metric-critical {
  color: var(--red-500);
  font-weight: 600;
}
.field-pc-status-log-level.active {
  background: var(--blue-600);
  color: var(--white);
}
.field-pc-status-logs-table td:nth-child(4) {
  min-width: 16rem;
}
@media (max-width: 1180px) {
  .field-pc-status-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Share mode --- */
.share-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-text);
  flex-wrap: wrap;
}
.share-header-title { font-weight: 600; font-size: 1rem; }
.share-header-device { color: var(--color-text-muted); }
.share-header-expires {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}
/* Share mode: expand portal-main and content to full width when sidebar is hidden */
body.share-mode .portal-sidebar {
  display: none !important; /* Completely remove sidebar from layout flow */
  width: 0;
  flex: 0 0 0;
}
body.share-mode .portal-body {
  width: 100%;
  max-width: 100%;
}
body.share-mode .portal-main {
  width: 100%;
  max-width: 100%;
  flex: 1 1 100%;
  padding: 0.75rem 1rem; /* Slightly reduced padding to maximize chart space */
}
body.share-mode #dashboard {
  width: 100%;
  max-width: 100%;
}
body.share-mode #device-detail {
  width: 100%;
  max-width: 100%;
}
/* Ensure chart containers and chart layout expand in share mode */
body.share-mode .chart-container,
body.share-mode .chart-wrapper,
body.share-mode .chart-layout,
body.share-mode .chart-panel-row {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
}
body.share-mode .chart-sidebar {
  flex: 0 0 auto;
  min-width: 280px;
  max-width: 400px; /* Allow sidebar to be wider in share mode for better usability */
  min-height: 0;
}
body.share-mode .chart-sidebar.collapsed {
  flex: 0 0 40px;
  min-width: 40px;
  max-width: 40px;
}
body.share-mode .chart-main {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important; /* Override the width: 0 that constrains normal mode */
  max-width: none;
}
/* Ensure device tab containers expand in share mode */
body.share-mode #device-tab-live-chart,
body.share-mode #device-tab-job-chart,
body.share-mode #device-tab-job-log {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
}

/* ---------------------------------------------------------------------- */
/* Panel fullscreen / "maximize" toggle                                   */
/* Lifts the active panel root (.chart-panel-row, .fm-layout, or          */
/* .wi-layout) to a fixed-position overlay covering the viewport so its   */
/* sidebars + main area get all available real estate. Only one element  */
/* ever carries .is-maximized at a time.                                  */
.chart-fullscreen-btn { margin-left: auto; }
.chart-fullscreen-btn .cf-icon { margin-right: 4px; }
.chart-fullscreen-btn[aria-pressed="true"] {
  background: var(--blue-600);
  color: var(--white);
  border-color: var(--blue-600);
}
body.panel-maximized { overflow: hidden; }
.chart-panel-row.is-maximized,
.fm-layout.is-maximized,
.wi-layout.is-maximized,
.pd-layout.is-maximized,
.cc-layout.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-surface);
  display: flex;
}
.chart-panel-row.is-maximized .chart-main { flex: 1 1 auto; min-width: 0; }
.fm-layout.is-maximized .fm-chart-area { flex: 1 1 auto; min-width: 0; }
.wi-layout.is-maximized .wi-main-right { flex: 1 1 auto; min-width: 0; }
.pd-layout.is-maximized .pd-charts { flex: 1 1 auto; min-width: 0; }
.cc-layout.is-maximized .cc-main { flex: 1 1 auto; min-width: 0; }
/* Scheduler timeline panel maximizes to a column layout: a thin action
   row at the top, the timeline grid filling the rest of the viewport. */
#scheduler-panel-timeline.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: auto;
}
#scheduler-panel-timeline.is-maximized > #scheduler-timeline { flex: 1 1 auto; min-height: 0; }
/* Job Report tab maximizes the same way: toolbar on top, sidebar+content
   filling the rest of the viewport. The inner `.jr-layout` already lays
   sidebar + main side-by-side, so we just need to give the wrap full
   viewport coverage and ensure the inner content can grow. */
#job-tab-job-report.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: auto;
}
#job-tab-job-report.is-maximized > .jr-layout { flex: 1 1 auto; min-height: 0; }
/* Live Device > Job Summary maximizes the shared chart pane the same way
   the Completed Jobs report does — toolbar pinned at top, chart host
   filling the rest of the viewport. */
#device-tab-job-summary.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: auto;
}
#device-tab-job-summary.is-maximized > .dev-js-charts-host { flex: 1 1 auto; min-height: 0; }
/* Active Status maximizes the same way: the Maximize button row stays pinned
   at the top so it can toggle back out, chart host takes the rest. */
#active-status-content.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: auto;
}
#active-status-content.is-maximized .active-status-chart-host {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
/* Defensive: if both share-mode and panel-maximized end up on body, the
   maximize overlay still wins on sizing. */
body.share-mode.panel-maximized .chart-panel-row.is-maximized .chart-main {
  width: auto !important;
}
.share-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.share-error-card {
  text-align: center;
  background: var(--color-surface-raised);
  padding: 2.5rem 3rem;
  border-radius: 8px;
  max-width: 420px;
}
.share-error-card h2 { margin-bottom: 0.75rem; color: var(--slate-100); }
.share-error-message { color: var(--color-text-muted); font-size: 1rem; }
.device-share-btn {
  background: var(--color-surface-raised);
  color: var(--blue-300);
  border: 1px solid var(--color-border);
  padding: 0.3rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
}
.device-share-btn:hover { background: var(--slate-700); }
.device-share-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================
   Crew Board Tab
   ============================ */
#crew-board-root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-x: hidden;
}

.crew-board-district-required {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--slate-900) 55%, transparent);
  color: var(--color-text);
  font-size: 0.9rem;
  max-width: 42rem;
}

.crew-board-district-required p {
  margin: 0;
}

.crew-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.crew-board-layout {
  --crew-left-width: min(22vw, 18rem);
  --crew-right-width: min(22vw, 18rem);
  display: grid;
  grid-template-columns: var(--crew-left-width) minmax(0, 1fr) var(--crew-right-width);
  align-items: stretch;
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.9rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.crew-board-layout.left-collapsed {
  --crew-left-width: 2.75rem;
}

.crew-board-layout.right-collapsed {
  --crew-right-width: 2.75rem;
}

.crew-board-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.crew-board-side-toggle {
  white-space: nowrap;
}

.crew-board-side-right .crew-board-side-toggle {
  margin-left: auto;
}

.crew-board-side.collapsed .crew-board-side-toggle {
  width: 100%;
  text-align: center;
  min-height: 10rem;
  padding: 0.45rem 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.crew-board-side-left.collapsed .crew-board-side-toggle {
  writing-mode: vertical-lr;
}

.crew-board-side-content {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.crew-board-center {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.crew-board-center-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
  min-width: 0;
}

.crew-board-center-filter-wrap {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.crew-board-center-filter {
  width: 100%;
  background: var(--gray-900);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.8rem;
  padding: 0.42rem 0.5rem;
}

.crew-board-center-filter:focus {
  outline: 1px solid var(--sky-400);
  outline-offset: 0;
  border-color: var(--sky-400);
}

.crew-board-center-scroll {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
}

.crew-board-scroll-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  align-items: start;
  gap: 0.9rem;
  overflow: visible;
  padding-bottom: 0.35rem;
  width: 100%;
}

.crew-board-lane {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  min-height: 18rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.crew-board-lane.crew-board-standby {
  order: -2;
}

.crew-board-lane.crew-board-off-duty {
  order: -1;
  border-color: var(--violet-800);
}

.crew-board-side .crew-board-lane {
  height: 100%;
  min-height: 0;
}

.crew-board-lane.crew-board-standby .crew-board-lane-body.crew-board-pool-dropzone,
.crew-board-lane.crew-board-off-duty .crew-board-lane-body.crew-board-pool-dropzone {
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.crew-board-lane-header {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.crew-board-pool-filter-wrap {
  display: block;
  padding: 0.5rem 0.75rem 0;
}

.crew-board-pool-filter {
  width: 100%;
  background: var(--gray-900);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.78rem;
  padding: 0.38rem 0.48rem;
}

.crew-board-pool-filter:focus {
  outline: 1px solid var(--sky-400);
  outline-offset: 0;
  border-color: var(--sky-400);
}

.crew-board-standby-filters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem 0;
}

.crew-board-standby-filters .crew-board-pool-filter-wrap {
  padding: 0;
}

.crew-board-standby-filter-details {
  font-size: 0.78rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--gray-900);
}

.crew-board-standby-filter-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.38rem 0.48rem;
  color: var(--color-text);
}

.crew-board-standby-filter-summary::-webkit-details-marker {
  display: none;
}

.crew-board-standby-filter-body {
  padding: 0.35rem 0.48rem 0.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.crew-board-standby-readiness-option {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--color-text-subtle);
  line-height: 1.25;
}

.crew-board-standby-readiness-option input {
  margin-top: 0.12rem;
  flex-shrink: 0;
}

.crew-board-standby-filter-clear {
  margin-top: 0.2rem;
  align-self: flex-start;
  font-size: 0.72rem;
  padding: 0.22rem 0.45rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.crew-board-lane-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.crew-board-shift-zone {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--gray-900);
  padding: 0.65rem;
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.crew-board-shift-zone.drag-over {
  border-style: dashed;
  border-color: var(--sky-400);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sky-400) 30%, transparent) inset;
}

.crew-board-shift-zone.drag-blocked {
  border-style: dashed;
  border-color: var(--red-500);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red-500) 35%, transparent) inset;
}

.crew-board-supervisor-slot.drag-over,
.crew-board-operators-dropzone.drag-over,
.crew-board-standby-dropzone.drag-over,
.crew-board-offduty-dropzone.drag-over {
  border-style: dashed;
  border-color: var(--sky-400);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sky-400) 30%, transparent) inset;
}

.crew-board-supervisor-slot.drag-blocked,
.crew-board-operators-dropzone.drag-blocked,
.crew-board-standby-dropzone.drag-blocked,
.crew-board-offduty-dropzone.drag-blocked {
  border-style: dashed;
  border-color: var(--red-500);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red-500) 35%, transparent) inset;
}

.crew-board-supervisor-slot {
  border: 1px dashed var(--color-border-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--slate-900) 45%, transparent);
  padding: 0.45rem;
  min-height: 2.4rem;
}

.crew-board-supervisor-slot.filled {
  border-style: solid;
  border-color: var(--green-500);
  background: var(--green-900);
}

.crew-board-operators-dropzone {
  border: 1px dashed var(--color-border-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--slate-900) 35%, transparent);
  padding: 0.45rem;
  min-height: 2.4rem;
}

.crew-board-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  background: var(--color-surface-raised);
  color: var(--slate-50);
  padding: 0.4rem 0.55rem;
  font-size: 0.83rem;
  cursor: grab;
}

.crew-board-chip--cdl {
  box-shadow: 0 0 0 2px var(--green-500);
}

.crew-board-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.crew-board-chip-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.12rem;
  flex: 0 0 auto;
  max-width: 42%;
  line-height: 1.15;
}

.crew-board-chip-quals {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sky-300);
}

.crew-board-chip-rank {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-board-chip-endorse {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--green-300);
  white-space: nowrap;
}

.crew-board-chip.dragging {
  opacity: 0.5;
}

.crew-board-chip-badges {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.crew-board-chip-badges:empty {
  display: none;
}

.crew-board-badge {
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
  color: var(--color-text-subtle);
  background: var(--color-surface);
  white-space: nowrap;
}

.crew-board-lane.saving .crew-board-lane-body {
  opacity: 0.55;
  pointer-events: none;
}

.crew-board-readonly .crew-board-chip {
  cursor: default;
}

@media (max-width: 1200px) {
  .crew-board-layout {
    --crew-left-width: min(28vw, 17rem);
    --crew-right-width: min(28vw, 17rem);
  }

  .crew-board-scroll-area {
    grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  }
}

@media (max-width: 900px) {
  .crew-board-layout {
    grid-template-columns: 1fr;
  }

  .crew-board-layout.left-collapsed,
  .crew-board-layout.right-collapsed {
    --crew-left-width: auto;
    --crew-right-width: auto;
  }

  .crew-board-side,
  .crew-board-side.collapsed {
    gap: 0.4rem;
  }

  .crew-board-side.collapsed .crew-board-side-content {
    display: none;
  }

  .crew-board-side .crew-board-side-toggle {
    width: 100%;
    margin-left: 0;
  }

  .crew-board-center-filter-row {
    flex-wrap: wrap;
  }

  .crew-board-side.collapsed .crew-board-side-toggle,
  .crew-board-side-left.collapsed .crew-board-side-toggle {
    min-height: 0;
    writing-mode: horizontal-tb;
    text-orientation: initial;
  }
}

/* ---- String Tools ---- */
#string-tools {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.string-tools-header {
  margin-bottom: 0.6rem;
}
.string-tools-header h2 {
  margin: 0;
}
.string-tools-subtitle {
  margin: 0.25rem 0 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.string-tools-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.string-tools-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-subtle);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
.string-tools-tab.active {
  background: var(--blue-800);
  border-color: var(--blue-500);
  color: var(--blue-100);
}
.string-tools-tab-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.string-tools-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.string-tools-control-tight {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.string-tools-metric-select {
  min-width: 0;
  max-width: 148px;
  font-size: 0.8rem;
  padding: 0.3rem 0.35rem;
}
.string-tools-available-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}
.string-tools-available-toolbar .string-tools-filter-toggle {
  min-width: 140px;
}
.string-tools-asset-filter {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 11ch;
  min-width: 0;
  max-width: 100%;
  font-size: 0.85rem;
}
.string-tools-actions-cell {
  white-space: nowrap;
}
.string-tools-actions-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}
input[type="color"].string-tools-series-color {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  background: transparent;
}
input[type="color"].string-tools-series-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}
input[type="color"].string-tools-series-color::-webkit-color-swatch {
  border-radius: 2px;
  border: none;
}
.string-tools-filter-dropdown {
  position: relative;
}
.string-tools-filter-toggle {
  min-width: 185px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
}
.string-tools-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  max-height: 230px;
  overflow: auto;
  z-index: 25;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  padding: 0.4rem 0.45rem;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--black) 35%, transparent);
}
.string-tools-filter-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
  padding: 0.2rem 0;
}
.string-tools-filter-option input[type="checkbox"] {
  accent-color: var(--blue-500);
}
.string-tools-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr);
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
}
#string-tools.string-tools-available-collapsed .string-tools-layout {
  grid-template-columns: 44px minmax(420px, 1fr);
}
#string-tools.string-tools-available-collapsed #string-tools-available-card {
  overflow: hidden;
}
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-table-wrap,
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-count,
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-available-title,
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-available-toolbar {
  display: none;
}
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-card-header {
  justify-content: center;
  padding: 0.25rem 0;
}
#string-tools.string-tools-available-collapsed #string-tools-available-card .string-tools-card-header h3 {
  display: none;
}
.string-tools-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.string-tools-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.string-tools-card-header h3 {
  margin: 0;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.string-tools-collapse-btn {
  width: 26px;
  min-width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--color-text-subtle);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.string-tools-collapse-btn:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.string-tools-count {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.string-tools-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
.string-tools-selected-list {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
  min-height: 2rem;
}
.string-tools-chip {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.string-tools-chip:hover {
  border-color: var(--color-border-strong);
}
.string-tools-chart-host {
  flex: 1 1 auto;
  min-height: 340px;
}
.string-tools-status {
  margin-top: 0.5rem;
}
@media (max-width: 1200px) {
  .string-tools-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Active Status page ---------- */
.active-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.active-status-header h2 {
  margin: 0;
}
.active-status-subtitle {
  margin: 0.25rem 0 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.active-status-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.active-status-updated {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.active-status-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.active-status-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.active-status-filter-select {
  min-width: 160px;
}
.active-status-status {
  margin: 0.25rem 0 0.5rem;
}
.active-status-content {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
/* Fill the viewport below the page header, filters, and status line rather
   than sitting at a fixed height — this is a wall-display dashboard, so the
   depth overlay should use all available vertical space. */
.active-status-chart-host {
  height: calc(100vh - 300px);
  min-height: 420px;
}
.active-status-notice {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  color: var(--color-text-subtle);
}
.active-status-notice-title {
  margin: 0 0 0.3rem;
  color: var(--color-text-muted);
}
.active-status-notice ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* ---------- Email admin pages ---------- */
.email-page {
  display: block;
  width: 100%;
}
.email-page-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.email-page-header--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.email-page-title {
  margin: 0;
}
.email-tabs {
  display: inline-flex;
  gap: 0.5rem;
}
.email-tab-btn {
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.email-tab-btn.is-active {
  background: var(--blue-600);
  color: var(--white);
  border-color: var(--blue-600);
}
a.email-tab-btn {
  text-decoration: none;
  display: inline-block;
}
.email-ondemand-groups {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.email-ondemand-groups label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
}
.email-page-description {
  margin: 0 0 0.75rem;
}
.email-tab-pane {
  display: block;
  width: 100%;
}
.email-detail-card {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
}
.email-types-table th,
.email-types-table td {
  padding: 6px;
}

/* ---------- Force Modelling page ---------- */
#force-model {
  flex-direction: column;
  min-height: 0;
}
.force-model-header {
  flex: 0 0 auto;
}
.force-model-subtitle {
  color: var(--color-text-muted);
  margin: 0.25rem 0 0.75rem;
}
.force-model-layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(420px, 1fr);
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
}
.force-model-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.force-model-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.force-model-card-header h3 {
  margin: 0;
  font-size: 0.95rem;
}
.force-model-selectors {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.force-model-field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.2rem;
}
.force-model-well-table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.force-model-well-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised);
  box-shadow: 0 1px 0 var(--slate-700);
}
.force-model-well-table .force-model-well-action {
  text-align: right;
  white-space: nowrap;
}
.force-model-well-row-selected td {
  background: var(--color-surface-raised);
}
.force-model-selected-line {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text);
}
.force-model-readiness {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

/* Well / CT-string picker triggers (replace the inline selectors so the page
   scales to hundreds of wells / dozens of strings) and their modal bodies. */
.force-model-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
}
.force-model-picker-trigger::after {
  content: '⌄';
  flex: 0 0 auto;
  opacity: 0.6;
  font-size: 0.9em;
}
.force-model-picker-trigger .force-model-selected-line {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.force-model-selected-line.empty {
  color: var(--color-text-muted);
}
.force-model-picker-content {
  min-width: 0;
  width: min(760px, 94vw);
  max-width: 760px;
}
.force-model-picker-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
}
.force-model-picker-search {
  width: 100%;
}
.force-model-picker-filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1fr;
  gap: 0.5rem;
}
.force-model-picker-filters .form-input,
.force-model-picker-filters .form-select {
  width: 100%;
}
.force-model-picker-table-wrap {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.force-model-picker-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.force-model-picker-flag {
  font-size: 0.7rem;
  color: var(--amber-400);
  border: 1px solid color-mix(in srgb, var(--amber-400) 40%, transparent);
  border-radius: 3px;
  padding: 0 0.25rem;
  margin-left: 0.35rem;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .force-model-picker-filters {
    grid-template-columns: 1fr 1fr;
  }
}
.force-model-knobs {
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
  margin-bottom: 0.75rem;
}
.force-model-knobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.force-model-knobs-header h3 {
  margin: 0;
  font-size: 0.95rem;
}
.force-model-group-title {
  margin: 0.35rem 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.force-model-knob-grid {
  margin: 0;
}
.force-model-knob {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}
.force-model-knob-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.force-model-knob-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.25;
}
.force-model-knob-toggle .force-model-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.force-model-modified-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: transparent;
  display: inline-block;
}
.force-model-knob-modified .force-model-modified-dot {
  background: var(--blue-500);
}
.force-model-knob-disabled {
  opacity: 0.5;
}
.force-model-advanced {
  margin-top: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
}
.force-model-advanced-summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}
.force-model-advanced-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin: 0.4rem 0;
}
.force-model-run-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.5rem;
}
.force-model-status {
  margin: 0;
}
.force-model-chart-host {
  flex: 1 1 auto;
  min-height: 340px;
}
.force-model-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.force-model-summary {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.force-model-whp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  cursor: pointer;
}
.force-model-save-status {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.force-model-save-line {
  margin: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--color-text-subtle);
  line-height: 1.4;
}
.force-model-save-hint {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}
.force-model-overwrite-details {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface-raised);
}
.force-model-overwrite-details li {
  font-size: 0.82rem;
  color: var(--color-text-subtle);
  padding: 0.15rem 0;
}
.force-model-overwrite-details li strong {
  color: var(--color-text);
}
.force-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.force-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  white-space: nowrap;
}
.force-model-chip-caution {
  border-color: var(--amber-800);
  background: var(--fm-chip-caution-bg);
  color: var(--amber-300);
  cursor: help;
}
.force-model-warnings {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.force-model-warnings li {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding-left: 1.1rem;
  position: relative;
  line-height: 1.3;
}
.force-model-warnings li::before {
  content: "ℹ";
  position: absolute;
  left: 0;
  color: var(--blue-400);
}
.force-model-table-wrap {
  max-height: 260px;
  overflow: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.force-model-table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.force-model-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised);
  box-shadow: 0 1px 0 var(--slate-700);
  text-align: right;
  white-space: nowrap;
}
.force-model-table thead th:first-child {
  text-align: left;
}
.force-model-table td {
  text-align: right;
}
.force-model-table td:first-child {
  text-align: left;
}
.force-model-history {
  border-top: 1px solid var(--color-border);
  margin-top: 0.75rem;
  padding-top: 0.6rem;
}
.force-model-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.force-model-history-header h3 {
  margin: 0;
  font-size: 0.95rem;
}
.force-model-compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--color-text-subtle);
}
.force-model-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 200px;
  overflow: auto;
}
.force-model-history-item {
  width: 100%;
  text-align: left;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  color: var(--color-text-subtle);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.35;
}
.force-model-history-item:hover {
  border-color: var(--color-border-strong);
}
.force-model-history-item-active {
  border-color: var(--blue-500);
}
.force-model-history-item-time {
  color: var(--color-text-muted);
}
.force-model-history-item-lockup {
  color: var(--color-text);
}
@media (max-width: 1200px) {
  .force-model-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Job review tags modal (#jr-tags-modal) ---------- */
.jr-tags-list {
  box-sizing: border-box;
  width: 100%;
  max-height: 55vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
  /* Firefox themed thin scrollbar (mirrors .lc-sidebar-scroll behaviour). */
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-raised) var(--color-surface-sunken);
}
.jr-tags-list::-webkit-scrollbar { width: 8px; }
.jr-tags-list::-webkit-scrollbar-track { background: var(--color-surface-sunken); }
.jr-tags-list::-webkit-scrollbar-thumb {
  background: var(--color-surface-raised);
  border-radius: 4px;
}
.jr-tags-list::-webkit-scrollbar-thumb:hover { background: var(--slate-700); }
.jr-tags-category {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding-bottom: 0.3rem;
  margin: 0.85rem 0 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.jr-tags-category:first-child { margin-top: 0; }
.jr-tags-row {
  display: grid;
  grid-template-columns: minmax(11rem, 42%) 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
}
.jr-tags-row-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  min-width: 0;
}
.jr-tags-row-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.jr-tags-note {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  font-size: 0.8rem;
}
.jr-tags-note:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.jr-tags-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* =========================================================================
   SHARED COMPONENTS — portal-wide primitives (portal-utils.js counterparts).
   Keep new shared vocabulary in this section rather than inside a view's
   block so future consumers can find it.
   ========================================================================= */

/* portalToast() — stacked non-blocking notifications (portal-utils.js).
   Sits above every overlay in the file (current max z-index: 10100). */
.portal-toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}
.portal-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  border-left-width: 4px;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.88rem;
  line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  animation: portal-toast-in 0.18s ease-out;
}
.portal-toast--success { border-left-color: var(--color-success); }
.portal-toast--error { border-left-color: var(--color-danger); }
.portal-toast--info { border-left-color: var(--color-info); }
.portal-toast--closing { opacity: 0; transition: opacity 0.2s ease-out; }
.portal-toast-message {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}
.portal-toast-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
}
.portal-toast-close:hover { color: var(--color-text); }
@keyframes portal-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-toast { animation: none; }
  .portal-toast--closing { transition: none; }
}

/* portalBadge() — entity-status badges (portal-utils.js). Tint + border
   treatment lifted from .optA-status-chip (device-optA.css), the polished
   baseline. STATUS badges only — the legacy .badge family stays for count
   badges (alarms count, crew Day/Night/Total chips). --orange exists beyond
   the six core variants because certifications carry four distinct urgency
   states (green/yellow/orange/red) that must not collapse into one warning. */
.portal-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.portal-badge--success {
  background: color-mix(in srgb, var(--green-500) 12%, transparent);
  color: var(--green-300);
  border: 1px solid color-mix(in srgb, var(--green-500) 35%, transparent);
}
.portal-badge--warning {
  background: color-mix(in srgb, var(--amber-500) 12%, transparent);
  color: var(--amber-300);
  border: 1px solid color-mix(in srgb, var(--amber-500) 35%, transparent);
}
.portal-badge--orange {
  background: color-mix(in srgb, var(--orange-500) 12%, transparent);
  color: var(--orange-300);
  border: 1px solid color-mix(in srgb, var(--orange-500) 35%, transparent);
}
.portal-badge--danger {
  background: color-mix(in srgb, var(--red-500) 12%, transparent);
  color: var(--red-300);
  border: 1px solid color-mix(in srgb, var(--red-500) 35%, transparent);
}
.portal-badge--neutral {
  background: color-mix(in srgb, var(--slate-500) 12%, transparent);
  color: var(--color-text-muted);
  border: 1px solid color-mix(in srgb, var(--slate-500) 35%, transparent);
}
.portal-badge--info {
  background: color-mix(in srgb, var(--sky-400) 12%, transparent);
  color: var(--sky-300);
  border: 1px solid color-mix(in srgb, var(--sky-400) 35%, transparent);
}
.portal-badge--violet {
  background: color-mix(in srgb, var(--violet-500) 12%, transparent);
  color: var(--violet-400);
  border: 1px solid color-mix(in srgb, var(--violet-500) 35%, transparent);
}

/* Quick switcher (quick-switcher.js) — Ctrl+K overlay palette. Sits above
   every view overlay but below toasts (10200). */
.qs-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}
.qs-header-btn:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.qs-header-btn kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.68rem;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0 0.3rem;
}
.qs-overlay {
  position: fixed;
  inset: 0;
  z-index: 10150;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
/* The display:flex above overrides the UA [hidden] rule, so hiding the
   overlay via the hidden attribute needs an explicit, higher-specificity
   display:none — otherwise qsClose() cannot visually dismiss the palette. */
.qs-overlay[hidden] { display: none; }
.qs-panel {
  width: min(560px, 92vw);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.qs-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--color-surface-sunken);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  outline: none;
}
.qs-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.35rem;
}
.qs-section {
  margin: 0.4rem 0.5rem 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.qs-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}
.qs-item:hover { background: var(--color-surface-raised); }
.qs-item--selected { background: color-mix(in srgb, var(--blue-500) 18%, transparent); }
.qs-item-label {
  color: var(--color-text);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qs-item-sub {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.qs-empty {
  margin: 0.75rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.qs-foot {
  display: flex;
  gap: 1rem;
  padding: 0.45rem 0.8rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-faint);
  font-size: 0.72rem;
}
.qs-foot kbd {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0 0.25rem;
  margin-right: 0.15rem;
}

/* Well Notes "System history" — read-only machine-provenance block above the
   editable Notes textarea (wells.js, polish-4). */
.well-system-history {
  /* The shared .form-grid span rule targets label.full-width only, so this
     div must span explicitly or it auto-places as a grid cell. */
  grid-column: 1 / -1;
}
.well-system-history-details {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface-sunken);
  margin-bottom: 0.5rem;
}
.well-system-history-details > summary {
  cursor: pointer;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  list-style-position: inside;
}
.well-system-history-count {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--color-surface-raised);
  color: var(--color-text-subtle);
  font-size: 0.72rem;
  text-align: center;
}
.well-system-history-tag {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
}
.well-system-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.well-system-history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  border-top: 1px solid var(--color-border);
}
.well-system-history-item-main {
  flex: 1 1 auto;
  min-width: 0;
}
.well-system-history-item-type {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-subtle);
  margin-right: 0.5rem;
}
.well-system-history-item-ts {
  font-size: 0.72rem;
  color: var(--color-text-faint);
}
.well-system-history-item-line {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--color-text-subtle);
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-top: 0.15rem;
}
.well-system-history-copy {
  flex: 0 0 auto;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  font-size: 0.74rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}
.well-system-history-copy:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.well-system-history-hint {
  margin: 0;
  padding: 0.35rem 0.7rem 0.45rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.72rem;
  color: var(--color-text-faint);
}

/* Location Map: employee-facing job geography backed by Azure Maps. */
#location-map {
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  gap: 0.8rem;
}
.location-map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.location-map-header h2,
.location-map-header p {
  margin: 0;
}
.location-map-subtitle,
.location-map-updated,
.location-map-help {
  color: var(--color-text-muted);
}
.location-map-subtitle {
  margin-top: 0.25rem !important;
}
.location-map-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.location-map-style-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.location-map-style-control .form-select {
  min-width: 10.5rem;
}
.location-map-updated {
  font-size: 0.8rem;
  white-space: nowrap;
}
.location-map-view-tabs {
  display: flex;
  gap: 0.35rem;
}
.location-map-view-tab {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  font-size: 0.85rem;
  text-decoration: none;
}
.location-map-view-tab:hover,
.location-map-view-tab.active {
  color: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  background: var(--color-surface-raised);
}
.location-map-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 10rem));
  gap: 0.65rem;
}
.location-map-summary > div {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.location-map-summary span {
  color: var(--color-text);
  font-size: 1.35rem;
  font-weight: 700;
}
.location-map-summary small {
  color: var(--color-text-muted);
}
.location-map-status {
  margin: 0;
}
.location-map-status--error {
  color: var(--color-danger-text);
}
.location-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-sunken);
}
.location-map-canvas {
  min-width: 0;
  height: 100%;
  min-height: 0;
}
.location-map-sidebar {
  min-height: 0;
  padding: 0.85rem;
  overflow-y: auto;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
}
.location-map-sidebar h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}
.location-map-job-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.location-map-job-card {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-raised);
}
.location-map-job-card strong {
  color: var(--white);
}
.location-map-job-card span,
.location-map-job-card small {
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.location-map-job-card-focus {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.location-map-job-card-focus:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}
.location-map-job-card a {
  align-self: flex-start;
  margin-top: 0.25rem;
  font-size: 0.82rem;
}
.location-map-unmapped-panel {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--color-border);
}
.location-map-help {
  margin: -0.25rem 0 0.65rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.location-map-completed-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.location-map-completed-filters[hidden] {
  display: none;
}
.location-map-completed-filters > label,
.location-map-date-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.location-map-completed-filters .location-map-check {
  flex-direction: row;
  align-items: center;
}
.location-map-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.location-map-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.location-map-filter-actions .btn {
  flex: 1 1 auto;
  text-align: center;
}
.location-map-completed-filters .location-map-help {
  margin: 0;
}
.location-map-popup {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 12rem;
  color: var(--slate-900);
}
.location-map-popup span {
  color: var(--slate-600);
}
.location-map-popup-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 18rem;
  overflow-y: auto;
}
.location-map-popup a {
  color: var(--blue-700);
}

@media (max-width: 900px) {
  .location-map-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .location-map-canvas {
    min-height: 24rem;
  }
  .location-map-sidebar {
    max-height: 18rem;
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }
}

@media (max-width: 600px) {
  .location-map-header {
    flex-direction: column;
  }
  .location-map-header-actions {
    flex-wrap: wrap;
  }
  .location-map-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .location-map-summary > div {
    padding: 0.5rem;
  }
}
