/* StairFab Studio — Clean, Simple Architectural CAD & Fabrication UI */

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --ink: #0f172a;
  --ink-muted: #475569;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: #e0f2fe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #1e293b;
  border: 1px solid #334155;
  display: grid;
  place-items: center;
  color: #f8fafc;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preset-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.preset-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.unit-toggle {
  display: inline-flex;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.topbar-ada-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-ada-btn:hover {
  border-color: #64748b;
  color: #ffffff;
}

.topbar-ada-btn .ada-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.topbar-ada-btn.active {
  background: #065f46;
  border-color: #10b981;
  color: #ffffff;
}

.topbar-ada-btn.active .ada-dot {
  background: #34d399;
}

.topbar-io-btn {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.topbar-io-btn:hover {
  background: #334155;
  color: #ffffff;
}

.topbar-io-btn.clear-btn {
  border-color: #7f1d1d;
  color: #fca5a5;
}

.topbar-io-btn.clear-btn:hover {
  background: #991b1b;
  border-color: #b91c1c;
  color: #ffffff;
}

/* Multi-Item Job Scope Bar (Left Sidebar Top) */
.job-scope-bar {
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.job-scope-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.job-scope-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.job-add-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.scope-add-btn {
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid #7dd3fc;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.scope-add-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.job-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 132px;
  overflow-y: auto;
}

.job-item-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 56px 22px 22px;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.12s ease;
}

.job-item-row:hover {
  border-color: #94a3b8;
}

.job-item-row.active {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.25);
}

.job-tag-badge {
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  padding: 2px 4px;
  border-radius: 4px;
  background: #0f172a;
  color: #ffffff;
}

.job-item-row.active .job-tag-badge {
  background: var(--primary);
}

.job-item-name {
  min-width: 0;
  border: none !important;
  background: transparent !important;
  padding: 2px 3px !important;
  font-size: 11.5px !important;
  font-weight: 600;
  color: var(--ink);
  font-family: inherit;
}

.job-item-name:focus {
  background: #ffffff !important;
  outline: 1px solid var(--primary);
  border-radius: 4px;
}

.job-qty-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-muted);
}

.job-qty-in {
  width: 42px;
  padding: 2px 4px !important;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11.5px !important;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}

.job-mini-act {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  line-height: 1;
}

.job-mini-act:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.job-mini-act.del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Workspace Split */
.workspace {
  display: grid;
  grid-template-columns: 410px 1fr;
  flex: 1;
  min-height: 0;
}

/* Left Wizard Pane */
.wizard-pane {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.step-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-soft);
}

.step-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-tab:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.step-tab.active {
  background: var(--primary-soft);
  border-color: #7dd3fc;
  color: #0369a1;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.step-tab.active .step-num {
  background: var(--primary);
  color: #ffffff;
}

.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 24px;
}

.step-panel {
  display: none;
  flex-direction: column;
  gap: 15px;
}

.step-panel.active {
  display: flex;
}

.step-intro h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.step-intro p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.45;
}

/* Form Elements */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.field-group .opt {
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-muted);
  margin-left: auto;
}

.field-group .req {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 7px;
  border-radius: 99px;
  margin-left: auto;
}

.field-group input[type='text'],
.field-group input[type='number'],
.field-group select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-pills.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pill-card {
  text-align: left;
  padding: 10px 11px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.pill-card:hover {
  border-color: #94a3b8;
  background: var(--surface-alt);
}

.pill-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.pill-card strong {
  font-size: 12.5px;
  color: var(--ink);
}

.pill-card span {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.3;
}

/* Visual Style Cards */
.visual-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

/* Full-width Visual Railing + Stair-Attachment Cutaway Gallery */
.rail-gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.rail-gallery-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 9px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.rail-gallery-card:hover {
  border-color: #64748b;
  transform: translateY(-1px);
}

.rail-gallery-card.active {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.16);
}

.rail-gallery-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 240 / 144;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  margin-bottom: 7px;
  overflow: hidden;
}

.rail-gallery-card.active .rail-gallery-thumb {
  border-color: #38bdf8;
}

.rail-gallery-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rail-gallery-meta strong {
  font-size: 12.6px;
  color: var(--ink);
}

.rail-gallery-chip {
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.rail-gallery-card small {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.32;
}

.mount-visual-card {
  padding: 8px !important;
}

.mount-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 120 / 68;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 5px;
  overflow: hidden;
}

.pill-card.active .mount-thumb {
  border-color: #38bdf8;
}

.fab-drawer {
  margin-top: 2px;
}

.fab-drawer .field-group {
  margin-top: 8px;
}

.advanced-grid .field-group label {
  display: block;
}

.ramp-leg-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 9px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ramp-leg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ramp-leg-badge {
  font-size: 10.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 5px;
}

.ramp-leg-rise {
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #059669;
}

.ramp-leg-rise.warn {
  color: #d97706;
}

.ramp-leg-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.ramp-leg-fields label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
}

.ramp-leg-fields input,
.ramp-leg-fields select {
  width: 100%;
  padding: 5px 6px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.style-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 9px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.style-card:hover {
  border-color: #64748b;
  transform: translateY(-1px);
}

.style-card.active {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.16);
}

.card-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 220 / 132;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0;
  margin-bottom: 8px;
  overflow: hidden;
  color: #1e293b;
}

.style-card.active .card-thumb {
  border-color: #38bdf8;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.14);
}

.style-card strong {
  font-size: 12.2px;
  color: var(--ink);
  margin-bottom: 2px;
}

.style-card small {
  font-size: 10.8px;
  color: var(--ink-muted);
  line-height: 1.32;
}

/* Measurement Inputs */
.measure-box {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.big-input input {
  font-size: 17px !important;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace !important;
  padding-right: 46px !important;
}

.unit-suffix {
  position: absolute;
  right: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  pointer-events: none;
}

.field-hint {
  font-size: 11.2px;
  color: var(--ink-muted);
}

/* Plain-English Live Summary Card */
.summary-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  background: #ffffff;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.summary-head strong {
  font-size: 12.5px;
}

.code-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

.code-pill.pass {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.code-pill.warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-box {
  background: var(--surface-alt);
  border-radius: 7px;
  padding: 7px 8px;
}

.stat-box span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.stat-box strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}

.summary-warnings {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  color: var(--danger);
}

.callout-tip {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 12px;
  color: #0c4a6e;
}

.callout-tip ul {
  margin: 6px 0 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-badge {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  font-size: 11.5px;
  color: #0c4a6e;
  line-height: 1.4;
}

.info-badge.hidden {
  display: none;
}

.info-badge strong {
  display: block;
  color: #0369a1;
  font-size: 11.8px;
  margin-bottom: 2px;
}

.info-badge .badge-meta {
  display: inline-block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #059669;
  background: #d1fae5;
  padding: 2px 6px;
  border-radius: 5px;
}

.crl-selector-box {
  padding: 11px 12px;
  background: var(--surface-alt);
  border: 1.5px solid #7dd3fc;
  border-radius: 10px;
}

.ada-toggle-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  transition: all 0.15s ease;
}

.ada-toggle-card.active {
  border-color: var(--emerald);
  background: #ecfdf5;
}

.ada-hint {
  margin-top: 5px;
  padding-left: 24px;
  font-size: 11.2px;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* Job Mode Selector Grid (Step 2) */
.job-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.mode-card:hover {
  border-color: #64748b;
  background: var(--surface-alt);
}

.mode-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.mode-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 96 / 54;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 5px;
  overflow: hidden;
  color: #1e293b;
}

.mode-card.active .mode-thumb {
  border-color: #7dd3fc;
}

.mode-card strong {
  font-size: 11.5px;
  color: var(--ink);
}

.mode-subopts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-subopts.hidden,
.measure-box.hidden,
.field-group.hidden,
.field-row.hidden {
  display: none;
}

.subopt-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.choice-pills.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

/* Split / Multi-Section Builder */
.seg-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seg-builder-head strong {
  font-size: 12px;
}

.seg-add-btns {
  display: flex;
  gap: 4px;
}

.mini-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mini-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.segment-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.seg-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 68px 24px;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.seg-row input {
  min-width: 0;
  width: 100%;
  padding: 5px 6px !important;
  font-size: 12px !important;
}

.seg-tag {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 5px;
  text-align: center;
}

.seg-tag.steps {
  background: var(--amber-soft);
  color: #b45309;
}

.seg-tag.level {
  background: var(--primary-soft);
  color: #0369a1;
}

.seg-tag.ramp {
  background: var(--emerald-soft);
  color: #047857;
}

.seg-tag.curved {
  background: #ede9fe;
  color: #6d28d9;
}

.combo-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.combo-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}

.combo-btn {
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.combo-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.seg-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.seg-top-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 74px 22px;
  align-items: center;
  gap: 5px;
}

.seg-sub-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.seg-card-wrap input,
.seg-card-wrap select {
  min-width: 0;
  width: 100%;
  padding: 4px 6px !important;
  font-size: 11.5px !important;
  border-radius: 6px !important;
}

.seg-row input {
  padding: 5px 7px !important;
  font-size: 12px !important;
}

.seg-del-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 5px;
  line-height: 1;
}

.seg-del-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Collapsible Advanced Drawer */
.advanced-drawer {
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 9px 12px;
  background: var(--surface-alt);
}

.advanced-drawer summary {
  cursor: pointer;
  font-size: 12.2px;
  font-weight: 700;
  color: var(--ink-muted);
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 11px 0;
}

/* Wizard Footer */
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-alt);
}

.step-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #0f172a;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #1e293b;
}

.btn-subtle {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--border);
}

.btn-subtle:hover {
  background: var(--surface-alt);
}

.btn-3d {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #7dd3fc;
}

.btn-3d:hover {
  background: #e0f2fe;
}

.btn.btn-3d.active,
.btn-3d.active {
  background: #0284c7;
  color: #ffffff !important;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.22);
}

/* Interactive 3D Model Viewport */
.viewer3d-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer3d-stage.hidden,
.sheet-stage.hidden {
  display: none !important;
}

.v3d-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.v3d-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-bottom: 1px solid #1e293b;
}

.v3d-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.v3d-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 3px;
}

.v3d-btn {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.v3d-btn:hover {
  border-color: #64748b;
  background: #334155;
}

.v3d-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.v3d-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 240px;
  cursor: grab;
}

.v3d-canvas-wrap:active {
  cursor: grabbing;
}

.v3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.v3d-hud-tl {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 11.5px;
  pointer-events: none;
  min-width: 235px;
}

.v3d-hud-title {
  font-weight: 800;
  font-size: 12px;
  color: #38bdf8;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 4px;
}

.v3d-hud-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.5;
}

.v3d-hud-row span {
  color: #94a3b8;
}

.v3d-hud-row strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #f1f5f9;
}

.v3d-hud-br {
  position: absolute;
  bottom: 10px;
  right: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: #e2e8f0;
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* RIGHT VIEWER PANE */
.viewer-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #e2e8f0;
}

.package-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 16px;
}

.package-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pkg-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-soft);
  background: var(--surface-alt);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.pkg-tab:hover {
  border-color: #94a3b8;
}

.pkg-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pkg-submittal .pkg-dot {
  background: var(--primary);
}
.pkg-stair .pkg-dot {
  background: var(--amber);
}
.pkg-rail .pkg-dot {
  background: var(--emerald);
}

.pkg-tab.active.pkg-submittal {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.pkg-tab.active.pkg-stair {
  background: var(--amber-soft);
  border-color: var(--amber);
}

.pkg-tab.active.pkg-rail {
  background: var(--emerald-soft);
  border-color: var(--emerald);
}

.pkg-text strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.pkg-text small {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}

/* Sheet Toolbar */
.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.sheet-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sheet-pill {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sheet-pill strong {
  font-family: 'JetBrains Mono', monospace;
  margin-right: 4px;
}

.sheet-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-group {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-alt);
}

.zoom-label {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-muted);
  min-width: 38px;
  text-align: center;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  display: inline-flex;
  gap: 6px;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  max-height: calc(100vh - 185px);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dropdown-menu.hidden {
  display: none;
}

.menu-section {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 5px 9px 2px;
}

.dropdown-menu button {
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.dropdown-menu button:hover {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: block;
  background: radial-gradient(circle at 20% 20%, #dbeafe 0%, #e2e8f0 60%);
}

.canvas-viewport.mode-3d {
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}

.canvas-viewport.can-pan {
  cursor: grab;
}

.canvas-viewport.panning {
  cursor: grabbing;
  user-select: none;
}

.sheet-stage {
  margin: 0 auto;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  border-radius: 4px;
  background: #ffffff;
  width: 100%;
  max-width: 1240px;
}

.cad-svg-sheet {
  display: block;
  width: 100%;
  height: auto;
}

/* Status Strip */
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-item strong {
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

/* Visual Stair Structural Mounting Substrate Cards */
.stair-mount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stair-mount-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 5px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
  font-family: inherit;
}

.stair-mount-card:hover {
  border-color: #7dd3fc;
  background: #f8fafc;
}

.stair-mount-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.14);
}

.stair-mount-slot {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.stair-mount-thumb {
  display: block;
  width: 100%;
  height: auto;
}

.stair-mount-card strong {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.stair-mount-card span {
  font-size: 9.5px;
  color: var(--ink-muted);
  line-height: 1.15;
}

/* ============================================================================
   CLEAN & SIMPLE UI POLISH (Collapsible Job Scope, Step Section Cards, Single-Row Toolbar)
   ============================================================================ */
.job-scope-drawer {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.job-scope-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.job-scope-summary-bar::-webkit-details-marker {
  display: none;
}

.scope-expand-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #bae6fd;
  border-radius: 99px;
  padding: 2px 9px;
}

.job-scope-drawer[open] .scope-expand-pill {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--ink);
}

.job-scope-body {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-section-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-sec-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2e8f0;
}

.drawer-section-heading {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-top: 4px;
}

.fab-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #0369a1;
  background: var(--primary-soft);
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.package-bar {
  padding: 8px 14px;
}

.pkg-tab {
  padding: 7px 11px;
}

.sheet-toolbar {
  padding: 7px 14px;
  gap: 8px;
}

.sheet-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sheet-pill {
  white-space: nowrap;
  padding: 5px 8.5px;
  font-size: 11.5px;
}

/* Print Layout — Clean 1-Sheet-Per-Page Engineering Landscape PDF */
.print-only {
  display: none;
}

@media print {
  @page {
    size: landscape;
    margin: 0.25in;
  }
  body {
    background: #ffffff !important;
  }
  .no-print {
    display: none !important;
  }
  .app-shell {
    height: auto !important;
    overflow: visible !important;
  }
  .print-only {
    display: block !important;
  }
  .print-sheet-page {
    page-break-after: always;
    break-after: page;
    width: 100%;
  }
  .print-sheet-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .print-sheet-page svg {
    width: 100%;
    height: auto;
    display: block;
  }
}

/* ADA §307 / IBC §1003.3.3 Cane-Detection Safety Prompt Banner */
.safety-prompt-banner {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.12);
}

.safety-prompt-banner.hidden {
  display: none !important;
}

.safety-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.safety-prompt-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #92400e;
  letter-spacing: 0.01em;
}

.safety-prompt-badge {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  white-space: nowrap;
}

.safety-prompt-msg {
  font-size: 11px;
  line-height: 1.4;
  color: #78350f;
  margin: 0 0 8px 0;
}

.safety-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.safety-act-btn {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #d97706;
  background: #d97706;
  color: #ffffff;
  font-family: inherit;
  font-size: 10.8px;
  font-weight: 700;
  cursor: pointer;
}

.safety-act-btn:hover {
  background: #b45309;
  border-color: #b45309;
}

.safety-act-btn.ghost {
  background: #ffffff;
  color: #92400e;
  border-color: #f59e0b;
}

.safety-act-btn.ghost:hover {
  background: #fef3c7;
}

.safety-act-btn.dismiss {
  background: transparent;
  color: #64748b;
  border-color: #cbd5e1;
}

.safety-act-btn.dismiss:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Mobile / iPhone Quick Pane Switcher (hidden on desktop) */
.mobile-pane-tabs {
  display: none;
}

/* Touch responsiveness */
button,
select,
input,
summary {
  touch-action: manipulation;
}

/* Responsive fallback for tablet & narrow screens */
@media (max-width: 1024px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .wizard-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .package-tabs {
    grid-template-columns: 1fr;
  }
}

/* Dedicated iPhone & Smartphone Responsive Layout */
@media (max-width: 820px) {
  html,
  body,
  .app-shell {
    overflow-x: clip;
    max-width: 100vw;
  }
  .app-shell {
    overflow-y: visible;
  }
  .preview-pane,
  .sheet-toolbar,
  .sheet-pills {
    min-width: 0;
    max-width: 100%;
  }
  .topbar {
    flex-wrap: wrap;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    gap: 8px;
    height: auto;
  }
  .brand-sub {
    display: none;
  }
  .brand h1 {
    font-size: 16px;
  }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  .preset-group {
    flex: 1 1 160px;
    min-width: 140px;
  }
  .preset-select {
    width: 100%;
    font-size: 14px;
  }

  .mobile-pane-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 7px 8px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .mobile-pane-btn {
    padding: 8px 4px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
  }
  .mobile-pane-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
  }

  /* Single-pane toggle on iPhone so user sees either full Design Controls OR full Drawings / 3D */
  body.mobile-pane-design .preview-pane {
    display: none !important;
  }
  body.mobile-pane-preview .wizard-pane {
    display: none !important;
  }

  .wizard-pane {
    height: auto;
    max-height: none;
    overflow: visible;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }
  .wizard-body {
    overflow: visible;
    padding: 12px;
  }
  .wizard-footer {
    position: sticky;
    bottom: 0;
    z-index: 30;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* Prevent iOS Safari automatic page zoom when focusing inputs (<16px triggers iOS zoom) */
  input[type="text"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .job-mode-grid,
  .stair-mount-grid,
  .choice-pills.three-col {
    grid-template-columns: repeat(2, 1fr);
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-pane {
    min-height: calc(100dvh - 110px);
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }
  .package-bar {
    padding: 8px 10px;
  }
  .sheet-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 8px;
  }
  .sheet-pills {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .toolbar-right {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }
  .canvas-viewport {
    padding: 8px;
    min-height: 56dvh;
    -webkit-overflow-scrolling: touch;
  }
  .canvas-viewport.mode-3d {
    min-height: 64dvh;
    padding: 4px;
  }
  .v3d-toolbar {
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: 5px;
  }
  .v3d-group {
    flex-wrap: wrap;
    gap: 2.5px;
  }
  .v3d-btn {
    padding: 3.5px 4.5px;
    font-size: 10px;
  }
  .v3d-label {
    font-size: 9.5px;
  }
  .v3d-hud-tl {
    position: static;
    width: auto;
    margin: 6px 6px 4px;
    border-radius: 8px;
    font-size: 10.5px;
  }
  .v3d-canvas-wrap {
    display: flex;
    flex-direction: column;
    min-height: 360px;
  }
  .v3d-canvas {
    flex: 1 1 320px;
    min-height: 320px;
  }
  .v3d-hud-br {
    position: static;
    margin: 0 6px 6px;
    text-align: center;
    font-size: 9.5px;
    padding: 4px 8px;
  }
  .status-strip {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
    gap: 4px;
  }
  .dropdown-menu {
    right: 0;
    left: auto;
    max-width: calc(100vw - 24px);
    max-height: 65dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ==========================================================================
   STUDIO POWER TOOLS: UNDO/REDO, AUTO-FIX CODE, TOASTS & CUT-LIST/QUOTE VIEW
   ========================================================================== */
.undo-redo-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.topbar-io-btn.icon-io {
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  min-width: 28px;
  border: none;
  background: transparent;
}
.topbar-io-btn.icon-io:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.topbar-io-btn.icon-io:not(:disabled):hover {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff;
}

.btn-quote {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  border: 1px solid #0f766e;
  font-weight: 700;
}
.btn-quote:hover {
  background: linear-gradient(135deg, #115e59 0%, #0f766e 100%);
}
.btn-quote.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #5eead4;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.35);
}

.summary-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auto-fix-btn {
  border: none;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.auto-fix-btn:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.status-code-pill.pass {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.status-code-pill.warn {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
  cursor: pointer;
}
.status-code-pill.warn:hover {
  background: #fde68a;
}

/* Toast Notification Stack */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  border-left: 4px solid #38bdf8;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 380px;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  border-left-color: #10b981;
}
.toast-warn {
  border-left-color: #f59e0b;
}

/* Interactive Cut-List, Stock Nesting & Live Quote Studio Stage */
.canvas-viewport.mode-quote {
  padding: 16px 20px;
  background: #f1f5f9;
  overflow-x: hidden;
}
.quote-stage {
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: 0 auto;
}
.quote-stage.hidden {
  display: none;
}
.quote-studio {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}
.quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.quote-header h2 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.quote-header p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.quote-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quote-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.q-kpi {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
}
.q-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-kpi-val {
  font-size: clamp(13.5px, 1.15vw, 17px);
  font-weight: 800;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-kpi-val.primary {
  color: #0f766e;
}
.q-kpi small {
  font-size: 10.5px;
  color: var(--ink-muted);
  line-height: 1.3;
}
.quote-two-col {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 14px;
}
.q-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}
.q-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.q-card-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
}
.q-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 9px;
  border-radius: 99px;
}
.q-reset-btn {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.q-reset-btn:hover {
  background: #e2e8f0;
  color: var(--ink);
}
.q-rates-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.q-rates-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  min-width: 0;
}
.q-rates-grid input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.q-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.q-brow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.q-brow strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}
.q-brow.total {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 2px solid #0f172a;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.q-brow.total strong {
  font-size: 16px;
  color: #0f766e;
}

/* Visual Bar Stock Nesting Diagram */
.q-order-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
}
.q-order-strip strong {
  color: var(--ink);
}
.nest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.nest-group-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  background: #f8fafc;
}
.nest-group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}
.nest-mark-pill {
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
}
.nest-group-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.nest-group-meta strong {
  font-size: 12px;
  color: var(--ink);
}
.nest-group-meta small {
  font-size: 10.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nest-group-stat {
  text-align: right;
  display: flex;
  flex-direction: column;
}
.nest-group-stat strong {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}
.nest-group-stat small {
  font-size: 10.5px;
  color: #0f766e;
  font-weight: 700;
}
.nest-sticks {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nest-stick-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.nest-stick-id {
  width: 22px;
  font-size: 10px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-muted);
}
.nest-bar-track {
  flex: 1;
  height: 20px;
  display: flex;
  gap: 1.5px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}
.nest-seg {
  height: 100%;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}
.nest-drop {
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    #f1f5f9,
    #f1f5f9 4px,
    #e2e8f0 4px,
    #e2e8f0 8px
  );
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
}
.nest-stick-pct {
  width: 34px;
  text-align: right;
  font-size: 10.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
}

/* Filterable Cut-List BOM Table */
.q-bom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.q-filter-pills {
  display: flex;
  gap: 4px;
}
.q-pill {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
}
.q-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.q-search {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  width: 210px;
}
.q-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.q-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.q-table th {
  text-align: left;
  background: #f8fafc;
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.q-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--ink);
  vertical-align: middle;
}
.q-table tr:last-child td {
  border-bottom: none;
}
.q-table th.num, .q-table td.num {
  text-align: right;
}
.q-table .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}
.q-table .muted {
  color: var(--ink-muted);
  font-size: 11.5px;
}
.q-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  background: #e2e8f0;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.q-mark {
  font-family: 'JetBrains Mono', monospace;
  color: #0369a1;
}
.q-pkg {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.q-pkg-stair { background: #ffedd5; color: #9a3412; }
.q-pkg-rail { background: #dcfce7; color: #166534; }
.q-pkg-glass { background: #e0f2fe; color: #0369a1; }
.quote-empty {
  text-align: center;
  padding: 22px;
  color: var(--ink-muted);
  font-size: 12.5px;
}

@media (max-width: 1080px) {
  .quote-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quote-two-col {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  .canvas-viewport.mode-quote {
    padding: 10px;
  }
  .quote-header {
    padding: 11px 12px;
  }
  .quote-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .quote-header-actions .btn {
    padding: 7px 6px;
    font-size: 11px;
    justify-content: center;
    text-align: center;
  }
  .quote-kpi-grid {
    gap: 8px;
  }
  .q-kpi {
    padding: 9px 10px;
  }
  .q-kpi small {
    font-size: 9.8px;
  }
  .q-card {
    padding: 11px 12px;
  }
  .q-rates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .q-filter-pills {
    flex-wrap: wrap;
  }
  .q-search {
    width: 100%;
  }
  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 16px;
  }
}

/* ==========================================================================
   HELP BUTTON & COMPLETE ITEM GUIDE MODAL
   ========================================================================== */
.topbar-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.16);
  color: #e0f2fe;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.topbar-help-btn:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}
.help-btn-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #38bdf8;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

body.modal-open {
  overflow: hidden;
}

.help-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.help-modal-overlay.hidden {
  display: none;
}

.help-modal-dialog {
  width: min(1040px, 100%);
  max-height: min(86vh, 820px);
  background: #f8fafc;
  color: var(--ink);
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.42);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #1e293b;
}
.help-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.help-badge-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-modal-header h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
}
.help-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: #94a3b8;
}
.help-close-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-close-btn:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff;
}

.help-modal-controls {
  padding: 12px 18px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-search-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.help-search-input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}
.help-search-clear {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.help-search-clear.hidden {
  display: none;
}

.help-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.help-cat-pill {
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.help-cat-pill:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
.help-cat-pill.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.help-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  -webkit-overflow-scrolling: touch;
}
.help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.help-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 5px;
}
.help-section-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}
.help-section-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 99px;
}
.help-section-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.help-items-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.help-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.help-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.help-item-card h4 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}
.help-item-tag {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.help-item-card p {
  margin: 0;
  font-size: 11.8px;
  line-height: 1.45;
  color: #334155;
}
.help-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-muted);
  font-size: 13px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

.help-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-muted);
}

@media (max-width: 820px) {
  .help-modal-overlay {
    padding: 8px;
    align-items: stretch;
  }
  .help-modal-dialog {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }
  .help-modal-header {
    padding: 11px 12px;
  }
  .help-modal-header h2 {
    font-size: 14px;
  }
  .help-modal-controls {
    padding: 10px 12px 8px;
  }
  .help-cat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
  }
  .help-modal-body {
    padding: 12px;
  }
  .help-items-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .help-modal-footer {
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    font-size: 10.8px;
  }
  .help-modal-footer .btn {
    margin-left: auto;
  }
}

/* ==========================================================================
   ARCHITECTURAL STUDIO VISUAL POLISH & INTERACTIVE REFINEMENTS
   ========================================================================== */
.topbar {
  background: linear-gradient(180deg, #0b1324 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.24);
  box-shadow: 0 4px 18px rgba(2, 6, 23, 0.28);
}

.brand-mark {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(2, 132, 199, 0.22);
}

.preset-select,
.topbar-io-btn,
.topbar-ada-btn,
.unit-toggle {
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.preset-select:hover,
.topbar-io-btn:hover {
  border-color: rgba(148, 163, 184, 0.55);
}

.step-tab {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.step-tab.active {
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.18);
}

/* Elevated interactive selection cards across Steps 1-4 */
.style-card,
.rail-gallery-card,
.job-mode-card,
.stair-mount-card,
.pill-card {
  transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.style-card:hover,
.rail-gallery-card:hover,
.job-mode-card:hover,
.stair-mount-card:hover,
.pill-card:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.09);
}

.style-card.active,
.rail-gallery-card.active,
.job-mode-card.active,
.stair-mount-card.active,
.pill-card.active {
  box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.18), 0 6px 16px rgba(2, 132, 199, 0.12);
}

/* Quick-Measure Architectural Height & Width Chips on Step 4 */
.quick-measure-bar {
  margin-top: 6px;
  gap: 4px;
}

.combo-btn {
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.combo-btn.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.26);
}

/* Crisp Package Tabs, Sheet Pills & Tabular Numerals */
.package-tab,
.sheet-pill,
.btn {
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.package-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}

.package-tab.active {
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.14);
}

.sheet-pill.active {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
}

.q-kpi-val,
.zoom-label,
.summary-tile strong,
.status-strip {
  font-variant-numeric: tabular-nums;
}

/* Refined Thin Scrollbars */
.wizard-body,
.sheet-pills,
.nest-list,
.help-modal-body {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* Crisp Keyboard Focus Accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 1.5px;
}

/* Shop Floor Quick-Reference: Key Measurements & Saw Angles */
.q-fab-ref .q-fab-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.q-angle-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.q-angle-tile {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #1e293b;
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.q-angle-tile.highlight {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  border-color: #38bdf8;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.25);
}
.q-angle-tile span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cbd5e1;
  text-transform: uppercase;
}
.q-angle-tile.highlight span {
  color: #e0f2fe;
}
.q-angle-tile strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.q-angle-tile small {
  font-size: 10px;
  color: #94a3b8;
}
.q-angle-tile.highlight small {
  color: #bae6fd;
}
.q-meas-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.q-meas-strip > div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.q-meas-strip span {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}
.q-meas-strip strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.q-meas-strip strong.accent {
  color: #c2410c;
}
.q-meas-strip small {
  font-size: 10px;
  color: #475569;
  font-family: 'JetBrains Mono', monospace;
}
.q-angle-cell {
  color: #0369a1;
  font-weight: 700;
  white-space: nowrap;
}
@media (max-width: 1120px) {
  .q-angle-grid,
  .q-meas-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .q-angle-grid,
  .q-meas-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Step 3 Actual Railing Components & Live Breakdown Schedule */
#railPostCompWrap.hidden {
  display: none !important;
}
.comp-breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.comp-breakdown-head strong {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.comp-count-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: 99px;
}
.comp-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.comp-item-card {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}
.comp-item-card:hover {
  border-color: #0284c7;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.12);
  transform: translateY(-1px);
}
.comp-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.comp-mark-badge {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 4px;
  color: #ffffff;
  background: #0f172a;
}
.comp-mark-badge.tone-rail { background: #0284c7; }
.comp-mark-badge.tone-glass { background: #0891b2; }
.comp-mark-badge.tone-struct { background: #1e293b; }
.comp-mark-badge.tone-hw { background: #b45309; }
.comp-item-name {
  flex: 1 1 auto;
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comp-qty-pill {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 1px 6px;
  border-radius: 5px;
}
.comp-item-mat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #334155;
  line-height: 1.3;
}
.comp-item-foot {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.comp-cut-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  font-weight: 800;
  color: #c2410c;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 0.5px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.comp-note-txt {
  font-size: 10px;
  color: #64748b;
  line-height: 1.3;
}
.comp-breakdown-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.comp-rf205-btn {
  border: 1px solid #0284c7;
  background: #e0f2fe;
  color: #0369a1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.comp-rf205-btn:hover {
  background: #0284c7;
  color: #ffffff;
}
.comp-fastener-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.4px;
  font-weight: 700;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.5px 5px;
  border-radius: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comp-inspect-link {
  margin-left: auto;
  font-size: 9.8px;
  font-weight: 800;
  color: #0284c7;
  white-space: nowrap;
}

/* Interactive Per-Component Detail & Fastener Inspector Modal */
.comp-detail-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.comp-detail-modal-overlay.hidden {
  display: none !important;
}
.comp-detail-modal {
  width: min(880px, 100%);
  max-height: 90vh;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.34);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.comp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.comp-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.comp-modal-title-wrap h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}
.comp-modal-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}
.comp-modal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.comp-nav-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
}
.comp-nav-btn:hover {
  border-color: #0284c7;
  color: #0284c7;
}
.comp-nav-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  padding: 0 4px;
}
.comp-close-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.comp-close-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}
.comp-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comp-modal-drawing-wrap {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.comp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 12px;
}
.comp-spec-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.comp-spec-panel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.comp-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.comp-spec-table th,
.comp-spec-table td {
  padding: 5px 4px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}
.comp-spec-table tr:last-child th,
.comp-spec-table tr:last-child td {
  border-bottom: none;
}
.comp-spec-table th {
  color: #475569;
  font-weight: 700;
  width: 40%;
}
.comp-spec-table td.mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0f172a;
}
.comp-spec-table td.accent {
  color: #b45309;
}
.comp-fastener-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comp-fastener-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #dc2626;
  border-radius: 7px;
  padding: 7px 9px;
}
.comp-fastener-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: #0f172a;
}
.comp-fastener-qty {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #0369a1;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.comp-fastener-spec {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  color: #b91c1c;
  margin: 3px 0;
}
.comp-fastener-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: #475569;
}
.comp-torque-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 1px 6px;
  border-radius: 4px;
}
.comp-modal-notes {
  margin: 0;
  padding: 8px 12px 8px 26px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 11px;
  color: #1e3a8a;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.comp-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.suite-back-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
}
.suite-back-wrap.hidden {
  display: none !important;
}
.suite-back-btn,
.suite-seacraft-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 7px;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.suite-back-btn {
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}
.suite-back-btn:hover {
  background: rgba(14, 165, 233, 0.28);
  color: #ffffff;
}
.suite-seacraft-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}
.suite-seacraft-btn:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #ffffff;
}
@media (max-width: 720px) {
  .suite-seacraft-btn {
    display: none;
  }
}

/* Means of Egress (IBC Ch. 10 / NFPA 101) Step 1 Card */
.egress-toggle-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.egress-toggle-card.active {
  background: #eff6ff;
  border-color: #60a5fa;
}
.egress-toggle-card.hidden,
.egress-options-wrap.hidden,
.egress-cap-pill.hidden {
  display: none !important;
}
.egress-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.egress-cap-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  font-weight: 800;
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.egress-cap-pill.warn {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}
.egress-options-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #bfdbfe;
}
.egress-opts-row {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 10px;
  align-items: center;
}
.egress-opts-row .compact-field {
  margin-bottom: 0;
}
.egress-opts-row .compact-field label {
  font-size: 10.5px;
  margin-bottom: 3px;
}
.egress-opts-row .compact-field input {
  padding: 5px 7px;
  font-size: 12px;
}
.egress-checks-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.compact-chk {
  font-size: 11px;
  color: #1e293b;
}

.auto-landing-banner {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-left: 3.5px solid #059669;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.auto-landing-banner.warn {
  background: #fef2f2;
  border-color: #fca5a5;
  border-left-color: #dc2626;
}
.auto-landing-banner.hidden {
  display: none !important;
}
.auto-landing-banner-title {
  font-size: 11.2px;
  font-weight: 800;
  color: #065f46;
}
.auto-landing-banner.warn .auto-landing-banner-title {
  color: #991b1b;
}
.auto-landing-banner-msg {
  font-size: 10.4px;
  color: #334155;
  line-height: 1.38;
}
.auto-landing-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

@media (max-width: 720px) {
  .comp-detail-grid {
    grid-template-columns: 1fr;
  }
  .comp-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .comp-modal-nav {
    width: 100%;
    justify-content: flex-end;
  }
}
