:root {
  --bg: #0b0e13;
  --panel: #121722;
  --panel-soft: #171d2a;
  --line: rgba(255,255,255,.09);
  --text: #f8fafc;
  --muted: #9da8ba;
  --orange: #ff6a00;
  --orange-2: #ff9b35;
  --green: #30d158;
  --red: #ff453a;
  --yellow: #ffd60a;
  --shadow: 0 22px 60px rgba(0,0,0,.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,106,0,.18), transparent 34rem),
    radial-gradient(circle at 90% 15%, rgba(255,155,53,.10), transparent 30rem),
    var(--bg);
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
code { color: #ffd8b3; }
.muted { color: var(--muted); }

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(10, 13, 19, .9);
  backdrop-filter: blur(16px);
  z-index: 30;
  overflow: hidden;
}
.brand, .brand-large {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.brand { flex: 0 0 auto; margin-bottom: 0; }
.brand-icon, .brand-large span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: #111;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(255,106,0,.3);
}
.brand strong, .brand small, .brand-large strong, .brand-large small { display: block; }
.brand small, .brand-large small, .sidebar-card small, .kpi-card small, .panel p, .section-heading p { color: var(--muted); }
.nav {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.nav a {
  color: #d8dee9;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 13px;
  transition: .18s ease;
}
.nav a:hover, .nav a.active { color: white; background: rgba(255,106,0,.16); }
.sidebar-card {
  position: static;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(48,209,88,.12);
}
.main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,14,19,.82);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.menu-toggle { display: none; border: 0; color: var(--text); background: transparent; font-size: 24px; }
.search-wrap input, label input, label select, label textarea, .toolbar input {
  width: 100%;
  color: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  padding: 13px 15px;
  outline: 0;
}
label textarea { resize: vertical; }
.search-wrap input:focus, label input:focus, label select:focus, label textarea:focus, .toolbar input:focus {
  border-color: rgba(255,106,0,.8);
  box-shadow: 0 0 0 4px rgba(255,106,0,.12);
}
.top-search-form,
.toolbar-search {
  width: min(100%, 620px);
}
.search-wrap .scan-field {
  width: 100%;
}
.search-wrap .scan-field input,
.toolbar .scan-field input {
  max-width: none;
}
select {
  color: #fff;
  background-color: #1f2530;
  color-scheme: dark;
}
select option,
select optgroup {
  color: #111827 !important;
  background-color: #fff !important;
}
select option:checked {
  color: #fff !important;
  background-color: #2563eb !important;
}
select option:disabled {
  color: #6b7280 !important;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.clock, .user-chip { color: var(--muted); }
.content-section { padding: 30px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: stretch;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(115deg, rgba(255,106,0,.92), rgba(255,155,53,.18) 42%, rgba(18,23,34,.82) 100%),
    var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.hero h1, .section-heading h1 {
  margin: 0;
  letter-spacing: -.04em;
  line-height: 1.02;
}
.hero h1 { max-width: 850px; font-size: clamp(2.2rem, 4vw, 4.8rem); }
.hero p { max-width: 680px; color: rgba(255,255,255,.86); }
.hero-actions, .panel-heading, .section-heading, .toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.hero-panel, .kpi-card, .panel, .table-card, .location-card, .phone-frame, .login-card, .form-panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  border-radius: 24px;
}
.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: rgba(10,13,19,.52);
}
.hero-panel strong { font-size: 3.5rem; letter-spacing: -.06em; }
.primary-button, .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}
.primary-button { color: #111; background: linear-gradient(135deg, var(--orange), var(--orange-2)); }
.ghost-button { color: var(--text); border: 1px solid var(--line); background: rgba(255,255,255,.06); }
.ghost-button.light { background: rgba(255,255,255,.22); }
.ghost-button.compact { padding: 8px 10px; border-radius: 12px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-2);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.kpi-card { padding: 18px; background: var(--panel); }
.kpi-card span, .kpi-card strong, .kpi-card small { display: block; }
.kpi-card strong { margin: 8px 0 4px; font-size: 1.8rem; letter-spacing: -.05em; overflow-wrap: anywhere; }
.kpi-card.warning { border-color: rgba(255,214,10,.38); }
.kpi-card.danger { border-color: rgba(255,69,58,.42); }
.dashboard-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.report-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}
.report-card h2 { margin: 0 0 8px; }
.report-card p { min-height: 44px; color: var(--muted); }
.report-card strong {
  display: block;
  margin: 12px 0;
  font-size: 2rem;
}
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.panel, .table-card, .form-panel { padding: 22px; background: var(--panel); margin-bottom: 20px; }
.table-card.flat { padding: 0; background: transparent; border: 0; overflow-x: auto; }
.section-heading { margin-bottom: 20px; }
.section-heading h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.toolbar { margin-bottom: 16px; justify-content: flex-start; }
.toolbar input { max-width: 520px; }
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 28px;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.data-table small { display: block; color: var(--muted); margin-top: 3px; }
.product-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.thumb-empty {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.05);
}
.image-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.image-strip img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 900;
}
.badge.ok { color: #08230f; background: var(--green); }
.badge.warn { color: #352500; background: var(--yellow); }
.badge.danger { color: white; background: var(--red); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 7px; color: #e7edf7; font-weight: 700; }
.form-panel h2 { margin-top: 22px; }
.align-end { align-self: end; }
.lookup-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  margin: 16px 0;
  border: 1px solid rgba(255,106,0,.28);
  border-radius: 18px;
  background: rgba(255,106,0,.08);
}
.lookup-strip strong,
.lookup-strip small,
[data-company-lookup-status] { display: block; }
.lookup-strip small,
[data-company-lookup-status] { color: var(--muted); }
button:disabled {
  cursor: wait;
  opacity: .68;
}
.mini-form {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}
.mini-form small { color: var(--muted); }
.inline-note {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(48,209,88,.35);
  background: rgba(48,209,88,.12);
  color: #d9ffe2;
  font-size: .86rem;
  font-weight: 800;
}
.image-url-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}
.image-url-preview img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
}
.price-offers small {
  display: block;
  color: var(--muted);
}
.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.alert.danger { background: rgba(255,69,58,.13); border-color: rgba(255,69,58,.4); }
.alert.success { background: rgba(48,209,88,.13); border-color: rgba(48,209,88,.38); }
.location-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.location-card { min-height: 140px; padding: 22px; background: var(--panel); }
.location-card strong, .location-card span, .location-card i { display: block; }
.location-card strong { font-size: 1.4rem; }
.location-card span { margin: 8px 0 25px; color: var(--muted); }
.location-card i { color: var(--orange-2); font-style: normal; font-weight: 900; }
.scan-card {
  padding: 18px;
  margin: 18px 0;
  border: 1px solid rgba(255,106,0,.25);
  border-radius: 22px;
  background: rgba(255,106,0,.06);
}
.scan-card-head,
.scan-add-row,
.scan-field {
  display: flex;
  gap: 12px;
  align-items: center;
}
.scan-card-head {
  justify-content: space-between;
  margin-bottom: 14px;
}
.scan-card-head h2,
.wms-step h2 { margin: 0 0 6px; }
.scan-card-head p { margin: 0; color: var(--muted); }
.scan-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px auto;
  margin-bottom: 16px;
}
.scan-field input,
.scan-add-row input,
.line-mini-input {
  width: 100%;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  padding: 12px 14px;
}
.line-mini-input { min-width: 90px; }
.wms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.wms-step {
  position: relative;
  overflow: hidden;
}
.step-no {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 13px;
  color: #111;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  font-weight: 900;
}
.confirmed-location {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(48,209,88,.35);
  border-radius: 16px;
  background: rgba(48,209,88,.08);
}
.confirmed-location strong,
.confirmed-location small { display: block; }
.close-pick-form { margin-top: 16px; }
.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.72);
}
.scanner-modal[hidden] { display: none; }
.scanner-dialog {
  width: min(100%, 560px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #10151f;
  box-shadow: var(--shadow);
}
.scanner-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.scanner-dialog video {
  width: 100%;
  max-height: 65vh;
  border-radius: 18px;
  background: #000;
}
.html5-reader {
  overflow: hidden;
  min-height: 320px;
  border: 2px solid rgba(255,106,0,.75);
  border-radius: 18px;
  background: #000;
}
.html5-reader video {
  border-radius: 16px;
}
.html5-reader > div {
  border: 0 !important;
}
.html5-reader__scan_region,
.html5-reader img {
  background: transparent !important;
}
.scanner-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .9rem;
}
.scanner-demo { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.phone-frame { display: grid; gap: 18px; padding: 20px; background: #080a0d; box-shadow: var(--shadow); }
.scan-window {
  position: relative;
  height: 260px;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,106,0,.18), rgba(255,255,255,.04)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, transparent 2px 36px);
}
.scan-window span {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 50%;
  height: 2px;
  background: var(--orange-2);
  box-shadow: 0 0 30px var(--orange);
  animation: scan 1.5s infinite alternate ease-in-out;
}
@keyframes scan { from { transform: translateY(-90px); } to { transform: translateY(90px); } }
.product-detail { display: grid; gap: 8px; }
.product-detail h3 { margin: 0 0 8px; font-size: 2rem; }
.print-body {
  background: #fff;
  color: #111;
}
.print-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #111827;
  position: sticky;
  top: 0;
  z-index: 5;
}
.print-toolbar button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 800;
  background: #ff6a00;
}
.print-back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  background: rgba(255,255,255,.12);
  text-decoration: none;
  font-weight: 800;
}
.label-sheet {
  display: grid;
  gap: 10mm;
  padding: 10mm;
}
.labels-large .label-sheet {
  grid-template-columns: 100mm;
}
.labels-small .label-sheet {
  grid-template-columns: repeat(2, 70mm);
}
.print-label {
  display: grid;
  gap: 5mm;
  align-content: start;
  border: 1px solid #111;
  border-radius: 4mm;
  padding: 6mm;
  background: white;
  page-break-inside: avoid;
}
.labels-large .print-label {
  width: 100mm;
  min-height: 150mm;
}
.labels-small .print-label {
  width: 70mm;
  min-height: 45mm;
}
.label-head strong {
  display: block;
  font-size: 18pt;
}
.label-head span, .label-code {
  color: #333;
}
.label-body {
  display: grid;
  grid-template-columns: 30mm 1fr;
  gap: 5mm;
  align-items: center;
}
.label-body-stack {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}
.qr-img {
  width: 30mm;
  height: 30mm;
}
.barcode-svg {
  width: 100%;
  height: 22mm;
  fill: #000;
}
.barcode-block {
  display: grid;
  gap: 1.5mm;
  width: 100%;
  justify-items: center;
}
.barcode-block span,
.barcode-block small {
  color: #111;
  font-weight: 800;
  letter-spacing: .08em;
}
.ean13-svg {
  width: 100%;
  max-width: 82mm;
  height: 25mm;
  fill: #000;
  background: #fff;
}
.label-price {
  font-size: 30pt;
  font-weight: 900;
}
@media print {
  .print-toolbar { display: none; }
  .print-body { margin: 0; }
  .label-sheet { padding: 0; }
}
@media screen and (max-width: 700px) {
  .print-body {
    overflow-x: hidden;
  }
  .print-toolbar {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .print-toolbar button,
  .print-back {
    flex: 1 1 145px;
    justify-content: center;
  }
  .label-sheet,
  .labels-large .label-sheet,
  .labels-small .label-sheet {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    padding: 12px;
  }
  .labels-large .print-label,
  .labels-small .print-label,
  .print-label {
    width: 100%;
    min-height: auto;
    max-width: calc(100vw - 24px);
  }
  .label-head strong {
    font-size: clamp(20px, 9vw, 34px);
  }
  .label-price {
    font-size: clamp(28px, 12vw, 46px);
  }
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-card .brand-large { margin-bottom: 22px; }
.debug {
  white-space: pre-wrap;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.3);
  color: #ffd8b3;
}
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero, .dashboard-grid, .scanner-demo, .wms-grid { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .content-section { padding: 24px; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-104%);
    transition: transform .2s ease;
    width: min(86vw, 320px);
    box-shadow: 22px 0 60px rgba(0,0,0,.42);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0,0,0,.45);
  }
  .menu-toggle { display: block; }
  .topbar { grid-template-columns: auto 1fr; }
  .topbar-actions { grid-column: 1 / -1; justify-content: space-between; }
  .content-section { padding: 18px; }
  .settings-grid, .location-grid, .report-grid, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .table-card { overflow-x: auto; }
  .scan-card-head,
  .scan-field { align-items: stretch; flex-direction: column; }
  .scan-add-row { grid-template-columns: 1fr; }
  .scan-lines-table { min-width: 620px; }
}
@media (max-width: 560px) {
  .topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
  }
  .search-wrap input { min-width: 0; padding: 11px 12px; }
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .content-section { padding: 12px; }
  .hero { padding: 24px; border-radius: 24px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .hero-actions, .panel-heading, .section-heading, .toolbar { align-items: stretch; flex-direction: column; }
  .primary-button, .ghost-button { width: 100%; }
  .panel, .table-card, .form-panel, .scan-card { padding: 16px; border-radius: 18px; }
  .section-heading h1 { font-size: clamp(1.8rem, 12vw, 2.6rem); }
  .data-table { min-width: 680px; }
  .scanner-dialog { padding: 12px; border-radius: 18px; }
}
