/* Warehouse Builder — themed on the Spatialis OS style guide v1.1 (July 2026) */

:root {
  /* Brand — Primary (amber gold) */
  --primary-light: #FCEACF;
  --primary: #F2A93C;
  --primary-2: #C97E0D;
  --primary-dark: #734808;

  /* Brand — Secondary (coral orange) */
  --secondary-light: #F7D0C5;
  --secondary: #E98162;
  --secondary-2: #E2572E;

  /* Brand — Tertiary (plum-burgundy) */
  --tertiary-light: #ECD0DF;
  --tertiary: #BC5C92;
  --tertiary-dark: #6B2C4F;

  /* Status system — pale bg + dark text pairs, for light surfaces only */
  --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: #1a1a18;
  --ink-secondary: #5f5e5a;
  --surface: #f4f3f0;
  --border: #e0ded8;
  --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
     existing Spatialis OS brand colors so the palette stays the same, 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(252, 234, 207, 0.35); /* primary-light, translucent */
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-border-soft: rgba(26, 26, 24, 0.08);
  --glass-blur: blur(18px) saturate(1.4);
  --glass-blur-soft: blur(10px) saturate(1.2);
  --glass-shadow: 0 8px 30px rgba(115, 72, 8, 0.1), 0 1px 2px rgba(26, 26, 24, 0.06);
  --glass-shadow-lifted: 0 14px 40px rgba(115, 72, 8, 0.16), 0 2px 6px rgba(26, 26, 24, 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: 'Barlow', -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: Barlow Condensed 700 — the one place weight 700 is allowed */
.brand h1 {
  font-family: 'Barlow Condensed', 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); }
/* Persistent "this is a demo" note under the tagline — see index.html for
   why it's never dismissed/hidden. Brand-colored text rather than a boxed
   banner so it reads as part of the header, not as a warning/error state. */
.brand .demo-disclaimer { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--primary-2); font-weight: 500; }

.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: 'Barlow', 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(201, 126, 13, 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(--secondary-2), var(--secondary));
  border-color: var(--secondary-2);
  color: #fff;
  box-shadow: var(--glass-inset-highlight), 0 4px 14px rgba(226, 87, 46, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--secondary-2), var(--secondary));
  border-color: var(--secondary);
  box-shadow: var(--glass-inset-highlight), 0 6px 20px rgba(226, 87, 46, 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: 'Barlow', 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(201, 126, 13, 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); }

.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: 'Barlow', 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(242, 169, 60, 0.28), rgba(252, 234, 207, 0.45));
  box-shadow: var(--glass-inset-highlight), 0 2px 8px rgba(115, 72, 8, 0.12);
}

.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: Barlow Semi Condensed 500 24px — used for each tab's heading */
h2 {
  font-family: 'Barlow Semi Condensed', 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: 'Barlow Semi Condensed', 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: 'Barlow', 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(201, 126, 13, 0.18);
}
.form-grid input:disabled, .form-grid select:disabled, .form-grid textarea:disabled { opacity: .5; }

/* Caption / metadata role: Barlow 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(201, 126, 13, 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: 'Barlow', 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(201, 126, 13, 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; }
}

.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: 'Barlow', 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(201, 126, 13, 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(242, 169, 60, 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 Spatialis 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(201, 126, 13, 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%;
  height: 140px;
  object-fit: contain; /* show the whole product, never crop it, even if it doesn't fill the box */
  background: var(--glass-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 4px 0 6px;
  display: block;
}

/* Any product photo the user can click to see full-size — the info-panel
   photo (click a box in the 3D view), Items-tab table thumbnails, and the
   Add Item form's upload preview all opt in via this class. */
.lightbox-trigger {
  cursor: zoom-in;
  transition: opacity var(--motion-fast);
}
.lightbox-trigger:hover { opacity: 0.85; }

/* ---------------- Photo lightbox (quasi-fullscreen product photo) ---------------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  background: rgba(26, 26, 24, 0.82);
  cursor: zoom-out;
}
.lightbox-overlay[hidden] { display: none; }
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow-lifted);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 20px;
}
.lightbox-close:hover { background: #fff; }

/* ---------------- Manage Access modal ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh var(--sp-4) var(--sp-4);
  background: rgba(26, 26, 24, 0.45);
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--glass-inset-highlight), var(--glass-shadow-lifted);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.modal-header h2 {
  margin: 0;
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--ink);
}
#accessTable td:nth-child(2), #accessTable th:nth-child(2) { text-align: center; }
#accessTable td:last-child, #accessTable th:last-child { text-align: right; width: 40px; }
.access-add-form {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.access-add-form input[type="email"] { flex: 1; }
.access-add-admin {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 14px;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.access-error {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin: var(--sp-4) 0 0;
  font-size: 14px;
}
#visitorLogModal .modal-card { max-width: 720px; }
#visitorLogTable td:nth-child(n+2) { text-align: center; white-space: nowrap; }
#visitorLogTable th:nth-child(n+2) { text-align: center; }
.visitor-log-never { color: var(--ink-secondary); font-style: italic; }
.visitor-log-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

@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); }
}

/* Mobile gate — below this, #app is replaced entirely by a "use your
   computer" message (#mobileGate in index.html) rather than trying to
   squeeze the 2D/3D editors and dense tables onto a phone screen. 600px is
   comfortably below tablet width (768px+, where the 800px breakpoint
   above still applies and the app stays usable), so this only catches
   actual phones. */
#mobileGate { display: none; }
@media (max-width: 600px) {
  #app { display: none; }
  #mobileGate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 100vh;
    padding: var(--sp-8) var(--sp-6);
    text-align: center;
    box-sizing: border-box;
  }
  .mobile-gate-logo { width: 160px; max-width: 60%; height: auto; margin-bottom: var(--sp-4); }
  #mobileGate h2 { margin-bottom: var(--sp-2); }
  #mobileGate .hint { max-width: 340px; }
}
