/* Warehouse Builder — themed on Federal Steel's brand identity (navy/steel-blue,
   pulled from federalsteel.ca): a dark navy primary action color, a pale
   steel-blue secondary, and a neutral warm-gray tertiary for a third
   category color, in place of the previous Spatialis OS amber/coral/plum
   palette. Same token names/structure throughout, so every rule below that
   references var(--primary), var(--secondary-2), etc. is unchanged. */

:root {
  /* Brand — Primary (Federal Steel navy) */
  --primary-light: #D7E3EA;
  --primary: #143B52;
  --primary-2: #051C2C;
  --primary-dark: #020D15;

  /* Brand — Secondary (Federal Steel pale steel-blue) */
  --secondary-light: #EAF2F7;
  --secondary: #C6DAE6;
  --secondary-2: #6E93A8;

  /* Brand — Tertiary (neutral steel gray, for a third category color) */
  --tertiary-light: #E8E6E1;
  --tertiary: #8C8781;
  --tertiary-dark: #4A4742;

  /* Status system — pale bg + dark text pairs, for light surfaces only.
     Kept as universal green/amber/red semantics rather than brand colors —
     these mean success/warning/danger regardless of whose logo is on top. */
  --status-neutral-bg: #eceae4;   --status-neutral-text: #5f5e5a;
  --status-progress-bg: #e6f1fb;  --status-progress-text: #0c447c;
  --status-success-bg: #eaf3de;   --status-success-text: #27500a;
  --status-warning-bg: #faeeda;   --status-warning-text: #633806;
  --status-danger-bg: #fcebeb;    --status-danger-text: #791f1f;

  /* Base palette — ink matches Federal Steel's own body/link navy (#051C2C),
     same color doing double duty as --primary-2, just like their site. */
  --ink: #051C2C;
  --ink-secondary: #4A5A66;
  --surface: #EEF3F6;
  --border: #D7E1E7;
  --background: #ffffff;

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Glassmorphism system — translucent frosted surfaces layered over the
     ambient gradient backdrop (see body, below), built entirely from the
     Federal Steel brand colors above so the palette stays consistent, just
     given depth/blur/light instead of flat fills. Two strengths: "glass"
     for panels that sit over busy content (cards, tables, toolbars) and
     want to stay legible, "glass-strong" for chrome that should feel more
     opaque (topbar, sidebar nav, sticky form actions). */
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-bg-tint: rgba(215, 227, 234, 0.4); /* primary-light, translucent */
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-border-soft: rgba(5, 28, 44, 0.08);
  --glass-blur: blur(18px) saturate(1.4);
  --glass-blur-soft: blur(10px) saturate(1.2);
  --glass-shadow: 0 8px 30px rgba(2, 13, 21, 0.12), 0 1px 2px rgba(5, 28, 44, 0.06);
  --glass-shadow-lifted: 0 14px 40px rgba(2, 13, 21, 0.18), 0 2px 6px rgba(5, 28, 44, 0.08);
  --glass-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --motion-fast: 150ms cubic-bezier(.2, .7, .3, 1);
  --motion-snap: 220ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
}

/* Ambient gradient backdrop — soft, low-opacity color blooms in the brand's
   amber/coral/plum hues, fixed behind the whole app so every frosted-glass
   surface above has real color/light to blur and refract instead of
   sitting on flat white. Kept subtle (a working data tool, not a hero
   splash) and fixed so it doesn't scroll/shift as content does. */
body {
  background-color: var(--background);
  background-image:
    radial-gradient(720px 520px at 6% -6%, var(--primary-light) 0%, transparent 60%),
    radial-gradient(680px 520px at 100% 0%, var(--secondary-light) 0%, transparent 55%),
    radial-gradient(760px 620px at 15% 100%, var(--tertiary-light) 0%, transparent 55%),
    radial-gradient(900px 700px at 100% 100%, var(--primary-light) 0%, transparent 50%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-6);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border-soft);
  box-shadow: var(--glass-inset-highlight);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}
/* Logotype role: Abel 700 — the one place weight 700 is allowed */
.brand h1 {
  font-family: 'Abel', sans-serif;
  font-size: 24px;
  line-height: 1.1;
  margin: 0;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--ink);
}
.brand .subtitle { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-secondary); }

.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.save-status { font-size: 13px; color: var(--ink-secondary); margin-right: var(--sp-1); }

.btn {
  border: 1px solid var(--glass-border-soft);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--glass-inset-highlight), 0 1px 2px rgba(26, 26, 24, 0.04);
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast),
    transform var(--motion-fast), box-shadow var(--motion-fast);
}
/* Crisp, instant-feeling micro-interactions: a small lift + brighter shadow
   on hover, a quick press-down (scale + flattened shadow) on click — the
   same pattern repeated across every button variant below so the whole app
   responds consistently to touch. */
.btn:hover { background: rgba(255, 255, 255, 0.92); border-color: var(--primary-2); transform: translateY(-1px); box-shadow: var(--glass-inset-highlight), var(--glass-shadow); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: var(--glass-inset-highlight), 0 1px 2px rgba(26, 26, 24, 0.08); }
.btn:focus-visible { outline: none; box-shadow: var(--glass-inset-highlight), 0 0 0 3px rgba(5, 28, 44, 0.22); }
.btn:disabled, .icon-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}
.icon-btn:disabled:hover { background: transparent; color: var(--ink-secondary); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  border-color: var(--primary-2);
  color: #fff;
  box-shadow: var(--glass-inset-highlight), 0 4px 14px rgba(5, 28, 44, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  border-color: var(--primary);
  box-shadow: var(--glass-inset-highlight), 0 6px 20px rgba(5, 28, 44, 0.36);
}
.btn-ghost { background: var(--glass-bg); }
.btn-danger-ghost { background: var(--glass-bg); color: var(--status-danger-text); border-color: var(--glass-border-soft); }
.btn-danger-ghost:hover { background: rgba(252, 235, 235, 0.85); border-color: var(--status-danger-text); }
.file-btn { display: inline-flex; align-items: center; }
.file-btn.is-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.icon-btn {
  background: transparent; border: none; color: var(--ink-secondary); cursor: pointer; font-size: 14px;
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.icon-btn:hover { color: var(--status-danger-text); background: var(--status-danger-bg); transform: scale(1.08); }
.icon-btn:active { transform: scale(.94); }

.switcherbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border-bottom: 1px solid var(--glass-border-soft);
  flex-shrink: 0;
  position: relative;
  z-index: 4;
}
.lock-banner {
  font-size: 13px;
  font-weight: 500;
  color: var(--status-danger-text);
  background: rgba(252, 235, 235, 0.75);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid rgba(121, 31, 31, 0.35);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.switcher-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--ink-secondary);
}
.switcher-label select {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-size: 14px;
  min-width: 220px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.switcher-label select:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(5, 28, 44, 0.18);
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}
.empty-state[hidden] { display: none; }
.empty-state-inner {
  text-align: center;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow-lifted);
}
.empty-state-logo { width: 220px; max-width: 60%; height: auto; margin: 0 auto var(--sp-6); display: block; }
.empty-state-inner h2 { margin-bottom: var(--sp-2); }
.empty-state-inner .hint { margin: 0 auto var(--sp-4); }

/* Customer intake gate — a full-screen overlay above everything else (see
   the HTML comment above #customerGate for why it's always in the markup
   rather than injected). Deliberately opaque, not glass — this is the very
   first thing a customer sees and should read as a clean, branded form, not
   a translucent layer over app chrome they haven't earned access to yet. */
.customer-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background-color: var(--background);
  background-image:
    radial-gradient(720px 520px at 6% -6%, var(--primary-light) 0%, transparent 60%),
    radial-gradient(680px 520px at 100% 0%, var(--secondary-light) 0%, transparent 55%),
    radial-gradient(760px 620px at 15% 100%, var(--tertiary-light) 0%, transparent 55%),
    radial-gradient(900px 700px at 100% 100%, var(--primary-light) 0%, transparent 50%);
}
.customer-gate[hidden] { display: none; }
.customer-gate-card {
  width: 100%;
  max-width: 520px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow-lifted);
  text-align: center;
}
.customer-gate-logo { width: 220px; max-width: 70%; height: auto; margin: 0 auto var(--sp-6); display: block; }
.customer-gate-card h2 { margin: 0 0 var(--sp-2); }
.customer-gate-card .hint { margin: 0 0 var(--sp-6); color: var(--ink-secondary); }
.customer-gate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  text-align: left;
  margin-bottom: var(--sp-6);
}
.customer-gate-grid label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: 13px;
  color: var(--ink-secondary);
}
.customer-gate-grid input {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-size: 14px;
}
.customer-gate-grid input:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(5, 28, 44, 0.18);
}
.customer-gate-full { grid-column: 1 / -1; }
.customer-gate-error {
  color: var(--status-danger-text);
  background: var(--status-danger-bg);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin: 0 0 var(--sp-4);
  font-size: 13px;
}
.customer-gate-submit { width: 100%; }
@media (max-width: 520px) {
  .customer-gate-grid { grid-template-columns: 1fr; }
}

.layout { display: flex; flex: 1; min-height: 0; }

.tabs {
  width: 220px;
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border-right: 1px solid var(--glass-border-soft);
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) var(--sp-2);
  overflow-y: auto;
  gap: 2px;
}

.tab-btn {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: var(--sp-3) var(--sp-3);
  font-family: 'Mulish', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}
.tab-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.55); transform: translateX(2px); }
.tab-btn.active {
  color: var(--primary-dark);
  border-left-color: var(--primary-2);
  background: linear-gradient(135deg, rgba(20, 59, 82, 0.28), rgba(215, 227, 234, 0.45));
  box-shadow: var(--glass-inset-highlight), 0 2px 8px rgba(2, 13, 21, 0.12);
}

/* Separates the numbered guided steps from the always-on views (2D Plan,
   3D View) below them — those aren't part of the sequence and are never
   locked, so the divider signals "different kind of nav item" at a glance. */
.tabs-divider {
  height: 1px;
  background: var(--glass-border-soft);
  margin: var(--sp-2) var(--sp-2);
  flex-shrink: 0;
}
@media (max-width: 1100px) {
  .tabs-divider { width: 1px; height: auto; align-self: stretch; margin: 0 var(--sp-2); }
}

/* ---- Guided stepper (customer-facing wizard: Shell → Doors → Zones →
   Bays → Racks → Review) — layered on top of the .tabs/.tab-btn base
   styles above. Each nav button gets a numbered/checkmark badge
   (.step-num), plus two extra states beyond the existing .active:
   .step-completed (already passed, still revisitable) and .step-locked
   (not yet reached, disabled). */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: var(--sp-2);
  border-radius: 50%;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink-secondary);
  font-family: 'Abel', sans-serif;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: -4px;
}
.tab-btn.active .step-num {
  background: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
}
.tab-btn.step-completed .step-num {
  background: var(--status-success-bg);
  border-color: var(--status-success-bg);
  color: var(--status-success-text);
}
.tab-btn.step-locked {
  color: var(--ink-secondary);
  opacity: 0.5;
  cursor: not-allowed;
}
.tab-btn.step-locked:hover { background: transparent; transform: none; }

/* ---- Warehouse Shell sub-step pager (Basics / Shape / Mezzanine) ---- */
.substep-pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
/* Purely a "you are here" progress indicator now — plain <span>s, not
   buttons, since clicking ahead to skip a sub-step is exactly what we don't
   want to invite (see goToShellSubstep in main.js). Three states: neutral
   (not reached yet), .active (current — the one thing to do right now),
   .completed (already done, highlight has moved on). */
.substep-pill {
  display: inline-block;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink-secondary);
  font-family: 'Mulish', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}
.substep-pill.active {
  background: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
  box-shadow: var(--glass-inset-highlight), 0 2px 8px rgba(2, 13, 21, 0.18);
}
.substep-pill.completed {
  background: var(--status-success-bg);
  border-color: var(--status-success-bg);
  color: var(--status-success-text);
}
/* Guard against any conflicting `display` rule silently overriding the
   native [hidden] attribute — same class of bug fixed earlier for
   .form-grid label[hidden]. */
.shell-substep[hidden] { display: none; }

/* ---- "Continue to..." bars at the bottom of each guided step ---- */
.guided-continue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--glass-border-soft);
}
.guided-continue-bar .hint { margin: 0; max-width: 480px; }
.guided-continue-bar .btn { flex-shrink: 0; }

/* ---- Review & Download step ---- */
.review-actions {
  display: flex;
  gap: var(--sp-2);
  margin: var(--sp-4) 0 var(--sp-6);
  flex-wrap: wrap;
}
.review-edit-links {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6) 28px 60px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Page title (h1) role: Abel 500 24px — used for each tab's heading */
h2 {
  font-family: 'Abel', sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  margin: 0 0 var(--sp-2);
  color: var(--ink);
}
.hint { color: var(--ink-secondary); font-size: 14px; line-height: 1.6; margin: 0 0 var(--sp-4); max-width: 720px; }

/* Secondary heading for a sub-section within a tab (e.g. "Location
   Barcodes" under the Inventory tab) — same family as h2, smaller, with
   extra top margin to separate it from whatever came before. */
.section-heading {
  font-family: 'Abel', sans-serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
  margin: var(--sp-6) 0 var(--sp-2);
  color: var(--ink);
}

.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  margin-bottom: var(--sp-4);
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow);
  transition: box-shadow var(--motion-snap);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--sp-4);
  max-width: 900px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-secondary);
}
/* An author-stylesheet display value on any selector (however unspecific)
   always beats the user-agent [hidden] { display: none } rule, since origin
   order — not specificity — decides UA vs. author wins. Without this, any
   label toggled to `hidden` inside a .form-grid (e.g. Zones/Obstacles/Walls'
   Kind-dependent fields) stays visibly flexed instead of disappearing. */
.form-grid label[hidden] {
  display: none;
}

.form-grid input, .form-grid select {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-size: 14px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
.form-grid input:hover, .form-grid select:hover { background: rgba(255, 255, 255, 0.88); }
.form-grid input:focus, .form-grid select:focus {
  outline: none;
  border-color: var(--primary-2);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(5, 28, 44, 0.18);
}
.form-grid input:disabled, .form-grid select:disabled, .form-grid textarea:disabled { opacity: .5; }

/* Caption / metadata role: Mulish 400 12px, used here as small branded section labels */
.section-label {
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--primary-2);
  margin-top: var(--sp-2);
  font-weight: 500;
}
.full-row { grid-column: 1 / -1; }

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: var(--sp-2) !important;
  font-size: 14px;
  color: var(--ink);
}
.checkbox-row input[type="checkbox"] { width: auto; accent-color: var(--secondary-2); }

.form-actions { grid-column: 1 / -1; display: flex; gap: var(--sp-2); margin-top: var(--sp-1); flex-wrap: wrap; }
.auto-place-actions { justify-content: flex-start; }

.summary-card { font-size: 14px; line-height: 1.7; color: var(--ink); }
.summary-card b { color: var(--primary-2); }

.gate-message {
  color: var(--ink-secondary);
  font-size: 14px;
  line-height: 1.6;
  background: var(--glass-bg-tint);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px dashed rgba(5, 28, 44, 0.35);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  display: none;
}
.gate-message.show { display: block; }

.shape-gen-row { margin-bottom: var(--sp-4); }
.shape-gen-row:last-child { margin-bottom: 0; }
.shape-gen-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.shape-gen-group input, .shape-gen-group select {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-size: 13px;
  width: 150px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.shape-gen-group input:focus, .shape-gen-group select:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(5, 28, 44, 0.18);
}

.vertex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.shape-preview {
  width: 100%;
  height: 260px;
  display: block;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-sm);
  margin-top: var(--sp-4);
  box-shadow: var(--glass-inset-highlight);
}

/* Split-editor layout: a main column (preview + the item list below it) on
   the left, parameters in a fixed-width column on the right. Sidebar nav
   (.tabs) is untouched — this only splits the content area within a tab.
   Shared by the Warehouse Shell, Doors, Zones & Obstacles, Bay Builder and
   Racks & Aisles tabs. */
.split-editor {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-6);
}
/* Left/main column: preview on top, item list below it, both narrowed to
   make room for the params column beside them (rather than the list
   spanning full width beneath the whole split-editor). */
.split-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}
/* Deliberately NOT position:sticky. It shares .split-main-col with the item
   list below it, so a sticky preview stays pinned across the *entire*
   column's scroll range (preview + list combined) — meaning as the list
   scrolls up past it, the list's rows pass behind the pinned preview and
   get visually hidden under it (sticky/positioned elements always paint
   above static in-flow siblings, regardless of DOM order). Keeping this
   static lets the preview and the list scroll together as one block, so
   the list is never obscured. (.split-params-col alongside it is a
   separate column and stays sticky/self-scrolling without this issue.) */
.split-preview-col {
  position: static;
}
.split-params-col {
  width: 380px;
  flex-shrink: 0;
  /* Pinned in the viewport and scrollable on its own, independent of how
     tall the preview + item list on the left get — so the form/menu stays
     visible and reachable no matter how long the list below grows. */
  position: sticky;
  top: 0;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}
/* Pins the Save/Update (+ Cancel) button to the top of the scrolling
   params column so it's reachable without scrolling back up through a
   long form. */
.form-actions-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-2);
  border-bottom: 1px solid var(--glass-border-soft);
}
.shape-preview-large {
  margin-top: 0;
  height: calc((100vh - 260px) * 0.75);
  min-height: 320px;
  border-radius: var(--radius-md);
}

@media (max-width: 1100px) {
  .split-editor { flex-direction: column; }
  .split-main-col { width: 100%; }
  .split-preview-col { position: static; width: 100%; }
  .split-params-col { position: static; width: 100%; max-height: none; overflow-y: visible; }
  .form-actions-sticky { position: static; }
  .shape-preview-large { height: 300px; }
}

/* Bay Builder: a single bay never needs anywhere near as much width as the
   full-warehouse 2D/3D views on the other tabs — give more of the row to
   the template form instead, which has a lot of fields, and let the
   preview column (still flex:1 from .split-main-col) narrow accordingly. */
#tab-bays .split-params-col { width: 460px; }
@media (max-width: 1100px) {
  #tab-bays .split-params-col { width: 100%; }
}

/* Shown only while the Bay Builder form is locked (before "Create Bay" is
   clicked, or between templates) — points at the one thing to do next. */
.bay-locked-hint {
  background: var(--glass-bg-tint);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin: 0 0 var(--sp-4);
}

.data-table input[type="number"], .data-table input[type="text"] {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--glass-border-soft);
  color: var(--ink);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-family: 'Mulish', sans-serif;
  font-size: 13px;
  width: 90px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
.data-table input[type="number"]:focus, .data-table input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-2);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(5, 28, 44, 0.18);
}
.data-table .barcode-input { width: 150px; }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow);
}
.data-table th, .data-table td {
  text-align: left;
  padding: var(--sp-3);
  border-bottom: 1px solid var(--glass-border-soft);
  white-space: nowrap;
}
.data-table th {
  color: var(--ink-secondary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: rgba(255, 255, 255, 0.35);
}
.data-table td { color: var(--ink); font-weight: 400; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr { transition: background var(--motion-fast); }
.data-table tr:hover td { background: rgba(20, 59, 82, 0.1); }

.bay-name-cell, .name-cell { cursor: pointer; color: var(--primary-2); font-weight: 500; transition: color var(--motion-fast); }
.bay-name-cell:hover, .name-cell:hover { text-decoration: underline; color: var(--secondary-2); }

@keyframes rowFlash {
  0% { background: var(--primary-light); }
  100% { background: transparent; }
}
.row-flash td { animation: rowFlash 1.5s ease-out; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: var(--sp-2); vertical-align: middle; }

.canvas-toolbar { margin-bottom: var(--sp-3); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.canvas-toolbar-right { justify-content: flex-end; }
.legend { font-size: 13px; color: var(--ink-secondary); }
.legend .chip { display: inline-flex; align-items: center; gap: var(--sp-1); margin-right: var(--sp-4); }

/* The 2D/3D viewports sit on the light surface tone (not a dark
   "hero" panel) so the whole app stays visually consistent; racks/outline
   use saturated brand + rack colors for contrast against it instead. */
.canvas-wrap {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  height: calc(100vh - 230px);
  min-height: 400px;
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow);
}
.canvas-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.canvas-wrap canvas:active { cursor: grabbing; }

/* Inside the split-editor layout (Doors, Zones & Obstacles, Bay Builder),
   the preview sits alongside a form column with a table below it — sized to
   75% of the full-viewport preview height (25% smaller) so the item list at
   the bottom stays visible without scrolling as much. */
.split-preview-col .canvas-wrap {
  height: calc((100vh - 260px) * 0.75);
  min-height: 315px;
}
@media (max-width: 1100px) {
  .split-preview-col .canvas-wrap { height: 270px; }
}

.three-wrap {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  height: calc(100vh - 230px);
  min-height: 400px;
  position: relative;
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow);
}
.three-wrap canvas { display: block; width: 100%; height: 100%; }

/* Scale reference for the 3D viewports: the ground GridHelper drawn in both
   three3d.js and baypreview3d.js is always sized so each square is ~1m in
   real-world scale — this just makes that legible, since a literal on-screen
   ruler (like the 2D plan's scale bar) isn't meaningful under perspective. */
.scale-chip {
  position: absolute;
  left: var(--sp-3);
  bottom: var(--sp-3);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  color: var(--ink-secondary);
  pointer-events: none;
  z-index: 1;
  box-shadow: var(--glass-shadow);
}

/* Click-to-inspect popup (Dynamic Spatial Model tab) — shows what's stored
   in an occupancy box (Inventory tab) when it's clicked. */
.info-panel {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  min-width: 220px;
  max-width: 280px;
  max-height: calc(100% - 2 * var(--sp-3));
  overflow-y: auto;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  font-size: 13px;
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow-lifted);
  z-index: 2;
  animation: infoPanelIn var(--motion-snap);
}
@keyframes infoPanelIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.info-panel-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-2) 0;
}
.info-panel-close {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-secondary);
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}
.info-panel-close:hover { color: var(--ink); background: rgba(0, 0, 0, 0.06); transform: scale(1.1); }
.info-panel-close:active { transform: scale(.92); }
.info-panel-title {
  font-weight: 700;
  margin-bottom: var(--sp-2);
  padding-right: var(--sp-4);
  color: var(--ink);
}
.info-panel-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 2px 0;
  color: var(--ink-secondary);
}
.info-panel-row span:last-child { color: var(--ink); font-weight: 500; }

.split-preview-col .three-wrap {
  height: calc((100vh - 230px) * 0.75);
  min-height: 300px;
}
@media (max-width: 1100px) {
  .split-preview-col .three-wrap { height: 270px; }
}

/* Ground/Mezzanine floor toggle (Racks & Aisles + 2D Plan tabs) */
.floor-toggle { display: inline-flex; gap: 2px; }
.floor-toggle-btn.active {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff;
  border-color: var(--primary-2);
  box-shadow: var(--glass-inset-highlight), 0 4px 14px rgba(5, 28, 44, 0.32);
}

/* Items tab (catalog) + click-info panel photo thumbnails */
.item-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-soft);
  display: block;
  box-shadow: 0 2px 6px rgba(26, 26, 24, 0.12);
  transition: transform var(--motion-fast);
}
.data-table tr:hover .item-thumb { transform: scale(1.08); }
.item-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--glass-border-soft);
  background: var(--glass-bg);
}
.item-photo-preview {
  max-width: 160px;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  margin-bottom: var(--sp-2);
}
.info-panel-photo {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 4px 0 6px;
  display: block;
}

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .tabs { width: 100%; flex-direction: row; overflow-x: auto; padding: var(--sp-2); }
  .tab-btn { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .tab-btn.active { border-bottom-color: var(--primary-2); }
}
