:root {
  color-scheme: dark;
  --font-sans: 'Google Sans', 'Google Sans Text', 'Product Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Luxury Dark Palette */
  --bg: #080c15;
  --obsidian: #060911;
  --card: #111827;
  --card-elevated: #172135;
  --card-soft: #1b273d;
  --input-bg: #0a101d;

  --gold: #e5b84b;
  --gold-bright: #f6d57a;
  --gold-deep: #b88619;
  --gold-soft: rgba(229, 184, 75, 0.14);
  --gold-border: rgba(229, 184, 75, 0.38);

  --primary: #e5b84b;
  --primary-hover: #f0c75e;
  --primary-soft: rgba(229, 184, 75, 0.14);

  --sapphire: #3b82f6;
  --sapphire-soft: rgba(59, 130, 246, 0.16);
  --emerald: #10b981;
  --emerald-deep: #059669;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.16);
  --orange: #ea580c;
  --orange-soft: rgba(234, 88, 12, 0.16);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.16);

  --border: rgba(255, 255, 255, 0.13);
  --border-light: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --radius: 15px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(circle at 50% -10%, rgba(229, 184, 75, 0.08), transparent 50%), var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: 92px;
  min-height: 100vh;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-bright);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 12, 21, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(229, 184, 75, 0.24);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(229, 184, 75, 0.22);
}

.brand-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--gold-bright);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.wh-badge {
  background: linear-gradient(135deg, rgba(229, 184, 75, 0.22), rgba(184, 134, 25, 0.12));
  color: var(--gold-bright);
  border: 1px solid var(--gold-border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

.mobile-link-btn {
  background: var(--card-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 0.77rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

/* Layout Container */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px;
}

/* Bottom Navigation (Mobile-first) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: rgba(9, 13, 23, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(229, 184, 75, 0.22);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
}

.nav-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 9px 3px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-btn .nav-ico {
  font-size: 1.2rem;
  line-height: 1;
}

.nav-btn.active {
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(229, 184, 75, 0.16), rgba(229, 184, 75, 0.04));
  font-weight: 700;
  box-shadow: inset 0 2px 0 var(--gold);
}

/* Cards & Grid */
.card {
  background: linear-gradient(180deg, #131c30 0%, #0e1525 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text);
}

.section-sub {
  margin: 3px 0 0;
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* Quick Hero Action Buttons */
.hero-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 11px;
  margin-bottom: 16px;
}

.hero-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  text-align: left;
  color: #ffffff;
  font-family: var(--font-sans);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s, border-color 0.15s;
}

.hero-btn:active {
  transform: scale(0.985);
}

.hero-btn.inbound {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  border-color: rgba(96, 165, 250, 0.45);
}

.hero-btn.outbound {
  background: linear-gradient(135deg, #065f46 0%, #064e3b 100%);
  border-color: rgba(52, 211, 153, 0.45);
}

.hero-btn.relocate {
  background: linear-gradient(135deg, #272015 0%, #17130d 100%);
  border-color: var(--gold-border);
}

.hero-ico {
  font-size: 1.85rem;
  background: rgba(255, 255, 255, 0.12);
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-label {
  font-size: 1.03rem;
  font-weight: 700;
  color: #ffffff;
}

.hero-btn.relocate .hero-label {
  color: var(--gold-bright);
}

.hero-desc {
  font-size: 0.79rem;
  color: rgba(248, 250, 252, 0.82);
  margin-top: 2px;
}

/* KPI & Solid Colored Alert Strips (#4) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat-box {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  min-width: 0;
}

/* Full rich background colors for Expired, Urgent (<30d), Expiring (<90d) */
.stat-box.expired {
  background: linear-gradient(135deg, #dc2626 0%, #881337 100%);
  border: 1px solid #f87171;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.32);
}

.stat-box.critical {
  background: linear-gradient(135deg, #ea580c 0%, #9a3412 100%);
  border: 1px solid #fb923c;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.32);
}

.stat-box.warning {
  background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
  border: 1px solid #fbbf24;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.32);
}

.stat-box.empty-slot {
  background: linear-gradient(135deg, #065f46 0%, #022c22 100%);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #ffffff;
}

.stat-num {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: #ffffff;
}

.stat-box.expired .stat-num,
.stat-box.critical .stat-num,
.stat-box.warning .stat-num {
  color: #ffffff;
}

.stat-box.empty-slot .stat-num {
  color: #6ee7b7;
}

.stat-lbl {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 5px;
}

.stat-box.expired .stat-lbl,
.stat-box.critical .stat-lbl,
.stat-box.warning .stat-lbl,
.stat-box.empty-slot .stat-lbl {
  color: rgba(255, 255, 255, 0.96);
}

/* Forms, Date Inputs & Mobile Layout Fixes (#6) */
.form-group {
  margin-bottom: 14px;
  min-width: 0;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.86rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.input-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.input-row.stack-mobile {
  display: flex;
  gap: 8px;
}

@media (max-width: 560px) {
  .input-row.stack-mobile {
    flex-direction: column;
  }
  .input-row.stack-mobile .btn {
    width: 100%;
  }
}

.form-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.form-grid-2 > * {
  min-width: 0;
}

@media (max-width: 600px) {
  .form-grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

.input,
select.input,
textarea.input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 13px;
  font-size: 0.96rem;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-sans);
  box-sizing: border-box;
  color-scheme: dark;
}

/* Fix iOS Safari <input type="date"> intrinsic width overflow */
input[type="date"].input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.3;
}

.input::placeholder {
  color: #64748b;
}

.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(229, 184, 75, 0.2);
}

/* Buttons — Mobile-safe wrapping (#11) */
.btn {
  min-height: 46px;
  padding: 10px 15px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  white-space: normal;
  word-break: break-word;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  box-sizing: border-box;
  transition: transform 0.08s, filter 0.15s, border-color 0.15s;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: linear-gradient(135deg, #f0c75e 0%, #c89629 100%);
  color: #090d16;
  border-color: rgba(246, 213, 122, 0.6);
  box-shadow: 0 4px 14px rgba(229, 184, 75, 0.24);
}
.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: rgba(52, 211, 153, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
}

.btn-outline {
  background: var(--card-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--gold-border);
  background: var(--card-soft);
}

.btn-danger-outline {
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
}
.btn-danger-outline:hover {
  background: rgba(220, 38, 38, 0.22);
}

.btn-scan {
  background: linear-gradient(135deg, #1c273d 0%, #121a2b 100%);
  color: var(--gold-bright);
  border: 1.5px solid var(--gold-border);
}
.btn-scan:hover {
  border-color: var(--gold-bright);
}

.btn-lg {
  width: 100%;
  min-height: 52px;
  font-size: 1.01rem;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 11px;
  font-size: 0.81rem;
}

/* Quick Date Shortcuts & Pills */
.quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.pill-btn {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.14s;
}
.pill-btn:hover,
.pill-btn.active {
  background: linear-gradient(135deg, #f0c75e 0%, #c89629 100%);
  border-color: var(--gold-bright);
  color: #090d16;
  font-weight: 700;
}

/* Semantic Dark Banners (replaces old hardcoded light boxes) */
.banner-info {
  background: rgba(59, 130, 246, 0.13);
  border: 1.5px solid rgba(96, 165, 250, 0.45);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}

.banner-success {
  background: rgba(16, 185, 129, 0.13);
  border: 1.5px solid rgba(52, 211, 153, 0.5);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}

.banner-warn {
  background: rgba(245, 158, 11, 0.13);
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
}

.banner-danger {
  background: rgba(220, 38, 38, 0.16);
  border: 1.5px solid rgba(248, 113, 113, 0.5);
  border-radius: 12px;
  padding: 16px;
  color: #fecaca;
}

.selected-rack-box {
  background: linear-gradient(135deg, rgba(229, 184, 75, 0.16) 0%, rgba(229, 184, 75, 0.06) 100%);
  border: 2px solid var(--gold);
  border-radius: 13px;
  padding: 12px 15px;
  margin-bottom: 12px;
}

.selected-rack-lbl {
  font-size: 0.75rem;
  color: var(--gold-bright);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.surface-panel {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
}

/* Location Code Display & Anatomy */
.loc-code-xl {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1.3rem, 5.4vw, 1.72rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
  word-break: break-all;
}

.anatomy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.anatomy-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 600;
}

.anatomy-tag.highlight {
  background: rgba(229, 184, 75, 0.16);
  color: var(--gold-bright);
  border: 1px solid rgba(229, 184, 75, 0.28);
}

/* FEFO Target Card (#11) */
.fefo-hero {
  border: 2px solid var(--emerald);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.14) 0%, rgba(17, 24, 39, 0.95) 100%);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 16px;
  min-width: 0;
}

.fefo-hero.EXPIRED {
  border-color: #ef4444;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.22) 0%, rgba(17, 24, 39, 0.95) 100%);
}

.fefo-hero.CRITICAL {
  border-color: #f97316;
  background: linear-gradient(180deg, rgba(234, 88, 12, 0.22) 0%, rgba(17, 24, 39, 0.95) 100%);
}

.fefo-hero.WARNING {
  border-color: #f59e0b;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.22) 0%, rgba(17, 24, 39, 0.95) 100%);
}

.fefo-loc-box {
  background: rgba(8, 12, 21, 0.78);
  border-radius: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  min-width: 0;
}

.fefo-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
}

.fefo-actions-stack .btn {
  width: 100%;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 700;
  max-width: 100%;
}

.status-badge.EXPIRED {
  background: #dc2626;
  color: #ffffff;
}

.status-badge.CRITICAL {
  background: #ea580c;
  color: #ffffff;
}

.status-badge.WARNING {
  background: #d97706;
  color: #ffffff;
}

.status-badge.NORMAL {
  background: #059669;
  color: #ffffff;
}

.status-badge.MUTED {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* Bay Level Selector Grid (Inbound / Relocate Picker) */
.bay-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.level-slot-btn {
  padding: 11px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
}

.level-slot-btn.free {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.1);
}

.level-slot-btn.occupied {
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.58;
  cursor: not-allowed;
}

.level-slot-btn.selected {
  border-color: var(--gold-bright);
  background: rgba(229, 184, 75, 0.2);
  box-shadow: 0 0 0 3px rgba(229, 184, 75, 0.22);
}

/* Visual Rack Map — Collapsible Aisle Accordions & Unified Bay (L + R) Cards (#12) */
.aisle-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aisle-accordion {
  background: linear-gradient(180deg, #131c30 0%, #0e1525 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.aisle-accordion.expanded {
  border-color: var(--gold-border);
}

.aisle-acc-header {
  width: 100%;
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.aisle-acc-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.aisle-accordion.expanded .aisle-acc-header {
  background: linear-gradient(90deg, rgba(229, 184, 75, 0.14), rgba(229, 184, 75, 0.03));
  border-bottom: 1px solid var(--border-light);
}

.aisle-acc-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.aisle-acc-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.aisle-acc-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  color: var(--gold-bright);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.aisle-accordion.expanded .aisle-acc-arrow {
  background: rgba(229, 184, 75, 0.2);
  border-color: var(--gold);
}

.aisle-acc-body {
  padding: 14px;
}

.unified-bays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

@media (max-width: 560px) {
  .unified-bays-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.unified-bay-card {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}

.unified-bay-header {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  padding: 5px 8px 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--gold-bright);
  letter-spacing: 0.02em;
}

.unified-bay-sides {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.unified-side-col {
  min-width: 0;
}

.unified-side-lbl {
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 3px 4px;
  margin-bottom: 6px;
}

.rack-cell {
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 5px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
  display: block;
  font-family: var(--font-sans);
  min-width: 0;
}
.rack-cell:last-child {
  margin-bottom: 0;
}

.rack-cell.EMPTY {
  background: rgba(8, 12, 21, 0.55);
  border: 1.5px dashed rgba(148, 163, 184, 0.35);
  color: var(--text-muted);
}
.rack-cell.NORMAL {
  background: rgba(37, 99, 235, 0.24);
  border-color: #60a5fa;
  color: #dbeafe;
}
.rack-cell.WARNING {
  background: rgba(217, 119, 6, 0.28);
  border-color: #fbbf24;
  color: #fef3c7;
}
.rack-cell.CRITICAL {
  background: rgba(234, 88, 12, 0.32);
  border-color: #fb923c;
  color: #ffedd5;
}
.rack-cell.EXPIRED {
  background: rgba(220, 38, 38, 0.36);
  border-color: #f87171;
  color: #fee2e2;
  font-weight: 700;
}

.rack-cell-top {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-weight: 700;
}

.rack-cell-prod {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-size: 0.71rem;
}

/* Lists & Tables */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--card-elevated);
  flex-wrap: wrap;
}

.list-item.clickable {
  cursor: pointer;
}
.list-item.clickable:hover {
  border-color: var(--gold-border);
  background: var(--card-soft);
}

/* Mode Tabs (FEFO Pick / Relocate — 2 visible columns #11) & Settings Tabs (All 5 visible #13) */
.mode-tabs-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.settings-tabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.subtab-btn {
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.84rem;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
}

.subtab-btn.active {
  background: linear-gradient(135deg, #f0c75e 0%, #c89629 100%);
  color: #090d16;
  border-color: var(--gold-bright);
  box-shadow: 0 4px 14px rgba(229, 184, 75, 0.22);
}

/* Modals & Scanner */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.hidden {
  display: none !important;
}

.modal-card {
  background: linear-gradient(180deg, #162036 0%, #0f1626 100%);
  border: 1px solid var(--gold-border);
  color: var(--text);
  width: 100%;
  max-width: 500px;
  border-radius: 18px;
  padding: 18px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.scanner-viewport {
  position: relative;
  width: 100%;
  min-height: 256px;
  background: #050811;
  border-radius: 14px;
  overflow: hidden;
  margin: 10px 0;
  display: block;
  border: 1.5px solid var(--gold-border);
}

.scanner-viewport.http-mode {
  background: var(--card-elevated);
  border: 1.5px dashed var(--gold-border);
  min-height: auto;
  padding: 16px;
}

.scanner-video {
  display: block;
  width: 100%;
  height: 264px;
  object-fit: cover;
  transform-origin: center center;
  transition: transform 0.18s ease;
  background: #050811;
}

.scanner-photo-preview {
  display: block;
  width: 100%;
  height: 264px;
  object-fit: contain;
  background: #050811;
}

.scanner-guide-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 86%;
  height: 132px;
  border: 2px solid rgba(52, 211, 153, 0.85);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(3, 6, 14, 0.44);
  pointer-events: none;
  z-index: 2;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.scanner-guide-box::before,
.scanner-guide-box::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  pointer-events: none;
}

.scanner-guide-box.detected {
  border-color: #10b981;
  border-width: 3px;
  background: rgba(16, 185, 129, 0.22);
}

.scanner-guide-hint {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f8fafc;
  background: rgba(8, 12, 21, 0.82);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

@keyframes laserSweep {
  0% {
    top: 14%;
    opacity: 0.92;
  }
  50% {
    top: 86%;
    opacity: 1;
  }
  100% {
    top: 14%;
    opacity: 0.92;
  }
}

.scanner-laser-line {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 36, 36, 0.25) 0%, #ff2424 15%, #ff5757 50%, #ff2424 85%, rgba(255, 36, 36, 0.25) 100%);
  box-shadow: 0 0 12px 2px rgba(255, 36, 36, 0.95), 0 0 24px 4px rgba(239, 68, 68, 0.55);
  animation: laserSweep 1.65s ease-in-out infinite;
}

.scanner-laser-line.paused {
  display: none;
}

.scanner-overlay-action {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  text-align: center;
  background: rgba(5, 8, 17, 0.72);
  backdrop-filter: blur(2px);
}

.scanner-controls-bar {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 4;
}

.scanner-ctrl-btn {
  background: rgba(8, 12, 21, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.scanner-ctrl-btn.active {
  background: var(--gold);
  border-color: var(--gold-bright);
  color: #090d16;
}

.scanner-status {
  font-size: 0.83rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--card-elevated);
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.scanner-status.ok {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
  font-weight: 700;
}
.scanner-status.warn {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde68a;
}

.chips-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 10px 0 6px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-btn {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
}
.chip-btn span {
  color: var(--text-muted);
  font-size: 0.73rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #1e293b;
  border: 1px solid var(--gold-border);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  max-width: 92vw;
  text-align: center;
}
.toast.success {
  background: #059669;
  border-color: #34d399;
}
.toast.error {
  background: #dc2626;
  border-color: #f87171;
}

/* Printable Barcode Labels Grid (stays white for physical barcode scanner contrast!) */
.labels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.barcode-label-card {
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
  text-align: center;
  page-break-inside: avoid;
}

.label-meta {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

/* Visual Zero-Typing Rack Picker */
.visual-picker {
  background: rgba(8, 12, 21, 0.55);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  margin-top: 10px;
}

.picker-row {
  margin-bottom: 13px;
}
.picker-row:last-child {
  margin-bottom: 0;
}

.picker-step-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  margin-bottom: 7px;
}

.zone-aisle-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bay-num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 7px;
}

.bay-num-btn {
  padding: 8px 4px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--card-elevated);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-sans);
  transition: transform 0.08s, border-color 0.12s;
}

.bay-num-btn.has-free {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(16, 185, 129, 0.1);
}

.bay-num-btn.is-full {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  opacity: 0.55;
}

.bay-num-btn.selected {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, #f0c75e 0%, #c89629 100%);
  color: #090d16;
  box-shadow: 0 0 0 3px rgba(229, 184, 75, 0.25);
}

.bay-num-btn .bay-n {
  font-weight: 800;
  font-size: 0.96rem;
  display: block;
}

.bay-num-btn .bay-free {
  font-size: 0.68rem;
  font-weight: 700;
  color: #34d399;
  display: block;
}

.bay-num-btn.is-full .bay-free {
  color: var(--text-muted);
}

.bay-num-btn.selected .bay-free {
  color: #1e293b;
}

@media print {
  :root {
    color-scheme: light;
  }
  .topbar, .bottom-nav, .no-print {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #000000;
    padding: 0;
  }
  .container {
    max-width: 100%;
    padding: 0;
  }
  .card {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
  }
  .barcode-label-card {
    border: 2px solid #0f172a;
  }
  .labels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
