*,
*::before,
*::after {
  box-sizing: border-box;
}

body.station-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #f8fafc;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.station-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #1e293b;
  border-bottom: 3px solid #38bdf8;
  flex-shrink: 0;
}

.station-order-block {
  flex: 1;
}

.station-order-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin: 0;
}

.station-order-ref {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vh, 2.4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.station-customer {
  margin: 2px 0 0;
  font-size: clamp(0.8rem, 1.6vh, 0.95rem);
  color: #cbd5e1;
}

.station-header-side {
  text-align: right;
  flex-shrink: 0;
}

.station-header-summary {
  margin: 0 0 2px;
  font-size: clamp(0.95rem, 2vh, 1.15rem);
  color: #fbbf24;
  font-weight: 700;
  line-height: 1.2;
}

.station-header-meta {
  margin: 0;
  font-size: 0.75rem;
  color: #64748b;
}

.station-active {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}

.station-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 22vw) 1fr;
  min-height: 0;
  overflow: hidden;
}

.station-phase-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
  min-width: 0;
}

.station-phase-num {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.station-phase-title {
  margin: 0;
  font-size: clamp(0.85rem, 1.8vh, 1rem);
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
}

.station-outer-section {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 8px 12px;
  background: #1a2332;
  border-right: 3px solid #fbbf24;
  min-height: 0;
  overflow: hidden;
}

.station-outer-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0f172a;
  border: 2px solid #fbbf24;
  border-radius: 10px;
  padding: 10px 12px;
  gap: 4px;
}

.station-outer-code {
  margin: 0;
  font-size: clamp(1.6rem, 4vh, 2.4rem);
  font-weight: 800;
  color: #fbbf24;
  line-height: 1;
}

.station-outer-dims {
  margin: 0;
  font-size: clamp(0.85rem, 2vh, 1.05rem);
  font-weight: 600;
  color: #fff;
}

.station-outer-name {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-outer-note {
  margin: 0;
  font-size: 0.72rem;
  color: #64748b;
}

.station-outer-visual-wrap {
  flex: 1;
  min-height: 0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 4px;
  margin-top: 4px;
  display: flex;
}

.station-outer-svg {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  display: block;
}

.station-inner-section {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 8px 8px;
  background: #0b1220;
  min-height: 0;
  overflow: hidden;
}

.station-inner-section .station-phase-head {
  flex-wrap: wrap;
}

.station-inner-section .station-legend {
  margin-left: auto;
  flex: 1 1 auto;
  justify-content: flex-end;
  max-height: 2.2em;
  overflow: hidden;
}

.station-inner-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr minmax(200px, 24vw);
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.station-bin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 10px;
  background: #111827;
  flex-shrink: 0;
}

.station-bin-tab {
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.station-bin-tab.active {
  border-color: #38bdf8;
  background: #0c4a6e;
  color: #fff;
}

.station-diagram-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.station-viewer-wrap,
.station-svg-wrap {
  background: #f4f6fa;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #334155;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.station-viewer {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.station-svg-wrap h3,
.station-viewer-wrap h3 {
  position: absolute;
  top: 8px;
  left: 12px;
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  z-index: 2;
  pointer-events: none;
}

.station-svg {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
}

.station-load-panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.station-load-title {
  margin: 0;
  padding: 8px 10px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  flex-shrink: 0;
}

.station-steps {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  min-height: 0;
}

.station-step {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #334155;
}

.station-step-num {
  flex: 0 0 24px;
  height: 24px;
  border-radius: 50%;
  background: #0ea5e9;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.station-step-body strong {
  display: block;
  font-size: clamp(0.78rem, 1.6vh, 0.9rem);
  margin-bottom: 2px;
  line-height: 1.2;
}

.station-step-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 0;
}

.station-step-hint,
.station-step-pos {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.2;
}

.station-step-hint {
  background: #0f766e;
  color: #ccfbf1;
}

.station-step-pos {
  background: #1d4ed8;
  color: #dbeafe;
}

.station-step-dims {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: #cbd5e1;
  font-weight: 600;
}

.station-inner-list {
  padding: 0 14px 18px;
  overflow-y: auto;
}

.station-inner-card {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #334155;
}

.station-inner-num {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 8px;
  color: #0f172a;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.station-inner-body strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 2px;
}

.station-inner-body p {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.35;
}

.station-inner-pos {
  color: #7dd3fc !important;
  margin-top: 2px !important;
}

.station-step-detail {
  margin: 0;
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.4;
}

.station-idle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 48px;
  text-align: center;
}

.station-idle h2 {
  margin: 0;
  font-size: 2rem;
  color: #64748b;
}

.station-idle p {
  margin: 0;
  color: #475569;
  font-size: 1.1rem;
}

.station-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
}

.station-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: #cbd5e1;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.station-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

/* Demo kiosk — simple full screen, large product visuals */
body.demo-kiosk-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(165deg, #f0f9ff 0%, #e2e8f0 55%, #f8fafc 100%);
  color: #0f172a;
  min-height: 100vh;
}

.demo-kiosk {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.demo-kiosk-header {
  text-align: center;
  margin-bottom: 20px;
}

.demo-kiosk-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.demo-kiosk-sub {
  margin: 10px 0 0;
  font-size: 1.15rem;
  color: #64748b;
}

.demo-kiosk-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.demo-kiosk-next-label {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #64748b;
  font-weight: 600;
}

.demo-kiosk-order-ref {
  margin: 6px 0 4px;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 800;
  color: #0369a1;
  letter-spacing: -0.02em;
}

.demo-kiosk-customer {
  margin: 0 0 24px;
  font-size: 1.2rem;
  color: #475569;
}

.demo-product-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  width: 100%;
  margin-bottom: 12px;
}

.demo-product-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
  border: 2px solid #e2e8f0;
  width: min(280px, 44vw);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.demo-product-visual {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  padding: 16px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.demo-product-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}

.demo-product-meta {
  padding: 16px 18px 20px;
  text-align: left;
  border-top: 1px solid #e2e8f0;
}

.demo-product-qty {
  display: inline-block;
  background: #0ea5e9;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 4px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.demo-product-name {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
}

.demo-product-dims {
  margin: 0;
  font-size: 0.95rem;
  color: #64748b;
}

.demo-kiosk-loading {
  color: #94a3b8;
  font-size: 1.1rem;
}

.demo-kiosk-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: 28px;
}

.demo-next-btn {
  width: min(480px, 100%);
  border: none;
  border-radius: 20px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(2, 132, 199, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.demo-next-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(2, 132, 199, 0.5);
}

.demo-next-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.demo-next-btn:disabled,
.demo-next-btn.is-loading {
  opacity: 0.65;
  cursor: wait;
}

.demo-next-btn-label {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.demo-next-btn-hint {
  font-size: 1rem;
  opacity: 0.88;
  font-weight: 500;
}

.demo-kiosk-toast {
  margin: 0;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  max-width: 100%;
  text-align: center;
}

.demo-kiosk-toast.demo-toast-ok {
  background: #dcfce7;
  color: #166534;
}

.demo-kiosk-toast.demo-toast-err {
  background: #fee2e2;
  color: #b91c1c;
}

.demo-kiosk-link {
  font-size: 0.95rem;
  color: #64748b;
  text-decoration: none;
}

.demo-kiosk-link:hover {
  color: #0369a1;
  text-decoration: underline;
}

/* Legacy demo admin layout (unused) */
body.demo-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
}

.demo-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.demo-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  margin-bottom: 20px;
}

.demo-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.demo-card p {
  margin: 0 0 16px;
  color: #64748b;
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.demo-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.demo-row input,
.demo-row select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  min-width: 140px;
}

.demo-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-btn-primary {
  background: #0ea5e9;
  color: #fff;
}

.demo-btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.demo-btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.demo-status {
  padding: 12px 16px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.demo-links a {
  color: #0369a1;
  font-weight: 600;
}

.demo-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-order-list li {
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

@media (max-height: 720px) {
  .station-header {
    padding: 6px 12px;
  }

  .station-order-label {
    font-size: 0.7rem;
    margin: 0;
  }

  .station-outer-section,
  .station-inner-section {
    padding: 6px 8px;
  }
}

@media (max-width: 900px) {
  body.station-body {
    overflow: auto;
    height: auto;
  }

  .station-shell {
    height: auto;
    min-height: 100vh;
  }

  .station-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .station-outer-section {
    border-right: none;
    border-bottom: 3px solid #fbbf24;
    max-height: 28vh;
  }

  .station-inner-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .station-diagram-row {
    min-height: 200px;
  }

  .station-load-panel {
    max-height: 30vh;
  }
}

body.station-embed {
  height: 100%;
  min-height: 480px;
  overflow: auto;
}

body.station-embed .station-shell {
  min-height: 100%;
}

body.station-embed .station-header {
  padding: 8px 14px;
}

body.station-embed .station-order-ref {
  font-size: 1.15rem;
}
