﻿:root {
  --bg: #0f1419;
  --surface: #171d25;
  --surface-2: #1f2732;
  --row-odd: #0c1118;
  --row-even: #2a3848;
  --row-hover: color-mix(in srgb, var(--primary) 14%, var(--row-even));
  --row-selected: color-mix(in srgb, var(--primary) 20%, var(--row-even));
  --row-selected-hover: color-mix(in srgb, var(--primary) 26%, var(--row-even));
  --border: #3d4d62;
  --border-row: #324055;
  --text: #f2f6fb;
  --muted: #a8b6c8;
  /* Semantic action / status tokens (Task 18) */
  --primary: #5b9cf5;
  --primary-dim: #4a85d4;
  --primary-glow: rgba(91, 156, 245, 0.35);
  --warning: #e5a020;
  --warning-bg: rgba(229, 160, 32, 0.12);
  --success: #3ecf8e;
  --danger: #ff6b6b;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --btn-height: 38px;
  /* Legacy accent — amber warnings only; primary actions use --primary */
  --accent: var(--warning);
  --accent-dim: #c9841a;
  --accent-glow: rgba(229, 160, 32, 0.3);
  --green: var(--success);
  --red: var(--danger);
  --blue: var(--primary);
  --input-bg: #111922;
  --input-border: #5a7088;
  --focus-border: #6ec4ff;
  --focus-glow: rgba(110, 196, 255, 0.45);
  --focus-glow-outer: rgba(110, 196, 255, 0.2);
  --header-grad-top: #151b22;
  --well-shade: #0a0e14;
  --input-focus-bg: #0d1520;
  --pin-surface: var(--bg);
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

/* Light theme — same variable contract, inverted palette */
body.theme-light {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --row-odd: #ffffff;
  --row-even: #e7edf4;
  --row-hover: color-mix(in srgb, var(--primary) 10%, var(--row-even));
  --row-selected: color-mix(in srgb, var(--primary) 16%, var(--row-even));
  --row-selected-hover: color-mix(in srgb, var(--primary) 22%, var(--row-even));
  --border: #bcc8d6;
  --border-row: #d6dee7;
  --text: #1b2531;
  --muted: #5a6878;
  --primary: #2563c4;
  --primary-dim: #1d4f9e;
  --primary-glow: rgba(37, 99, 196, 0.25);
  --warning: #b97607;
  --warning-bg: rgba(185, 118, 7, 0.1);
  --success: #178f5b;
  --danger: #cc3d3d;
  --accent: var(--warning);
  --accent-dim: #965f06;
  --accent-glow: rgba(185, 118, 7, 0.25);
  --green: var(--success);
  --red: var(--danger);
  --blue: var(--primary);
  --input-bg: #ffffff;
  --input-border: #93a5ba;
  --focus-border: #2f86d8;
  --focus-glow: rgba(47, 134, 216, 0.35);
  --focus-glow-outer: rgba(47, 134, 216, 0.15);
  --header-grad-top: #ffffff;
  --well-shade: #dde5ee;
  --input-focus-bg: #ffffff;
  /* Pinned header bars blend with the white panel instead of cutting gray strips across it */
  --pin-surface: var(--surface);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* App shell — min full viewport height, single page scroll (no nested viewports) */
body.app-shell {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Slim bar when embedded on alphateamus.com */
.site-chrome {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.site-chrome-back {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.site-chrome-back:hover {
  color: var(--blue);
}

.site-chrome-title {
  font-weight: 600;
  color: var(--text);
}

body.app-shell .app-header {
  flex-shrink: 0;
}

body.app-shell .layout {
  flex: 1 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.75rem 0 1.5rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "dropzone"
    "project"
    "runs";
  overflow-x: clip;
}

body.app-shell .plan-drop-zone { grid-area: dropzone; }
body.app-shell .panel-project { grid-area: project; }
body.app-shell .panel-runs { grid-area: runs; min-width: 0; }

body.app-shell .panel-runs.panel-work,
body.app-shell .panel-runs.panel-work .work-view {
  min-width: 0;
  max-width: 100%;
}

body.app-shell .panel {
  padding: 0.75rem 1rem;
}

body.app-shell .panel-runs.panel-work {
  padding: 0.65rem 0.85rem 0.85rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

body.app-shell .panel-runs.panel-work .work-view-runs-head {
  margin-bottom: 0.65rem;
  overflow: visible;
}

/* Horizontal scroll only for wide tables — vertical scroll is the page */
.scroll-region {
  overflow-x: auto;
  overflow-y: visible;
}

.hscroll-host {
  position: relative;
}

body.app-shell .schedule-table-wrap,
body.app-shell .stock-table-wrap,
body.app-shell .table-wrap:not(.runs-table-wrap),
body.app-shell .sheet-wrap,
body.app-shell .hscroll-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

body.app-shell .panel-runs.panel-work,
body.app-shell .panel-runs.panel-work .work-view {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

body.runs-pin-actions-active.app-shell .panel-runs.panel-work,
body.runs-pin-actions-active.app-shell .panel-runs.panel-work .work-view {
  overflow-x: visible;
}

/* Runs: horizontal scroll on host; visible bar is .runs-table-hscroll below */
body.app-shell .runs-scroll-host {
  overflow-x: auto;
  overflow-y: visible;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

body.app-shell .runs-scroll-host::-webkit-scrollbar {
  display: none;
  height: 0;
}

body.app-shell .runs-table-hscroll {
  display: none;
  overflow-x: scroll;
  overflow-y: hidden;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 16px;
  margin-top: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: var(--primary) color-mix(in srgb, var(--surface-2) 55%, var(--well-shade));
}

body.app-shell .runs-table-hscroll.is-active {
  display: block;
}

body.app-shell .runs-table-hscroll-inner {
  height: 1px;
  pointer-events: none;
}

body.app-shell .runs-table-hscroll::-webkit-scrollbar {
  height: 16px;
}

body.app-shell .runs-table-hscroll::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  border-top: 1px solid var(--border);
}

body.app-shell .runs-table-hscroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 78%, #fff);
  border-radius: 8px;
  border: 3px solid color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  min-width: 48px;
}

body.app-shell .runs-table-hscroll::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

body.app-shell .runs-table-wrap {
  overflow: visible;
}

/* Wide tables — horizontal scroll + fixed mirror bar at viewport bottom */
body.app-shell .runs-scroll-host,
body.app-shell .hscroll-host {
  position: relative;
}

body.app-shell .schedule-table-wrap,
body.app-shell .stock-table-wrap,
body.app-shell .cost-table-wrap.hscroll-wrap,
body.app-shell .po-sections-scroll.hscroll-wrap {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: var(--primary) color-mix(in srgb, var(--surface-2) 55%, var(--well-shade));
  padding-bottom: 2px;
}

body.app-shell .schedule-table-wrap::-webkit-scrollbar,
body.app-shell .stock-table-wrap::-webkit-scrollbar,
body.app-shell .cost-table-wrap.hscroll-wrap::-webkit-scrollbar,
body.app-shell .po-sections-scroll.hscroll-wrap::-webkit-scrollbar {
  height: 14px;
}

body.app-shell .schedule-table-wrap::-webkit-scrollbar-track,
body.app-shell .stock-table-wrap::-webkit-scrollbar-track,
body.app-shell .cost-table-wrap.hscroll-wrap::-webkit-scrollbar-track,
body.app-shell .po-sections-scroll.hscroll-wrap::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  border-top: 1px solid var(--border);
}

body.app-shell .schedule-table-wrap::-webkit-scrollbar-thumb,
body.app-shell .stock-table-wrap::-webkit-scrollbar-thumb,
body.app-shell .cost-table-wrap.hscroll-wrap::-webkit-scrollbar-thumb,
body.app-shell .po-sections-scroll.hscroll-wrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 78%, #fff);
  border-radius: 8px;
  border: 3px solid color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  min-width: 48px;
}

.hscroll-stick {
  position: fixed;
  bottom: 0;
  left: 0;
  overflow-x: auto;
  overflow-y: hidden;
  height: 18px;
  z-index: 100;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--well-shade));
  border-top: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  scrollbar-width: auto;
  scrollbar-color: var(--primary) color-mix(in srgb, var(--surface-2) 55%, var(--well-shade));
}

.hscroll-stick::-webkit-scrollbar {
  height: 16px;
}

.hscroll-stick::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
}

.hscroll-stick::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 78%, #fff);
  border-radius: 8px;
  border: 3px solid color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  min-width: 48px;
}

.hscroll-stick::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.hscroll-stick.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hscroll-stick-inner {
  height: 1px;
  pointer-events: none;
}

body.app-shell.hscroll-active {
  scroll-padding-bottom: 20px;
}

@media (min-width: 1100px) {
  body.app-shell .layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "dropzone dropzone"
      "project project"
      "runs runs"
      "stock pricing"
      "results results";
  }
}

@media (max-height: 740px) {
  body.app-shell .app-header {
    padding: 0.75rem 1rem;
  }

  body.app-shell h1 {
    font-size: 1.35rem;
  }

  body.app-shell .subtitle {
    font-size: 0.82rem;
    line-height: 1.35;
  }
}

@media (max-width: 768px) {
  body.app-shell .layout {
    padding: 0.65rem 0 1rem;
  }

  body.app-shell .app-header {
    flex-wrap: wrap;
    padding: 1rem 1rem 0.85rem;
  }

  body.app-shell .header-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  body.app-shell h1 {
    font-size: 1.4rem;
  }
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--header-grad-top), var(--bg));
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.layout {
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.25rem 2rem 3rem;
  display: grid;
  gap: 1rem;
}

/* When not using app-shell (e.g. print), layout stays document flow */
body:not(.app-shell) .layout {
  max-width: 1680px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.results-panel {
  padding: 0.75rem 1rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.column-custom-control {
  position: relative;
  overflow: visible;
}

.column-custom-toggle-group {
  display: inline-flex;
  align-items: stretch;
}

.column-custom-toggle {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
}

/* Only join Custom + arrow into a segmented control while the arrow is usable */
.column-custom-toggle-group:has(.column-custom-dropdown:not(:disabled)) .column-custom-toggle {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.column-custom-toggle.active {
  background: var(--primary);
  border-color: var(--accent);
  color: #fff;
}

.column-custom-dropdown {
  min-width: 2rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.78rem;
  line-height: 1;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Hidden until Custom is active — a disabled stub just looks like a clipped button */
.column-custom-dropdown:disabled {
  display: none;
}

.column-custom-dropdown:not(:disabled):hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}

.column-picker-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 40;
  min-width: min(22rem, 92vw);
  max-width: min(28rem, 96vw);
  max-height: min(70vh, 28rem);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.column-picker-menu.column-picker-menu-fixed {
  position: fixed;
  right: auto;
  z-index: 120;
}

.column-picker-hint {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.column-picker-section-note {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.column-picker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.column-picker-table th,
.column-picker-table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  text-align: left;
  vertical-align: middle;
}

.column-picker-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.column-picker-show-col {
  width: 3.2rem;
  text-align: center !important;
}

.column-picker-toggle {
  text-align: center;
}

.column-picker-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.column-picker-name {
  font-weight: 500;
}

.column-picker-row-auto .column-picker-name {
  color: var(--muted);
}

.column-picker-auto-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--text);
}

.column-picker-row-locked {
  opacity: 0.55;
}

.column-picker-row-locked input {
  cursor: default;
}

.runs-col-head-has-hide {
  position: relative;
}

.runs-col-hide-btn {
  position: absolute;
  top: 0.12rem;
  right: 0.1rem;
  z-index: 2;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.15rem;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.runs-col-hide-btn:hover {
  color: var(--text);
  border-color: var(--input-border);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

th.col-hidden .runs-col-hide-btn {
  display: none;
}

.column-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--text);
}

.nec-ref-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nec-ref-link:hover,
.nec-ref-link:focus-visible {
  color: var(--text);
  outline: none;
  text-decoration-thickness: 2px;
}

body.nec-modal-open {
  overflow: hidden;
}

.nec-ref-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.nec-ref-modal[hidden] {
  display: none !important;
}

.nec-ref-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(2px);
}

.nec-ref-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

/* Welcome-home poster — flashes when switching from meters back to feet */
.flag-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.flag-overlay svg,
.flag-overlay-poster {
  width: min(50vw, 280px);
  height: auto;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  animation: flag-wave 1.5s ease-in-out both;
  object-fit: contain;
}

@keyframes flag-wave {
  0% { opacity: 0; transform: scale(0.6); }
  12% { opacity: 1; transform: scale(1.04); }
  20% { transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes flag-fade {
  0% { opacity: 0; }
  12%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flag-overlay svg,
  .flag-overlay-poster { animation: flag-fade 1.5s ease-in-out both; }
}

.nec-ref-modal-panel--wide {
  width: min(960px, 100%);
  max-height: min(90vh, 960px);
}

.nec-ref-modal-panel--paper {
  width: min(920px, 100%);
  max-height: min(90vh, 960px);
}

.nec-ref-modal-panel--paper .nec-ref-modal-body {
  padding: 0.65rem 0.85rem 1rem;
  background: #1a1814;
}

.nec-ref-source {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.nec-ref-source-label {
  font-weight: 600;
  color: var(--accent);
}

.nec-ref-source-note {
  color: var(--muted);
  font-style: italic;
}

.nec-ref-table-caption {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.nec-ref-table-scroll {
  overflow-x: auto;
  margin-top: 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.nec-ref-table-scroll .nec-ref-table {
  margin-top: 0;
}

.nec-ref-table-scroll .nec-ref-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.nec-ref-table--310 {
  font-size: 0.78rem;
}

.nec-ref-table--310 th,
.nec-ref-table--310 td {
  padding: 0.28rem 0.4rem;
  white-space: nowrap;
}

.nec-ref-th-sub {
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
}

.nec-ref-lead {
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.nec-ref-quote {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
  border-radius: 0 6px 6px 0;
}

.nec-ref-quote p {
  margin: 0;
}

.nec-ref-quote + .nec-ref-note {
  margin-top: 0.65rem;
}

.nec-ref-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.nec-ref-modal-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent);
}

.nec-ref-modal-section {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.nec-ref-modal-close {
  flex-shrink: 0;
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
}

.nec-ref-modal-body {
  overflow: auto;
  padding: 0.85rem 1.1rem 1.1rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Scanned NEC pages — printed-paper look in modal */
.nec-ref-paper {
  margin: 0;
}

.nec-ref-paper-sheet {
  position: relative;
  padding: 0.85rem 0.95rem 1rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%),
    #f3ecdf;
  border: 1px solid #c9bfb0;
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 14px 28px rgba(0, 0, 0, 0.38),
    0 2px 6px rgba(0, 0, 0, 0.22);
  transform: rotate(-0.35deg);
}

.nec-ref-paper-sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.012) 3px,
    rgba(0, 0, 0, 0.012) 4px
  );
  border-radius: inherit;
}

.nec-ref-paper-sheet img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
  filter: contrast(1.04) saturate(0.92) sepia(0.12);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.nec-ref-paper-sheet--stacked {
  margin-top: 0.85rem;
  transform: rotate(0.25deg);
}

.nec-ref-paper-sheet--stacked::after {
  content: '';
  position: absolute;
  top: -0.35rem;
  left: 0.65rem;
  right: 0.65rem;
  height: 0.35rem;
  background: #e8dfd0;
  border: 1px solid #c9bfb0;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.08);
  z-index: 0;
}

.nec-ref-paper-caption {
  margin: 0.55rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #b8aea0;
  font-style: italic;
  text-align: center;
}

.nec-ref-paper-supplement {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--surface) 88%, #f3ecdf);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.84rem;
}

.nec-ref-paper-supplement .nec-ref-note {
  margin: 0;
}

.nec-ref-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* "In plain terms" footer of the NEC reference modal */
.nec-plain {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.nec-plain-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.nec-plain-text {
  margin: 0 0 0.6rem;
  line-height: 1.55;
}

.nec-plain-example {
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.8rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
  border-radius: 0 6px 6px 0;
}

.nec-plain-example-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.nec-plain-example p {
  margin: 0;
  line-height: 1.5;
}

.nec-math {
  margin-top: 0.35rem;
}

.nec-math summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  user-select: none;
}

.nec-math summary:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nec-math[open] summary {
  margin-bottom: 0.25rem;
}

.nec-math-steps {
  margin: 0;
  padding: 0.25rem 0 0.25rem 1.35rem;
}

.nec-math-steps li {
  margin-bottom: 0.45rem;
  line-height: 1.5;
}

.nec-math-steps li:last-child {
  margin-bottom: 0;
}

.nec-ref-subhead {
  margin: 1.25rem 0 0.35rem;
  font-size: 0.92rem;
  color: var(--text);
}

.nec-ref-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.nec-ref-list li {
  margin-bottom: 0.35rem;
}

.nec-ref-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.nec-ref-table th,
.nec-ref-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.nec-ref-table th {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  color: var(--text);
  font-weight: 600;
}

.nec-ref-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.nec-ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.nec-ref-chip {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.nec-footnote .nec-ref-link {
  font-size: inherit;
}

.schedule-review-note .nec-ref-link {
  font-size: inherit;
}

.column-picker-list {
  display: block;
}

.column-picker-list label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

.column-picker-list label.is-locked {
  opacity: 0.55;
  cursor: default;
}

.column-picker-list input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.column-view-presets {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.column-view-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.15rem;
}

.column-view-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
}

.column-view-btn.active {
  background: var(--primary);
  border-color: var(--accent);
  color: #0f1419;
  font-weight: 600;
}

/* Feeder column presets — secondary to main work-area navigation tabs */
.panel-work .runs-view-controls .column-view-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.panel-work .runs-view-controls .column-view-btn,
.panel-work .runs-view-controls .column-custom-toggle,
.panel-work .runs-view-controls .column-custom-dropdown {
  padding: 0.18rem 0.42rem;
  font-size: 0.7rem;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
  border-color: color-mix(in srgb, var(--border) 75%, transparent);
}

.panel-work .runs-view-controls .column-view-btn:hover,
.panel-work .runs-view-controls .column-custom-toggle:hover,
.panel-work .runs-view-controls .column-custom-dropdown:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--input-border);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.panel-work .runs-view-controls .column-view-btn.active,
.panel-work .runs-view-controls .column-custom-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent) 12%);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--text);
  font-weight: 600;
  box-shadow: none;
}

.runs-hint {
  margin-bottom: 0.5rem;
}

.runs-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
}

.runs-table-toolbar-primary,
.runs-table-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.runs-table-toolbar-secondary {
  margin-left: auto;
}

.btn-add-run {
  padding: 0.45rem 1.05rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.runs-view-controls {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .runs-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .runs-table-toolbar-primary,
  .runs-table-toolbar-secondary {
    width: 100%;
  }

  .runs-table-toolbar-secondary {
    margin-left: 0;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
  }

  .btn-add-run {
    width: 100%;
  }
}

.runs-guide {
  margin: 0.35rem 0 0.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.84rem;
  line-height: 1.45;
}

.runs-guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.runs-guide[open] summary {
  margin-bottom: 0.45rem;
  color: var(--text);
}

.runs-guide-body p {
  margin: 0 0 0.5rem;
}

.runs-guide-body p:last-child {
  margin-bottom: 0;
}

[data-col].col-hidden {
  display: none !important;
}

/* "# of Conduits" on the panel schedule is a print-only column */
#scheduleTable [data-col="schedConduits"] {
  display: none;
}

.runs-table-wrap input.copper-ground-check,
.runs-table-wrap input[data-field="continuousLoad"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.runs-table-wrap th[data-col="continuous"],
.runs-table-wrap td[data-col="continuous"] {
  text-align: center;
  vertical-align: middle;
}

.runs-table-wrap td[data-col="continuous"] {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.runs-table-wrap td[data-col="continuous"] input[data-field="continuousLoad"] {
  display: block;
  margin-inline: auto;
}

.runs-col-head-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  line-height: 1.25;
  max-width: 100%;
}

.runs-col-head-main,
.runs-col-head-sub {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  white-space: nowrap;
}

/* Feeder runs — centered body cells without clipping controls */
.runs-table-wrap th[data-col="vd"],
.runs-table-wrap th[data-col="wire"],
.runs-table-wrap th[data-col="parallel"],
.runs-table-wrap th[data-col="hot"],
.runs-table-wrap th[data-col="neutralFlag"],
.runs-table-wrap th[data-col="downsize"],
.runs-table-wrap th[data-col="cuGround"],
.runs-table-wrap th[data-col="sdsSecondary"],
.runs-table-wrap th[data-col="inRoomPanel"],
.runs-table-wrap th[data-col="conduitType"],
.runs-table-wrap th[data-col="conduitCount"],
.runs-table-wrap th[data-col="parPerRaceway"],
.runs-table-wrap th[data-col="conduitSize"],
.runs-table-wrap th[data-col="derate"],
.runs-table-wrap th[data-col="continuous"],
.runs-table-wrap td[data-col="vd"],
.runs-table-wrap td[data-col="wire"],
.runs-table-wrap td[data-col="parallel"],
.runs-table-wrap td[data-col="hot"],
.runs-table-wrap td[data-col="neutralFlag"],
.runs-table-wrap td[data-col="downsize"],
.runs-table-wrap td[data-col="cuGround"],
.runs-table-wrap td[data-col="sdsSecondary"],
.runs-table-wrap td[data-col="inRoomPanel"],
.runs-table-wrap td[data-col="conduitType"],
.runs-table-wrap td[data-col="conduitCount"],
.runs-table-wrap td[data-col="parPerRaceway"],
.runs-table-wrap td[data-col="conduitSize"],
.runs-table-wrap td[data-col="derate"],
.runs-table-wrap td[data-col="continuous"] {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  text-align: center;
  vertical-align: middle;
}

.runs-table-wrap td[data-col="vd"].vd-cell {
  font-size: 0.84rem;
}

.panel-cell {
  display: block;
  vertical-align: top;
}

.run-name-stack {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 10.5rem;
  padding-left: 0.4rem;
  border-left: 3px solid transparent;
}

.run-name-stack-ok { border-left-color: color-mix(in srgb, #3dd68c 55%, transparent); }
.run-name-stack-warn { border-left-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.run-name-stack-fix { border-left-color: color-mix(in srgb, #f87171 75%, transparent); }
.run-name-stack-error { border-left-color: color-mix(in srgb, #f87171 75%, transparent); }
.run-name-stack-limit { border-left-color: color-mix(in srgb, #f87171 75%, transparent); }
.run-name-stack-enter { border-left-color: color-mix(in srgb, #f87171 65%, transparent); }
.run-name-stack-draft { border-left-color: color-mix(in srgb, var(--muted) 45%, transparent); }

.run-name-primary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.run-name-primary input[data-field="panel"] {
  flex: 1 1 auto;
  min-width: 0;
}

.run-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.run-status-ok {
  color: #052e1a;
  background: color-mix(in srgb, #3dd68c 82%, #fff);
  border: 1px solid color-mix(in srgb, #3dd68c 55%, transparent);
}

.run-status-warn {
  color: #2a2008;
  background: color-mix(in srgb, var(--accent) 88%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.run-status-error,
.run-status-fix {
  color: #3f0a0a;
  background: color-mix(in srgb, #f87171 82%, #fff);
  border: 1px solid color-mix(in srgb, #f87171 55%, transparent);
}

.run-status-limit {
  color: #3f0a0a;
  background: color-mix(in srgb, #f87171 82%, #fff);
  border: 1px solid color-mix(in srgb, #f87171 55%, transparent);
}

.run-status-btn {
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 3.35rem;
  min-width: 3.35rem;
  padding-left: 0;
  padding-right: 0;
}

.run-status-btn:hover,
.run-status-btn:focus-visible {
  filter: brightness(1.08);
  outline: 2px solid color-mix(in srgb, var(--focus-border) 65%, transparent);
  outline-offset: 1px;
}

.run-status-enter {
  color: #3f0a0a;
  background: color-mix(in srgb, #fca5a5 78%, #fff);
  border: 1px solid color-mix(in srgb, #f87171 45%, transparent);
}

.run-status-draft {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 18%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
}

.run-scan-summary {
  font-size: 0.72rem;
  line-height: 1.35;
  color: color-mix(in srgb, var(--muted) 82%, var(--text));
  font-variant-numeric: tabular-nums;
  padding-left: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.run-status-note-row td {
  padding: 0.45rem 0.75rem 0.55rem;
  border-bottom: 1px solid var(--border-row);
  vertical-align: top;
}

.run-status-note {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.run-status-note-line + .run-status-note-line {
  margin-top: 0.35rem;
}

.run-status-note-row.run-status-note-warn td {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border-left: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
}

.run-status-note-row.run-status-note-limit td {
  background: color-mix(in srgb, #f87171 10%, var(--surface-2));
  border-left: 3px solid color-mix(in srgb, #f87171 70%, transparent);
}

#runsTable tbody tr.run-status-note-open td[data-col="panel"] {
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border-row) 80%, transparent);
}

.nec-asterisk,
.nec-dagger {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

button.nec-flag-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0 0 0 0.2rem;
  cursor: pointer;
  font: inherit;
  vertical-align: super;
}

button.nec-flag-btn:hover,
button.nec-flag-btn:focus-visible {
  text-decoration: underline;
  outline: none;
}

.nec-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.runs-table-wrap select.wire-type-select { min-width: 6.25rem; max-width: none; }
.runs-table-wrap select.material-select { min-width: 3.75rem; max-width: none; }
.runs-table-wrap select.derate-select { min-width: 6.75rem; max-width: none; font-size: 0.84rem; }
.runs-table-wrap th[data-col="derate"],
.runs-table-wrap td[data-col="derate"] {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  text-align: center;
  vertical-align: middle;
}

.runs-table-wrap select.conduit-type-select { min-width: 6.5rem; max-width: none; }
.runs-table-wrap select[data-field="phases"] { min-width: 5rem; max-width: none; }
.runs-table-wrap select[data-field="voltage"] { min-width: 5.25rem; max-width: none; }
.runs-table-wrap select[data-field="phaseSize"],
.runs-table-wrap select[data-field="neutralSize"],
.runs-table-wrap select[data-field="groundSize"] { min-width: 6.75rem; max-width: none; }
.runs-table-wrap select[data-field="conduitSize"] { min-width: 8.5rem; max-width: none; }
.runs-table-wrap select[data-field="conduitCount"],
.runs-table-wrap select[data-field="parallelsPerRaceway"] { min-width: 5rem; max-width: none; }
.runs-table-wrap select { min-width: 4rem; max-width: none; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.checkbox-row input { width: auto; margin: 0; accent-color: var(--primary); }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.panel .grid-2 input,
.panel .grid-3 input {
  min-width: 0;
  width: 100%;
}

input[type="text"],
input[type="number"],
select {
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--focus-border);
  background: var(--input-focus-bg, #0d1520);
  box-shadow:
    0 0 0 2px var(--focus-glow),
    0 0 0 4px var(--focus-glow-outer);
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  margin-top: 0.35rem;
}

.btn {
  border: none;
  border-radius: var(--radius);
  min-height: var(--btn-height);
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #111;
  font-weight: 600;
}

.btn-primary:hover { background: var(--primary-dim); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  min-height: var(--btn-height);
  border-radius: var(--radius);
}

.btn-secondary:hover { border-color: var(--muted); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
}

.btn-warning {
  background: var(--warning);
  color: #111;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-warning:hover {
  filter: brightness(1.05);
}

.btn-danger.btn,
.header-menu-item.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-weight: 600;
  padding: 0.45rem 0.85rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.header-stock-btn {
  font-weight: 600;
}

.header-overflow-wrap {
  position: relative;
}

.header-overflow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-inline: 0.65rem;
}

.header-overflow-btn-label {
  font-size: 0.85rem;
}

.header-overflow-panel {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 0.4rem);
  z-index: 200;
  width: min(92vw, 320px);
  max-height: min(78vh, 640px);
  overflow-y: auto;
  padding: 0.55rem 0.65rem 0.75rem;
  display: grid;
  gap: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.header-overflow-panel[hidden] {
  display: none;
}

.header-overflow-label {
  margin: 0.35rem 0.45rem 0.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-overflow-section {
  display: grid;
  gap: 0.15rem;
}

.header-overflow-section.settings-menu {
  position: static;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  box-shadow: none;
  border: none;
  background: transparent;
}

.header-overflow-tools {
  gap: 0.25rem;
}

.header-overflow-tools .v2-toggle-btn,
.header-overflow-tools .header-menu-link {
  width: 100%;
}

.sr-only-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.plan-browse-label {
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}

.plan-browse-label.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.header-legacy-menu-trigger {
  display: none !important;
}

.settings-menu-wrap {
  position: relative;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.settings-gear-icon {
  flex-shrink: 0;
}

.settings-menu[hidden] {
  display: none;
}

.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 120;
  min-width: 230px;
  padding: 0.7rem 0.8rem;
  display: grid;
  gap: 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.settings-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.settings-menu-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.settings-menu select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  font: inherit;
  font-size: 0.85rem;
}

.account-menu-wrap {
  position: relative;
}

.account-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 11rem;
}

.account-menu-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.account-menu[hidden] {
  display: none;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 120;
  min-width: 240px;
  padding: 0.35rem 0;
}

.account-menu-user {
  padding: 0.65rem 0.85rem 0.5rem;
}

.account-menu-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-menu-name {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.account-menu-email {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  word-break: break-all;
}

.theme-toggle {
  display: inline-flex;
  gap: 0;
}

.theme-toggle .theme-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.theme-toggle .theme-btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.theme-toggle .theme-btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}

.theme-toggle .theme-btn.active {
  background: var(--primary);
  border-color: var(--accent);
  color: #14181d;
  font-weight: 700;
}

/* Import project from plans — drop zone + review modal */
.plan-drop-zone[hidden] {
  display: none;
}

.plan-drop-zone {
  border: 2px dashed color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  text-align: center;
  padding: 1.6rem 1.25rem 1.5rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

body.plan-drag-active::after {
  content: 'Drop plans here to import';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: rgba(37, 99, 235, 0.12);
  border: 3px dashed rgba(37, 99, 235, 0.55);
}

.plan-drop-zone.plan-drop-over {
  border-color: var(--primary);
  border-style: solid;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
}

.plan-drop-zone.plan-drop-busy {
  border-style: solid;
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.plan-import-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(12, 16, 22, 0.55);
  backdrop-filter: blur(2px);
}

.plan-import-overlay[hidden] {
  display: none !important;
}

.plan-import-overlay-panel {
  min-width: min(22rem, 92vw);
  max-width: 34rem;
  padding: 1.35rem 1.4rem 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  text-align: center;
}

.plan-import-overlay-spinner {
  width: 72px;
  height: 72px;
}

.plan-import-overlay-status {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

body.plan-import-overlay-open {
  overflow: hidden;
}

/* Modals sit at z-index 1200; never let the import spinner overlay block them. */
body.nec-modal-open .plan-import-overlay {
  display: none !important;
}

.plan-drop-inner {
  max-width: 620px;
  margin: 0 auto;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  pointer-events: none; /* drag events land on the zone itself */
  cursor: pointer;
}

.plan-drop-inner .plan-drop-actions,
.plan-drop-inner .plan-drop-preview,
.plan-drop-inner .plan-drop-go-actions,
.plan-drop-inner .plan-drop-actions button,
.plan-drop-inner button {
  pointer-events: auto;
}

.plan-drop-icon {
  color: var(--accent);
}

.plan-drop-title {
  margin: 0;
  font-size: 1.1rem;
}

.plan-drop-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.plan-drop-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  margin-top: 0.4rem;
}

.plan-drop-or {
  font-size: 0.8rem;
  color: var(--muted);
}

.plan-drop-status {
  margin: 0.35rem 0 0;
  font-weight: 600;
  color: var(--accent);
}

.plan-drop-status[hidden] {
  display: none;
}

/* Lightning ring — bolts orbit and strike in sequence around the circle */
.bolt-spinner {
  position: relative;
  width: 52px;
  height: 52px;
}

.bolt-spinner-orbit {
  position: absolute;
  inset: 0;
  animation: bolt-orbit-spin 1.35s linear infinite;
}

.bolt-spinner .bolt {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transform: rotate(calc(var(--i) * 45deg));
  color: var(--accent);
  opacity: 0.14;
  animation: bolt-strike-orbit 1.35s ease-out infinite;
  animation-delay: calc(var(--i) * -0.16875s);
}

.bolt-spinner .bolt svg {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 0 3px var(--accent-glow));
  transform-origin: center 36px;
}

@keyframes bolt-orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes bolt-strike-orbit {
  0%, 78%, 100% {
    opacity: 0.12;
    filter: brightness(0.75);
  }
  6% {
    opacity: 1;
    filter: brightness(2.4) drop-shadow(0 0 10px var(--accent)) drop-shadow(0 0 18px var(--accent-glow));
  }
  12% {
    opacity: 0.35;
    filter: brightness(1.2) drop-shadow(0 0 4px var(--accent-glow));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bolt-spinner-orbit { animation: none; }
  .bolt-spinner .bolt {
    animation: none;
    opacity: 0.65;
  }
}

/* Dropped-file preview inside the drop zone */
.plan-drop-preview[hidden] {
  display: none;
}

.plan-drop-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.7rem;
  margin-top: 0.55rem;
  max-width: 100%;
}

.plan-drop-single {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
}

.plan-drop-thumb {
  max-width: min(340px, 100%);
  max-height: 190px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.plan-drop-file {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  width: 104px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.plan-drop-file svg,
.plan-drop-single > svg {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.plan-file-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-drop-go-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0.35rem;
  pointer-events: auto;
}

.plan-drop-go-actions[hidden] {
  display: none;
}

.plan-drop-staged-file {
  position: relative;
  padding-bottom: 0.15rem;
}

.plan-drop-staged-remove {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.35rem;
  height: 1.35rem;
  min-width: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
}

.import-project-btn[hidden] {
  display: none;
}

#saveProjectBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.plan-import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.plan-import-table th,
.plan-import-table td {
  padding: 0.3rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid var(--border-row);
  white-space: nowrap;
}

.plan-import-table input[type="text"] {
  min-width: 9rem;
  width: 100%;
}

.plan-import-table input[type="number"] {
  width: 5rem;
}

.plan-import-job-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.plan-import-job-fields label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.plan-import-junk {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.plan-import-debug-dialog {
  max-width: min(720px, calc(100vw - 2rem));
}

.plan-import-debug-body {
  max-height: min(60vh, 520px);
  overflow: auto;
  font-size: 0.875rem;
}

.plan-import-debug-body h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.9rem;
}

.plan-import-debug-body ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.plan-import-junk summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
}

.plan-import-junk-lead {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.78rem;
}

.plan-import-junk-editor {
  display: block;
  width: 100%;
  min-height: 6.5rem;
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-row);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
}

.plan-import-junk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.plan-import-retry {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.plan-import-retry summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
}

.plan-import-retry-lead {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.78rem;
}

.plan-import-retry-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
}

.plan-import-retry-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.plan-import-retry-fields select,
.plan-import-retry-fields input {
  font-weight: 400;
}

.plan-import-retry-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0;
  font-size: 0.78rem;
}

.plan-import-retry-btn {
  margin-top: 0.45rem;
}

/* Plan import review — full-viewport modal */
#planImportModal {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.plan-import-panel {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

.plan-import-panel > .plan-import-body,
#planImportModalBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#planImportModalBody tr[data-plan-row] {
  cursor: default;
}

.plan-import-panel.plan-import-busy {
  opacity: 0.92;
}

.plan-import-panel.plan-import-busy #planImportModalBody,
.plan-import-panel.plan-import-busy .plan-import-junk,
.plan-import-panel.plan-import-busy .plan-import-retry {
  pointer-events: none;
}

.plan-import-junk-add {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.plan-import-junk-input {
  flex: 1;
  min-width: 0;
  max-width: 14rem;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-row);
  border-radius: 6px;
}

.plan-row-junk-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, #c0392b 14%, var(--surface));
  color: #a93226;
  vertical-align: middle;
}

tr.plan-row-junk td {
  background: color-mix(in srgb, #c0392b 5%, var(--surface));
}

.plan-import-warn {
  margin: 0.5rem 0 0;
  color: var(--red);
  font-size: 0.82rem;
}

.plan-import-note {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 0.82rem;
  color: var(--text);
}

.plan-import-questions-inline {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.02);
}

.plan-import-questions-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
}

.plan-import-q {
  margin-bottom: 0.55rem;
}

.plan-import-q-text {
  margin: 0 0 0.25rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.plan-import-q .plan-import-answer,
.plan-import-q .plan-import-answer-custom {
  width: 100%;
  max-width: 28rem;
  font-size: 0.85rem;
}

.plan-import-refine-btn {
  margin-top: 0.35rem;
}

.plan-row-uncertain {
  background: var(--warning-bg);
}

tr.plan-row-in-room td {
  background: color-mix(in srgb, var(--warning) 9%, var(--surface));
}

tr.plan-row-in-room td:first-child {
  box-shadow: inset 3px 0 0 var(--warning);
}

tr.plan-row-in-room.plan-row-uncertain td {
  background: color-mix(in srgb, var(--warning) 7%, var(--warning-bg));
}

.plan-import-in-room-note {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--border));
  background: color-mix(in srgb, var(--warning) 6%, var(--surface));
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.plan-import-table th:nth-child(8),
.plan-import-table th:nth-child(9),
.plan-import-table td:nth-child(8),
.plan-import-table td:nth-child(9) {
  text-align: center;
  width: 3.1rem;
}

.plan-row-length-cell {
  min-width: 6.5rem;
  vertical-align: top;
}

.plan-row-length-cell .plan-row-length {
  width: 100%;
  min-width: 4.5rem;
}

tr.plan-row-missing-length .plan-row-length-cell .plan-row-length {
  border-color: rgba(234, 179, 8, 0.65);
  background: rgba(234, 179, 8, 0.08);
}

.plan-row-length-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr.plan-row-missing-length td {
  background: color-mix(in srgb, rgba(234, 179, 8, 0.14) 55%, transparent);
}

.plan-row-voltage-cell {
  min-width: 7.5rem;
  vertical-align: top;
}

.plan-row-voltage-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.plan-row-voltage-picker .plan-row-voltage-select {
  flex: 1 1 5rem;
  min-width: 4.5rem;
}

.plan-row-voltage-picker .plan-row-voltage-custom {
  flex: 1 1 3.5rem;
  min-width: 3rem;
  max-width: 4.5rem;
}

.plan-row-voltage-picker .plan-row-voltage-other-btn {
  flex: 0 0 auto;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
}

tr.plan-row-missing-voltage .plan-row-voltage-picker .plan-row-voltage-select,
tr.plan-row-missing-voltage .plan-row-voltage-picker .plan-row-voltage-custom {
  border-color: rgba(234, 179, 8, 0.65);
  background: rgba(234, 179, 8, 0.08);
}

.plan-row-voltage-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr.plan-row-missing-voltage td {
  background: color-mix(in srgb, rgba(234, 179, 8, 0.14) 55%, transparent);
}

.run-voltage-defaulted {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
  color: #92400e;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.45);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  cursor: help;
}

.run-manual-override {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
  color: color-mix(in srgb, var(--warning) 85%, #000);
  background: var(--warning-bg);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  cursor: help;
  white-space: nowrap;
}

td.run-voltage-defaulted-cell select[data-field="voltage"] {
  border-color: rgba(234, 179, 8, 0.55);
  background: rgba(234, 179, 8, 0.06);
}

.plan-row-name-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 11rem;
}

.plan-row-name-cell .plan-row-name {
  flex: 1;
  min-width: 0;
}

.plan-row-flag,
.plan-row-flag.inline {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  background: var(--warning-bg);
  color: color-mix(in srgb, var(--warning) 85%, #000);
}

.plan-row-flag-medium {
  background: rgba(59, 130, 246, 0.18);
  color: #1e40af;
}

.plan-import-section {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.55rem 0.65rem 0.65rem;
  background: rgba(0, 0, 0, 0.02);
}

.plan-import-section-heading {
  margin-bottom: 0.45rem;
}

.plan-import-section-title {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
}

.plan-import-section-lead {
  margin: 0;
  font-size: 0.8rem;
}

.plan-import-section-empty {
  margin: 0;
  font-size: 0.82rem;
}

.plan-import-section-primary {
  border-color: color-mix(in srgb, var(--success, #16a34a) 35%, var(--border));
  background: color-mix(in srgb, var(--success, #16a34a) 4%, var(--surface));
}

.plan-import-section-primary .plan-import-section-title {
  color: #166534;
}

.plan-import-section-review {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: color-mix(in srgb, var(--warning) 5%, var(--surface));
}

.plan-import-section-review .plan-import-section-title {
  color: #92400e;
}

.plan-import-section summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.25rem 0.15rem;
  user-select: none;
}

.plan-import-section-medium summary {
  color: #1e40af;
}

.plan-import-section-low summary {
  color: #92400e;
}

.plan-import-section .plan-import-table {
  margin-top: 0.45rem;
}

.plan-import-review-board {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.plan-import-review-group {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 0.55rem 0.65rem 0.75rem;
  background: rgba(248, 250, 252, 0.65);
}

.plan-import-review-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
}

.plan-import-review-group-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
  min-width: 0;
}

.plan-import-search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.9);
}

.plan-import-search-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.plan-import-search-input {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 28rem;
  font-size: 0.88rem;
  padding: 0.35rem 0.55rem;
}

.plan-import-search-count {
  margin: 0;
  font-size: 0.78rem;
}

.plan-import-search-hidden {
  display: none;
}

.plan-import-search-empty {
  display: none;
}

.runs-floor-header-cell,
.v2-floor-header-cell {
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0f172a;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent) 12%);
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.runs-floor-header:first-child .runs-floor-header-cell {
  border-top: none;
}

.v2-floor-header .v2-floor-header-cell {
  position: sticky;
  top: 0;
  z-index: 2;
}

.plan-import-group-drop-target {
  outline: 2px dashed #2563eb;
  outline-offset: 2px;
  background: rgba(37, 99, 235, 0.06);
}

.plan-import-drag-col,
.plan-import-drag-handle {
  width: 1.5rem;
  text-align: center;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
}

.plan-import-row-dragging {
  opacity: 0.55;
}

.plan-import-move-cell {
  min-width: 9rem;
}

.plan-import-move-group {
  display: block;
}

.plan-import-move-select {
  width: 100%;
  max-width: 11rem;
  font-size: 0.78rem;
}

.plan-import-rejected {
  margin-top: 0.75rem;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.plan-import-rejected summary {
  cursor: pointer;
  font-weight: 600;
  color: #64748b;
}

.plan-import-rejected-lead {
  margin: 0.35rem 0 0.5rem;
}

.plan-import-corrections-actions {
  margin: 0.65rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plan-import-feedback-btns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.plan-import-feedback-btns .btn-xs {
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  line-height: 1.2;
}

.plan-import-feedback-confirm {
  color: #166534;
}

.plan-import-feedback-junk {
  color: #b45309;
}

.plan-row-hidden-junk {
  opacity: 0.72;
}

.plan-row-status {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
}

.plan-import-transformers summary {
  display: block;
  line-height: 1.35;
}

.plan-import-transformers-title {
  display: block;
  font-weight: 700;
  color: #5b21b6;
}

.plan-import-transformers-subtitle {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #7c3aed;
}

.plan-import-transformers-count {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted, #64748b);
}

.plan-import-transformers-note {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted, #64748b);
  line-height: 1.4;
}

.plan-import-transformers-table td:first-child {
  font-weight: 600;
}

.plan-import-transformer-name {
  vertical-align: top;
  min-width: 8rem;
}

.plan-import-transformer-rels {
  vertical-align: top;
}

.plan-import-transformer-rel {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
}

.plan-import-transformer-rel + .plan-import-transformer-rel {
  margin-top: 0.2rem;
}

.plan-import-transformer-rel-ref {
  font-style: italic;
  color: #7c3aed;
}

.plan-row-ok {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--green);
}

/* Header dropdown menus (File) */
.header-menu-wrap {
  position: relative;
}

.header-menu[hidden] {
  display: none;
}

.header-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  z-index: 120;
  min-width: 240px;
  padding: 0.4rem;
  display: grid;
  gap: 0.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.header-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.header-menu-item:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.header-menu-item-danger {
  color: var(--red);
}

.header-menu-item-danger:hover {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
}

.header-menu-divider {
  height: 1px;
  margin: 0.25rem 0.35rem;
  background: var(--border);
}

.header-menu-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.settings-menu .header-menu-item,
.settings-menu .header-menu-link {
  width: 100%;
  text-align: left;
  margin: 0;
}

.header-menu-item:disabled,
.header-menu-item[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-menu-item:disabled:hover,
.header-menu-item[disabled]:hover {
  background: transparent;
}

/* Collapsible Lengths group on Takeoff / Purchase Order toolbars */
.lengths-toggle-btn {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 7px;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.lengths-toggle-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.takeoff-toolbar-lengths.lengths-collapsed > :not(.lengths-toggle-btn) {
  display: none;
}

/* Simple view keeps the Feeder Input toolbar minimal — advanced bulk controls
   appear in Standard / Advanced / Custom */
body[data-runs-preset="simple"] .runs-table-toolbar-secondary {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border-row);
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1a2432;
  color: #c5d2e0;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

tbody tr {
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

tbody tr:nth-child(odd) {
  background: var(--row-odd);
}

tbody tr:nth-child(even) {
  background: var(--row-even);
}

table.selectable-rows tbody tr:hover {
  background: var(--row-hover);
  box-shadow: inset 5px 0 0 var(--primary), 0 0 0 1px var(--primary-glow);
}

table.selectable-rows tbody tr:hover td {
  color: var(--text);
}

table.selectable-rows tbody tr {
  cursor: pointer;
}

table tbody tr.row-selected {
  background: var(--row-selected);
  box-shadow: inset 5px 0 0 var(--primary), 0 0 0 1px var(--primary-glow);
}

table tbody tr.row-selected:hover {
  background: var(--row-selected-hover);
  box-shadow: inset 5px 0 0 var(--primary), 0 0 0 1px var(--primary-glow);
}

table tbody tr.row-selected td {
  color: var(--text);
}

.hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.pricing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.pricing-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
}

.pricing-option input[type="number"] {
  width: 4.75rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
}

.pricing-grid {
  display: block;
}

.pricing-collapse-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.pricing-collapse-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cost-pricing-section.pricing-collapsed #pricingGrid {
  display: none;
}

.pricing-grid label input { width: 100%; }

.pricing-table-wrap {
  overflow-x: auto;
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
}

.pricing-table {
  width: auto;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.pricing-table th,
.pricing-table td {
  border: 1px solid var(--border);
  padding: 0.28rem 0.45rem;
  text-align: center;
  vertical-align: middle;
}

.pricing-table thead th {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel, transparent));
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
}

.pricing-table tbody th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  white-space: nowrap;
  padding: 0.28rem 0.6rem;
}

.pricing-table tbody tr:nth-child(even) td,
.pricing-table tbody tr:nth-child(even) th {
  background: rgba(255, 255, 255, 0.02);
}

.pricing-table .price-cell {
  display: block;
  width: 88px;
  margin: 0 auto;
}

.pricing-table .price-input-wrap {
  position: relative;
  display: block;
}

.pricing-table .price-currency {
  position: absolute;
  left: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 0.78rem;
}

.pricing-table .price-cell input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.18rem 0.35rem 0.18rem 1.05rem;
  font-size: 0.8rem;
  text-align: right;
}

.pricing-table .price-date {
  width: 100%;
  margin: 0.1rem 0 0;
  text-align: left;
}

.price-cell-empty {
  color: var(--muted);
}

.price-date {
  display: block;
  font-size: 0.62rem;
  line-height: 1.1;
  color: var(--muted);
  margin: 0.1rem 0 0.15rem;
}

.price-date.stale { color: #e25555; }

.pricing-grid label.price-stale input {
  border-color: #e25555;
  box-shadow: 0 0 0 2px rgba(226, 85, 85, 0.45);
}

.pricing-grid-section {
  grid-column: 1 / -1;
  margin-top: 1.1rem;
  padding: 0.35rem 0.55rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.pricing-grid-section:first-child {
  margin-top: 0;
}

.pricing-grid-divider {
  grid-column: 1 / -1;
  margin-top: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

/* Supplier price PDF import — review modal */
.price-pdf-panel {
  width: min(680px, 100%);
}

.price-pdf-body {
  padding-top: 0.5rem;
}

/* Animated "swimming" border while the AI is reading a sheet */
@property --ai-spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.btn-ai-busy {
  position: relative;
  overflow: visible;
  opacity: 1 !important;
}

.btn-ai-busy::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 8px;
  padding: 2px;
  background: conic-gradient(
    from var(--ai-spin),
    transparent 0deg,
    transparent 250deg,
    color-mix(in srgb, var(--accent) 45%, transparent) 295deg,
    var(--accent) 340deg,
    #ffe3a3 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: ai-border-swim 1.2s linear infinite;
  pointer-events: none;
}

@keyframes ai-border-swim {
  to { --ai-spin: 360deg; }
}

.price-pdf-header-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.plan-import-compare-page-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-right: 0.25rem;
  padding-right: 0.45rem;
  border-right: 1px solid var(--border);
}

.plan-import-compare-page-label,
.plan-compare-page-label {
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 5.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.plan-panzoom-toolbar-sep {
  width: 1px;
  align-self: stretch;
  margin: 0 0.15rem;
  background: var(--border);
}

#pricePdfCompareBtn[aria-pressed="true"],
#planImportCompareBtn[aria-pressed="true"] {
  background: var(--primary);
  color: #14110b;
}

/* Unit override bar */
.price-pdf-unitbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.55rem;
  background: color-mix(in srgb, var(--surface-2, #20242c) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.price-pdf-unit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.price-pdf-unit select {
  font-size: 0.78rem;
}

.price-pdf-unit-custom {
  width: 5.5rem;
}

/* Compare view: imported sheet beside the price table */
.price-pdf-compare-viewer {
  display: none;
}

.price-pdf-panel.compare-open {
  width: min(96vw, 1750px);
  max-height: min(94vh, 1150px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'hdr hdr'
    'viewer body'
    'ftr ftr';
}

.plan-import-panel.compare-open {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'hdr hdr'
    'viewer body'
    'ftr ftr';
}

.plan-import-panel.compare-open > .plan-import-junk,
.plan-import-panel.compare-open > .plan-import-retry {
  display: none;
}

.price-pdf-panel.compare-open > .nec-ref-modal-header,
.plan-import-panel.compare-open > .nec-ref-modal-header { grid-area: hdr; }
.price-pdf-panel.compare-open > .price-pdf-footer,
.plan-import-panel.compare-open > .price-pdf-footer { grid-area: ftr; }

.price-pdf-panel.compare-open > .price-pdf-body,
.plan-import-panel.compare-open > .plan-import-body {
  grid-area: body;
  overflow: auto;
}

.price-pdf-panel.compare-open > .price-pdf-compare-viewer,
.plan-import-panel.compare-open > .price-pdf-compare-viewer {
  display: flex;
  flex-direction: column;
  grid-area: viewer;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: #15181d;
  min-height: 0;
}

.price-pdf-compare-viewer iframe {
  width: 100%;
  height: 100%;
  min-height: 65vh;
  border: 0;
  background: #fff;
}

.price-pdf-compare-viewer img {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  background: #fff;
}

.price-pdf-compare-viewer pre {
  margin: 0;
  padding: 0.6rem 0.75rem;
  white-space: pre-wrap;
  font-size: 0.72rem;
  line-height: 1.45;
}

/* Plan import compare — tabs, legend, and green/red highlighted text */
.plan-compare-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.6rem 0.45rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

.plan-compare-tabs .btn {
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
}

.plan-compare-tabs .btn.active {
  background: var(--primary);
  color: #14110b;
}

.plan-compare-legend {
  margin: 0.45rem 0.7rem 0.2rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.plan-compare-legend .plan-legend-used {
  color: var(--green);
  font-weight: 700;
}

.plan-compare-legend .plan-legend-skip {
  color: var(--red);
  font-weight: 700;
}

.plan-compare-text[hidden],
.plan-compare-pages[hidden] {
  display: none;
}

/* Extracted text — rendered as a readable document, not a code dump */
.plan-compare-text {
  padding: 0.35rem 0.7rem 0.8rem;
}

.plan-text-filter {
  display: flex;
  /* the global label rule stacks children in a column — keep this one inline */
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0.25rem 0 0.55rem;
  cursor: pointer;
  user-select: none;
}

.plan-text-filter input {
  width: auto;
  margin: 0;
}

.plan-compare-doc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.7rem;
}

.plan-doc-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-row);
}

.plan-line {
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  opacity: 0.62;
  border-left: 3px solid transparent;
}

.plan-line-hit {
  color: var(--text);
  opacity: 1;
  border-left-color: var(--green);
  background: color-mix(in srgb, var(--green) 6%, transparent);
  border-radius: 0 4px 4px 0;
}

.plan-text-matched-only .plan-line:not(.plan-line-hit) {
  display: none;
}

.plan-line mark.plan-used {
  background: color-mix(in srgb, var(--green) 22%, transparent);
  color: var(--green);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 3px;
}

.plan-compare-empty {
  margin: 0.7rem;
}

.plan-compare-pages-note {
  margin: 0.45rem 0.7rem 0.35rem;
  flex-shrink: 0;
}

.plan-compare-viewer {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.plan-compare-viewer .plan-compare-tabs,
.plan-compare-viewer .plan-compare-legend {
  flex-shrink: 0;
}

.plan-compare-viewer .plan-compare-pages,
.plan-compare-viewer .plan-compare-text {
  flex: 1;
  min-height: 0;
}

.plan-compare-viewer .plan-compare-text {
  overflow: auto;
}

.plan-compare-pages {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.plan-compare-scroll {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.plan-compare-scroll-hint {
  margin: 0.35rem 0.7rem 0.25rem;
  flex-shrink: 0;
  font-size: 0.72rem;
}

.plan-compare-scroll-pages {
  flex: 1;
  min-height: 14rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0.5rem 0.75rem;
  background: #2a3038;
}

.plan-compare-scroll-pages .plan-page-wrap {
  background: #fff;
  border-radius: 2px;
  overflow: hidden;
}

.plan-page-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--border);
}

.plan-page-label {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.plan-page-rotate-btn {
  min-width: 2rem;
  padding: 0.15rem 0.35rem;
}

.plan-page-inner {
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.plan-page-media {
  position: relative;
}

.plan-compare-scroll-pages img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: high-quality;
  image-rendering: -webkit-optimize-contrast;
}

.plan-panzoom {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.plan-panzoom-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: inherit;
  flex-shrink: 0;
}

.plan-panzoom-zoom-label {
  min-width: 3.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plan-panzoom-hint {
  margin: 0;
  font-size: 0.72rem;
}

.plan-panzoom-viewport {
  flex: 1;
  min-height: min(72vh, 36rem);
  overflow: hidden;
  cursor: grab;
  background: #2a3038;
  touch-action: none;
  user-select: none;
  outline: none;
}

.plan-panzoom-viewport.plan-panzoom-dragging {
  cursor: grabbing;
}

.plan-panzoom-viewport.plan-panzoom-scroll {
  overflow: auto;
  touch-action: pan-x pan-y;
}

.plan-panzoom-viewport.plan-panzoom-scroll .plan-panzoom-stage {
  transform: none !important;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.35rem;
  box-sizing: border-box;
}

.plan-panzoom-viewport.plan-panzoom-scroll .plan-page-wrap-single {
  margin: 0;
}

.plan-panzoom-viewport.plan-panzoom-scroll .plan-page-inner {
  display: inline-block;
}

.plan-panzoom-stage {
  transform-origin: 0 0;
  will-change: transform;
  width: max-content;
}

.plan-panzoom-stage img,
.plan-panzoom-stage iframe {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  margin-bottom: 0.5rem;
  background: #fff;
  pointer-events: none;
  image-rendering: auto;
}

.plan-panzoom-stage .plan-page-wrap {
  margin-bottom: 0.75rem;
  width: max-content;
}

.plan-panzoom-stage .plan-page-wrap img {
  width: auto;
  max-width: none;
  margin-bottom: 0;
}

.plan-panzoom-stage iframe {
  min-height: 70vh;
  border: 0;
}

.plan-compare-pages img {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  background: #fff;
}

/* Rendered PDF pages with imported-value highlight overlays */
.plan-page-wrap {
  position: relative;
  margin-bottom: 0.5rem;
}

.plan-page-wrap img {
  margin-bottom: 0;
}

.plan-page-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.plan-page-mark {
  position: absolute;
  background: rgba(46, 200, 110, 0.3);
  outline: 2px solid rgba(23, 143, 91, 0.9);
  border-radius: 2px;
  box-sizing: content-box;
  padding: 0.15%;
  margin: -0.15%;
}

.plan-compare-pages iframe {
  width: 100%;
  height: auto;
  min-height: 65vh;
  border: 0;
  background: #fff;
}

.panel-project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.panel-project-head h2 {
  margin: 0;
}

.project-plans-body {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: min(72vh, 42rem);
  padding: 0 1rem 1rem;
}

.project-plans-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: auto;
  border: 1px solid var(--border-row);
  border-radius: var(--radius);
  padding: 0.45rem;
  background: var(--surface-2, #f8fafc);
}

.project-plans-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  padding: 0.45rem 0.55rem;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}

.project-plans-item:hover {
  border-color: var(--border-row);
}

.project-plans-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.project-plans-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.project-plans-item-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.project-plans-empty {
  margin: 0.35rem;
  font-size: 0.82rem;
}

.project-plans-viewer {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-row);
  border-radius: var(--radius);
  padding: 0;
  background: #15181d;
  display: flex;
  flex-direction: column;
}

.project-plans-panel .nec-ref-modal-header {
  padding-bottom: 0.35rem;
}

.project-plans-panel .nec-ref-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.project-plans-compare-feeders {
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-row);
  border-radius: var(--radius);
  background: var(--surface, #fff);
}

.project-plans-compare-feeders-head {
  padding: 0.55rem 0.65rem 0.35rem;
  border-bottom: 1px solid var(--border-row);
}

.project-plans-compare-feeders-title {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
}

.project-plans-compare-feeders-body {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 0.35rem 0.45rem 0.55rem;
}

.project-plans-compare-table td:first-child {
  font-weight: 600;
}

#runsTable [data-col="fedFrom"] input[data-field="fedFrom"] {
  min-width: 6.5rem;
  width: 100%;
}

.project-plans-panel.compare-open {
  width: min(96vw, 1750px);
  max-height: min(94vh, 1150px);
}

.project-plans-panel.compare-open .project-plans-body {
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr) minmax(0, 1fr);
}

.project-plans-panel.compare-open .project-plans-compare-feeders {
  display: flex;
}

@media (max-width: 720px) {
  .project-plans-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(16rem, 1fr);
  }

  .project-plans-panel.compare-open .project-plans-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(14rem, 1fr) minmax(14rem, 1fr);
  }

  .project-plans-list {
    max-height: 9rem;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .project-plans-item {
    min-width: 11rem;
    flex: 0 0 auto;
  }
}

.price-pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.price-pdf-table th,
.price-pdf-table td {
  padding: 0.32rem 0.55rem;
  border-bottom: 1px solid var(--border-row);
  text-align: left;
  white-space: nowrap;
}

.price-pdf-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
}

.price-pdf-table th.num,
.price-pdf-table td.num {
  text-align: right;
}

.price-pdf-table td.price-pdf-check,
.price-pdf-table th.price-pdf-check {
  width: 2rem;
  text-align: center;
}

.price-pdf-table input[type="number"] {
  width: 5.5rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.82rem;
  text-align: right;
}

.price-pdf-change.up { color: var(--red); }
.price-pdf-change.down { color: var(--green); }

.price-pdf-tag {
  display: inline-block;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
  vertical-align: middle;
}

.price-pdf-tag-warn {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.price-pdf-tag-sheet {
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.35);
  background: rgba(29, 78, 216, 0.06);
}

.price-pdf-tag-assumed {
  color: #92400e;
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.12);
  font-weight: 700;
}

.price-pdf-assume-summary {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: var(--radius);
  background: rgba(234, 179, 8, 0.08);
}

.price-pdf-assume-title {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.price-pdf-assume-line {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
}

.price-pdf-assume-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}

tr[data-price-source="assumed"] {
  background: rgba(234, 179, 8, 0.06);
}

.price-pdf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-top: 1px solid var(--border);
}

.price-pdf-note {
  margin: 0;
}

.price-pdf-footer-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* AI price sheet reader — settings modal */
.ai-settings-panel {
  width: min(460px, 100%);
}

.ai-settings-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ai-settings-body input,
.ai-settings-body select {
  width: 100%;
}

.ai-settings-hint {
  margin: 0;
}

.ai-settings-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.ai-settings-test {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.ai-settings-test--ok {
  color: #15803d;
}

.plan-row-sheet {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  vertical-align: middle;
}

.plan-row-pool {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 4px;
  vertical-align: middle;
}

.plan-row-elevator,
.run-name-primary .plan-row-elevator {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  vertical-align: middle;
}

.plan-import-equipment-note {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
}

.plan-import-review-board tr.plan-row-elevator-row {
  background: linear-gradient(90deg, #fffbeb 0%, transparent 100%);
}

.plan-row-fire-pump,
.run-name-primary .plan-row-fire-pump {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  vertical-align: middle;
}

.plan-import-review-board tr.plan-row-fire-pump-row {
  background: linear-gradient(90deg, #fef2f2 0%, transparent 100%);
}

.plan-import-confirm-panel {
  width: min(860px, 100%);
  position: relative;
}

.plan-import-confirm-body {
  position: relative;
}

.plan-import-confirm-warn {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  color: #92400e;
  line-height: 1.45;
}

.plan-import-confirm-sheets {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(28vh, 220px);
  overflow: auto;
}

.plan-import-confirm-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  text-align: left;
  line-height: 1.45;
  transition: border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.plan-import-confirm-item:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.plan-import-confirm-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.plan-import-confirm-item--selected {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border));
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

.plan-import-confirm-item:not(.plan-import-confirm-item--selected) {
  opacity: 0.72;
}

.plan-import-confirm-check {
  flex: 0 0 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  background: #fff;
}

.plan-import-confirm-item--selected .plan-import-confirm-check {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, #fff);
}

.plan-import-confirm-item-text {
  flex: 1;
  min-width: 0;
}

.plan-import-confirm-view-btn {
  flex-shrink: 0;
  margin-left: auto;
}

.plan-import-confirm-item--warn {
  color: #b45309;
}

.plan-import-confirm-item--feeder {
  color: var(--text);
}

.plan-import-confirm-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  max-height: min(50vh, 420px);
  overflow: auto;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.plan-import-confirm-page {
  position: relative;
  margin: 0;
  text-align: center;
  border-radius: 6px;
  padding: 0.2rem;
  opacity: 0.72;
  transition: opacity 0.12s ease, box-shadow 0.12s ease;
}

.plan-import-confirm-page--selected {
  opacity: 1;
  box-shadow: inset 0 0 0 2px var(--green);
}

.plan-import-confirm-expand-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 1;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.plan-import-confirm-expand-btn:hover {
  border-color: var(--accent);
  background: #fff;
}

.plan-import-confirm-page img {
  width: 100%;
  height: auto;
  min-height: 4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  cursor: zoom-in;
  display: block;
}

.plan-import-confirm-page-select {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.plan-import-confirm-page-select:not([aria-pressed="true"]) {
  color: var(--muted);
}

.plan-import-confirm-page figcaption {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.plan-import-confirm-expand {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.plan-import-confirm-expand[hidden] {
  display: none !important;
}

.plan-import-confirm-expand-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.72);
}

.plan-import-confirm-expand-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100% - 1rem);
  min-height: min(70vh, 540px);
  margin: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.plan-import-confirm-expand-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.plan-import-confirm-expand-title {
  margin: 0;
  font-size: 0.95rem;
}

.plan-import-confirm-expand-sub {
  margin: 0.15rem 0 0;
}

.plan-import-confirm-expand-viewer {
  flex: 1;
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  background: #2a3038;
}

.plan-import-confirm-expand-viewer .plan-panzoom {
  flex: 1;
  min-height: 18rem;
}

.plan-import-confirm-expand-viewer .plan-panzoom-viewport {
  min-height: 14rem;
}

.plan-import-confirm-expand-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.plan-import-confirm-expand-include {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

.plan-import-confirm-expand-include input {
  width: auto;
  margin: 0;
}

.ai-serve-banner {
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #92400e;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  text-align: center;
  line-height: 1.45;
}

.ai-serve-banner code {
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.ai-key-help {
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.45;
}

.ai-key-help a,
.ai-settings-hint a {
  color: var(--accent);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.summary-cards .card {
  padding: 0.45rem 0.7rem;
}

button.card-jump {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s, background 0.12s;
}

button.card-jump:hover {
  border-color: var(--accent-dim);
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent));
}

.card .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* Project hub jump cards — title stands apart from the numbers below */
.summary-cards .card .label {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--accent);
  line-height: 1.2;
}

button.card-jump:hover .label {
  color: var(--text);
}

.card .value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.summary-cards .card .value {
  margin-top: 0.05rem;
  font-size: 1.05rem;
  line-height: 1.15;
}

.card .value.money { color: var(--green); }

.card-sub {
  margin-top: 0.15rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.card-value-split {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.card-takeoff-row.card-jump {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.card-takeoff-row .label {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.card-value-split-inline {
  flex: 0 0 auto;
  margin-top: 0;
  align-items: flex-end;
  text-align: right;
}

.card-est-material {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.06rem;
}

.card-est-material .value {
  margin-top: 0.05rem;
}

.card-pricing-btn {
  align-self: flex-end;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  padding: 0.12rem 0.4rem;
  white-space: nowrap;
}

.card-split-line {
  display: block;
}

.card-split-key {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 0.25rem;
}

.project-hub {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.project-hub .summary-cards {
  margin-bottom: 0;
}

.work-tabs-bar {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.runs-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  padding: 0.2rem 0.35rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s, transform 0.12s;
}

.runs-pin-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
}

.runs-pin-btn:focus-visible {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
}

.runs-pin-btn[aria-pressed="true"] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.runs-pin-btn[aria-pressed="true"]:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}

/* Header pin — quiet toggle at the right end of the category row */
.runs-pin-btn-chrome {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  align-self: center;
  padding: 0.42rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
}

.runs-pin-btn-chrome:hover {
  border-color: var(--border);
}

.runs-pin-btn-label {
  white-space: nowrap;
  line-height: 1;
}

.runs-pin-icon {
  display: block;
  pointer-events: none;
  transform: rotate(38deg);
  transition: transform 0.15s ease;
}

.runs-pin-btn[aria-pressed="true"] .runs-pin-icon {
  transform: rotate(0deg);
}

.runs-actions-pin-head .runs-delete-head-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.runs-delete-head-label {
  flex: 1 1 auto;
  text-align: center;
  min-width: 0;
}

.runs-actions-pin-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  flex: 0 0 auto;
  margin-left: 0.15rem;
}

.runs-actions-pin-head .runs-pin-btn-actions {
  padding: 0.15rem 0.3rem;
}

.runs-actions-pin-hint {
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  opacity: 0.75;
  white-space: nowrap;
  line-height: 1.1;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th.runs-actions-pin-head .runs-pin-btn {
  pointer-events: auto;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th.runs-actions-pin-head .runs-actions-pin-hint {
  color: var(--accent);
  opacity: 1;
}

.work-tabs-bar .work-tabs {
  flex: 1 1 auto;
  margin-bottom: 0;
  min-width: 0;
}

.work-view-runs-head-leading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.work-print-slot {
  flex: 0 0 auto;
  margin-left: auto;
}

.work-view-toolbar .work-print-slot,
.schedule-toolbar .work-print-slot,
.takeoff-view-toolbar .work-print-slot,
.po-export-toolbar .work-print-slot {
  align-self: center;
}

.work-print-slot .work-print-btn {
  white-space: nowrap;
}

/* Keep Export Spreadsheet docked beside Print at the right edge on every view */
.work-view-toolbar > .work-export-btn {
  margin-left: auto;
}

.work-view-toolbar > .work-export-btn + .work-print-slot {
  margin-left: 0;
}

.work-tabs-groups {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.work-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.work-cat {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  color: var(--muted);
  border-radius: 9px;
  padding: 0.5rem 1.35rem;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.work-cat:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-color: var(--border);
}

.work-cat.active {
  background: var(--primary);
  color: #111;
  border-color: color-mix(in srgb, var(--accent) 85%, #fff 15%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 14px var(--accent-glow);
}

.work-cat:focus-visible {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
}

.work-tabs[hidden] {
  display: none;
}

.work-tab[hidden] {
  display: none;
}

.work-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  padding: 0.4rem;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--well-shade));
  border: 1px solid color-mix(in srgb, var(--border) 90%, var(--accent) 10%);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 4%, transparent);
}

.work-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 0.52rem 1rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.work-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
}

.work-tab.active {
  background: var(--primary);
  color: #111;
  border-color: color-mix(in srgb, var(--accent) 85%, #fff 15%);
  font-weight: 700;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 14px var(--accent-glow);
}

.work-tab:focus-visible {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
}

.work-view {
  display: none;
}

.work-view.active {
  display: block;
}

.panel-work .panel-head {
  margin-bottom: 0.5rem;
}

.work-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.work-view-toolbar.schedule-toolbar {
  gap: 0.45rem 0.65rem;
}

.cost-view-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.35rem;
}

.cost-view-controls select,
.cost-view-controls input[type="search"] {
  height: 1.75rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  line-height: 1.2;
  box-sizing: border-box;
}

.cost-view-controls input[type="search"] {
  width: 11rem;
}

.cost-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.cost-table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.75rem 0 0.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.cost-sheet .cost-shown-row td {
  color: var(--accent);
  font-weight: 600;
}

.cost-sheet .cost-empty-row {
  text-align: center;
  color: var(--muted);
  padding: 1rem 0.5rem;
}

.work-view-toolbar .work-print-btn {
  margin-right: 0.15rem;
}

.runs-view-toolbar {
  justify-content: flex-end;
}

.panel-nested {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.panel-nested h2 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.cost-pricing-section .panel-head {
  margin-bottom: 0.55rem;
}

.work-stock-footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.work-stock-footer .stock-panel-head .work-print-btn {
  display: none;
}

.work-stock-footer .stock-panel-title {
  font-size: 0.92rem;
  margin: 0;
}

.work-stock-footer .stock-panel-hint {
  font-size: 0.72rem;
  margin-bottom: 0.4rem;
}

.stock-panel:not(.stock-panel--footer) .stock-panel-title {
  font-size: 0.95rem;
  margin: 0;
}

.stock-sort-control {
  gap: 0.4rem;
}

.stock-panel-head .stock-sort-control {
  margin-right: 0.15rem;
}

.po-stock-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.po-stock-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.po-stock-head-actions .stock-edit-btn {
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  white-space: nowrap;
}

.po-stock-select-head .po-stock-sort {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* Main group headers (location / size / color / type) centered across the
   table; subheaders stay left, above the Size column */
#stockTable tbody tr.stock-section-row td {
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-2);
  text-align: center;
  padding: 0.5rem 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ~1/4" breathing room between stock groups (skip the gap above the first) */
#stockTable tbody tr.stock-section-row:not(:first-child) td {
  border-top: 1.5rem solid var(--bg);
}

/* Sub-grouping inside each stock section (size + type under a location, or
   location under a size / color / type section) */
#stockTable tbody tr.stock-subsection-row td {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--surface);
  text-align: left;
  padding: 0.32rem 0.55rem 0.24rem 1.6rem;
  border-bottom: 1px solid var(--border-row);
}

.po-pdf tr.po-stock-section-title td {
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}

.purchase-order {
  display: block;
  min-width: 0;
}

.takeoff-panel {
  min-width: 0;
}

.takeoff-panel:not(.takeoff-panel-active) {
  display: none !important;
}

.takeoff-panel-active {
  display: block;
}

/* "All" subtab — wire and conduit stack with a clear break between them */
body[data-takeoff-sub="all"] #conduitTakeoff.takeoff-panel-active {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}

.takeoff-view-toolbar {
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.takeoff-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.takeoff-subtab {
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
}

.takeoff-subtab.active {
  background: var(--primary);
  border-color: var(--accent);
  color: #1a1208;
}

.takeoff-view-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.takeoff-view-actions .takeoff-print-btn {
  white-space: nowrap;
}

.takeoff-doc-hint {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
}

.conduit-takeoff-pdf col.col-size,
.conduit-takeoff-pdf .col-size {
  width: 38%;
}

.conduit-takeoff-pdf col.col-runs,
.conduit-takeoff-pdf .col-runs {
  width: 24%;
}

.conduit-takeoff-pdf col.col-length,
.conduit-takeoff-pdf .col-length {
  width: 38%;
}

.conduit-takeoff-pdf tr.conduit-section-total td {
  font-weight: 700;
  background: color-mix(in srgb, var(--surface-2) 85%, var(--bg));
  border-top: 2px solid var(--border);
}

.panel-work .purchase-order .hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.3;
}

/* Spreadsheet-style tables — wire takeoff, purchase order, cost */
.sheet-wrap {
  overflow-x: auto;
  margin-top: 0.15rem;
}

.sheet-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.sheet-table th,
.sheet-table td {
  padding: 0.35rem 0.22rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.sheet-table th:first-child,
.sheet-table td:first-child {
  padding-left: 0.35rem;
}

.sheet-table th:last-child,
.sheet-table td:last-child {
  padding-right: 0.35rem;
}

.sheet-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border);
  background: var(--panel, #1a1d24);
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.sheet-table th.num,
.sheet-table td.num {
  text-align: right;
  white-space: nowrap;
}

.sheet-table tr.sheet-section td {
  font-weight: 600;
  font-size: 1.01rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  padding-top: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.sheet-table tr.sheet-group-break td {
  border-top: 2px solid var(--border);
}

.sheet-table .tag {
  padding: 0.12rem 0.4rem;
  font-size: 0.89rem;
  margin-right: 0.2rem;
  vertical-align: middle;
}

.sheet-table .col-panels {
  white-space: normal;
  word-break: break-word;
  font-size: 1.01rem;
  line-height: 1.35;
}

/* Takeoff column widths (legacy 3-col sheet) */
.takeoff-sheet .col-color { width: 9%; }
.takeoff-sheet .col-wire { width: 62%; }
.takeoff-sheet .col-length { width: 11%; }

/* Wire takeoff — PO-style document layout */
.takeoff-doc-header,
.takeoff-sections {
  width: 100%;
  box-sizing: border-box;
}

.takeoff-section-block {
  margin-bottom: 0.3in;
}

.takeoff-section-block:last-child {
  margin-bottom: 0;
}

.takeoff-pdf.sheet-table col.col-size { width: calc(148px + 0.5in); }
.takeoff-pdf.sheet-table col.col-color { width: calc(80px + 0.25in); }
.takeoff-pdf.sheet-table col.col-type { width: calc(94px + 0.25in); }
.takeoff-pdf.sheet-table col.col-material { width: calc(66px + 0.25in); }
.takeoff-pdf.sheet-table col.col-length { width: calc(98px + 0.25in); }

.takeoff-pdf.sheet-table {
  width: auto;
  max-width: none;
  line-height: 1.45;
}

.takeoff-pdf.sheet-table .col-size { width: calc(148px + 0.5in); }
.takeoff-pdf.sheet-table .col-color { width: calc(80px + 0.25in); }
.takeoff-pdf.sheet-table .col-type { width: calc(94px + 0.25in); }
.takeoff-pdf.sheet-table .col-material { width: calc(66px + 0.25in); }
.takeoff-pdf.sheet-table .col-length { width: calc(98px + 0.25in); }

.takeoff-pdf.sheet-table td.col-length strong {
  font-weight: 700;
  color: inherit;
}

.takeoff-total-bar {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--po-grid, #3a4554);
  font-variant-numeric: tabular-nums;
}

.takeoff-total-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.takeoff-total-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.takeoff-head {
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.takeoff-head .takeoff-doc-header {
  margin-bottom: 0.45rem;
}

.takeoff-toolbar-wrap {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.takeoff-toolbar.po-toolbar {
  gap: 0.5rem 1.35rem;
  margin: 0;
  padding: 0.55rem 0.85rem;
}

/* Cleaner sub-header: drop the cramped uppercase category labels and the hard
   vertical dividers — each control already carries its own inline label, and
   comfortable spacing keeps the groups readable. A single subtle separator is
   kept after the collapsible "Lengths" settings to set them apart from the
   view controls. */
.takeoff-toolbar-group-label,
.takeoff-toolbar-divider {
  display: none;
}

.takeoff-toolbar-lengths + .takeoff-toolbar-divider {
  display: block;
  width: 1px;
  align-self: stretch;
  min-height: 1.6rem;
  margin: 0;
  background: var(--border);
  opacity: 0.6;
}

.takeoff-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.takeoff-toolbar-group-label {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
  margin-right: 0.1rem;
}

.takeoff-toolbar-divider {
  width: 1px;
  align-self: stretch;
  min-height: 2.25rem;
  background: var(--border);
  margin: 0 0.55rem;
  flex-shrink: 0;
}

.takeoff-field,
.takeoff-sort,
.takeoff-filter-field,
.takeoff-check {
  gap: 0.4rem;
}

.takeoff-field-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.takeoff-field-unit {
  font-size: 0.72rem;
  color: var(--muted);
}

.takeoff-check span {
  color: var(--text);
  font-size: 0.78rem;
}

.takeoff-toolbar-btn {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.takeoff-filter-panel.po-filter-panel {
  margin: 0;
  padding: 0.55rem 0.65rem 0.6rem;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
  gap: 0.5rem 0.75rem;
}

.takeoff-filter-heading {
  flex: 0 0 100%;
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.takeoff-filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  flex: 1 1 auto;
}

.takeoff-filter-panel .takeoff-filter-field select {
  min-width: 7rem;
}

.takeoff-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;
}

@media (max-width: 720px) {
  .takeoff-toolbar.po-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .takeoff-toolbar-divider {
    width: auto;
    height: 1px;
    min-height: 0;
    margin: 0.35rem 0;
  }

  .takeoff-toolbar-group {
    flex-wrap: wrap;
  }
}

.po-toolbar .po-option input[type="number"] {
  width: 4.75rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
}

/* Purchase order — PDF-style (BPE feeder PO layout) */
.po-doc-header {
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.po-doc-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.po-doc-sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.po-pdf.sheet-table col.col-size,
.po-pdf.sheet-table col.col-color,
.po-pdf.sheet-table col.col-spool,
.po-pdf.sheet-table col.col-length,
.po-pdf.sheet-table col.col-used {
  width: 1%;
}

.po-pdf.sheet-table col.col-labels {
  width: auto;
}

.po-pdf.po-cut-to-length col.col-used {
  width: 0 !important;
}

.po-pdf .col-size,
.po-pdf .col-color,
.po-pdf .col-spool,
.po-pdf .col-length,
.po-pdf .col-used {
  width: 1%;
  white-space: nowrap;
}

.po-pdf .col-labels {
  width: auto;
}

.po-pdf.po-cut-to-length .col-used,
.po-pdf.po-cut-to-length tr.po-col-head td:nth-child(5),
.po-pdf.po-cut-to-length tr.po-col-head th:nth-child(5),
.po-pdf.po-cut-to-length tr.po-data-row td.col-used {
  display: none;
}

.po-spool-gap td {
  height: 0.55rem;
  padding: 0;
  line-height: 0;
  background: var(--surface-2);
  border: 1px solid var(--po-grid, #2a2a2a);
}

.po-size-group-gap td {
  height: 0.75rem;
  padding: 0;
  line-height: 0;
  background: var(--surface-2);
  border: 1px solid var(--po-grid, #2a2a2a);
  border-top: none;
}

.po-color-group-gap td {
  height: 0.75rem;
  padding: 0;
  line-height: 0;
  background: var(--surface-2);
  border: 1px solid var(--po-grid, #2a2a2a);
}

.po-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.15rem;
  margin-top: 0.15rem;
  margin-bottom: 0;
}

.po-toolbar label,
.po-toolbar .po-option,
.po-filter-panel label,
.po-filter-panel .po-option {
  flex-direction: row !important;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin: 0;
  gap: 0.35rem;
}

.po-toolbar input[type="checkbox"],
.po-filter-panel input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}

.po-toolbar .btn,
.po-filter-panel .btn {
  flex-shrink: 0;
  align-self: center;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.po-toolbar .po-option input[type="number"],
.po-toolbar .po-option select,
.po-filter-panel .po-option input[type="number"],
.po-filter-panel .po-option select {
  height: 1.75rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.2;
  box-sizing: border-box;
}

.po-field-unit,
.po-toolbar .takeoff-field-unit {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.po-toolbar .po-cut-to-length-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  padding: 0 0.55rem 0 0.4rem;
  height: 1.75rem;
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  cursor: pointer;
  user-select: none;
}

.po-toolbar .po-cut-to-length-toggle span {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1;
}

.po-toolbar .po-cut-to-length-toggle input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
}

.po-toolbar-wrap {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.po-order-toolbar.po-toolbar {
  gap: 0.5rem 1.35rem;
  margin: 0;
  padding: 0.55rem 0.85rem;
}

.po-toolbar-wrap .po-filter-panel {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.po-pinned-chrome {
  flex-shrink: 0;
}

/* Stick the whole project panel with a negative top so its sticky range covers
   the entire page (the hub alone would unstick once the panel scrolls away);
   only the band from the hub down to the panel's bottom edge stays visible. */
body.po-pin-header-active .panel-project {
  position: sticky;
  top: var(--po-pin-project-top, 0);
  z-index: 44;
}

body.po-pin-header-active .project-hub {
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

body.po-pin-header-active .work-tabs-bar {
  position: sticky;
  top: var(--po-pin-tabs-top, 3.5rem);
  z-index: 43;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}

body.po-pin-header-active #work-view-purchase.active .po-export-toolbar {
  position: sticky;
  top: var(--po-pin-chrome-top, 6.5rem);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  padding: 0.4rem 0 0.5rem;
}

/* Pinned below the export toolbar: PO title, lengths toolbar, and the
   over-max warning banner all live inside .po-pinned-chrome. */
body.po-pin-header-active #work-view-purchase.active .purchase-order > .po-pinned-chrome {
  position: sticky;
  top: var(--po-pin-po-chrome-top, 8.75rem);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th.runs-actions-pin-head .runs-pin-btn {
  pointer-events: auto;
}

.runs-display-toolbar {
  flex: 0 1 auto;
  min-width: 0;
}

.panel-work .work-view-runs-head.panel-head {
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0 0.5rem;
}

body.runs-pin-chrome-active .work-tabs-bar {
  position: sticky;
  top: var(--runs-pin-tabs-top, 0);
  z-index: 43;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}

/* Keep the normal gap below the tab bar inside its pinned (opaque) box so the
   chrome stacked beneath it doesn't sit flush against the tabs */
body.runs-pin-chrome-active .work-tabs-bar,
body.po-pin-header-active .work-tabs-bar {
  margin-bottom: 0;
  padding-top: 0.25rem;
  padding-bottom: 0.35rem;
}

body.runs-pin-chrome-active #work-view-runs.active .work-view-runs-head {
  position: sticky;
  top: var(--runs-pin-head-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

body.runs-pin-chrome-active #work-view-runs.active .runs-hint {
  position: sticky;
  top: var(--runs-pin-hint-top, 0);
  z-index: 41;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0.35rem;
}

body.runs-pin-chrome-active #work-view-runs.active .runs-guide {
  position: sticky;
  top: var(--runs-pin-guide-top, 0);
  z-index: 40;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-top: 0;
  margin-bottom: 0;
}

body.runs-pin-chrome-active #work-view-stock.active .stock-panel-head {
  position: sticky;
  top: var(--stock-pin-head-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.55rem;
}

body.runs-pin-chrome-active #work-view-stock.active .stock-panel-hint {
  position: sticky;
  top: var(--stock-pin-hint-top, 0);
  z-index: 41;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-bottom: 0.5rem;
}

body.runs-pin-chrome-active #work-view-stock.active #stockTable thead th {
  top: var(--stock-pin-table-top, 0);
  z-index: 5;
}

/* Sticky thead only works when the wrap is not a scroll container; JS adds
   this class whenever the stock table fits without horizontal scrolling */
body.app-shell .stock-table-wrap.stock-wrap-static {
  overflow-x: visible;
}

body.runs-pin-chrome-active #work-view-schedule.active .schedule-toolbar {
  position: sticky;
  top: var(--schedule-pin-toolbar-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.55rem;
}

body.runs-pin-chrome-active #work-view-cost.active .cost-toolbar {
  position: sticky;
  top: var(--cost-pin-toolbar-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.55rem;
}

/* Pushpin on the Purchase Order tab (PO "Pin header" checkbox takes over when
   it is on): pin the export row, then the doc title + spool toolbar + over-max
   warning banner chrome below it */
body.runs-pin-chrome-active #work-view-purchase.active .po-export-toolbar {
  position: sticky;
  top: var(--po-chrome-pin-toolbar-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.55rem;
}

body.runs-pin-chrome-active #work-view-purchase.active .purchase-order > .po-pinned-chrome {
  position: sticky;
  top: var(--po-chrome-pin-chrome-top, 0);
  z-index: 41;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  padding-bottom: 0.5rem;
}

body.runs-pin-chrome-active #work-view-takeoff.active .takeoff-view-toolbar {
  position: sticky;
  top: var(--takeoff-pin-toolbar-top, 0);
  z-index: 42;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.55rem;
}

body.runs-pin-chrome-active #work-view-takeoff.active .takeoff-panel-active .takeoff-head {
  position: sticky;
  top: var(--takeoff-pin-head-top, 0);
  z-index: 41;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  margin-bottom: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="panel"] {
  z-index: 22;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="delete"] {
  position: sticky;
  right: var(--runs-pin-delete-right, 0px);
  z-index: 18;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="dupBtn"] {
  position: sticky;
  right: var(--runs-pin-dup-right, 0px);
  z-index: 17;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="overrideBtn"]:not(.col-hidden) {
  position: sticky;
  right: var(--runs-pin-override-right, 0px);
  z-index: 16;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="autoBtn"] {
  position: sticky;
  right: var(--runs-pin-auto-right, 0px);
  z-index: 15;
}

body.runs-pin-actions-active #runsTable tbody td[data-col="delete"] {
  position: sticky;
  right: var(--runs-pin-delete-right, 0px);
  z-index: 11;
}

body.runs-pin-actions-active #runsTable tbody td[data-col="dupBtn"] {
  position: sticky;
  right: var(--runs-pin-dup-right, 0px);
  z-index: 10;
}

body.runs-pin-actions-active #runsTable tbody td[data-col="overrideBtn"]:not(.col-hidden) {
  position: sticky;
  right: var(--runs-pin-override-right, 0px);
  z-index: 9;
}

body.runs-pin-actions-active #runsTable tbody td[data-col="autoBtn"] {
  position: sticky;
  right: var(--runs-pin-auto-right, 0px);
  z-index: 8;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="delete"] {
  background: var(--runs-group-actions);
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable tbody td[data-col="autoBtn"] {
  overflow: visible;
}

body.runs-pin-actions-active #runsTable thead .runs-col-labels th[data-col="autoBtn"]::before,
body.runs-pin-actions-active #runsTable tbody td[data-col="autoBtn"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 10px;
  transform: translateX(-100%);
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.22), transparent);
}

body.runs-pin-actions-active .runs-scroll-host.is-scrolled-x #runsTable thead .runs-col-labels th[data-col="autoBtn"]::before,
body.runs-pin-actions-active .runs-scroll-host.is-scrolled-x #runsTable tbody td[data-col="autoBtn"]::before {
  opacity: 1;
}

body.runs-pin-actions-active .runs-scroll-host.is-scrolled-x #runsTable thead .runs-col-labels th[data-col="autoBtn"] {
  box-shadow: inset 1px 0 0 var(--runs-group-divider), -6px 0 10px rgba(0, 0, 0, 0.2);
}

body.runs-pin-actions-active #runsTable tbody td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable tbody td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable tbody td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable tbody td[data-col="delete"] {
  background-color: inherit;
}

body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="delete"] {
  background: var(--runs-actions-odd);
}

body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="delete"] {
  background: var(--runs-actions-even);
}

body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="delete"] {
  background: var(--runs-actions-hover);
}

body.runs-pin-actions-active #runsTable tbody tr.row-selected td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-selected td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-selected td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-selected td[data-col="delete"] {
  background: #243044;
}

body.runs-pin-actions-active #runsTable tbody tr.row-override-mode td[data-col="autoBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-override-mode td[data-col="overrideBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-override-mode td[data-col="dupBtn"],
body.runs-pin-actions-active #runsTable tbody tr.row-override-mode td[data-col="delete"] {
  background: #3d3520;
}

.po-pdf.po-combine-colors .col-color,
.po-pdf.po-combine-colors col.col-color,
.po-pdf.po-combine-colors thead th.col-color,
.po-pdf.po-combine-colors tbody td.col-color {
  display: none;
}

.po-length-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
}

.po-length-input {
  width: 4.75rem;
  min-width: 4.75rem;
  flex: 0 0 auto;
  padding: 0.15rem 0.35rem;
  font: inherit;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 3px;
  color: var(--text);
}

.po-length-input:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 2px var(--focus-glow-outer);
}

.po-split-spool-btn,
.po-size-up-spool-btn {
  flex-shrink: 0;
  padding: 0.1rem 0.28rem;
  min-width: 1.35rem;
  font-size: 0.6rem;
  line-height: 1;
  border-radius: 3px;
}

.po-filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.po-filter-panel[hidden] {
  display: none;
}

.po-filter-btn.active,
.po-reset-auto-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.po-pdf tr.po-subsection-title td {
  position: sticky;
  top: var(--po-col-head-sticky-h, 1.65rem);
  z-index: 5;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 92%, var(--text));
  padding-top: 0.4rem;
  padding-bottom: 0.28rem;
  border: 1px solid var(--po-grid, #3a4554);
  border-top: 1px solid var(--po-grid, #3a4554);
  white-space: nowrap;
  line-height: 1.25;
  vertical-align: middle;
}

.po-pdf.po-sort-wire-type thead tr.po-col-head th.col-size {
  font-size: 0.9375rem;
  color: var(--text);
}

.po-sheet.po-pdf.po-sort-wire-type tr.po-subsection-title.po-size-group td {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  background: #9333ea;
  padding-top: 0.5rem;
  padding-bottom: 0.35rem;
  border-top-width: 2px;
  border-color: #7c22ce;
}

.po-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.25rem 0.5rem;
  font-style: italic;
}

.po-option select {
  min-width: 6.5rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
}

.po-over-max-banner {
  display: block;
  width: 100%;
  margin: 0.5rem 0 0.4rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  color: var(--po-warn-fg, #78350f);
  background: var(--po-warn-bg, #fffbeb);
  border: 1px solid var(--po-warn-line, #fcd34d);
  border-left: 3px solid var(--po-warn-border, #d97706);
  border-radius: 0;
}

.po-over-max-banner:hover {
  background: color-mix(in srgb, var(--po-warn-bg, #fffbeb) 88%, var(--po-warn-border, #d97706));
}

.po-over-max-banner:focus-visible {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
}

.po-over-max-banner-active {
  border-left-width: 4px;
  background: color-mix(in srgb, var(--po-warn-bg, #fffbeb) 78%, var(--po-warn-border, #d97706));
}

.po-missing-length-banner {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 8px;
  background: rgba(245, 166, 35, 0.08);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
}

.po-lock-banner {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, #c8860a 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #c8860a 35%, var(--border));
  border-radius: 10px;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

tr.run-procurement-locked {
  background: color-mix(in srgb, #c8860a 6%, transparent);
}

tr.run-procurement-locked input,
tr.run-procurement-locked select,
tr.run-procurement-locked textarea,
tr.run-procurement-locked button:not(.run-status-btn) {
  pointer-events: none;
  opacity: 0.88;
}

body.procurement-locked #runsTable tr.run-procurement-locked::before {
  content: none;
}

.po-missing-length-banner strong {
  font-weight: 600;
}

.po-sanity-check {
  margin: 0.65rem 0 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.po-sanity-check.po-sanity-ok {
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 8%, transparent);
}

.po-sanity-check.po-sanity-warn {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-bg);
}

.po-sanity-check.po-sanity-blocked {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.po-sanity-summary {
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  list-style: none;
}

.po-sanity-summary::-webkit-details-marker {
  display: none;
}

.po-sanity-body {
  padding: 0 0.75rem 0.65rem;
}

.po-sanity-section + .po-sanity-section {
  margin-top: 0.55rem;
}

.po-sanity-section-title {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.po-sanity-section-ok .po-sanity-section-title {
  color: var(--success);
}

.po-sanity-section-warn .po-sanity-section-title {
  color: var(--warning);
}

.po-sanity-section-blocked .po-sanity-section-title {
  color: var(--danger);
}

.po-sanity-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
}

.po-sanity-list li + li {
  margin-top: 0.15rem;
}

.po-sanity-included li {
  color: var(--success);
}

.po-sanity-panels {
  font-weight: 500;
}

.po-sanity-manual-override {
  color: color-mix(in srgb, var(--warning) 85%, #000);
  font-weight: 600;
}

.po-sanity-blocker-note {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
}

.po-over-max-banner-hint {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--po-warn-border, #d97706);
}

.po-length-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.05rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: var(--po-warn-fg, #78350f);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: help;
}

.po-spool-warn {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--po-warn-fg, #78350f);
  background: var(--po-warn-bg, #fffbeb);
  border: 1px solid var(--po-warn-border, #d97706);
  border-radius: 2px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Over max — flag length column only; no full-row highlight */
.po-pdf tr.po-data-row td.po-over-max {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.po-pdf tr.po-data-row.po-spool-over-max td.col-length {
  box-shadow: inset 3px 0 0 var(--po-warn-border, #d97706);
}

.po-sections {
  overflow: visible;
  margin-top: 0.15rem;
  width: 100%;
  box-sizing: border-box;
}

.po-section-block {
  margin-bottom: 0.25in;
  width: 100%;
  box-sizing: border-box;
}

.po-section-block table.po-pdf.sheet-table {
  width: 100%;
  box-sizing: border-box;
}

.po-sticky-mirror {
  position: fixed;
  z-index: 100;
  overflow: hidden;
  box-shadow: none;
  pointer-events: none;
  background: #434c5e;
  border: 1px solid #5c677a;
  border-top: none;
  border-radius: 0;
}

.po-sticky-mirror[hidden] {
  display: none !important;
}

.po-sticky-mirror table {
  margin: 0;
  width: 100%;
  table-layout: fixed;
  border: none;
}

.po-sticky-mirror thead tr.po-col-head th,
.po-sticky-mirror thead tr.po-col-head td {
  position: static;
  color: #e8ecf0;
  background: #434c5e;
  border-color: #5c677a;
  border-bottom-color: #5c677a;
}

.po-section-block:last-child {
  margin-bottom: 0;
}

.po-section-title-bar:not(.po-stock-section) {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #000000;
  padding: 0.5rem 0.55rem 0.42rem;
  border-bottom: none;
}

.po-section-block:not(:first-child) .po-section-title-bar:not(.po-stock-section) {
  padding-top: 0.5rem;
  margin-top: 0.2in;
  border-top: none;
}

/* Takeoff: section blocks shrink to the table so title bars end at the table edge */
.takeoff-panel .po-section-block {
  width: max-content;
  min-width: 0;
}

/* Takeoff: section title sticks while its section scrolls (below pinned chrome when active) */
.takeoff-panel .po-section-title-bar {
  position: sticky;
  top: var(--takeoff-pin-sections-top, 0px);
  z-index: 7;
}

/* Takeoff: column heads stack directly under the sticky section title */
.takeoff-panel .po-pdf tr.po-col-head th {
  top: calc(var(--takeoff-pin-sections-top, 0px) + var(--takeoff-section-title-h, 2.45rem));
}

/* Sticky only works when the sections wrap is not a scroll container; JS adds
   this class whenever the tables fit without horizontal scrolling */
body.app-shell .po-sections-scroll.hscroll-wrap.takeoff-sections-static {
  overflow-x: visible;
}

.po-section-title-bar.po-stock-section {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 0.15rem 0.35rem;
  border-bottom: 2px solid var(--green);
  color: var(--green);
  background: var(--surface);
}

.po-stock-select-hint {
  margin: 0 0 0.5rem;
  padding: 0 0.15rem;
}

.po-stock-select-table .col-use {
  width: 3.25rem;
  text-align: right;
}

.stock-use-all-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  white-space: nowrap;
}

.stock-use-all-label input {
  width: auto;
  margin: 0;
}

/* Collapsed stock spools — only the title bar stays */
.po-stock-select-block.po-stock-collapsed .po-stock-select-hint,
.po-stock-select-block.po-stock-collapsed .po-stock-select-table {
  display: none;
}

.po-stock-select-table .col-location {
  min-width: 8rem;
}

.po-pdf tr.po-section-title td {
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface);
  padding-top: calc(0.65rem + 0.25in);
  padding-bottom: 0.4rem;
  border-color: var(--po-grid, #2a2a2a);
}

.po-pdf tr.po-section-title:first-child td {
  border-top-color: var(--po-grid, #2a2a2a);
}

/* PO — flat supplier document grid */
.po-pdf.sheet-table {
  --po-grid: #8a9aab;
  --po-warn-fg: #78350f;
  --po-warn-bg: #fffbeb;
  --po-warn-border: #d97706;
  --po-warn-line: #fcd34d;
  table-layout: auto;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  border: 1px solid var(--po-grid);
  border-radius: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  --po-col-head-sticky-h: 1.65rem;
}

.po-pdf.sheet-table th,
.po-pdf.sheet-table td {
  border: 1px solid var(--po-grid);
  border-radius: 0;
  box-shadow: none;
  padding: 0.42rem 0.45rem;
  overflow: visible;
}

.po-pdf.sheet-table th:first-child,
.po-pdf.sheet-table td:first-child,
.po-pdf.sheet-table th:last-child,
.po-pdf.sheet-table td:last-child {
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.po-pdf.sheet-table th.num,
.po-pdf.sheet-table td.num {
  text-align: center;
}

.po-pdf.sheet-table th {
  border-bottom: 1px solid var(--po-grid);
}

.po-pdf thead tr.po-col-head th,
.po-pdf tr.po-col-head th,
.po-pdf tr.po-col-head td {
  position: sticky;
  top: 0;
  z-index: 6;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: center;
  color: #1a1a1a;
  background: #eef1f4;
  padding: 0.45rem 0.45rem;
  vertical-align: middle;
  border-bottom: 2px solid #8a9aab;
  box-shadow: none;
}

/* Purchase order — column headers distinct from wire row colors */
#purchaseOrder .po-pdf thead tr.po-col-head th,
#purchaseOrder .po-pdf tr.po-col-head th,
#purchaseOrder .po-pdf tr.po-col-head td {
  color: #e8ecf0;
  background: #434c5e;
  border-color: #5c677a;
  border-bottom-color: #5c677a;
}

#purchaseOrder .po-pdf.po-sort-wire-type thead tr.po-col-head th.col-size {
  color: #e8ecf0;
}

.po-pdf tr.po-data-row td {
  vertical-align: middle;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

.po-pdf tr.po-data-row td.col-size,
.po-pdf tr.po-data-row td.col-color,
.po-pdf tr.po-data-row td.col-labels {
  text-align: left;
}

.po-pdf thead tr.po-col-head th.col-size,
.po-pdf thead tr.po-col-head th.col-color,
.po-pdf thead tr.po-col-head th.col-labels {
  text-align: left;
}

.po-pdf tr.po-data-row td.col-length {
  overflow: visible;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  white-space: nowrap;
  text-align: center;
}

.po-pdf tr.po-data-row td.col-length .po-length-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.po-pdf thead tr.po-col-head th.col-size,
.po-pdf thead tr.po-col-head th.col-color,
.po-pdf thead tr.po-col-head th.col-spool,
.po-pdf thead tr.po-col-head th.col-length,
.po-pdf thead tr.po-col-head th.col-used,
.po-pdf tr.po-data-row td.col-size,
.po-pdf tr.po-data-row td.col-color,
.po-pdf tr.po-data-row td.col-spool,
.po-pdf tr.po-data-row td.col-length,
.po-pdf tr.po-data-row td.col-used {
  width: 1%;
  white-space: nowrap;
}

.po-pdf thead tr.po-col-head th.col-labels,
.po-pdf tr.po-data-row td.col-labels {
  width: auto;
}

.po-pdf thead tr.po-col-head th.col-size,
.po-pdf tr.po-data-row td.col-size {
  text-align: left;
}

.po-pdf thead tr.po-col-head th.col-color,
.po-pdf tr.po-data-row td.col-color {
  text-align: left;
}

.po-pdf thead tr.po-col-head th.col-labels,
.po-pdf tr.po-data-row td.col-labels {
  text-align: left;
}

.po-pdf tr.po-data-row td.col-length.num {
  text-align: center;
}

.po-pdf tr.po-data-row td.col-size {
  font-weight: 600;
  white-space: nowrap;
}

.po-pdf tr.po-data-row td.col-color {
  font-weight: 600;
  white-space: nowrap;
}

.po-pdf tr.po-data-row td.col-spool {
  font-variant-numeric: tabular-nums;
}

.po-pdf tr.po-data-row td.col-labels {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
  font-size: inherit;
  word-break: break-word;
  vertical-align: middle;
}

.po-pdf tr.po-stock-row td.col-size,
.po-pdf tr.po-stock-row td.col-labels {
  vertical-align: middle;
}

.po-stock-select-table td {
  vertical-align: middle;
}

.po-stock-select-table td.col-use {
  text-align: center;
}

/* Wire takeoff table — readable report spacing (overrides generic po-pdf compact cells) */
.takeoff-pdf.po-pdf.sheet-table th,
.takeoff-pdf.po-pdf.sheet-table td {
  padding: 0.45rem 0.5rem;
}

.takeoff-pdf.po-pdf.sheet-table th:first-child,
.takeoff-pdf.po-pdf.sheet-table td:first-child {
  padding-left: 0.55rem;
}

.takeoff-pdf.po-pdf.sheet-table th:last-child,
.takeoff-pdf.po-pdf.sheet-table td:last-child {
  padding-right: 0.55rem;
}

.takeoff-pdf.po-pdf.sheet-table thead tr.po-col-head th.col-length,
.takeoff-pdf.po-pdf.sheet-table tr.po-data-row td.col-length,
.takeoff-pdf.po-pdf.sheet-table tr.po-data-row td.col-length.num {
  text-align: right;
}

.takeoff-pdf.po-pdf.sheet-table td.col-type,
.takeoff-pdf.po-pdf.sheet-table td.col-material {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Wire rows — subtle flat color tint across full row */
.po-pdf tr.po-data-row[class*="po-wire-"] td {
  --po-wire: var(--po-grid);
  --po-wire-bg: color-mix(in srgb, var(--po-wire) 22%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: var(--po-wire);
  border-color: var(--po-grid);
  background: var(--po-wire-bg) !important;
  color: var(--po-wire-fg);
}

.po-pdf tr.po-data-row.po-wire-black td {
  --po-wire: #64748b;
  --po-wire-bg: color-mix(in srgb, #334155 18%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #cbd5e1;
}

.po-pdf tr.po-data-row.po-wire-brown td {
  --po-wire: #c2410c;
  --po-wire-bg: color-mix(in srgb, #c2410c 16%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #fdba74;
}

.po-pdf tr.po-data-row.po-wire-orange td {
  --po-wire: #ea580c;
  --po-wire-bg: color-mix(in srgb, #ea580c 16%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #fdba74;
}

.po-pdf tr.po-data-row.po-wire-yellow td {
  --po-wire: #ca8a04;
  --po-wire-bg: color-mix(in srgb, #eab308 18%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #854d0e;
}

.po-pdf tr.po-data-row.po-wire-red td {
  --po-wire: #dc2626;
  --po-wire-bg: color-mix(in srgb, #dc2626 14%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #fca5a5;
}

.po-pdf tr.po-data-row.po-wire-blue td {
  --po-wire: #2563eb;
  --po-wire-bg: color-mix(in srgb, #2563eb 14%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #93c5fd;
}

.po-pdf tr.po-data-row.po-wire-white td,
.po-pdf tr.po-stock-row.po-wire-white td {
  --po-wire: #64748b;
  --po-wire-bg: #ffffff;
  --po-wire-fg: #111827;
  --po-wire-label: #374151;
  color: var(--po-wire-fg);
  border-color: #c5cad0;
}

.po-pdf tr.po-data-row.po-wire-gray td,
.po-pdf tr.po-stock-row.po-wire-gray td {
  --po-wire: #94a3b8;
  --po-wire-bg: color-mix(in srgb, #e2e8f0 35%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #cbd5e1;
}

.po-pdf tr.po-data-row.po-wire-green td {
  --po-wire: #16a34a;
  --po-wire-bg: color-mix(in srgb, #16a34a 14%, var(--surface));
  --po-wire-fg: var(--text);
  --po-wire-label: #86efac;
}

.po-pdf tr.po-data-row[class*="po-wire-"] td.col-color {
  color: var(--po-wire-label);
  font-weight: 700;
  background: var(--po-wire-bg) !important;
}

.po-pdf tr.po-data-row[class*="po-wire-"] td.col-size {
  font-weight: 600;
}

.takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-type,
.takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-material,
.takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-length strong {
  color: var(--po-wire-fg);
}

.po-pdf tr.po-data-row[class*="po-wire-"] td.col-spool strong,
.po-pdf tr.po-data-row[class*="po-wire-"] td.col-length strong {
  color: var(--po-wire-fg);
}

/* Order length inputs keep light text on dark input bg regardless of wire row color */
.po-pdf .po-length-input {
  color: var(--text);
}

.po-pdf tr.po-data-row.po-wire-white td.col-color .tag.white {
  background: #d1d5db;
  color: #111827;
  border: 1px solid #9ca3af;
}

.po-pdf tr.po-data-row.po-wire-yellow td .po-length-warn,
.po-pdf tr.po-data-row.po-wire-white td .po-length-warn {
  color: #b45309;
}

.po-pdf tr.po-stock-section td {
  color: var(--green);
  background: var(--surface);
}

.po-pdf tr.po-stock-row td {
  background: var(--surface);
  color: var(--text);
  border-color: var(--po-grid, #2a2a2a);
}

.po-pdf tr.po-stock-row[class*="po-wire-"] td {
  --po-wire-bg: color-mix(in srgb, var(--po-wire, var(--po-grid)) 18%, var(--surface));
  background: var(--po-wire-bg) !important;
  color: var(--po-wire-fg, var(--text));
}

.po-pdf tr.po-stock-row[class*="po-wire-"] td:first-child {
  border-left: 1px solid var(--po-grid, #3a4554);
  box-shadow: none;
}

.po-pdf tr.po-stock-row td.col-size {
  white-space: normal;
}

/* Legacy po-sheet aliases */
.po-sheet .col-wire { width: 16%; }
.po-sheet .col-size { width: 16%; }
.po-sheet .col-color { width: 9%; }
.po-sheet .col-spool { width: 7%; }
.po-sheet .col-order,
.po-sheet .col-length { width: 14%; }
.po-sheet .col-used { width: 8%; }
.po-sheet .col-panels,
.po-sheet .col-labels { width: 46%; }

/* Cost breakdown column widths */
.cost-sheet .col-item { width: 46%; }
.cost-sheet .col-length { width: 14%; }
.cost-sheet .col-unit { width: 14%; }
.cost-sheet .col-extended { width: 14%; }

.cost-sheet .col-item {
  white-space: normal;
  word-break: break-word;
}

.sheet-table .col-item-detail {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: normal;
  line-height: 1.35;
}

.sheet-table tfoot td {
  border-top: 1px solid var(--border);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  padding-top: 0.48rem;
  padding-bottom: 0.48rem;
}

.sheet-table tfoot tr:first-child td {
  border-top: 2px solid var(--border);
  padding-top: 0.6rem;
}

.sheet-table tfoot tr:last-child td {
  font-weight: 700;
  font-size: 1.11rem;
  border-top: 2px solid var(--border);
}

.sheet-table tfoot td.num {
  text-align: center;
}

.po-option {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.po-option input {
  width: 4.75rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
}

.po-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.wire-takeoff-by-color {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.takeoff-color-group {
  width: fit-content;
  max-width: 100%;
}

.takeoff-color-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}

.takeoff-color-group .wire-takeoff-list {
  margin-top: 0;
  padding-left: 0.25rem;
}

.takeoff-color-group .takeoff-row:last-child {
  border-bottom: none;
}

.wire-takeoff-list {
  width: fit-content;
  max-width: 100%;
  margin-top: 0.5rem;
}

/* Legacy takeoff-option — toolbar now uses po-option */
.takeoff-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.takeoff-option input {
  cursor: pointer;
}

.takeoff-option input[type="number"] {
  width: 4.75rem;
  padding: 0.18rem 0.35rem;
  font-size: 0.78rem;
  cursor: text;
}

.takeoff-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  gap: 1.25rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.takeoff-row:last-child {
  border-bottom: none;
}

.takeoff-wire {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.takeoff-ft {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.po-table {
  width: 100%;
  font-size: 0.82rem;
}

.po-table td:last-child {
  white-space: normal;
  min-width: 220px;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

.tag.stock { background: #2a4a3a; color: var(--green); }
.tag.black { background: #333; color: #ccc; }
.tag.brown { background: #4a3020; color: #ddb892; }
.tag.orange { background: #5a3818; color: #ffcc88; }
.tag.yellow { background: #4a4418; color: #ffe566; }
.tag.red { background: #4a2020; color: #ffaaaa; }
.tag.blue { background: #1a3050; color: #aaccff; }
.tag.white { background: #444; color: #eee; }
.tag.gray, .tag.grey { background: #3a3a3a; color: #ccc; }
.tag.green { background: #1a3a28; color: #8feca8; }

tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  padding-top: 0.6rem;
}

.table-wrap tbody input,
.table-wrap tbody select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  position: relative;
  z-index: 1;
}

.table-wrap tbody input:focus,
.table-wrap tbody select:focus {
  outline: none;
  border-color: var(--focus-border);
  background: var(--input-focus-bg, #0a121c);
  box-shadow:
    0 0 0 2px var(--focus-glow),
    0 0 0 4px var(--focus-glow-outer);
}

.runs-table-wrap input[type="text"],
.runs-table-wrap input[type="number"],
.runs-table-wrap select {
  font-size: 0.86rem;
  padding: 0.38rem 0.45rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
}

.runs-table-wrap input[type="text"]:focus,
.runs-table-wrap input[type="number"]:focus,
.runs-table-wrap select:focus {
  outline: none;
  border-color: var(--focus-border);
  background: var(--input-focus-bg, #0a121c);
  box-shadow:
    0 0 0 2px var(--focus-glow),
    0 0 0 4px var(--focus-glow-outer);
}

.runs-table-wrap tbody tr.row-selected input:not(:focus),
.runs-table-wrap tbody tr.row-selected select:not(:focus) {
  border-color: #8a7348;
}

.runs-table-wrap input[type="number"] { width: auto; }

.input-unit-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  max-width: 100%;
}

.input-unit-suffix {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
  user-select: none;
}

.runs-table-wrap td.load-cell .input-unit-wrap,
.schedule-table-wrap td.load-cell .input-unit-wrap {
  vertical-align: middle;
}

.schedule-table-wrap td.load-cell {
  overflow: visible;
}

/* Static feeder-runs print table — screen hidden until print */
#runsPrintHost {
  display: none;
}

/* Feeder sheet — center controls; size from min-width, not clipped cells */
#runsTable tbody td {
  text-align: center;
  vertical-align: middle;
  overflow: visible;
}

#runsTable tbody td.panel-cell {
  text-align: left;
  vertical-align: top;
}

.runs-table-wrap tbody td input[type="text"]:not([data-field="panel"]),
.runs-table-wrap tbody td input[type="number"],
.runs-table-wrap tbody td select {
  display: inline-block;
  width: auto;
  max-width: none;
  margin-inline: auto;
  vertical-align: middle;
  text-align: center;
  box-sizing: border-box;
}

.runs-table-wrap tbody td input[data-field="panel"] {
  display: block;
  width: 100%;
  max-width: none;
  text-align: left;
}

.runs-table-wrap tbody td input[type="checkbox"] {
  display: inline-block;
  margin-inline: auto;
  vertical-align: middle;
}

.runs-table-wrap tbody td.vd-cell {
  text-align: center;
}

.runs-table-wrap tbody td .btn {
  vertical-align: middle;
}

.runs-table-wrap td.panel-cell { min-width: 13rem; }
.runs-table-wrap input[data-field="panel"] { min-width: 0; width: 100%; max-width: none; }

.runs-table-wrap,
.runs-sticky-mirror {
  --runs-group-panel: color-mix(in srgb, var(--blue) 24%, #1a2332);
  --runs-group-identity: color-mix(in srgb, var(--blue) 10%, #222a38);
  --runs-group-input: color-mix(in srgb, var(--green) 9%, #222a38);
  --runs-group-results: color-mix(in srgb, #7eb8ff 8%, #222a38);
  --runs-group-layout: color-mix(in srgb, var(--primary) 7%, #222a38);
  --runs-group-actions: color-mix(in srgb, #8ea3b8 20%, #1c2430);
  --runs-group-divider: color-mix(in srgb, var(--border-row) 72%, transparent);
}

body.theme-light .runs-table-wrap,
body.theme-light .runs-sticky-mirror {
  --runs-group-panel: color-mix(in srgb, var(--blue) 18%, #e8eef6);
  --runs-group-identity: color-mix(in srgb, var(--blue) 12%, #2c3a50);
  --runs-group-input: color-mix(in srgb, var(--green) 11%, #2c3a50);
  --runs-group-results: color-mix(in srgb, #7eb8ff 10%, #2c3a50);
  --runs-group-layout: color-mix(in srgb, var(--primary) 9%, #2c3a50);
  --runs-group-actions: color-mix(in srgb, #6b7f96 16%, #e4e9f0);
}

/* Feeder runs — grouped headers, sticky name column */
#runsTable {
  --runs-group-header-h: 0;
  width: max-content;
  min-width: 100%;
  /* Shared column floors — th + td use the same min-width so controls are not clipped */
  --col-phases: 5.25rem;
  --col-voltage: 5.5rem;
  --col-breaker: 5.75rem;
  --col-load: 5.75rem;
  --col-wireMax: 4.25rem;
  --col-length: 6.25rem;
  --col-vd: 4.25rem;
  --col-derate: 7.75rem;
  --col-ambient: 7.5rem;
  --col-wire: 6.75rem;
  --col-material: 4.5rem;
  --col-parallel: 4rem;
  --col-hot: 7.75rem;
  --col-neutralFlag: 4.25rem;
  --col-downsize: 4.75rem;
  --col-neutral: 7.75rem;
  --col-cuGround: 4.5rem;
  --col-sdsSecondary: 4.5rem;
  --col-inRoomPanel: 4.5rem;
  --col-ground: 7.75rem;
  --col-conduitType: 7.25rem;
  --col-conduitCount: 5.75rem;
  --col-parPerRaceway: 6.25rem;
  --col-conduitSize: 9.25rem;
  --col-autoBtn: 8.75rem;
  --col-overrideBtn: 4.75rem;
  --col-dupBtn: 4.75rem;
  --col-delete: 6.75rem;
  --col-continuous: 2.75rem;
  /* Novice scan cues — softer zebra on wide sheet */
  --runs-row-odd: color-mix(in srgb, var(--surface) 78%, var(--bg));
  --runs-row-even: color-mix(in srgb, var(--surface-2) 78%, #1a2230);
  --runs-row-hover: color-mix(in srgb, var(--primary) 14%, var(--surface-2));
  --runs-panel-odd: color-mix(in srgb, var(--blue) 16%, var(--runs-row-odd));
  --runs-panel-even: color-mix(in srgb, var(--blue) 16%, var(--runs-row-even));
  --runs-panel-hover: color-mix(in srgb, var(--blue) 22%, var(--runs-row-hover));
  --runs-actions-odd: color-mix(in srgb, #8ea3b8 14%, var(--runs-row-odd));
  --runs-actions-even: color-mix(in srgb, #8ea3b8 14%, var(--runs-row-even));
  --runs-actions-hover: color-mix(in srgb, #8ea3b8 20%, var(--runs-row-hover));
}

body.theme-light #runsTable {
  --runs-row-odd: var(--row-odd);
  --runs-row-even: var(--row-even);
  --runs-row-hover: color-mix(in srgb, var(--primary) 12%, #ffffff);
  --runs-panel-odd: color-mix(in srgb, var(--blue) 12%, var(--runs-row-odd));
  --runs-panel-even: color-mix(in srgb, var(--blue) 12%, var(--runs-row-even));
  --runs-panel-hover: color-mix(in srgb, var(--blue) 18%, var(--runs-row-hover));
  --runs-actions-odd: color-mix(in srgb, #6b7f96 10%, var(--runs-row-odd));
  --runs-actions-even: color-mix(in srgb, #6b7f96 10%, var(--runs-row-even));
  --runs-actions-hover: color-mix(in srgb, #6b7f96 16%, var(--runs-row-hover));
}

#runsTable thead .runs-col-labels th,
.runs-sticky-mirror thead .runs-col-labels th {
  position: sticky;
  top: var(--runs-group-header-h);
  z-index: 6;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.45rem 0.4rem;
  white-space: normal;
  vertical-align: middle;
  text-align: center;
  overflow: visible;
  background: #222a38;
  color: #c5d2e0;
  box-shadow: inset 0 -1px 0 var(--border);
  border-right: 1px solid var(--runs-group-divider);
  text-transform: none;
  letter-spacing: normal;
}

.runs-sticky-mirror thead .runs-col-labels th {
  position: static;
  top: auto;
}

#runsTable thead .runs-col-labels th .runs-col-head-stack,
.runs-sticky-mirror thead .runs-col-labels th .runs-col-head-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  width: 100%;
  min-height: 0;
}

/* Shared stacked column headers (schedule, etc.) */
.app-col-head-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  width: 100%;
  min-height: 0;
  line-height: 1.25;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.app-col-head-main,
.app-col-head-sub {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  white-space: nowrap;
}

#runsTable thead .runs-col-labels th[data-col="phases"],
#runsTable tbody td[data-col="phases"] { min-width: var(--col-phases); }
#runsTable thead .runs-col-labels th[data-col="voltage"],
#runsTable tbody td[data-col="voltage"] { min-width: var(--col-voltage); }
#runsTable thead .runs-col-labels th[data-col="breaker"],
#runsTable tbody td[data-col="breaker"] { min-width: var(--col-breaker); }
#runsTable thead .runs-col-labels th[data-col="load"],
#runsTable tbody td[data-col="load"] { min-width: var(--col-load); }
#runsTable thead .runs-col-labels th[data-col="wireMax"],
#runsTable tbody td[data-col="wireMax"] { min-width: var(--col-wireMax); }
#runsTable thead .runs-col-labels th[data-col="length"],
#runsTable tbody td[data-col="length"] { min-width: var(--col-length); }
#runsTable thead .runs-col-labels th[data-col="vd"],
#runsTable tbody td[data-col="vd"] { min-width: var(--col-vd); }
#runsTable thead .runs-col-labels th[data-col="derate"],
#runsTable tbody td[data-col="derate"] { min-width: var(--col-derate); }
#runsTable thead .runs-col-labels th[data-col="ambient"],
#runsTable tbody td[data-col="ambient"] { min-width: var(--col-ambient); }
#runsTable thead .runs-col-labels th[data-col="wire"],
#runsTable tbody td[data-col="wire"] { min-width: var(--col-wire); }
#runsTable thead .runs-col-labels th[data-col="material"],
#runsTable tbody td[data-col="material"] { min-width: var(--col-material); }
#runsTable thead .runs-col-labels th[data-col="parallel"],
#runsTable tbody td[data-col="parallel"] { min-width: var(--col-parallel); }
#runsTable thead .runs-col-labels th[data-col="hot"],
#runsTable tbody td[data-col="hot"] { min-width: var(--col-hot); }
#runsTable thead .runs-col-labels th[data-col="neutralFlag"],
#runsTable tbody td[data-col="neutralFlag"] { min-width: var(--col-neutralFlag); }
#runsTable thead .runs-col-labels th[data-col="downsize"],
#runsTable tbody td[data-col="downsize"] { min-width: var(--col-downsize); }
#runsTable thead .runs-col-labels th[data-col="neutral"],
#runsTable tbody td[data-col="neutral"] { min-width: var(--col-neutral); }
#runsTable thead .runs-col-labels th[data-col="cuGround"],
#runsTable tbody td[data-col="cuGround"] { min-width: var(--col-cuGround); }
#runsTable thead .runs-col-labels th[data-col="sdsSecondary"],
#runsTable tbody td[data-col="sdsSecondary"] { min-width: var(--col-sdsSecondary); }
#runsTable thead .runs-col-labels th[data-col="inRoomPanel"],
#runsTable tbody td[data-col="inRoomPanel"] { min-width: var(--col-inRoomPanel); }
#runsTable thead .runs-col-labels th[data-col="ground"],
#runsTable tbody td[data-col="ground"] { min-width: var(--col-ground); }
#runsTable thead .runs-col-labels th[data-col="conduitType"],
#runsTable tbody td[data-col="conduitType"] { min-width: var(--col-conduitType); }
#runsTable thead .runs-col-labels th[data-col="conduitCount"],
#runsTable tbody td[data-col="conduitCount"] { min-width: var(--col-conduitCount); }
#runsTable thead .runs-col-labels th[data-col="parPerRaceway"],
#runsTable tbody td[data-col="parPerRaceway"] { min-width: var(--col-parPerRaceway); }
#runsTable thead .runs-col-labels th[data-col="conduitSize"],
#runsTable tbody td[data-col="conduitSize"] { min-width: var(--col-conduitSize); }
#runsTable thead .runs-col-labels th[data-col="autoBtn"],
#runsTable tbody td[data-col="autoBtn"] { min-width: var(--col-autoBtn); }
#runsTable thead .runs-col-labels th[data-col="overrideBtn"],
#runsTable tbody td[data-col="overrideBtn"] { min-width: var(--col-overrideBtn); }
#runsTable thead .runs-col-labels th[data-col="dupBtn"],
#runsTable tbody td[data-col="dupBtn"] { min-width: var(--col-dupBtn); }
#runsTable thead .runs-col-labels th[data-col="delete"],
#runsTable tbody td[data-col="delete"] { min-width: var(--col-delete); }
#runsTable thead .runs-col-labels th[data-col="continuous"],
#runsTable tbody td[data-col="continuous"] { min-width: var(--col-continuous); }

#runsTable thead .runs-col-labels th[data-col="panel"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="panel"] {
  background: var(--runs-group-panel);
}

#runsTable thead .runs-col-labels th[data-col="phases"],
#runsTable thead .runs-col-labels th[data-col="voltage"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="phases"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="voltage"] {
  background: var(--runs-group-identity);
}

#runsTable thead .runs-col-labels th[data-col="breaker"],
#runsTable thead .runs-col-labels th[data-col="load"],
#runsTable thead .runs-col-labels th[data-col="continuous"],
#runsTable thead .runs-col-labels th[data-col="length"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="breaker"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="load"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="continuous"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="length"] {
  background: var(--runs-group-input);
}

#runsTable thead .runs-col-labels th[data-col="vd"],
#runsTable thead .runs-col-labels th[data-col="wireMax"],
#runsTable thead .runs-col-labels th[data-col="derate"],
#runsTable thead .runs-col-labels th[data-col="wire"],
#runsTable thead .runs-col-labels th[data-col="material"],
#runsTable thead .runs-col-labels th[data-col="parallel"],
#runsTable thead .runs-col-labels th[data-col="hot"],
#runsTable thead .runs-col-labels th[data-col="neutralFlag"],
#runsTable thead .runs-col-labels th[data-col="downsize"],
#runsTable thead .runs-col-labels th[data-col="neutral"],
#runsTable thead .runs-col-labels th[data-col="cuGround"],
#runsTable thead .runs-col-labels th[data-col="sdsSecondary"],
#runsTable thead .runs-col-labels th[data-col="inRoomPanel"],
#runsTable thead .runs-col-labels th[data-col="ground"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="vd"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="wireMax"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="derate"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="wire"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="material"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="parallel"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="hot"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="neutralFlag"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="downsize"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="neutral"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="cuGround"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="sdsSecondary"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="inRoomPanel"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="ground"] {
  background: var(--runs-group-results);
}

#runsTable thead .runs-col-labels th[data-col="conduitType"],
#runsTable thead .runs-col-labels th[data-col="conduitCount"],
#runsTable thead .runs-col-labels th[data-col="parPerRaceway"],
#runsTable thead .runs-col-labels th[data-col="conduitSize"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="conduitType"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="conduitCount"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="parPerRaceway"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="conduitSize"] {
  background: var(--runs-group-layout);
}

#runsTable thead .runs-col-labels th[data-col="autoBtn"],
#runsTable thead .runs-col-labels th[data-col="overrideBtn"],
#runsTable thead .runs-col-labels th[data-col="dupBtn"],
#runsTable thead .runs-col-labels th[data-col="delete"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="autoBtn"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="overrideBtn"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="dupBtn"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="delete"] {
  background: var(--runs-group-actions);
}

#runsTable tbody td[data-col="breaker"],
#runsTable tbody td[data-col="vd"],
#runsTable tbody td[data-col="conduitType"],
#runsTable tbody td[data-col="autoBtn"] {
  border-left: 1px solid var(--runs-group-divider);
}

#runsTable thead .runs-col-labels th[data-col="overrideBtn"],
#runsTable tbody td[data-col="overrideBtn"],
#runsTable thead .runs-col-labels th[data-col="dupBtn"],
#runsTable tbody td[data-col="dupBtn"],
#runsTable thead .runs-col-labels th[data-col="delete"],
#runsTable tbody td[data-col="delete"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="overrideBtn"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="dupBtn"],
.runs-sticky-mirror thead .runs-col-labels th[data-col="delete"] {
  border-left: 1px solid var(--runs-group-divider);
}

#runsTable thead .runs-col-labels th[data-col="panel"] {
  position: sticky;
  left: 0;
  z-index: 9;
  box-shadow: none;
  min-width: 13rem;
}

.runs-sticky-mirror thead .runs-col-labels th[data-col="panel"] {
  min-width: 13rem;
}

/* Horizontal zebra — full-width row bands (no vertical column tints) */
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) {
  background: var(--runs-row-odd);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) {
  background: var(--runs-row-even);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td {
  background: var(--runs-row-odd);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td {
  background: var(--runs-row-even);
}

/* Pinned panel name (left) and action columns (right) — distinct from the scrollable middle */
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="panel"] {
  background: var(--runs-panel-odd);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="panel"] {
  background: var(--runs-panel-even);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="autoBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="overrideBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="dupBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(odd):not(.row-override-mode):not(.row-selected) td[data-col="delete"] {
  background: var(--runs-actions-odd);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="autoBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="overrideBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="dupBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:nth-child(even):not(.row-override-mode):not(.row-selected) td[data-col="delete"] {
  background: var(--runs-actions-even);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) {
  background: var(--runs-row-hover);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td {
  background: var(--runs-row-hover);
  color: var(--text);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="panel"] {
  background: var(--runs-panel-hover);
}

.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="autoBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="overrideBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="dupBtn"],
.runs-table-wrap #runsTable.selectable-rows tbody tr:hover:not(.row-selected):not(.row-override-mode) td[data-col="delete"] {
  background: var(--runs-actions-hover);
}

.runs-table-wrap #runsTable tbody tr:not(.row-override-mode):not(.row-selected) td[data-col="hot"] {
  font-weight: 600;
}

#runsTable tbody td[data-col="panel"] {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: none;
}

#runsTable tbody tr.row-selected td {
  background: #243044;
}

#runsTable tbody tr.row-selected td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 16%, #243044);
}

#runsTable tbody tr.row-selected td[data-col="autoBtn"],
#runsTable tbody tr.row-selected td[data-col="overrideBtn"],
#runsTable tbody tr.row-selected td[data-col="dupBtn"],
#runsTable tbody tr.row-selected td[data-col="delete"] {
  background: color-mix(in srgb, #8ea3b8 14%, #243044);
}

#runsTable tbody tr.row-selected:hover td {
  background: #283548;
}

#runsTable tbody tr.row-selected:hover td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 18%, #283548);
}

#runsTable tbody tr.row-selected:hover td[data-col="autoBtn"],
#runsTable tbody tr.row-selected:hover td[data-col="overrideBtn"],
#runsTable tbody tr.row-selected:hover td[data-col="dupBtn"],
#runsTable tbody tr.row-selected:hover td[data-col="delete"] {
  background: color-mix(in srgb, #8ea3b8 16%, #283548);
}

#runsTable tbody tr.row-override-mode td {
  background: #3d3520;
}

#runsTable tbody tr.row-override-mode td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 12%, #3d3520);
}

#runsTable tbody tr.row-override-mode td[data-col="autoBtn"],
#runsTable tbody tr.row-override-mode td[data-col="overrideBtn"],
#runsTable tbody tr.row-override-mode td[data-col="dupBtn"],
#runsTable tbody tr.row-override-mode td[data-col="delete"] {
  background: color-mix(in srgb, #8ea3b8 10%, #3d3520);
}

#runsTable tbody tr.row-override-mode:hover td,
#runsTable tbody tr.row-override-mode.row-selected td {
  background: #453c24;
}

#runsTable tbody tr.row-override-mode:hover td[data-col="panel"],
#runsTable tbody tr.row-override-mode.row-selected td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 14%, #453c24);
}

#runsTable tbody tr.row-override-mode:hover td[data-col="autoBtn"],
#runsTable tbody tr.row-override-mode:hover td[data-col="overrideBtn"],
#runsTable tbody tr.row-override-mode:hover td[data-col="dupBtn"],
#runsTable tbody tr.row-override-mode:hover td[data-col="delete"],
#runsTable tbody tr.row-override-mode.row-selected td[data-col="autoBtn"],
#runsTable tbody tr.row-override-mode.row-selected td[data-col="overrideBtn"],
#runsTable tbody tr.row-override-mode.row-selected td[data-col="dupBtn"],
#runsTable tbody tr.row-override-mode.row-selected td[data-col="delete"] {
  background: color-mix(in srgb, #8ea3b8 12%, #453c24);
}

body.theme-light #runsTable tbody tr.row-selected td {
  background: #d9e6f6;
}

body.theme-light #runsTable tbody tr.row-selected td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 14%, #d9e6f6);
}

body.theme-light #runsTable tbody tr.row-selected td[data-col="autoBtn"],
body.theme-light #runsTable tbody tr.row-selected td[data-col="overrideBtn"],
body.theme-light #runsTable tbody tr.row-selected td[data-col="dupBtn"],
body.theme-light #runsTable tbody tr.row-selected td[data-col="delete"] {
  background: color-mix(in srgb, #6b7f96 10%, #d9e6f6);
}

body.theme-light #runsTable tbody tr.row-selected:hover td {
  background: #cdddf1;
}

body.theme-light #runsTable tbody tr.row-selected:hover td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 16%, #cdddf1);
}

body.theme-light #runsTable tbody tr.row-selected:hover td[data-col="autoBtn"],
body.theme-light #runsTable tbody tr.row-selected:hover td[data-col="overrideBtn"],
body.theme-light #runsTable tbody tr.row-selected:hover td[data-col="dupBtn"],
body.theme-light #runsTable tbody tr.row-selected:hover td[data-col="delete"] {
  background: color-mix(in srgb, #6b7f96 12%, #cdddf1);
}

body.theme-light #runsTable tbody tr.row-override-mode td {
  background: #f5edd0;
}

body.theme-light #runsTable tbody tr.row-override-mode td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 10%, #f5edd0);
}

body.theme-light #runsTable tbody tr.row-override-mode td[data-col="autoBtn"],
body.theme-light #runsTable tbody tr.row-override-mode td[data-col="overrideBtn"],
body.theme-light #runsTable tbody tr.row-override-mode td[data-col="dupBtn"],
body.theme-light #runsTable tbody tr.row-override-mode td[data-col="delete"] {
  background: color-mix(in srgb, #6b7f96 8%, #f5edd0);
}

body.theme-light #runsTable tbody tr.row-override-mode:hover td,
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td {
  background: #efe4ba;
}

body.theme-light #runsTable tbody tr.row-override-mode:hover td[data-col="panel"],
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td[data-col="panel"] {
  background: color-mix(in srgb, var(--blue) 12%, #efe4ba);
}

body.theme-light #runsTable tbody tr.row-override-mode:hover td[data-col="autoBtn"],
body.theme-light #runsTable tbody tr.row-override-mode:hover td[data-col="overrideBtn"],
body.theme-light #runsTable tbody tr.row-override-mode:hover td[data-col="dupBtn"],
body.theme-light #runsTable tbody tr.row-override-mode:hover td[data-col="delete"],
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td[data-col="autoBtn"],
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td[data-col="overrideBtn"],
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td[data-col="dupBtn"],
body.theme-light #runsTable tbody tr.row-override-mode.row-selected td[data-col="delete"] {
  background: color-mix(in srgb, #6b7f96 10%, #efe4ba);
}

/* Sticky panel column right-edge shadow — ::after avoids box-shadow fights with label inset borders */
#runsTable thead .runs-col-labels th[data-col="panel"],
#runsTable tbody td[data-col="panel"] {
  overflow: visible;
}

#runsTable thead .runs-col-labels th[data-col="panel"]::after,
#runsTable tbody td[data-col="panel"]::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  transform: translateX(100%);
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.22), transparent);
}

.runs-scroll-host.is-scrolled-x #runsTable thead .runs-col-labels th[data-col="panel"]::after,
.runs-scroll-host.is-scrolled-x #runsTable tbody td[data-col="panel"]::after {
  opacity: 1;
}

.runs-scroll-host.is-scrolled-x #runsTable tbody td[data-col="panel"] {
  z-index: 4;
}

/* Fixed mirror — page scroll + overflow-x on host prevents native thead top sticky */
.runs-sticky-mirror {
  position: fixed;
  top: 0;
  z-index: 24;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.runs-sticky-mirror[hidden] {
  display: none !important;
}

.runs-sticky-mirror-scroll {
  will-change: transform;
}

.runs-sticky-mirror table {
  margin: 0;
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.runs-sticky-mirror thead th {
  position: static;
  top: auto;
  left: auto;
}

.runs-sticky-mirror thead .runs-col-labels th[data-col="panel"] {
  position: relative;
  overflow: visible;
}

.runs-sticky-mirror thead .runs-col-labels th[data-col="panel"]::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  transform: translateX(100%);
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.22), transparent);
}

.runs-sticky-mirror.is-scrolled-x thead .runs-col-labels th[data-col="panel"]::after {
  opacity: 1;
}

/* Pinned mirror — Name + action headers stay visible; middle columns scroll */
.runs-sticky-mirror-pinned {
  overflow: hidden;
}

.runs-sticky-mirror-pinned-head {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 100%;
}

.runs-sticky-mirror-rail {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.runs-sticky-mirror-rail-left {
  flex-shrink: 0;
  border-right: 1px solid var(--runs-group-divider);
  box-shadow: 4px 0 8px rgba(0, 0, 0, 0.18);
  z-index: 2;
  background: var(--runs-group-identity);
}

.runs-sticky-mirror-rail-right {
  flex-shrink: 0;
  border-left: 1px solid var(--runs-group-divider);
  box-shadow: -6px 0 10px rgba(0, 0, 0, 0.22);
  z-index: 2;
  background: var(--runs-group-actions);
}

.runs-sticky-mirror-mid-scrolled .runs-sticky-mirror-rail-right {
  box-shadow: -8px 0 12px rgba(0, 0, 0, 0.28);
}

.runs-sticky-mirror-rail-mid {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  background: #222a38;
}

.runs-sticky-mirror-mid-inner {
  will-change: transform;
  height: 100%;
}

.runs-sticky-mirror-pinned table {
  margin: 0;
  height: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.runs-sticky-mirror-rail-left table,
.runs-sticky-mirror-rail-right table {
  width: 100%;
  min-width: 0;
}

.runs-sticky-mirror-rail-mid table {
  width: max-content;
  min-width: 100%;
}

.runs-sticky-mirror-pinned thead,
.runs-sticky-mirror-pinned thead tr {
  height: 100%;
}

.runs-sticky-mirror-pinned thead th {
  position: static;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  vertical-align: middle;
  box-shadow: inset 0 -1px 0 var(--border);
}

.runs-sticky-mirror-pinned thead .runs-col-labels th[data-col="panel"] {
  background: var(--runs-group-panel);
  text-align: left;
}

.runs-sticky-mirror-pinned thead .runs-col-labels th[data-col="autoBtn"],
.runs-sticky-mirror-pinned thead .runs-col-labels th[data-col="overrideBtn"],
.runs-sticky-mirror-pinned thead .runs-col-labels th[data-col="dupBtn"],
.runs-sticky-mirror-pinned thead .runs-col-labels th[data-col="delete"] {
  background: var(--runs-group-actions);
}

#runsTable tbody tr.run-cable-wire td.runs-cable-na {
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
}

body[data-job-mixed-voltage="true"] #runsTable tbody tr.run-voltage-480-highlight td,
body[data-job-mixed-voltage="true"] #scheduleTable tbody tr.run-voltage-480-highlight td {
  box-shadow: inset 3px 0 0 #c2410c;
}

body[data-job-mixed-voltage="true"] #runsTable tbody tr.run-voltage-480-highlight:nth-child(odd):not(.row-selected):not(.row-override-mode) td,
body[data-job-mixed-voltage="true"] #scheduleTable tbody tr.run-voltage-480-highlight:nth-child(odd):not(.row-selected) td {
  background: color-mix(in srgb, #c2410c 10%, var(--row-odd));
}

body[data-job-mixed-voltage="true"] #runsTable tbody tr.run-voltage-480-highlight:nth-child(even):not(.row-selected):not(.row-override-mode) td,
body[data-job-mixed-voltage="true"] #scheduleTable tbody tr.run-voltage-480-highlight:nth-child(even):not(.row-selected) td {
  background: color-mix(in srgb, #c2410c 10%, var(--row-even));
}

body[data-job-mixed-voltage="true"] .takeoff-pdf tr.run-voltage-480-highlight td,
body[data-job-mixed-voltage="true"] .po-pdf tr.run-voltage-480-highlight td {
  outline: 1px solid color-mix(in srgb, #c2410c 45%, transparent);
  outline-offset: -1px;
}

.runs-sticky-mirror-pinned .runs-col-head-stack {
  justify-content: center;
}

.runs-table-wrap tbody td.load-exceeds-breaker input[data-field="actualLoad"],
.schedule-table-wrap tbody td.load-exceeds-breaker input[data-field="actualLoad"],
.schedule-table-wrap tbody td.load-exceeds-breaker {
  background: rgba(220, 53, 69, 0.12);
  box-shadow: inset 0 0 0 1px rgba(220, 53, 69, 0.45);
}

.runs-table-wrap td.load-cell {
  vertical-align: middle;
  text-align: center;
  overflow: visible;
}

.runs-table-wrap tbody td[data-col="breaker"] .input-unit-wrap input[data-field="breaker"],
.runs-table-wrap tbody td.load-cell .input-unit-wrap input[data-field="actualLoad"],
.runs-table-wrap tbody td[data-col="length"] .input-unit-wrap input[data-field="length"] {
  min-width: 4.75rem;
  width: 4.75rem;
  max-width: none;
}

.runs-table-wrap tbody td input[data-field="breaker"] {
  min-width: 4.75rem;
  width: 4.75rem;
  max-width: none;
}

.wire-max-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.86rem;
  padding: 0.38rem 0.5rem;
  line-height: 1.2;
}

.wire-max-cell .wire-max-val {
  display: block;
}

.wire-max-cell .wire-max-unit {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.runs-table-wrap tbody td input[data-field="length"] {
  min-width: 3.25rem;
  width: 3.25rem;
  max-width: none;
}

.ambient-select {
  min-width: 6.5rem;
  width: 100%;
  max-width: 7.5rem;
  font-size: 0.66rem;
  padding-inline: 0.15rem;
  text-align: center;
}

.project-ambient-wrap select#ambientTempUnit {
  min-width: 2.75rem;
  width: auto;
  font-size: 0.78rem;
  padding-inline: 0.2rem;
}

.project-ambient-wrap input#defaultAmbient {
  min-width: 3.5rem;
  width: 3.5rem;
}

.runs-table-wrap tbody td input[data-field="parallel"] {
  min-width: 3.5rem;
  width: 3.5rem;
  max-width: none;
}

.runs-table-wrap tbody td select[data-field="phases"] {
  min-width: 5rem;
  width: 5rem;
  max-width: none;
}

.runs-table-wrap tbody td select[data-field="voltage"] {
  min-width: 5.25rem;
  width: 5.25rem;
  max-width: none;
}

.runs-table-wrap tbody tr.row-override-mode {
  background: #fff9e6;
}

.runs-table-wrap tbody tr.row-override-mode td {
  color: #1a2430;
}

.runs-table-wrap tbody tr.row-override-mode:hover td,
.runs-table-wrap tbody tr.row-override-mode.row-selected td,
.runs-table-wrap tbody tr.row-override-mode.row-selected:hover td {
  color: #1a2430;
}

.runs-table-wrap tbody tr.row-override-mode td.vd-cell {
  color: #1a2430;
  font-weight: 600;
}

.runs-table-wrap tbody tr.row-override-mode td.vd-cell.vd-warn {
  color: #9a5b00;
}

.runs-table-wrap tbody tr.row-override-mode td.vd-cell.vd-high,
.runs-table-wrap tbody tr.row-override-mode td.vd-cell.nec-invalid {
  color: #b91c1c;
}

.runs-table-wrap tbody tr.row-override-mode.row-selected {
  background: #fff3cc;
}

.runs-table-wrap tbody tr.row-override-mode.row-selected input:not(:focus),
.runs-table-wrap tbody tr.row-override-mode.row-selected select:not(:focus) {
  border-color: #c9a227;
}

.runs-table-wrap .btn-override-row.active {
  background: #c9a227;
  border-color: #a8861e;
  color: #1a1200;
  font-weight: 600;
}

.runs-table-wrap .btn-override-row {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.runs-table-wrap input.nec-invalid {
  color: var(--red);
  border-color: #c44;
  font-weight: 600;
}

.runs-table-wrap td.vd-cell.nec-invalid {
  color: var(--red);
  font-weight: 700;
}

.runs-table-wrap select.nec-invalid {
  color: var(--red);
  border-color: #c44;
  font-weight: 600;
}

.runs-table-wrap select[data-field="phaseSize"] option.wire-undersized,
.schedule-table-wrap select[data-field="phaseSize"] option.wire-undersized {
  color: var(--red, #f87171);
}

.runs-table-wrap select[data-field="phaseSize"] option.wire-nec-min,
.schedule-table-wrap select[data-field="phaseSize"] option.wire-nec-min {
  color: var(--green, #4ade80);
  font-weight: 600;
}

.runs-table-toolbar-secondary .allow-240b-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.runs-table-toolbar-secondary .allow-240b-toggle input {
  margin: 0;
  cursor: pointer;
}

.runs-table-toolbar-secondary .runs-toolbar-ambient[hidden] {
  display: none !important;
}

.runs-table-toolbar-secondary .runs-toolbar-ambient {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.runs-table-toolbar-secondary .runs-toolbar-ambient-label {
  flex-shrink: 0;
}

.runs-table-toolbar-secondary .project-ambient-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.runs-table-toolbar-secondary .project-ambient-wrap input#defaultAmbient {
  min-width: 3rem;
  width: 3rem;
  font-size: 0.78rem;
  padding-inline: 0.25rem;
}

.runs-table-toolbar-secondary .project-ambient-wrap select#ambientTempUnit {
  min-width: 2.5rem;
  width: auto;
  font-size: 0.78rem;
  padding-inline: 0.15rem;
}

.hot-wire-cell {
  vertical-align: middle;
}

.hot-wire-cell .hot-wire-controls {
  margin-bottom: 0.2rem;
}

.full-amp-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.full-amp-check input {
  margin: 0;
  cursor: pointer;
}

.full-amp-note {
  display: block;
  font-size: 0.65rem;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
}

.full-amp-note-on {
  color: var(--green);
}

.runs-table-wrap .field-manual,
.runs-table-wrap select.field-manual,
.runs-table-wrap input.field-manual {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.runs-table-wrap .btn-auto-row,
.runs-table-wrap .btn-dup-row {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.runs-table-wrap tbody td[data-col="delete"] {
  padding: 0.35rem 0.45rem;
  text-align: center;
  vertical-align: middle;
}

.runs-table-wrap tbody td[data-col="delete"] .btn-danger {
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#runsTable tbody td.runs-auto-col,
.runs-sticky-mirror tbody td.runs-auto-col {
  vertical-align: middle;
  white-space: nowrap;
}

.runs-auto-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

/* No Full Amp buttons anywhere on the sheet — the Auto column hugs the Auto button */
#runsTable.runs-auto-compact {
  --col-autoBtn: 4rem;
}

.runs-table-wrap .btn-full-amp {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 4.75rem;
}

.runs-table-wrap .btn-full-amp.active {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.vd-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.86rem;
  padding: 0.38rem 0.5rem;
  line-height: 1.2;
}

.runs-table-wrap .vd-cell {
  text-align: center;
}

.vd-cell .vd-pct {
  display: block;
}

.vd-cell .vd-volts {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.runs-table-wrap tbody tr.row-override-mode td.vd-cell .vd-volts {
  color: #4a5568;
}
.vd-warn { color: var(--warning); font-weight: 600; }
.vd-high { color: var(--red); font-weight: 600; }

/* Panel schedule — review mode */
.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

#scheduleReviewBtn.active {
  background: var(--primary);
  border-color: var(--accent);
  color: #0f1419;
  font-weight: 600;
}

.schedule-review-summary {
  margin: 0;
  flex: 1;
  min-width: 12rem;
}

.schedule-review-summary .schedule-review-critical-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  text-underline-offset: 2px;
}

.schedule-review-summary .schedule-review-critical-link:hover,
.schedule-review-summary .schedule-review-critical-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  outline: none;
}

@keyframes schedule-review-scroll-flash {
  0%, 100% {
    background-color: transparent;
  }
  20%, 60% {
    background-color: color-mix(in srgb, var(--accent) 28%, transparent);
  }
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-data.schedule-review-scroll-flash td {
  animation: schedule-review-scroll-flash 1.2s ease-out;
}

.schedule-review-abbrev-key {
  margin: 0.35rem 0 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.8rem;
  line-height: 1.4;
}

.schedule-review-abbrev-key summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.schedule-review-abbrev-key[open] summary {
  margin-bottom: 0.45rem;
}

.schedule-abbrev-section {
  margin: 0.55rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.schedule-abbrev-section:first-child {
  margin-top: 0;
}

.schedule-abbrev-grid dl {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  gap: 0.2rem 0.85rem;
  margin: 0 0 0.35rem;
}

.schedule-abbrev-grid dt {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.schedule-abbrev-grid dd {
  margin: 0;
  color: var(--text);
}

#scheduleTable:not(.schedule-review-active) .schedule-review-col {
  display: none;
}

#scheduleTable:not(.schedule-editing-active) .schedule-edit-col {
  display: none;
}

#scheduleTable.schedule-review-active .schedule-edit-col {
  display: none;
}

.schedule-review-col {
  text-align: center;
  white-space: nowrap;
}

#scheduleTable.schedule-review-active .schedule-review-col .btn-auto-row {
  min-width: 2.6rem;
  margin-left: 0.25rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

#scheduleTable.schedule-review-active .schedule-review-col .btn-review-delete {
  min-width: 2rem;
  margin-left: 0.25rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

#scheduleTable.schedule-review-active .schedule-review-col .btn-full-amp {
  min-width: 4.75rem;
  margin-left: 0.25rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

#scheduleTable.schedule-review-active .schedule-review-col .btn-full-amp.active {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-data td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-note-row td {
  white-space: normal;
  border-bottom: none;
  padding: 0 0.75rem 0.55rem;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-note-row + tr.schedule-review-data td,
#scheduleTable.schedule-review-active tbody tr.schedule-review-data:first-child td {
  padding-top: 0.65rem;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-note-row:last-child td {
  padding-bottom: 0.85rem;
}

.schedule-review-note {
  font-size: 0.82rem;
  line-height: 1.45;
}

.schedule-review-note-line + .schedule-review-note-line {
  margin-top: 0.45rem;
}

.schedule-review-note-row.schedule-review-note-ok .schedule-review-note {
  color: #8fd99a;
}

.schedule-review-note-row.schedule-review-note-reviewed .schedule-review-note {
  color: #9de0a8;
}

.schedule-review-note-row.schedule-review-note-warn .schedule-review-note {
  color: #fcd34d;
}

.schedule-review-note-row.schedule-review-note-error .schedule-review-note {
  color: #ffb4b4;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-data + tr.schedule-review-note-row td {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-note-row td {
  border-bottom: 0.75rem solid transparent;
  background: rgba(0, 0, 0, 0.18);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-warn-row td {
  background: rgba(245, 158, 11, 0.22);
  border-top: 1px solid rgba(252, 211, 77, 0.55);
  border-bottom: 1px solid rgba(252, 211, 77, 0.55);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-warn-row td:first-child {
  box-shadow: inset 5px 0 0 #f59e0b;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-issue td {
  background: rgba(255, 45, 45, 0.32);
  border-top: 1px solid rgba(255, 90, 90, 0.65);
  border-bottom: 1px solid rgba(255, 90, 90, 0.65);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-issue td:first-child {
  box-shadow: inset 5px 0 0 #ff1a1a;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-issue:hover td {
  background: rgba(255, 45, 45, 0.42);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-reviewed td {
  background: rgba(46, 200, 80, 0.22);
  border-top: 1px solid rgba(80, 220, 110, 0.45);
  border-bottom: 1px solid rgba(80, 220, 110, 0.45);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-clean td {
  background: rgba(46, 200, 80, 0.2);
  border-top: 1px solid rgba(80, 220, 110, 0.45);
  border-bottom: 1px solid rgba(80, 220, 110, 0.45);
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-clean td:first-child {
  box-shadow: inset 5px 0 0 #2ea043;
}

#scheduleTable.schedule-review-active tbody tr.schedule-review-clean:hover td {
  background: rgba(46, 200, 80, 0.28);
}

#scheduleTable.schedule-review-active td.schedule-review-flag {
  background: #ff1a1a !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: inset 0 0 0 2px #ff8080, 0 0 10px rgba(255, 30, 30, 0.55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

#scheduleTable.schedule-review-active td.schedule-review-flag.vd-cell .vd-pct,
#scheduleTable.schedule-review-active td.schedule-review-flag.vd-cell .vd-volts {
  color: #fff !important;
}

#scheduleTable.schedule-review-active td.schedule-review-warn {
  background: #f59e0b !important;
  color: #1a1000 !important;
  font-weight: 800;
  box-shadow: inset 0 0 0 2px #fcd34d, 0 0 8px rgba(245, 158, 11, 0.45);
}

.btn-review-row {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

.btn-review-row.reviewed {
  background: #2ea043;
  border-color: #2ea043;
  color: #fff;
}

.schedule-edit-col {
  text-align: center;
  white-space: nowrap;
}

#scheduleTable tbody tr.schedule-row-editing .btn-auto-row {
  min-width: 3rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
}

#scheduleTable.schedule-review-active tbody tr.schedule-row-editing.schedule-review-clean td {
  background: rgba(46, 220, 90, 0.38) !important;
  box-shadow: inset 0 0 0 2px #2ea043;
}

#scheduleTable.schedule-review-active tbody tr.schedule-row-editing.schedule-review-issue td {
  box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.75);
}

#scheduleTable.schedule-review-active tbody tr.schedule-row-editing td.schedule-review-flag,
#scheduleTable.schedule-review-active tbody tr.schedule-row-editing td.schedule-review-warn {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

#scheduleTable tbody tr.schedule-row-editing input,
#scheduleTable tbody tr.schedule-row-editing select {
  display: inline-block;
  width: auto;
  max-width: none;
  margin-inline: auto;
  vertical-align: middle;
  text-align: center;
  font-size: inherit;
  box-sizing: border-box;
}

.schedule-table-wrap tbody td input[data-field="panel"] {
  display: block;
  width: 100%;
  max-width: none;
  text-align: left;
}

.schedule-table-wrap tbody td select[data-field="phaseSize"],
.schedule-table-wrap tbody td select[data-field="neutralSize"],
.schedule-table-wrap tbody td select[data-field="groundSize"] { min-width: 6.75rem; }

.schedule-table-wrap tbody td select.derate-select { min-width: 6.75rem; font-size: 0.84rem; }

.schedule-table-wrap tbody td select[data-field="wireType"] { min-width: 6.25rem; }

.schedule-table-wrap tbody td select[data-field="material"] { min-width: 3.75rem; }

.schedule-table-wrap tbody td select[data-field="phases"] { min-width: 5rem; }

.schedule-table-wrap tbody td select[data-field="voltage"] { min-width: 5.25rem; }

.schedule-table-wrap tbody td input[data-field="breaker"],
.schedule-table-wrap tbody td input[data-field="actualLoad"],
.schedule-table-wrap tbody td input[data-field="length"] { min-width: 4.75rem; }

.schedule-table-wrap tbody td input[data-field="parallel"] { min-width: 4rem; }

#scheduleTable tbody tr.schedule-row-editing td.schedule-review-flag input,
#scheduleTable tbody tr.schedule-row-editing td.schedule-review-flag select,
#scheduleTable tbody tr.schedule-row-editing td.schedule-review-warn input,
#scheduleTable tbody tr.schedule-row-editing td.schedule-review-warn select {
  background: #fff;
  color: #111;
}

/* Panel schedule — centered layout matching feeder runs */
#scheduleTable {
  width: max-content;
  min-width: 100%;
  --sch-voltage: 5.5rem;
  --sch-panel: 11rem;
  --sch-breaker: 4.75rem;
  --sch-load: 4.75rem;
  --sch-phases: 5rem;
  --sch-length: 4.75rem;
  --sch-vd: 4.5rem;
  --sch-wire: 6.75rem;
  --sch-material: 4.5rem;
  --sch-parallel: 4rem;
  --sch-hot: 7.75rem;
  --sch-derate: 7.75rem;
  --sch-neutral: 7.75rem;
  --sch-ground: 7.75rem;
  --sch-parPerRaceway: 5.25rem;
  --sch-raceway: 12rem;
  --sch-review: 11rem;
}

.schedule-table-wrap #scheduleTable thead th {
  text-transform: none;
  letter-spacing: normal;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.45rem 0.4rem;
  vertical-align: middle;
  overflow: visible;
  background: #222a38;
  color: #c5d2e0;
  box-shadow: inset 0 -1px 0 var(--border);
  white-space: nowrap;
}

.schedule-table-wrap #scheduleTable thead th .app-col-head-stack,
.schedule-table-wrap #scheduleTable thead th .app-col-head-main,
.schedule-table-wrap #scheduleTable thead th .app-col-head-sub {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

.report-table { font-size: 0.88rem; }
.report-table thead th { font-size: 0.76rem; font-weight: 600; text-transform: none; letter-spacing: normal; }
.report-table td, .report-table th { white-space: nowrap; }

.schedule-table-wrap #scheduleTable tbody td {
  text-align: center;
  vertical-align: middle;
  overflow: visible;
  padding: 0.45rem 0.4rem;
}

.schedule-table-wrap #scheduleTable thead th[data-col="panel"],
.schedule-table-wrap #scheduleTable tbody td[data-col="panel"] {
  text-align: left;
  min-width: var(--sch-panel);
}

.schedule-table-wrap #scheduleTable thead th[data-col="voltage"],
.schedule-table-wrap #scheduleTable tbody td[data-col="voltage"] { min-width: var(--sch-voltage); }
.schedule-table-wrap #scheduleTable thead th[data-col="breaker"],
.schedule-table-wrap #scheduleTable tbody td[data-col="breaker"] { min-width: var(--sch-breaker); font-weight: 600; }
.schedule-table-wrap #scheduleTable thead th[data-col="load"],
.schedule-table-wrap #scheduleTable tbody td[data-col="load"] { min-width: var(--sch-load); }
.schedule-table-wrap #scheduleTable thead th[data-col="phases"],
.schedule-table-wrap #scheduleTable tbody td[data-col="phases"] { min-width: var(--sch-phases); }
.schedule-table-wrap #scheduleTable thead th[data-col="length"],
.schedule-table-wrap #scheduleTable tbody td[data-col="length"] { min-width: var(--sch-length); }
.schedule-table-wrap #scheduleTable thead th[data-col="vd"],
.schedule-table-wrap #scheduleTable tbody td[data-col="vd"] { min-width: var(--sch-vd); }
.schedule-table-wrap #scheduleTable thead th[data-col="wire"],
.schedule-table-wrap #scheduleTable tbody td[data-col="wire"] { min-width: var(--sch-wire); }
.schedule-table-wrap #scheduleTable thead th[data-col="material"],
.schedule-table-wrap #scheduleTable tbody td[data-col="material"] { min-width: var(--sch-material); }
.schedule-table-wrap #scheduleTable thead th[data-col="parallel"],
.schedule-table-wrap #scheduleTable tbody td[data-col="parallel"] { min-width: var(--sch-parallel); }
.schedule-table-wrap #scheduleTable thead th[data-col="hot"],
.schedule-table-wrap #scheduleTable tbody td[data-col="hot"] { min-width: var(--sch-hot); }
.schedule-table-wrap #scheduleTable thead th[data-col="derate"],
.schedule-table-wrap #scheduleTable tbody td[data-col="derate"] { min-width: var(--sch-derate); }
.schedule-table-wrap #scheduleTable thead th[data-col="neutral"],
.schedule-table-wrap #scheduleTable tbody td[data-col="neutral"] { min-width: var(--sch-neutral); }
.schedule-table-wrap #scheduleTable thead th[data-col="ground"],
.schedule-table-wrap #scheduleTable tbody td[data-col="ground"] { min-width: var(--sch-ground); }
.schedule-table-wrap #scheduleTable thead th[data-col="parPerRaceway"],
.schedule-table-wrap #scheduleTable tbody td[data-col="parPerRaceway"] { min-width: var(--sch-parPerRaceway); }
.schedule-table-wrap #scheduleTable thead th[data-col="raceway"],
.schedule-table-wrap #scheduleTable tbody td[data-col="raceway"] { min-width: var(--sch-raceway); }

.schedule-raceway-box {
  display: inline-block;
  max-width: 100%;
  padding: 0.2rem 0.45rem;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  font-size: 0.84rem;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
}
.schedule-table-wrap #scheduleTable thead th[data-col="review"],
.schedule-table-wrap #scheduleTable tbody td.schedule-review-col { min-width: var(--sch-review); }

.schedule-table-wrap #scheduleTable tbody td.vd-cell {
  text-align: center;
}

.schedule-table-wrap #scheduleTable tbody td[data-col="panel"] {
  font-weight: 600;
}

/* Stock wire table */
#stockTable {
  width: max-content;
  min-width: 100%;
  --stock-size: 7rem;
  --stock-material: 5rem;
  --stock-color: 8rem;
  --stock-length: 6.5rem;
  --stock-location: 8rem;
  --stock-delete: 3.5rem;
}

.stock-table-wrap #stockTable thead th {
  text-transform: none;
  letter-spacing: normal;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.45rem 0.4rem;
  vertical-align: middle;
  background: #222a38;
  box-shadow: inset 0 -1px 0 var(--border);
}

.stock-table-wrap #stockTable tbody td {
  text-align: center;
  vertical-align: middle;
  overflow: visible;
  padding: 0.45rem 0.4rem;
}

.stock-table-wrap #stockTable tbody tr.stock-row-odd:not(.row-selected),
.stock-table-wrap #stockTable tbody tr.stock-row-odd:not(.row-selected) td {
  background: var(--row-odd);
}

.stock-table-wrap #stockTable tbody tr.stock-row-even:not(.row-selected),
.stock-table-wrap #stockTable tbody tr.stock-row-even:not(.row-selected) td {
  background: var(--row-even);
}

.stock-table-wrap #stockTable thead th[data-col="size"],
.stock-table-wrap #stockTable tbody td[data-col="size"] { min-width: var(--stock-size); }
.stock-table-wrap #stockTable thead th[data-col="material"],
.stock-table-wrap #stockTable tbody td[data-col="material"] { min-width: var(--stock-material); }
.stock-table-wrap #stockTable thead th[data-col="color"],
.stock-table-wrap #stockTable tbody td[data-col="color"] { min-width: var(--stock-color); }
.stock-table-wrap #stockTable thead th[data-col="length"],
.stock-table-wrap #stockTable tbody td[data-col="length"] { min-width: var(--stock-length); }
.stock-table-wrap #stockTable thead th[data-col="location"],
.stock-table-wrap #stockTable tbody td[data-col="location"] { min-width: var(--stock-location); }
.stock-table-wrap #stockTable thead th[data-col="status"],
.stock-table-wrap #stockTable tbody td[data-col="status"] { min-width: 9rem; }
.stock-table-wrap #stockTable thead th[data-col="dup"],
.stock-table-wrap #stockTable tbody td[data-col="dup"] { min-width: var(--stock-delete); }
.stock-table-wrap #stockTable thead th[data-col="delete"],
.stock-table-wrap #stockTable tbody td[data-col="delete"] { min-width: var(--stock-delete); }

.stock-table-wrap tbody td select,
.stock-table-wrap tbody td input[type="number"] {
  display: inline-block;
  width: auto;
  max-width: none;
  margin-inline: auto;
  vertical-align: middle;
  text-align: center;
  box-sizing: border-box;
}

.stock-table-wrap tbody td select[data-field="size"] { min-width: 6.5rem; }
.stock-table-wrap tbody td select[data-field="material"] { min-width: 4.5rem; }
.stock-table-wrap tbody td select[data-field="color"] { min-width: 7.5rem; }
.stock-table-wrap tbody td input[data-field="length"] { min-width: 5.5rem; }
.stock-table-wrap tbody td input[data-field="location"] {
  min-width: 7rem;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.45rem;
}

.stock-table-wrap tbody td .btn {
  vertical-align: middle;
}

/* Company-stock reservation status pills */
.stock-status {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.3;
}

button.stock-status {
  cursor: pointer;
}

button.stock-status:hover {
  filter: brightness(1.25);
}

.stock-status-available {
  background: rgba(46, 160, 67, 0.16);
  color: #4caf6d;
  border: 1px solid rgba(46, 160, 67, 0.45);
}

.stock-status-mine {
  background: rgba(56, 139, 253, 0.15);
  color: #6aa6ff;
  border: 1px solid rgba(56, 139, 253, 0.45);
}

.stock-status-other {
  background: rgba(139, 148, 158, 0.14);
  color: #9aa4b2;
  border: 1px solid rgba(139, 148, 158, 0.4);
}

/* Print-only plain-text values for stock rows */
#stockTable .stock-print-text {
  display: none;
}

/* Cost breakdown tab */
.cost-table-wrap .cost-sheet thead th {
  text-transform: none;
  letter-spacing: normal;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  vertical-align: middle;
  background: #222a38;
  color: #c5d2e0;
  box-shadow: inset 0 -1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 6;
}

.cost-table-wrap .cost-sheet thead th[data-col="item"] {
  text-align: left;
}

.cost-table-wrap .cost-sheet tbody td {
  text-align: center;
  vertical-align: middle;
  padding: 0.45rem 0.5rem;
}

.cost-table-wrap .cost-sheet tbody td[data-col="item"] {
  text-align: left;
}

.cost-table-wrap .cost-sheet th.num,
.cost-table-wrap .cost-sheet td.num {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cost-table-wrap .cost-sheet tfoot td {
  text-align: center;
}

.cost-table-wrap .cost-sheet tfoot td:first-child {
  text-align: left;
}

.cost-table-wrap .cost-sheet tfoot td.num {
  text-align: center;
}

/* Wire / Conduit section header rows — stick just below the column header */
.cost-table-wrap .cost-sheet tbody .cost-section-row {
  position: sticky;
  top: var(--cost-thead-h, 30px);
  z-index: 5;
}

.cost-table-wrap .cost-sheet tbody .cost-section-row td {
  background: var(--primary);
  color: #14181f;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
  text-align: center;
  padding: 0.34rem 0.5rem;
  border-top: 1px solid var(--border);
}

/* Open space between the Wire and Conduit sections — reads as page background, not table */
.cost-table-wrap .cost-sheet tbody .cost-section-gap td {
  height: 0.75in;
  background: var(--bg);
  border: 0;
  padding: 0;
}

/* Wire size/type sub-header rows (per-spool view) — a clear break between groups */
.cost-table-wrap .cost-sheet tbody .cost-subhead-row td {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
  text-align: left;
  padding: 0.34rem 0.5rem;
  border-top: 2px solid var(--border);
}

.cost-table-wrap .cost-sheet tbody .cost-subhead-row + tr td {
  border-top: 0;
}

/* Totals follow you down the page — host must not be a scroll container for sticky to work */
body.app-shell .cost-table-wrap {
  overflow: visible;
}

#costTable tfoot {
  position: sticky;
  bottom: 0;
  z-index: 4;
}

/* One solid compact block — collapsed borders don't travel with sticky cells,
   so separators are drawn with the cells via box-shadow instead */
#costTable tfoot td {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-top: 0;
  border-bottom: 0;
  padding-top: 0.22rem;
  padding-bottom: 0.22rem;
}

#costTable tfoot tr:first-child td {
  border-top: 0;
  padding-top: 0.3rem;
  box-shadow: 0 -1px 0 var(--border), 0 -6px 12px rgba(0, 0, 0, 0.35);
}

#costTable tfoot tr:last-child td {
  border-top: 0;
  font-size: 1rem;
  padding-bottom: 0.3rem;
  box-shadow: inset 0 1px 0 var(--border);
}

.takeoff-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.5rem 0 0.25rem;
}

.print-report-header {
  display: none;
}

@media print {
  @page {
    margin: 0.5in 0.5in 0.7in 0.5in;

    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
      font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
      font-size: 8pt;
      color: #444;
    }
  }

  @page runs-landscape {
    size: landscape;
    margin: 0.25in 0.2in;
  }

  html, body {
    height: auto;
    min-height: 0;
    background: #fff !important;
    color: #000 !important;
    print-color-adjust: economy;
    -webkit-print-color-adjust: economy;
  }

  body.app-shell {
    display: block;
    min-height: 0;
  }

  body[data-print-view="runs"] {
    page: runs-landscape;
  }

  * {
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-report-header {
    display: block !important;
    margin: 0 0 0.45rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #000;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  .print-section-header {
    page-break-before: auto;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  .print-report-title {
    margin: 0 0 0.15rem;
    font-size: 14pt;
    font-weight: 800;
    color: #000;
    line-height: 1.25;
    letter-spacing: 0.02em;
  }

  .print-report-meta {
    margin: 0;
    font-size: 8pt;
    color: #333;
    line-height: 1.35;
  }

  .app-header,
  .panel-project,
  .work-tabs-bar,
  .work-tabs,
  .header-actions,
  .hscroll-stick,
  .panel-head,
  .panel-head-actions,
  .runs-view-controls,
  .runs-hint,
  .runs-guide,
  .runs-table-toolbar,
  .hint,
  .nec-footnote,
  .column-view-presets,
  .column-custom-control,
  .column-picker-menu,
  .schedule-review-abbrev-key,
  .schedule-review-summary,
  .po-toolbar,
  .po-filter-panel,
  .po-filter-btn,
  .stock-sort-control,
  .po-stock-select-hint,
  .po-over-max-banner,
  .pricing-toolbar,
  #resetPricesBtn,
  .work-view-toolbar,
  .work-print-btn,
  .work-export-btn,
  .btn,
  #stockPanel .stock-panel-head,
  .stock-panel-hint,
  .nec-ref-modal,
  .po-sticky-mirror,
  .runs-sticky-mirror {
    display: none !important;
  }

  .panel-work {
    border: none;
    box-shadow: none;
    padding: 0;
    background: #fff !important;
  }

  .work-view {
    display: none !important;
  }

  .work-stock-footer,
  #stockPanel {
    display: none !important;
  }

  body[data-print-po-stock="false"] .po-stock-select-block,
  body[data-print-po-stock="false"] .po-stock-block {
    display: none !important;
  }

  /* The takeoff is a needed-materials list — keep the on-screen stock selector
     out of the printed sheet. */
  body[data-print-view="takeoff"] .po-stock-select-block {
    display: none !important;
  }

  /* Full report — all report views except feeder runs and stock editor */
  body:not([data-print-view]) .work-view:not(#work-view-runs):not(#work-view-stock) {
    display: block !important;
  }

  body:not([data-print-view]) .work-stock-footer,
  body:not([data-print-view]) #stockPanel,
  body:not([data-print-view]) #work-view-stock {
    display: none !important;
  }

  body:not([data-print-view]) .work-view + .work-view {
    page-break-before: always;
  }

  body:not([data-print-view]) #work-view-schedule {
    page-break-before: auto;
  }

  body:not([data-print-view]) #work-view-takeoff .takeoff-panel {
    display: block !important;
  }

  /* Full report printed without pricing — drop the cost breakdown section */
  body.print-no-pricing #work-view-cost {
    display: none !important;
  }

  body:not([data-print-view]) #conduitTakeoff {
    page-break-before: always;
    break-before: page;
  }

  body:not([data-print-view]) #wireTakeoff .takeoff-doc-header {
    display: none !important;
  }

  body:not([data-print-view]) #conduitTakeoff .takeoff-doc-header {
    display: block !important;
    margin: 0 0 0.35rem;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  body:not([data-print-view]) #conduitTakeoff .takeoff-doc-title {
    margin: 0 0 0.15rem;
    font-size: 12pt;
    font-weight: 700;
    color: #000 !important;
  }

  body:not([data-print-view]) #conduitTakeoff .takeoff-doc-sub {
    margin: 0;
    font-size: 8pt;
    color: #333 !important;
  }

  body:not([data-print-view]) .po-doc-header {
    display: none !important;
  }

  /* Single-view print */
  body[data-print-view="schedule"] #work-view-schedule,
  body[data-print-view="takeoff"] #work-view-takeoff,
  body[data-print-view="purchase"] #work-view-purchase,
  body[data-print-view="cost"] #work-view-cost,
  body[data-print-view="runs"] #work-view-runs,
  body[data-print-view="stock"] #work-view-stock {
    display: block !important;
    page-break-before: auto;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="wire"] #conduitTakeoff,
  body[data-print-view="takeoff"][data-takeoff-sub="conduit"] #wireTakeoff {
    display: none !important;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] .takeoff-panel {
    display: block !important;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] #conduitTakeoff {
    page-break-before: always;
    break-before: page;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] #wireTakeoff .takeoff-doc-header {
    display: none !important;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] #conduitTakeoff .takeoff-doc-header {
    display: block !important;
    margin: 0 0 0.35rem;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] #conduitTakeoff .takeoff-doc-title {
    margin: 0 0 0.15rem;
    font-size: 12pt;
    font-weight: 700;
    color: #000 !important;
  }

  body[data-print-view="takeoff"][data-takeoff-sub="all"] #conduitTakeoff .takeoff-doc-sub {
    margin: 0;
    font-size: 8pt;
    color: #333 !important;
  }

  body[data-print-view="takeoff"] .takeoff-subtabs,
  body[data-print-view="takeoff"] .takeoff-view-actions,
  body[data-print-view="takeoff"] .takeoff-print-btn {
    display: none !important;
  }

  body[data-print-view="stock"] #work-view-stock {
    display: block !important;
    page-break-before: auto;
  }

  body[data-print-view="stock"] #stockPanel {
    display: block !important;
  }

  .hscroll-host,
  .hscroll-wrap,
  .table-wrap,
  .sheet-wrap,
  .runs-scroll-host,
  .schedule-scroll-host,
  .cost-scroll-host,
  .stock-scroll-host {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }

  .sheet-table,
  .report-table,
  #runsTable,
  #runsPrintTable,
  #scheduleTable,
  #stockTable,
  #costTable,
  #pricingPrintTable {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-collapse: collapse;
    color: #000 !important;
    background: #fff !important;
  }

  table.po-pdf.sheet-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  body[data-print-view="purchase"] .layout,
  body[data-print-view="purchase"] .panel-work,
  body[data-print-view="purchase"] .purchase-order,
  body[data-print-view="purchase"] .po-sections,
  body[data-print-view="purchase"] .po-sections-scroll,
  body[data-print-view="purchase"] .po-section-block {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  body[data-print-view="purchase"] .layout {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .sheet-table th,
  .sheet-table td,
  .report-table th,
  .report-table td,
  #runsTable th,
  #runsTable td,
  #runsPrintTable th,
  #runsPrintTable td,
  #scheduleTable th,
  #scheduleTable td,
  #stockTable th,
  #stockTable td,
  #costTable th,
  #costTable td,
  #pricingPrintTable th,
  #pricingPrintTable td {
    border: 1px solid #666 !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  .sheet-table tbody td,
  .report-table tbody td,
  #runsTable tbody td,
  #runsPrintTable tbody td,
  #scheduleTable tbody td,
  #stockTable tbody td,
  #costTable tbody td,
  #pricingPrintTable tbody td,
  .po-pdf tbody td,
  .takeoff-pdf tbody td {
    background: #fff;
  }

  tr.print-zebra-odd > td,
  tr.print-zebra-odd > th {
    background: #fff !important;
  }

  tr.print-zebra-even > td,
  tr.print-zebra-even > th {
    background: #e9e9e9 !important;
  }

  .sheet-table thead,
  .report-table thead,
  #runsTable thead,
  #runsPrintTable thead,
  #scheduleTable thead,
  #stockTable thead,
  #costTable thead,
  #pricingPrintTable thead {
    display: table-header-group;
  }

  .sheet-table th,
  .report-table th,
  #runsTable thead th,
  #runsPrintTable thead th,
  #scheduleTable thead th,
  #stockTable thead th,
  #costTable thead th,
  #pricingPrintTable thead th,
  tr.po-col-head th,
  tr.po-col-head td {
    background: #e8e8e8 !important;
    color: #000 !important;
    font-weight: 700;
    position: static !important;
  }

  tr.po-subsection-title td {
    background: #d4d4d4 !important;
    color: #000 !important;
    font-weight: 800;
  }

  /* Purchase order print — professional flat document */
  body[data-print-view="purchase"] .po-pdf.sheet-table {
    font-size: 9.5pt;
    line-height: 1.4;
    --po-grid: #888;
  }

  body[data-print-view="purchase"] .po-pdf.sheet-table th,
  body[data-print-view="purchase"] .po-pdf.sheet-table td {
    padding: 0.32rem 0.38rem !important;
    overflow: visible !important;
    vertical-align: middle !important;
  }

  body[data-print-view="purchase"] .po-pdf thead tr.po-col-head th,
  body[data-print-view="purchase"] .po-pdf tr.po-col-head td {
    background: #f0f0f0 !important;
    color: #000 !important;
    font-weight: 600;
    font-size: 8.5pt;
    border-color: #888 !important;
    box-shadow: none !important;
    vertical-align: middle !important;
    text-align: center;
  }

  body[data-print-view="purchase"] .po-pdf thead th.col-size,
  body[data-print-view="purchase"] .po-pdf thead th.col-color,
  body[data-print-view="purchase"] .po-pdf thead th.col-labels,
  body[data-print-view="purchase"] .po-stock-select-table thead th.col-size,
  body[data-print-view="purchase"] .po-stock-select-table thead th.col-location {
    text-align: left;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-row td,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-select-row td {
    vertical-align: middle !important;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-size,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-color,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-labels,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-row td.col-size,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-select-row td.col-size,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-select-row td.col-location {
    text-align: left;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-spool,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-length,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-used,
  body[data-print-view="purchase"] .po-stock-select-table td.col-length,
  body[data-print-view="purchase"] .po-stock-select-table td.col-use,
  body[data-print-view="purchase"] .po-stock-select-table thead th.col-length,
  body[data-print-view="purchase"] .po-stock-select-table thead th.col-use {
    text-align: center;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-subsection-title td,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-section-title td {
    vertical-align: middle !important;
    text-align: left;
  }

  body[data-print-view="purchase"] .po-stock-select-head {
    display: block !important;
  }

  body[data-print-view="purchase"] .po-stock-select-head .stock-sort-control,
  body[data-print-view="purchase"] .po-stock-select-head .po-stock-sort {
    display: none !important;
  }

  /* Collapse chrome never prints — and a collapsed stock list still prints in full */
  .pricing-collapse-btn,
  .stock-use-all-label input {
    display: none !important;
  }

  .po-stock-select-block.po-stock-collapsed .po-stock-select-table {
    display: table !important;
  }

  body[data-print-view="purchase"] .po-pdf .col-size,
  body[data-print-view="purchase"] .po-pdf .col-color,
  body[data-print-view="purchase"] .po-pdf .col-spool,
  body[data-print-view="purchase"] .po-pdf thead th.col-size,
  body[data-print-view="purchase"] .po-pdf thead th.col-color,
  body[data-print-view="purchase"] .po-pdf thead th.col-spool,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-size,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-color,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-spool {
    width: 1%;
    white-space: nowrap;
  }

  /* Order + Used — equal fixed width, plain text (no input chrome) */
  body[data-print-view="purchase"] table.po-pdf col.col-length,
  body[data-print-view="purchase"] table.po-pdf col.col-used,
  body[data-print-view="purchase"] .po-pdf thead th.col-length,
  body[data-print-view="purchase"] .po-pdf thead th.col-used,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-length,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-used {
    width: 4.75rem !important;
    min-width: 4.75rem !important;
    max-width: 4.75rem !important;
    white-space: nowrap;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-length .po-length-cell,
  body[data-print-view="purchase"] .po-pdf .po-length-input,
  body[data-print-view="purchase"] .po-pdf .po-length-warn {
    display: none !important;
  }

  body[data-print-view="purchase"] .po-pdf .po-length-print,
  body[data-print-view="purchase"] .po-pdf td.col-length {
    font-weight: inherit;
    text-align: center !important;
  }

  body[data-print-view="purchase"] .po-pdf .col-labels,
  body[data-print-view="purchase"] .po-pdf thead th.col-labels,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-labels {
    width: auto;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    font-size: inherit;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-length {
    white-space: nowrap;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-length.po-over-max,
  body[data-print-view="purchase"] .po-pdf tr.po-data-row td.col-used.po-over-max {
    font-weight: 600;
  }

  body[data-print-view="purchase"] .po-section-title-bar:not(.po-stock-section) {
    font-size: 11pt !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    color: #ffffff !important;
    background: #000000 !important;
    background-color: #000000 !important;
    border: none !important;
    padding: 0.1in 0.35rem !important;
    margin-top: 0.14in;
    page-break-after: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body[data-print-view="purchase"] .po-section-block:first-child .po-section-title-bar:not(.po-stock-section) {
    margin-top: 0;
  }

  body[data-print-view="purchase"] .po-section-block:not(:first-child) .po-section-title-bar:not(.po-stock-section) {
    padding-top: 0.1in !important;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-subsection-title td {
    font-size: 9.5pt !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    background: #f5f5f5 !important;
    color: #000 !important;
    border-top: 1px solid #888 !important;
    border-bottom: 1px solid #888 !important;
    padding: 0.06in 0.35rem 0.04in !important;
    page-break-after: avoid;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-subsection-title.po-size-group td {
    font-size: 9.5pt !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    background: #9333ea !important;
    background-color: #9333ea !important;
    border-color: #7c22ce !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body[data-print-view="purchase"] .po-spool-gap td,
  body[data-print-view="purchase"] .po-size-group-gap td,
  body[data-print-view="purchase"] .po-color-group-gap td {
    height: 0.2rem;
    padding: 0 !important;
    background: #fff !important;
    border: none !important;
    border-top: 1px solid #ddd !important;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row:not([class*="po-wire-"]) td {
    background: #fff !important;
    color: #111 !important;
  }

  .sheet-table tbody tr,
  .report-table tbody tr,
  #runsTable tbody tr,
  #runsPrintTable tbody tr,
  #stockTable tbody tr,
  #costTable tbody tr,
  #pricingPrintTable tbody tr {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  #scheduleTable tbody tr,
  .takeoff-pdf tbody tr,
  .po-pdf tbody tr {
    page-break-inside: auto;
    break-inside: auto;
  }

  tbody.print-row-group {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  tbody.print-row-group-break {
    page-break-before: auto;
    break-before: auto;
  }

  /* Chrome pushes every break-inside-avoid tbody whose rows don't all fit
     onto a fresh page, stranding huge gaps under tall schedule rows — let
     the schedule groups split and rely on the per-row avoid instead */
  #scheduleTable tbody.print-row-group {
    page-break-inside: auto;
    break-inside: auto;
  }

  #scheduleTable [data-col="schedConduits"] {
    display: table-cell !important;
  }

  tbody.print-row-group tr {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .print-section-chunk {
    margin-bottom: 0.25in;
  }

  .print-section-chunk.print-section-whole {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .print-section-chunk.print-section-splittable {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .print-section-chunk-break {
    page-break-before: auto;
    break-before: auto;
  }

  body[data-print-view="purchase"] .print-section-title-continued,
  body:not([data-print-view]) .print-section-title-continued {
    font-size: 10pt !important;
    opacity: 0.92;
  }

  .takeoff-panel .po-section-block.print-section-whole,
  .po-section-block.print-section-whole {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  body[data-print-view="purchase"] .po-section-block.print-section-splittable,
  body[data-print-view="takeoff"] .po-section-block.print-section-splittable {
    page-break-inside: auto;
    break-inside: auto;
  }

  .takeoff-panel .po-section-block:not(.print-section-splittable):not(.print-section-whole),
  .po-section-block:not(.print-section-splittable):not(.print-section-whole) {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .runs-table-wrap input,
  .runs-table-wrap select,
  .schedule-table-wrap input,
  .schedule-table-wrap select,
  .stock-table-wrap input,
  .stock-table-wrap select,
  .pricing-grid input,
  .report-table input,
  .report-table select,
  #costTable input {
    border: none !important;
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    appearance: auto;
    -webkit-appearance: auto;
  }

  .runs-table-wrap input[type="checkbox"],
  .schedule-table-wrap input[type="checkbox"],
  .stock-table-wrap input[type="checkbox"],
  #runsTable input[type="checkbox"] {
    display: none !important;
  }

  /* Feeder runs print — static #runsPrintTable (interactive #runsTable hidden) */
  body[data-print-view="runs"] #runsScrollHost,
  body[data-print-view="runs"] #runsTable,
  body[data-print-view="runs"] .runs-sticky-mirror,
  body[data-print-view="runs"] .hscroll-stick {
    display: none !important;
  }

  body[data-print-view="runs"] #runsPrintHost {
    display: block !important;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  body[data-print-view="runs"] #runsPrintTable {
    table-layout: fixed;
    font-size: 7pt;
    line-height: 1.25;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body[data-print-view="runs"] #runsPrintTable .runs-print-head-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.12rem;
    line-height: 1.15;
    white-space: normal;
    min-height: 2.1em;
  }

  body[data-print-view="runs"] #runsPrintTable .runs-print-head-main {
    display: block;
    font-size: 7pt;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.015em;
    color: #000 !important;
  }

  body[data-print-view="runs"] #runsPrintTable .runs-print-head-sub {
    display: block;
    font-size: 6pt;
    font-weight: 700;
    line-height: 1.1;
    color: #222 !important;
  }

  body[data-print-view="runs"] #runsPrintTable thead th {
    font-size: 7pt;
    font-weight: 800;
    line-height: 1.15;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    vertical-align: bottom;
    padding: 4px 3px !important;
    background: #ccc !important;
    border-bottom: 2px solid #000 !important;
  }

  body[data-print-view="runs"] #runsPrintTable thead th,
  body[data-print-view="runs"] #runsPrintTable tbody td {
    padding: 2px 3px !important;
    overflow: visible;
    text-overflow: clip;
    vertical-align: middle;
    text-align: center;
    position: static !important;
  }

  body[data-print-view="runs"] #runsPrintTable tbody td {
    white-space: nowrap;
    font-size: 7pt;
  }

  body[data-print-view="runs"] #runsPrintTable thead th[data-col="downsize"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="downsize"] {
    min-width: 2.75rem;
    white-space: nowrap;
  }

  body[data-print-view="runs"] #runsPrintTable thead th[data-col="panel"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="panel"] {
    text-align: left;
    white-space: normal;
    word-break: break-word;
    width: 8%;
  }

  body[data-print-view="runs"] #runsPrintTable thead th[data-col="wire"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="wire"],
  body[data-print-view="runs"] #runsPrintTable thead th[data-col="conduitType"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="conduitType"] {
    white-space: normal;
    word-break: break-word;
  }

  body[data-print-view="runs"] #runsPrintTable thead th[data-col="load"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="load"],
  body[data-print-view="runs"] #runsPrintTable thead th[data-col="wireMax"],
  body[data-print-view="runs"] #runsPrintTable tbody td[data-col="wireMax"] {
    min-width: 3.5rem;
  }

  body[data-print-view="runs"] #runsPrintTable tbody tr {
    page-break-inside: avoid;
  }

  body[data-print-view="runs"] #runsPrintTable tbody tr.print-zebra-odd > td {
    background: #fff !important;
  }

  body[data-print-view="runs"] #runsPrintTable tbody tr.print-zebra-even > td {
    background: #e0e0e0 !important;
  }

  /* Panel schedule print */
  .schedule-table-wrap #scheduleTable thead th,
  body[data-print-view="schedule"] .schedule-table-wrap #scheduleTable thead th,
  body:not([data-print-view]) .schedule-table-wrap #scheduleTable thead th {
    background: #e8e8e8 !important;
    color: #000 !important;
    box-shadow: none !important;
    position: static !important;
  }

  body[data-print-view="schedule"] #scheduleTable {
    font-size: 7.5pt;
    table-layout: fixed;
  }

  body:not([data-print-view]) #scheduleTable {
    font-size: 7.5pt;
    table-layout: fixed;
  }

  body[data-print-view="schedule"] #scheduleTable th,
  body[data-print-view="schedule"] #scheduleTable td,
  body:not([data-print-view]) #scheduleTable th,
  body:not([data-print-view]) #scheduleTable td {
    padding: 0.15rem 0.2rem !important;
    white-space: normal;
    word-break: break-word;
  }

  body[data-print-view="schedule"] .schedule-review-col,
  body[data-print-view="schedule"] .schedule-edit-col,
  body:not([data-print-view]) #scheduleTable .schedule-review-col,
  body:not([data-print-view]) #scheduleTable .schedule-edit-col {
    display: none !important;
  }

  body[data-print-view="schedule"] .schedule-review-note-row td,
  body:not([data-print-view]) #scheduleTable .schedule-review-note-row td {
    background: #f5f5f5 !important;
    font-size: 7pt;
    color: #222 !important;
    border-color: #888 !important;
  }

  /* Stock spools print */
  body[data-print-view="stock"] #stockTable [data-col="dup"],
  body[data-print-view="stock"] #stockTable [data-col="delete"] {
    display: none !important;
  }

  /* Text only — swap the form controls for the plain-text spans */
  #stockTable tbody td select,
  #stockTable tbody td .input-unit-wrap,
  #stockTable tbody td input[data-field="location"] {
    display: none !important;
  }

  /* Drop the dark screen stripes so the plain text prints black-on-white */
  #stockTable tbody tr:not(.stock-section-row):not(.stock-subsection-row),
  #stockTable tbody tr:not(.stock-section-row):not(.stock-subsection-row) td {
    background: #fff !important;
  }

  #stockTable .stock-print-text {
    display: inline !important;
    color: #000 !important;
  }

  /* Column header row (Size / Material / ...) tinted differently from the
     group header rows below it */
  #stockTable thead th {
    background: #c9d6e8 !important;
    color: #000 !important;
  }

  #stockTable tr.stock-section-row td {
    background: #d4d4d4 !important;
    color: #000 !important;
    font-weight: 700;
  }

  #stockTable tbody tr.stock-section-row:not(:first-child) td {
    border-top: 0.5rem solid #fff !important;
  }

  #stockTable tbody tr.stock-subsection-row td {
    background: #f0f0f0 !important;
    color: #222 !important;
    font-weight: 600;
  }

  .po-pdf tr.po-stock-section-title td {
    background: #d4d4d4 !important;
    color: #000 !important;
    font-weight: 700;
  }

  /* Cost breakdown print */
  body:not([data-print-view]) #work-view-cost #costTable tbody,
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #costTable tbody {
    display: none !important;
  }

  body:not([data-print-view]) #work-view-cost .cost-pricing-section,
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) .cost-pricing-section {
    display: none !important;
  }

  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #pricingPrintTable {
    display: none !important;
  }

  body:not([data-print-view]) #work-view-cost #costTable thead th[data-col="unit"],
  body:not([data-print-view]) #work-view-cost #costTable thead th[data-col="length"],
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #costTable thead th[data-col="unit"],
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #costTable thead th[data-col="length"] {
    display: none !important;
  }

  body:not([data-print-view]) #work-view-cost #costTable tfoot td[data-col="length"],
  body:not([data-print-view]) #work-view-cost #costTable tfoot td[data-col="unit"],
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #costTable tfoot td[data-col="length"],
  body[data-print-view="cost"]:not([data-print-cost-detail="true"]) #costTable tfoot td[data-col="unit"] {
    display: none !important;
  }

  /* No sticky totals or headers on paper */
  #costTable tfoot {
    position: static !important;
  }

  #costTable thead th,
  #costTable tbody .cost-section-row {
    position: static !important;
  }

  #costTable tfoot td {
    box-shadow: none !important;
  }

  .cost-sheet .cost-section-row td,
  .cost-sheet .cost-subhead-row td {
    background: #e8e8e8 !important;
    color: #000 !important;
  }

  .cost-sheet .cost-section-gap td {
    background: #fff !important;
    border: 0 !important;
  }

  body[data-print-view="cost"] .cost-pricing-section .panel-head {
    display: block !important;
    margin-bottom: 0.35rem;
    page-break-after: avoid;
  }

  body[data-print-view="cost"] .cost-pricing-section .panel-head-actions,
  body[data-print-view="cost"] #pricingGrid {
    display: none !important;
  }

  body[data-print-view="cost"] .cost-pricing-section h2 {
    margin: 0 0 0.25rem;
    font-size: 11pt;
    font-weight: 700;
    color: #000 !important;
  }

  body[data-print-view="cost"] #pricingPrintTable {
    width: 100% !important;
    margin-bottom: 0.65rem;
    font-size: 8pt;
  }

  body[data-print-view="cost"] #pricingPrintTable th,
  body[data-print-view="cost"] #pricingPrintTable td {
    padding: 0.2rem 0.35rem !important;
    text-align: left;
  }

  body[data-print-view="cost"] #pricingPrintTable th.num,
  body[data-print-view="cost"] #pricingPrintTable td.num {
    text-align: right;
  }

  body[data-print-view="cost"] #costTable {
    font-size: 8pt;
  }

  /* PO / takeoff — wire color highlights */
  .po-pdf thead tr.po-col-head th,
  .po-pdf tr.po-col-head td,
  .po-pdf tr.po-subsection-title td {
    position: static;
    box-shadow: none;
  }

  .po-split-spool-btn,
  .po-size-up-spool-btn,
  .po-stock-select input[type="checkbox"] {
    display: none !important;
  }

  .po-length-input {
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    pointer-events: none;
    font: inherit !important;
    font-weight: inherit !important;
    font-variant-numeric: tabular-nums;
    color: inherit !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .po-length-warn {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    color: #b45309 !important;
    font-size: 8pt;
    background: transparent !important;
    border: none !important;
  }

  .po-over-max-banner {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    background: #fffbeb !important;
    color: #78350f !important;
    border-color: #d97706 !important;
  }

  .po-pdf tr.po-data-row[class*="po-wire-"] td,
  .takeoff-pdf tr.po-data-row[class*="po-wire-"] td,
  .po-pdf tr.po-stock-row[class*="po-wire-"] td {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    background: var(--po-wire-bg) !important;
    color: var(--po-wire-fg) !important;
    border-color: #888 !important;
  }

  .po-pdf tr.po-data-row.po-wire-black td,
  .takeoff-pdf tr.po-data-row.po-wire-black td,
  .po-pdf tr.po-stock-row.po-wire-black td {
    --po-wire-bg: #eceff3;
    --po-wire-fg: #111827;
    --po-wire-label: #334155;
  }

  .po-pdf tr.po-data-row.po-wire-brown td,
  .takeoff-pdf tr.po-data-row.po-wire-brown td {
    --po-wire-bg: #fdf0e7;
    --po-wire-fg: #431407;
    --po-wire-label: #9a3412;
  }

  .po-pdf tr.po-data-row.po-wire-orange td,
  .takeoff-pdf tr.po-data-row.po-wire-orange td {
    --po-wire-bg: #fff0e6;
    --po-wire-fg: #431407;
    --po-wire-label: #c2410c;
  }

  .po-pdf tr.po-data-row.po-wire-yellow td,
  .takeoff-pdf tr.po-data-row.po-wire-yellow td,
  .po-pdf tr.po-stock-row.po-wire-yellow td {
    --po-wire-bg: #fef9e7;
    --po-wire-fg: #422006;
    --po-wire-label: #854d0e;
  }

  .po-pdf tr.po-data-row.po-wire-red td,
  .takeoff-pdf tr.po-data-row.po-wire-red td {
    --po-wire-bg: #fef2f2;
    --po-wire-fg: #7f1d1d;
    --po-wire-label: #991b1b;
  }

  .po-pdf tr.po-data-row.po-wire-blue td,
  .takeoff-pdf tr.po-data-row.po-wire-blue td {
    --po-wire-bg: #eff6ff;
    --po-wire-fg: #1e3a8a;
    --po-wire-label: #1d4ed8;
  }

  .po-pdf tr.po-data-row.po-wire-white td,
  .takeoff-pdf tr.po-data-row.po-wire-white td,
  .po-pdf tr.po-stock-row.po-wire-white td {
    --po-wire-bg: #f8fafc;
    --po-wire-fg: #111827;
    --po-wire-label: #475569;
  }

  .po-pdf tr.po-data-row.po-wire-gray td,
  .takeoff-pdf tr.po-data-row.po-wire-gray td {
    --po-wire-bg: #f1f5f9;
    --po-wire-fg: #111827;
    --po-wire-label: #475569;
  }

  .po-pdf tr.po-data-row.po-wire-green td,
  .takeoff-pdf tr.po-data-row.po-wire-green td {
    --po-wire-bg: #f0fdf4;
    --po-wire-fg: #14532d;
    --po-wire-label: #166534;
  }

  body[data-print-view="purchase"] .po-pdf tr.po-data-row[class*="po-wire-"] td,
  body[data-print-view="purchase"] .po-pdf tr.po-stock-row[class*="po-wire-"] td {
    color: var(--po-wire-fg) !important;
  }

  .po-pdf tr.po-data-row[class*="po-wire-"]:not(.po-wire-black):not(.po-wire-white):not(.po-wire-yellow):not(.po-wire-brown):not(.po-wire-orange):not(.po-wire-red):not(.po-wire-blue):not(.po-wire-gray):not(.po-wire-green) td,
  .takeoff-pdf tr.po-data-row[class*="po-wire-"]:not(.po-wire-black):not(.po-wire-white):not(.po-wire-yellow):not(.po-wire-brown):not(.po-wire-orange):not(.po-wire-red):not(.po-wire-blue):not(.po-wire-gray):not(.po-wire-green) td {
    --po-wire-bg: color-mix(in srgb, var(--po-wire, #666) 32%, #fff);
    --po-wire-fg: #111827;
    --po-wire-label: var(--po-wire, #374151);
  }

  .po-pdf tr.po-data-row[class*="po-wire-"] td.col-color,
  .takeoff-pdf tr.po-data-row[class*="po-wire-"] td.col-color {
    color: var(--po-wire-label, var(--po-wire-fg)) !important;
    font-weight: 700;
    background: var(--po-wire-bg) !important;
  }

  .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-type,
  .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-material,
  .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-length strong,
  .po-pdf tr.po-data-row[class*="po-wire-"] td.col-length strong,
  .po-pdf tr.po-data-row[class*="po-wire-"] td.col-spool strong {
    color: var(--po-wire-fg) !important;
  }

  .po-pdf tr.po-data-row.po-wire-white td.col-color .tag.white {
    background: #d1d5db !important;
    color: #111827 !important;
    border: 1px solid #9ca3af !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .po-pdf .tag,
  .takeoff-pdf .tag {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    padding: 0.05rem 0.25rem !important;
    border-radius: 2px;
    font-weight: 700;
  }

  .po-pdf.sheet-table,
  .takeoff-pdf.sheet-table {
    --po-grid: #666;
    font-size: 8pt;
  }

  .po-pdf.sheet-table th,
  .po-pdf.sheet-table td,
  .takeoff-pdf.sheet-table th,
  .takeoff-pdf.sheet-table td {
    border-color: #666 !important;
  }

  .po-pdf tr.po-data-row:not([class*="po-wire-"]) td,
  .takeoff-pdf tr.po-data-row:not([class*="po-wire-"]) td,
  .po-pdf tr.po-stock-row:not([class*="po-wire-"]) td {
    color: #111 !important;
  }

  /* Materials / wire takeoff print — light section titles, white rows */
  body[data-print-view="takeoff"] .takeoff-doc-header,
  body[data-print-view="takeoff"] .po-doc-header {
    display: none !important;
  }

  body[data-print-view="takeoff"] .po-section-title-bar:not(.po-stock-section),
  body:not([data-print-view]) #work-view-takeoff .po-section-title-bar:not(.po-stock-section) {
    display: block !important;
    position: static !important;
    background: #e8e8e8 !important;
    color: #000 !important;
    border: 1px solid #888 !important;
    font-weight: 700;
    padding: 0.18rem 0.35rem !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  body[data-print-view="takeoff"] .takeoff-head .takeoff-toolbar-wrap,
  body:not([data-print-view]) #work-view-takeoff .takeoff-toolbar-wrap {
    display: none !important;
  }

  /* Takeoff print — no color grouping: zebra stripes, no row tints */
  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-data-row td {
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
    color: #111 !important;
    border-color: #666 !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-data-row.print-zebra-odd td {
    background: #fff !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-data-row.print-zebra-even td {
    background: #e9e9e9 !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-data-row[class*="po-wire-"] td {
    background: inherit !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-data-row td.col-color .tag {
    background: #f5f5f5 !important;
    color: #111 !important;
    border: 1px solid #888 !important;
  }

  /* Takeoff print — color grouping on: readable pastel row highlights */
  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row[class*="po-wire-"] td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: var(--po-wire-bg) !important;
    color: var(--po-wire-fg) !important;
    border-color: #888 !important;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-black td {
    --po-wire-bg: #e2e8f0;
    --po-wire-fg: #0f172a;
    --po-wire-label: #0f172a;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-brown td {
    --po-wire-bg: #fde8d8;
    --po-wire-fg: #431407;
    --po-wire-label: #7c2d12;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-orange td {
    --po-wire-bg: #ffedd5;
    --po-wire-fg: #431407;
    --po-wire-label: #9a3412;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-yellow td {
    --po-wire-bg: #fef3c7;
    --po-wire-fg: #422006;
    --po-wire-label: #713f12;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-red td {
    --po-wire-bg: #fee2e2;
    --po-wire-fg: #7f1d1d;
    --po-wire-label: #991b1b;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-blue td {
    --po-wire-bg: #dbeafe;
    --po-wire-fg: #1e3a8a;
    --po-wire-label: #1d4ed8;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-white td {
    --po-wire-bg: #f8fafc;
    --po-wire-fg: #111827;
    --po-wire-label: #334155;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-gray td {
    --po-wire-bg: #e2e8f0;
    --po-wire-fg: #0f172a;
    --po-wire-label: #334155;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-green td {
    --po-wire-bg: #dcfce7;
    --po-wire-fg: #14532d;
    --po-wire-label: #166534;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row[class*="po-wire-"]:not(.po-wire-black):not(.po-wire-white):not(.po-wire-yellow):not(.po-wire-brown):not(.po-wire-orange):not(.po-wire-red):not(.po-wire-blue):not(.po-wire-gray):not(.po-wire-green) td {
    --po-wire-bg: #f3f4f6;
    --po-wire-fg: #111827;
    --po-wire-label: #374151;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row[class*="po-wire-"] td.col-color {
    color: var(--po-wire-label, var(--po-wire-fg)) !important;
    font-weight: 700 !important;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-type,
  body[data-takeoff-color-print="true"] .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-material,
  body[data-takeoff-color-print="true"] .takeoff-pdf.sheet-table tr.po-data-row[class*="po-wire-"] td.col-length strong {
    color: var(--po-wire-fg) !important;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row[class*="po-wire-"] td.col-color .tag {
    background: #fff !important;
    color: var(--po-wire-label, #111) !important;
    border: 1px solid #666 !important;
    font-weight: 700 !important;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-white td.col-color .tag.white,
  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-yellow td.col-color .tag.yellow {
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #666 !important;
  }

  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-data-row.po-wire-black td.col-color .tag.black {
    background: #334155 !important;
    color: #fff !important;
    border: 1px solid #0f172a !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-subsection-title td,
  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-subsection-title td,
  body:not([data-print-view]) #work-view-takeoff .takeoff-pdf tr.po-subsection-title td {
    background: #f0f0f0 !important;
    color: #000 !important;
    font-weight: 700 !important;
    border-color: #888 !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  body[data-takeoff-color-print="false"] .takeoff-pdf tr.po-subsection-title.po-size-group td,
  body[data-takeoff-color-print="true"] .takeoff-pdf tr.po-subsection-title.po-size-group td,
  body:not([data-print-view]) #work-view-takeoff .takeoff-pdf tr.po-subsection-title.po-size-group td {
    background: #e4e4e4 !important;
    color: #000 !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  body[data-takeoff-color-print="false"] #conduitTakeoff .takeoff-pdf tr.po-data-row.print-zebra-odd td,
  body[data-takeoff-color-print="true"] #conduitTakeoff .takeoff-pdf tr.po-data-row.print-zebra-odd td {
    background: #fff !important;
    color: #111 !important;
  }

  body[data-takeoff-color-print="false"] #conduitTakeoff .takeoff-pdf tr.po-data-row.print-zebra-even td,
  body[data-takeoff-color-print="true"] #conduitTakeoff .takeoff-pdf tr.po-data-row.print-zebra-even td {
    background: #fafafa !important;
    color: #111 !important;
  }

  .conduit-takeoff-pdf tr.conduit-section-total td {
    font-weight: 700 !important;
    background: #f3f4f6 !important;
    color: #111 !important;
    border-top: 2px solid #888 !important;
  }

  /* Wire takeoff print — plain rows; color tags only when grouping needs them */
  #wireTakeoff .takeoff-pdf tr.po-data-row td,
  body[data-takeoff-color-print="true"] #wireTakeoff .takeoff-pdf tr.po-data-row td,
  body[data-takeoff-color-print="false"] #wireTakeoff .takeoff-pdf tr.po-data-row td {
    background: #fff !important;
    color: #111 !important;
  }

  #wireTakeoff .takeoff-pdf tr.po-data-row td.col-length strong,
  #wireTakeoff .takeoff-pdf tr.po-data-row td.col-type,
  #wireTakeoff .takeoff-pdf tr.po-data-row td.col-material,
  #wireTakeoff .takeoff-pdf tr.po-data-row td.col-size {
    color: #111 !important;
  }

  body[data-takeoff-color-print="false"] #wireTakeoff .takeoff-pdf tr.po-data-row.print-zebra-odd td {
    background: #fafafa !important;
  }

  body[data-takeoff-color-print="false"] #wireTakeoff .takeoff-pdf tr.po-data-row.print-zebra-even td {
    background: #fff !important;
  }

  .schedule-raceway-box {
    border: 1px solid #666 !important;
    background: #f8f8f8 !important;
    color: #000 !important;
  }

  /* Keep the printed raceway box to size + type only */
  .schedule-raceway-box .raceway-ppr-note {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .app-header { flex-direction: column; padding: 1rem; }
  .layout { padding: 1rem; }
  body.app-shell .layout { padding: 0.45rem 0 0.55rem; }
}

/* 2.0 shell — critical visibility (v2.css has the full layer; these apply even if it loads late) */
html.v2 .site-chrome,
html.v2 .app-header,
html.v2 .work-tabs-bar,
html.v2 .panel-project {
  display: none !important;
}

html.v2 body.v2-dash-open .work-view,
html.v2 body.v2-dash-open .work-tabs-bar,
html.v2 body.v2-dash-open .v2-stepper,
html.v2 body.v2-dash-open .panel-project,
html.v2 body.v2-dash-open:not(.v2-dash-welcome) #planDropZone {
  display: none !important;
}

html.v2 #v2Dash[hidden] {
  display: none !important;
}

html.v2:not(.v2-import-step) #planDropZone {
  display: none !important;
}

html.v2.v2-import-step #planDropZone:not([hidden]) {
  display: block !important;
}

/* Protected feature gate (server-verified password on Vercel) */
.protected-lock-banner {
  grid-column: 1 / -1;
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.protected-lock-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  max-width: 36rem;
}

.protected-lock-cell {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1rem !important;
  text-align: center;
}

.protected-unlock-panel {
  max-width: 28rem;
}

.protected-unlock-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.protected-unlock-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.protected-unlock-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

.protected-unlock-error {
  margin: 0;
  color: var(--red);
  font-size: 0.8125rem;
}

/* Account gate — sign-in is the main app view until authenticated */
html.auth-pending #appWorkspace,
body.account-gated #appWorkspace {
  display: none !important;
}

html.auth-pending #accountGate,
body.account-gated #accountGate {
  display: flex;
}

body.account-gated .header-actions,
body.account-gated .ai-serve-banner {
  display: none;
}

.account-gate-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height, 4.25rem) - 2.5rem);
  min-height: calc(100dvh - var(--header-height, 4.25rem) - 2.5rem);
  padding: 2rem 1.5rem 3rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(91, 156, 245, 0.12), transparent),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(245, 166, 35, 0.08), transparent),
    var(--bg);
}

.app-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.account-gate-main[hidden] {
  display: none !important;
}

.account-gate-card {
  width: min(100%, 28rem);
  padding: 2rem 1.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.account-gate-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.account-gate-lead {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.account-gate-hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.account-google-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.account-google-icon {
  flex-shrink: 0;
}

.account-gate-divider {
  margin: 0 0 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.account-gate-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: color-mix(in srgb, var(--bg) 88%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 10px;
}

.account-gate-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.account-gate-tab:hover:not(.active) {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.account-gate-tab.active {
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.22) 0%, rgba(245, 166, 35, 0.1) 100%);
  border-color: rgba(245, 166, 35, 0.45);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.account-gate-form {
  display: grid;
  gap: 0.45rem;
}

.account-gate-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.account-gate-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.account-gate-password-wrap {
  position: relative;
  margin-bottom: 0.35rem;
}

.account-gate-password-wrap .account-gate-input {
  margin-bottom: 0;
  padding-right: 3.75rem;
}

.account-gate-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  padding: 0.2rem 0.45rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.account-gate-password-toggle:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.account-gate-password-toggle[aria-pressed="true"] {
  color: var(--accent, #f5a623);
}

.account-gate-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.account-gate-alt-action {
  margin: 0.85rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.account-gate-link-btn {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent, #f5a623);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.account-gate-link-btn:hover {
  color: var(--accent-bright, #ffc04d);
}

.account-gate-error {
  margin: 0 0 0.75rem;
  color: var(--red);
  font-size: 0.8125rem;
}

.account-gate-help {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.account-gate-help a {
  color: var(--blue);
}

.account-gate-layout {
  display: grid;
  gap: 1.25rem;
  width: min(100%, 56rem);
  align-items: start;
}

@media (min-width: 900px) {
  .account-gate-layout {
    grid-template-columns: minmax(0, 28rem) minmax(0, 22rem);
    justify-content: center;
  }
}

.account-gate-purchase-card {
  padding: 1.75rem 1.5rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.account-purchase-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.account-purchase-price {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.1;
}

.account-purchase-price strong {
  font-weight: 700;
}

.account-purchase-per {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
}

.account-purchase-alt {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.account-purchase-lead {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

.account-purchase-cta {
  width: 100%;
  margin-bottom: 0.65rem;
}

.account-purchase-calc-note {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.account-purchase-calc-note a {
  color: var(--blue);
}

.account-purchase-tagline {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Why FeederFlow — shared collapsible */
.why-feeder-machine {
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
  overflow: hidden;
}

.why-feeder-machine-summary {
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.why-feeder-machine-summary::-webkit-details-marker {
  display: none;
}

.why-feeder-machine-summary::before {
  content: '▸ ';
  color: var(--muted);
}

.why-feeder-summary-note {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
}

.why-feeder-positioning {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.why-feeder-headline {
  margin-top: 0;
}

.why-feeder-not {
  margin-bottom: 0;
}

.why-feeder-machine[open] > .why-feeder-machine-summary::before {
  content: '▾ ';
}

.why-feeder-machine-body {
  padding: 0 0.85rem 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
  max-height: min(70vh, 28rem);
  overflow: auto;
}

.why-feeder-lead {
  margin: 0 0 0.75rem;
  color: var(--text);
}

.why-feeder-h {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.why-feeder-note {
  margin: 0 0 0.5rem;
}

.why-feeder-table-wrap {
  overflow-x: auto;
  margin: 0.35rem 0 0.5rem;
}

.why-feeder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.why-feeder-table th,
.why-feeder-table td {
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.why-feeder-table th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.why-feeder-highlight td {
  background: rgba(91, 156, 245, 0.08);
}

.why-feeder-muted {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}

.why-feeder-save {
  margin: 0.35rem 0 0;
  color: var(--text);
}

.why-feeder-sub {
  margin: 0.5rem 0;
  font-size: 0.78rem;
}

.why-feeder-sub summary {
  cursor: pointer;
  color: var(--blue);
}

.why-feeder-runs {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.why-feeder-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

.why-feeder-list li {
  margin-bottom: 0.35rem;
}

.why-feeder-foot {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.why-feeder-app-strip {
  flex-shrink: 0;
  padding: 0.35rem 1rem 0;
  max-width: 100%;
}

body.account-gated .why-feeder-app-strip {
  display: none;
}

@media (max-width: 899px) {
  .account-gate-purchase-card {
    order: -1;
  }
}

/* First-login product tour */
.app-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 1900;
}

.app-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
}

.app-tour-spotlight {
  position: fixed;
  z-index: 1;
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(8, 10, 14, 0.72);
  pointer-events: none;
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.app-tour-card {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100% - 2rem), 28rem);
  max-height: min(70vh, 24rem);
  overflow: auto;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.app-tour-step {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-tour-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.app-tour-body {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.app-tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* PWA install prompt (also in v2.css for calc-only shell) */
.pwa-install-sheet {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  background: rgba(0, 0, 0, 0.45);
}

.pwa-install-sheet[hidden] {
  display: none;
}

.pwa-install-card {
  width: min(420px, 100%);
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.pwa-install-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}

.pwa-install-body {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
