:root {
  --bg0: #050607;
  --bg1: #0a0c0e;
  --bg2: #12171c;
  --bg3: #1a2128;
  --line: #2a3844;
  --line-strong: #3a4b5a;
  --text: #e8eef4;
  --muted: #a8b6c5;
  --dim: #7a8b9c;
  --accent: #3dd6c6;
  --gold: #f0b429;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --field-box-h: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(1100px 640px at 8% -12%, rgba(61, 214, 198, 0.08), transparent 50%),
    radial-gradient(800px 480px at 100% 0%, rgba(240, 180, 41, 0.05), transparent 45%),
    var(--bg0);
  color: var(--text);
  font-family: var(--font);
}
button, input, select { font: inherit; color: inherit; color-scheme: dark; }

.app {
  --input-h: 28vh;
  height: 100%;
  display: grid;
  /* Preview row keeps a real floor so a tall input strip cannot eat it. */
  grid-template-rows: auto auto minmax(220px, 1fr) 22px var(--input-h);
  min-height: 100vh;
}

.caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px;
  background: #2a2e32;
  border-bottom: 1px solid #3a4046;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-copy { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-name { font-weight: 700; letter-spacing: 0.04em; }
.brand-sub { color: var(--muted); font-size: 0.75rem; }
@media (max-width: 1280px) {
  .brand-sub { display: none; }
}
.caption-actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
.caption-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
}
.caption-stack .mini {
  padding: 3px 9px;
  font-size: 0.7rem;
  min-width: 4.4rem;
}
.code-switch {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  isolation: isolate;
  flex: 0 0 auto;
  padding: 3px;
  background: #0a0d10;
  border: 1px solid #c49a2a;
  border-radius: 12px;
  box-shadow: 0 0 0 1px #1a1404 inset, 0 6px 16px rgba(0, 0, 0, 0.35);
}
.code-switch-shape {
  position: absolute;
  z-index: 0;
  left: 3px;
  top: 3px;
  width: 50%;
  height: calc(100% - 6px);
  background: linear-gradient(180deg, #ffd15a, #f0b429);
  border-radius: 9px;
  box-shadow: 0 0 0 1px #8a5a00 inset, 0 4px 12px rgba(240, 180, 41, 0.45);
  transition: left 0.22s ease, width 0.22s ease, top 0.22s ease, height 0.22s ease;
  pointer-events: none;
}
.code-switch-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  padding: 8px 16px;
  color: #d8c48a;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 9px;
  line-height: 1;
}
.code-switch-item.is-on {
  color: #1a1200;
}
.code-switch-item:not(.is-on):hover {
  color: #ffe7a0;
}

.gad-sheet-row {
  position: relative;
  padding-top: 2px;
}
.gad-sheet {
  position: relative;
  min-width: 7.2rem;
  padding: 6px 10px 7px;
  border: 1px solid var(--line-strong);
  background: #10151a;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-align: center;
}
.gad-sheet span {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  text-transform: uppercase;
}
.gad-sheet.is-on {
  color: #1a1200;
  background: var(--gold);
  border-color: #c49a2a;
  box-shadow: 0 0 0 1px #8a5a00 inset, 0 0 10px rgba(240, 180, 41, 0.4);
}
.gad-sheet.is-on span { color: #5c4a12; }
html[data-product="gad"] #gadSheetRow { display: flex !important; }
.pqc-controls {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.pqc-code-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}
.pqc-stock-widths {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 11.5rem;
  min-width: 8.5rem;
  max-width: 13rem;
  padding: 2px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #10151a;
}
.pqc-width-lock {
  flex: 0 0 auto;
  padding: 3px 5px;
  color: var(--gold);
}
.pqc-width-lock svg {
  width: 13px;
  height: 13px;
  display: block;
}
.pqc-width-lock.locked .pqc-lock-open { display: none; }
.pqc-width-lock:not(.locked) .pqc-lock-closed { display: none; }
.pqc-width-lock:not(.locked) .pqc-lock-open { display: block; }
.pqc-width-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}
.pqc-width-input {
  width: 100%;
  min-width: 0;
  padding: 3px 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1014;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-align: center;
}
.pqc-width-input:disabled {
  opacity: 0.92;
  color: #c8d0d8;
}
.pqc-width-input:not(:disabled) {
  border-color: var(--gold);
  background: #141b22;
}
.pqc-action-row .pqc-btn,
.pqc-code-row .pqc-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 3.8rem;
  align-self: stretch;
}
.pqc-code {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  min-width: 0;
}
.pqc-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.1em;
  flex: 0 0 auto;
}
.pqc-icon-label svg {
  width: 12px;
  height: 12px;
}
.pqc-code select {
  background: #10151a;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 8.5rem;
  width: 11.5rem;
  max-width: 14rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.pqc-code-add {
  flex: 0 0 auto;
  width: 22px;
  min-width: 22px;
  padding: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  border-color: var(--gold);
}
.pqc-code-add:hover {
  color: #061014;
  background: var(--gold);
}
.pqc-code-new {
  width: 5.2rem;
  min-width: 4.4rem;
  padding: 4px 6px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #141b22;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.pqc-code-new:focus {
  outline: 1px solid var(--gold);
}
.pqc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.pqc-btn svg {
  width: 14px;
  height: 14px;
}
.pqc-btn:hover {
  filter: brightness(1.08);
}
#pqcOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  padding: 0;
}
#pqcOverlay[hidden] { display: none !important; }
.pqc-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: #10151a;
}
.pqc-overlay-panel,
.pqc-overlay-panel.pqc-overlay-panel--wide {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background: #10151a;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}
.pqc-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #1a2128;
  color: #e8eef4;
  border-bottom: 1px solid rgba(168, 132, 48, 0.45);
}
.pqc-overlay-actions { display: flex; gap: 8px; align-items: center; }
.pqc-overlay-print,
.pqc-overlay-close {
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
}
.pqc-overlay-print {
  background: var(--accent);
  color: #061014;
}
.pqc-overlay-close {
  background: #2a343e;
  color: #e8eef4;
  min-width: 2rem;
}
.pqc-overlay-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #e8eaed;
}
.menu-select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
.menu-select select {
  background: #10151a;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 10.5rem;
}
.pqc-code.menu-select select {
  min-width: 8.2rem;
  width: 11.2rem;
  max-width: 13rem;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.tabs {
  display: grid;
  gap: 4px;
  padding: 4px 12px 4px;
  background: linear-gradient(180deg, rgba(18, 23, 28, 0.96), rgba(10, 12, 14, 0.96));
  border-bottom: 1px solid var(--line);
}
.tab-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gad-job-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  flex: 0 0 auto;
}
html[data-product="gad"] .pqc-code,
html[data-product="gad"] .pqc-code-add,
html[data-product="gad"] .pqc-code-new,
html[data-product="gad"] .pqc-stock-widths {
  display: none !important;
}
.gad-pqc-report {
  display: none;
  align-items: center;
  min-width: 0;
}
html[data-product="gad"] .gad-pqc-report {
  display: flex;
}
.gad-pqc-report select {
  background: #10151a;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  min-width: 11.5rem;
  max-width: 16rem;
  padding: 5px 8px;
}
.gad-job-code span {
  color: var(--gold);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.12em;
  line-height: 1;
}
.gad-job-code select {
  background: #10151a;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  min-width: 5.8rem;
  width: 6.4rem;
  padding: 5px 6px;
}
.job-code-add {
  flex: 0 0 auto;
  width: 22px;
  min-width: 22px;
  padding: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  border-color: var(--gold);
}
.job-code-add:hover {
  color: #061014;
  background: var(--gold);
}
.job-code-new {
  width: 5.2rem;
  min-width: 4.4rem;
  padding: 4px 6px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #141b22;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.job-code-new:focus {
  outline: 1px solid var(--gold);
}
.job-save {
  font-weight: 800;
  letter-spacing: 0.04em;
  min-width: 0;
  width: auto;
  padding: 5px 8px;
}
.job-save.is-saved {
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.env-tab, .frame-tab, .mini {
  border: 1px solid var(--line-strong);
  background: #10151a;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}
.env-tab { font-size: 0.7rem; letter-spacing: 0.04em; }
.frame-tab { font-size: 0.86rem; padding: 7px 14px; }
.env-tab.active, .frame-tab.active {
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.mini { font-size: 0.76rem; padding: 5px 10px; }
.mini.gold {
  color: #5c4a12;
  background: #e8d59a;
  border-color: #d4bc6a;
  box-shadow: none;
  opacity: 0.92;
}
.mini.gold.active {
  color: #1a1200;
  background: #ffc107;
  border-color: #ff9800;
  outline: 2px solid #ffe082;
  box-shadow: 0 0 0 1px #8a5a00 inset, 0 0 10px rgba(255, 193, 7, 0.55);
  opacity: 1;
  font-weight: 800;
}
.tab-row .grow { flex: 1; }

.preview {
  position: relative;
  min-height: 0;
  background: #d0d0d0;
  border-bottom: 1px solid var(--line);
}
.preview canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  background: #d0d0d0;
  touch-action: none;
  user-select: none;
  image-rendering: crisp-edges;
}
.preview-tools {
  position: absolute;
  right: 12px;
  top: 8px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.preview-hint {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #555;
  pointer-events: none;
  padding-top: 8px;
}
.preview-annot { position: relative; }
.preview-annot-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #3a4046;
  border-radius: 7px;
  background: #161b20;
  color: #d8e2ea;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.preview-annot-btn:hover,
.preview-annot-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.preview-annot-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  padding: 8px 10px;
  border: 1px solid #3a4046;
  border-radius: 8px;
  background: #161b20;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 6px;
}
.preview-annot-menu[hidden] { display: none; }
.preview-annot-menu label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #e8eef3;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.preview-annot-menu input {
  margin: 0;
  accent-color: var(--accent);
}
.preview-annot-menu em {
  font-style: normal;
  font-weight: 500;
  color: #8a96a0;
  font-size: 0.7rem;
}
.preview-annot-cleats { color: #5ea86a; }
.preview-annot-cleats em { color: #7dbe8a; }
.preview-annot-menu label.preview-annot-fb { color: #e07030; }
.preview-annot-menu label.preview-annot-fb em { color: #f0a070; }
.zoom-btn {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #3a4046;
  border-radius: 8px;
  background: #161b20;
  color: #d8e2ea;
  cursor: pointer;
}
.zoom-btn svg { width: 20px; height: 20px; }
.zoom-btn:hover { border-color: var(--accent); color: var(--accent); }
.zoom-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #061014;
}
.preview canvas.loupe-on { cursor: grab; }

.panel-split {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 8px;
  background: #161b20;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  user-select: none;
  touch-action: none;
}
.app.split-unlocked .panel-split {
  cursor: ns-resize;
  background: #1c242c;
}
.app.split-unlocked .panel-split:hover {
  background: #243038;
}
.split-lock {
  flex: 0 0 auto;
  width: 22px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #10151a;
  color: var(--muted);
  cursor: pointer;
}
.split-lock svg { width: 13px; height: 13px; }
.split-lock .icon-unlocked { display: none; }
.app.split-unlocked .split-lock {
  color: #1a1404;
  background: var(--gold);
  border-color: var(--gold);
}
.app.split-unlocked .split-lock .icon-locked { display: none; }
.app.split-unlocked .split-lock .icon-unlocked { display: block; }
.split-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.split-grip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.split-grip span {
  display: block;
  width: 48px;
  height: 2px;
  border-radius: 1px;
  background: #4a5a68;
}
.app.split-unlocked .split-grip span { background: var(--gold); }
.split-fold {
  flex: 0 0 auto;
  width: 22px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #10151a;
  color: var(--muted);
  cursor: pointer;
}
.split-fold svg { width: 13px; height: 13px; display: block; }
.split-fold .icon-fold-up { display: none; }
.split-fold:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.app.inputs-folded .split-fold {
  color: #1a1404;
  background: var(--gold);
  border-color: var(--gold);
}
.app.inputs-folded .split-fold .icon-fold-down { display: none; }
.app.inputs-folded .split-fold .icon-fold-up { display: block; }
.app.inputs-folded {
  --input-h: 0px;
}
.app.inputs-folded .inputs {
  overflow: hidden;
  padding: 0;
  pointer-events: none;
}
.app.inputs-folded .panel-split {
  border-bottom: 0;
}
.split-hint {
  flex: 0 0 auto;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  pointer-events: none;
}
.app.split-unlocked .split-hint { color: var(--gold); }

.inputs {
  padding: 10px 10px 4px;
  display: block;
  background: #0b0f13;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 132, 48, 0.75) #12171c;
}
.inputs::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.inputs::-webkit-scrollbar-track {
  background: #12171c;
}
.inputs::-webkit-scrollbar-thumb {
  background: rgba(168, 132, 48, 0.75);
  border-radius: 6px;
  border: 2px solid #12171c;
}
.input-deck {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  width: max-content;
  min-width: 100%;
  padding-bottom: 4px;
}
.input-deck > .col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
}
.col {
  position: relative;
  border: 1px solid rgba(168, 132, 48, 0.85);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(22, 28, 34, 0.9), rgba(12, 16, 20, 0.95));
  padding: 12px 5px 5px;
  margin-top: 8px;
  width: max-content;
  max-width: 100%;
}
.col > .group-title:first-child {
  text-align: center;
  position: absolute;
  top: -0.65em;
  left: 50%;
  transform: translateX(-50%);
  background: #0c1014;
  padding: 0 10px;
  margin: 0;
  color: var(--gold);
  white-space: nowrap;
  z-index: 1;
}
.col[data-panel="geometry"] {
  max-width: none;
  min-width: max-content;
}
.geo-two-col {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 0 8px;
  align-items: start;
  justify-content: start;
  flex: 0 0 auto;
}
.geo-col {
  display: grid;
  align-content: start;
  width: max-content;
  min-width: 0;
}
.geo-col + .geo-col {
  border-left: 1px solid rgba(168, 132, 48, 0.75);
  padding-left: 8px;
}
.geometry-col .frames-block {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(168, 132, 48, 0.7);
}
.geometry-col .frames-block .group-title {
  position: static;
  transform: none;
  left: auto;
  top: auto;
  background: transparent;
  padding: 0;
  margin: 0 0 4px;
  text-align: left;
}
.geo-part-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(168, 132, 48, 0.7);
  min-width: max-content;
  align-self: stretch;
}
.geo-part-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 10px;
  min-width: max-content;
}
.geo-part-row .row-field.part-count {
  grid-template-columns: max-content calc(2ch + 12px);
  flex: 0 0 auto;
}
.geo-part-row .row-field.part-count:has(em) {
  grid-template-columns: max-content calc(2ch + 12px) 32px;
}
.geo-part-row .row-field.part-count span {
  white-space: nowrap;
  font-size: 0.72rem;
}
.geo-part-row .row-field.part-count input {
  width: calc(2ch + 12px);
  max-width: calc(2ch + 12px);
  text-align: right;
}
.geometry-col .opening-block {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(168, 132, 48, 0.7);
  min-width: max-content;
  align-self: stretch;
}
.geometry-col .opening-block .group-title {
  position: static;
  transform: none;
  left: auto;
  top: auto;
  background: transparent;
  padding: 0;
  margin: 0 0 4px;
  text-align: left;
}
.opening-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 10px;
  min-width: max-content;
  margin-bottom: 3px;
}
.opening-row:last-child {
  margin-bottom: 0;
}
.opening-face-block {
  margin-bottom: 6px;
}
.opening-face-block:last-child {
  margin-bottom: 0;
}
.opening-face {
  flex: 0 0 5.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #5c4a12;
  white-space: nowrap;
}
.opening-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 2px 0 4px 0.35rem;
  padding-left: 0.35rem;
  border-left: 2px solid rgba(168, 132, 48, 0.45);
}
.opening-items:empty {
  display: none;
}
.opening-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 8px;
  min-width: max-content;
  padding: 2px 4px;
  background: rgba(255, 248, 220, 0.55);
  border-radius: 3px;
}
.opening-item-tab {
  flex: 0 0 1.55rem;
  height: var(--field-box-h, 22px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #5c4a12;
  background: #f0e2a8;
  border: 1px solid rgba(168, 132, 48, 0.7);
  border-radius: 3px;
}
.opening-item .row-field.bay-pick {
  min-width: 0;
}
.opening-item .row-field.bay-pick select {
  min-width: 4.6rem;
  max-width: 9.5rem;
  height: var(--field-box-h, 22px);
  font-size: 0.72rem;
  font-weight: 600;
}
.opening-item .row-field.bay-pick select option:disabled {
  color: #8a8a8a;
  background: #d8d8d8;
}
.part-grid-picks {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-height: var(--field-box-h);
  flex: 1 1 auto;
}
.part-grid-picks:empty {
  display: none;
}
.part-grid-picks select {
  width: calc(3.4ch + 22px);
  min-width: 44px;
  height: var(--field-box-h);
  min-height: var(--field-box-h);
  max-height: var(--field-box-h);
  background: #070a0c;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 2px;
  color: var(--text);
  font-size: 0.72rem;
  font-family: var(--mono);
  box-sizing: border-box;
}
.plates-series .row-field {
  grid-template-columns: 62px max-content 22px;
}
.plates-series .row-field.plate-mode {
  grid-template-columns: 22px 60px max-content 22px;
}
.row-field.dual-unit {
  width: max-content;
  max-width: 100%;
  justify-content: start;
  grid-template-columns: 28px calc(5ch + 12px) 16px calc(6ch + 12px) 14px;
}
.row-field.dual-unit.depth-sum {
  position: relative;
  margin-top: 2px;
  padding-top: 6px;
}
.row-field.depth-sum::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(28px + 4px);
  right: 0;
  height: 1px;
  background: var(--text);
}
.row-field.dual-unit.depth-pair-w {
  margin-bottom: 2px;
}
.row-field.depth-pair-w > span {
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}
.row-field.depth-pair-w .inch-readout {
  color: var(--text);
}
.beam-block .row-field.plate-mode.dual-unit,
.beam-block .row-field.seg-derived.dual-unit {
  grid-template-columns: 22px 28px calc(5ch + 12px) 16px calc(6ch + 12px) 14px;
}
.beam-block .row-field.seg-derived {
  opacity: 0.78;
}
.beam-block .plate-mode-icon svg {
  width: 14px;
  height: 14px;
}
.beam-sep {
  height: 0;
  margin: 6px 2px 4px;
  border: 0;
  border-top: 1px dotted rgba(168, 182, 197, 0.28);
}
.beam-depths {
  width: max-content;
  --beam-du-label: 40px;
  --beam-du-mm: calc(5ch + 12px);
  --beam-du-in: calc(6ch + 12px);
  --beam-du-icon: 22px;
  --beam-du-seg-label: 28px;
  --beam-du-row-w: calc(
    var(--beam-du-label) + 4px + var(--beam-du-mm) + 4px + 16px + 4px + var(--beam-du-in) + 4px + 14px
  );
  --beam-seg-row-w: calc(
    var(--beam-du-icon) + 4px + var(--beam-du-seg-label) + 4px + var(--beam-du-mm)
    + 4px + 16px + 4px + var(--beam-du-in) + 4px + 14px
  );
}
.beam-depths > .beam-col {
  width: max-content;
  min-width: var(--beam-du-row-w);
}
.beam-depths .row-field.dual-unit {
  width: var(--beam-du-row-w);
  max-width: 100%;
  grid-template-columns: var(--beam-du-label) var(--beam-du-mm) 16px var(--beam-du-in) 14px;
}
.beam-depths .row-field.depth-sum::before {
  left: calc(var(--beam-du-label) + 4px);
}
.beam-th-block {
  margin-top: 2px;
  padding-top: 0;
  width: max-content;
  max-width: 100%;
}
.beam-len-block {
  margin-top: 2px;
  padding-top: 0;
  border-top: 0;
  width: var(--beam-seg-row-w);
  max-width: 100%;
}
.beam-block .beam-len-block .row-field.plate-mode.dual-unit,
.beam-block .beam-len-block .row-field.seg-derived.dual-unit {
  width: 100%;
  max-width: 100%;
  grid-template-columns:
    var(--beam-du-icon) var(--beam-du-seg-label) var(--beam-du-mm) 16px var(--beam-du-in) 14px;
}
.beam-len-block .group-title.sub-thick,
.beam-th-block .group-title.sub-thick,
.beam-split-block .group-title.sub-thick {
  margin-top: 0;
  margin-bottom: 3px;
}
.split-figure {
  margin-top: 8px;
  padding: 5px 4px 4px;
  border: 1px solid rgba(168, 132, 48, 0.75);
  border-radius: 8px;
  width: max-content;
  display: grid;
  gap: 4px;
}
.col-split-block {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.beam-split-block {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px dotted rgba(168, 182, 197, 0.28);
}
.col-split-block .group-title.sub-thick {
  margin-top: 0;
  margin-bottom: 3px;
}
.col-split-block .row-field.n2,
.beam-split-block .row-field.n2 {
  grid-template-columns: 28px calc(2ch + 12px);
}
.row-field.depth-echo {
  opacity: 0.78;
}
.row-field.depth-echo input {
  cursor: default;
}
.row-field.derived-sum .plate-mode-icon {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #070a0c;
  color: var(--dim);
}
.plates-series .row-field.dual-unit {
  grid-template-columns: 62px calc(5ch + 12px) 16px calc(6ch + 12px) 14px;
}
.plates-series .row-field.plate-mode.dual-unit {
  grid-template-columns: 22px 60px calc(5ch + 12px) 16px calc(6ch + 12px) 14px;
}
.plates-series .row-field.plate-mode.n2 {
  grid-template-columns: 22px 60px calc(2ch + 12px);
}
.plates-series .row-field.plate-mode > span {
  white-space: nowrap;
}
.plates-series .row-field.plate-mode.dual-unit.splice-to {
  grid-template-columns: 22px 72px calc(5ch + 12px) 16px calc(6ch + 12px) 14px;
}
.plate-mode-spacer,
.plate-mode-icon {
  width: var(--field-box-h);
  height: var(--field-box-h);
  display: grid;
  place-items: center;
  color: var(--dim);
}
.plate-mode-icon svg { width: 14px; height: 14px; }
.plates-series .row-field.splice-ht {
  width: max-content;
  max-width: 100%;
  grid-template-columns: 22px auto 6.6ch 22px;
}
.splice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 1px 0 4px;
  min-height: var(--field-box-h);
}
.splice-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.onoff-btn {
  min-width: 38px;
  height: var(--field-box-h);
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #070a0c;
  color: var(--dim);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.onoff-btn[aria-pressed="true"] {
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.onoff-btn:disabled,
.plate-mode-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
#colSpliceFields.mode-off {
  opacity: 0.45;
  pointer-events: none;
}
.plates-series.geometry-col {
  padding: 12px 6px 5px;
}
.plates-grid,
.beam-grid {
  display: grid;
  grid-template-columns: max-content max-content max-content;
  gap: 0 8px;
  align-items: start;
  justify-content: start;
  min-width: 0;
}
.plates-col,
.beam-col {
  display: grid;
  align-content: start;
  min-width: 0;
  width: max-content;
}
.plates-col + .plates-col,
.beam-col + .beam-col {
  border-left: 1px solid rgba(168, 132, 48, 0.75);
  padding-left: 8px;
}
.row-field .inch-readout,
.row-field input.inch-readout:disabled,
.row-field input.inch-readout:read-only {
  opacity: 1;
  color: var(--muted);
  background: #0a0e12;
  border-color: #243038;
  pointer-events: none;
}
.row-field.depth-echo > input:not([id$="_in"]) {
  pointer-events: auto;
  cursor: text;
}
.row-field.mode-off {
  cursor: text;
  opacity: 0.45;
}
.plate-mode-btn {
  width: var(--field-box-h);
  height: var(--field-box-h);
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #070a0c;
  color: var(--dim);
  cursor: pointer;
}
.plate-mode-btn svg { width: 14px; height: 14px; }
.plate-mode-btn.active {
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.plates-series .plate-split {
  height: 0;
  margin: 3px 2px 3px;
  border: 0;
  border-top: 1px solid rgba(168, 132, 48, 0.7);
}
.section-triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.section-triple > div {
  position: relative;
  border: 1px solid rgba(168, 132, 48, 0.85);
  padding: 10px 6px 6px;
  margin-top: 6px;
}
.section-triple > div > .group-title:first-child,
.section-triple .split-subhead {
  text-align: center;
  color: var(--gold);
  background: #0c1014;
  margin: 0 0 6px;
}
.group-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 6px;
}
.group-title.sub-thick {
  text-align: center;
  margin: 6px 0 4px;
  letter-spacing: 0.1em;
}
.cc-auto-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 2px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.cc-auto-names:empty { display: none; }
.col-th-grid {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 0 10px;
  align-items: start;
  width: max-content;
  margin-bottom: 4px;
}
.col-th-block {
  display: grid;
  align-content: start;
  width: max-content;
}
.col-th-block + .col-th-block {
  border-left: 1px solid rgba(168, 132, 48, 0.75);
  padding-left: 10px;
}
.col-th-block .group-title.sub-thick {
  margin-top: 0;
  margin-bottom: 3px;
}
.row-field.col-th-mm {
  grid-template-columns: 28px calc(4ch + 14px) 22px;
}
.beam-th-table {
  display: grid;
  gap: 2px 0;
  width: max-content;
  margin: 0 0 4px;
}
.beam-th-head,
.beam-th-row {
  display: grid;
  grid-template-columns: 26px repeat(4, calc(4ch + 12px)) 20px;
  column-gap: 2px;
  row-gap: 2px;
  align-items: center;
  min-height: var(--field-box-h);
}
.beam-th-row em {
  margin-left: 2px;
  font-style: normal;
  color: var(--dim);
  font-size: 0.68rem;
  font-family: var(--mono);
  white-space: nowrap;
}
.beam-th-head span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: var(--font);
}
.beam-th-row > span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  font-family: var(--font);
  margin-right: 2px;
}
.beam-th-row input {
  width: 100%;
  min-width: 0;
  max-width: calc(4ch + 12px);
  height: var(--field-box-h);
  min-height: var(--field-box-h);
  max-height: var(--field-box-h);
  background: #070a0c;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 4px;
  line-height: calc(var(--field-box-h) - 2px);
  font-size: 0.78rem;
  font-family: var(--mono);
  font-weight: 400;
  text-align: right;
  box-sizing: border-box;
  appearance: textfield;
  -moz-appearance: textfield;
}
.beam-th-row input[type="number"]::-webkit-inner-spin-button,
.beam-th-row input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.beam-th-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.splits-grid {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 0 8px;
  align-items: start;
}
.splits-col {
  display: grid;
  align-content: start;
  width: max-content;
}
.splits-col + .splits-col {
  border-left: 1px solid rgba(168, 132, 48, 0.75);
  padding-left: 8px;
}
.splits-block .group-title.sub-thick {
  margin-top: 0;
}
.splits-block .row-field.n2 {
  grid-template-columns: 28px calc(2ch + 12px);
}

.row-field {
  display: grid;
  grid-template-columns: 72px max-content 22px;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  min-height: var(--field-box-h);
  width: max-content;
  max-width: 100%;
}
.row-field.wide { grid-template-columns: 86px 6.6ch 22px; }
.row-field.wide.slope-row { grid-template-columns: 86px 18px 5.4ch 8px; }
.row-field.wide select { width: 8.2ch; max-width: 9.2ch; }
.row-field.n2 {
  grid-template-columns: 68px calc(2ch + 12px);
}
.row-field.n2:has(em) {
  grid-template-columns: 36px calc(2ch + 12px) 28px;
}
.row-field.n2 input {
  width: calc(2ch + 12px);
  max-width: calc(2ch + 12px);
  text-align: right;
}
.row-field span { color: var(--muted); font-size: 0.78rem; }
.row-field em {
  font-style: normal;
  color: var(--dim);
  font-size: 0.68rem;
  font-family: var(--mono);
  white-space: nowrap;
}
.row-field input, .row-field select {
  width: 100%;
  min-width: 0;
  height: var(--field-box-h);
  min-height: var(--field-box-h);
  max-height: var(--field-box-h);
  background: #070a0c;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 4px;
  line-height: calc(var(--field-box-h) - 2px);
  font-size: 0.78rem;
  font-family: var(--mono);
  box-sizing: border-box;
}
.row-field.dual-unit input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  text-align: right;
}
.row-field.dual-unit > input:not([id$="_in"]) {
  width: calc(5ch + 12px);
  max-width: calc(5ch + 12px);
}
.row-field.dual-unit > input[id$="_in"] {
  width: calc(6ch + 12px);
  max-width: calc(6ch + 12px);
}
.row-field.dual-unit input[type="number"]::-webkit-inner-spin-button,
.row-field.dual-unit input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.row-field input:focus, .row-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.row-field input:disabled, .row-field select:disabled {
  opacity: 0.45;
  color: var(--dim);
}
.slope-prefix {
  color: #fff;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-style: normal;
}
.cc-diff-box {
  margin-top: 6px;
  padding: 6px;
  border: 1px solid rgba(168, 132, 48, 0.85);
}

.frames-block .row-field.n2 {
  grid-template-columns: 68px calc(2ch + 12px);
}
.frames-block .row-field.bay {
  /* Room for derived C/C bay e.g. 23.608 / 24.740 (toUiLen → 3 decimals). */
  grid-template-columns: 68px 7.5ch 16px;
}
.frames-block .row-field.bay input {
  width: 7.5ch;
  max-width: 7.5ch;
  text-align: right;
}
.row-field.clit-base {
  grid-template-columns: 86px 5.2ch 22px 12px 4.4ch 22px 12px 5.2ch 22px;
  width: max-content;
}
.row-field.clit-base > input:not(.inch-readout) {
  width: 5.2ch;
  max-width: 5.2ch;
  text-align: right;
}
.row-field.clit-base input.inch-readout {
  width: 4.4ch;
  max-width: 4.4ch;
  text-align: right;
  color: #8b949e;
  background: #12171c;
}
.row-field.clit-base .clit-op {
  text-align: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.clit-reset-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.clit-reset {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #10151a;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.2;
  font-family: var(--font);
}
.clit-reset:hover {
  color: #061014;
  background: var(--accent);
  border-color: var(--accent);
}
.purlin-pair {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: flex-start;
}
.purlin-col {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 6px 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10151a;
}
.purlin-col.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 214, 184, 0.25);
}
.purlin-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
  min-height: 22px;
}
.purlin-col-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--dim);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.purlin-col.is-active .purlin-col-title { color: var(--accent); }
.purlin-slit {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  margin: 0;
}
.purlin-slit input {
  width: 4.6ch;
  min-width: 0;
  padding: 1px 3px;
  border: 1px solid #f0c14b;
  border-radius: 4px;
  background: #f0c14b;
  color: #1a1200;
  font: 800 0.72rem/1.2 var(--font);
  text-align: center;
  box-shadow: 0 0 0 1px rgba(240, 193, 75, 0.35);
  appearance: textfield;
  -moz-appearance: textfield;
}
.purlin-slit input::-webkit-outer-spin-button,
.purlin-slit input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.purlin-slit em {
  font-style: normal;
  font-size: 0.58rem;
  font-weight: 700;
  color: #f0c14b;
  letter-spacing: 0.02em;
}
.purlin-col .row-field.wide { grid-template-columns: 72px 5.2ch 22px; }
.frozen { opacity: 0.55; }

input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .input-deck { gap: 4px; }
}
