:root {
  color-scheme: light;
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --blue-mid: #bfdbfe;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* ─── Login ─── */

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #eef2f7;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(100%, 380px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
}

.login-card p {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}

/* ─── Layout ─── */

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

/* ─── Sidebar ─── */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 12px;
  background: #f3f4f6;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 6px 20px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 8px;
}

.brand:hover {
  color: var(--blue);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  font-weight: 600;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4b5563;
  text-align: left;
  font-size: 14px;
}

.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}

.nav-item:hover:not(.active) {
  background: #e5e7eb;
  color: var(--ink);
}

.nav-item svg,
.icon-button svg,
.search svg,
.mobile-taskbar svg,
.primary-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sidebar-panel {
  margin-top: auto;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-panel strong {
  display: block;
  margin: 4px 0 3px;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}

.sidebar-panel small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 0 0 20px;
}

.app-shell.sidebar-collapsed .brand div,
.app-shell.sidebar-collapsed .nav-item span,
.app-shell.sidebar-collapsed .sidebar-panel small,
.app-shell.sidebar-collapsed .sidebar-panel span {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar-panel {
  padding: 10px 6px;
  text-align: center;
}

.app-shell.sidebar-collapsed .sidebar-panel strong {
  font-size: 20px;
}

/* ─── Main ─── */

.main {
  min-width: 0;
  padding: 22px 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

h2 {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 600;
}

h3 {
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #374151;
}

.account-button svg {
  width: 16px;
  height: 16px;
}

.save-state-button {
  white-space: nowrap;
}

.pda-mode-button {
  white-space: nowrap;
}

.save-status {
  position: fixed;
  right: 24px;
  top: 18px;
  z-index: 20;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--blue);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.save-status.visible {
  transform: translateY(0);
  opacity: 1;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(300px, 28vw);
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
}

/* ─── Metrics ─── */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.metrics article {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metrics span,
.section-head p,
.product-meta,
.sku-sub,
.warehouse-line,
.empty-state p {
  color: var(--muted);
}

.metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
}

/* ─── Workspace ─── */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.catalog-section,
.detail-panel,
.warehouse-view {
  min-width: 0;
}

[hidden] {
  display: none !important;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-head p {
  margin-bottom: 0;
}

/* ─── Segmented control ─── */

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.segment {
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.segment.active {
  background: var(--blue);
  color: #ffffff;
  font-weight: 500;
}

.filter-select {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.filter-select select {
  min-width: 100px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

/* ─── Catalog toolbar ─── */

.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ─── Product grid ─── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 9px;
}

.product-card {
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.product-card:hover:not(.active) {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
  border-color: #d1d5db;
}

.product-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-mid);
}

.product-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: #f4f5f7;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-align: center;
}

.product-image .image-fallback {
  position: absolute;
  inset: 0;
}

.type-badge {
  position: absolute;
  left: 7px;
  top: 7px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(17, 24, 39, 0.68);
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.product-body {
  display: block;
  padding: 7px 9px 8px;
  line-height: 1.3;
}

.product-title {
  display: block;
  min-width: 0;
  margin-bottom: 5px;
}

.product-title-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 2px;
}

.product-title h3 {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-code {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.product-meta {
  display: block;
  min-width: 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.stock-row span {
  display: block;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-row strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

/* ─── Detail panel ─── */

.detail-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ─── Warehouse view ─── */

.warehouse-view {
  display: grid;
  gap: 12px;
}

.warehouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: 10px;
}

.warehouse-view-toolbar {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-view-switch {
  display: inline-flex;
  width: fit-content;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.warehouse-view-switch button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.warehouse-view-switch button:last-child {
  border-right: 0;
}

.warehouse-view-switch button.active {
  background: var(--ink);
  color: #fff;
}

.warehouse-global-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(170px, 1fr) minmax(130px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.warehouse-global-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.warehouse-global-filters input,
.warehouse-global-filters select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.warehouse-global-filters input {
  padding: 0 11px;
}

.warehouse-global-filters select {
  padding: 0 9px;
}

.warehouse-stock-toggle {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.warehouse-stock-toggle > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.warehouse-stock-toggle button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.warehouse-stock-toggle button:last-child {
  border-right: 0;
}

.warehouse-stock-toggle button.active {
  background: var(--blue-light);
  color: var(--blue);
}

.warehouse-export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 112px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.warehouse-export-button svg {
  width: 16px;
  height: 16px;
}

.warehouse-global-view {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.warehouse-global-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.warehouse-global-summary span,
.warehouse-global-summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.warehouse-global-summary strong {
  color: var(--ink);
}

.warehouse-global-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.warehouse-global-group {
  display: grid;
  border-bottom: 1px solid var(--line);
}

.warehouse-global-group:last-child {
  border-bottom: 0;
}

.warehouse-global-group-head {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.4fr) 80px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.warehouse-global-group-head strong {
  color: var(--ink);
}

.warehouse-global-group-head span {
  color: var(--muted);
}

.warehouse-global-group-head b {
  justify-self: end;
  color: var(--ink);
}

.warehouse-global-row {
  display: grid;
  grid-template-columns: minmax(128px, 0.9fr) minmax(180px, 1.25fr) minmax(96px, 0.65fr) 72px minmax(220px, 1.45fr);
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-bottom: 1px solid #eef2f7;
  color: var(--muted);
  font-size: 13px;
}

.warehouse-global-row:last-child {
  border-bottom: 0;
}

.warehouse-global-row.table-head {
  min-height: 30px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.warehouse-global-row.empty {
  color: #94a3b8;
}

.warehouse-global-row strong {
  justify-self: end;
  color: var(--ink);
  font-size: 15px;
}

.warehouse-global-row.empty strong {
  color: #94a3b8;
}

.global-model {
  color: var(--ink);
  font-weight: 800;
}

.global-product-name {
  color: var(--ink);
}

.global-distribution {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.warehouse-global-row.empty .global-model,
.warehouse-global-row.empty .global-product-name,
.warehouse-global-row.empty .global-distribution {
  color: #94a3b8;
}

.warehouse-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-card.disabled {
  opacity: 0.55;
}

.warehouse-card-head,
.warehouse-card-foot {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.warehouse-card h3 {
  margin-bottom: 0;
}

.warehouse-type,
.warehouse-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.warehouse-type {
  margin-bottom: 6px;
  background: var(--blue-light);
  color: var(--blue);
}

.warehouse-state {
  background: var(--green-light);
  color: var(--green);
  white-space: nowrap;
}

.warehouse-card.disabled .warehouse-state {
  background: #fef2f2;
  color: var(--red);
}

.warehouse-meta {
  display: grid;
  gap: 6px;
}

.warehouse-meta span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.warehouse-meta svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.warehouse-card-foot {
  align-items: center;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.warehouse-card-foot span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.warehouse-card-foot strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 700;
}

.warehouse-actions {
  display: flex;
  gap: 7px;
}

/* ─── Warehouse inventory detail ─── */

.warehouse-detail {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
}

.warehouse-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 12px;
}

.warehouse-detail-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.warehouse-detail-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-detail-title {
  min-width: 0;
}

.warehouse-detail-title h2,
.warehouse-detail-title p {
  overflow-wrap: anywhere;
}

.warehouse-detail-hero h2 {
  margin: 5px 0 4px;
  font-size: 24px;
}

.warehouse-detail-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

.warehouse-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.warehouse-detail-stats article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.warehouse-detail-stats span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.warehouse-detail-stats strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  font-weight: 700;
}

.warehouse-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.warehouse-detail-meta span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.warehouse-detail-meta svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.warehouse-inventory-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-inventory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.warehouse-inventory-head h3 {
  margin-bottom: 0;
}

.warehouse-inventory-head span,
.warehouse-group-head span {
  color: var(--muted);
  font-size: 13px;
}

.warehouse-inventory-group {
  border-bottom: 1px solid var(--line);
}

.warehouse-inventory-group:last-child {
  border-bottom: 0;
}

.warehouse-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
}

.warehouse-group-head strong,
.warehouse-group-head span {
  display: block;
}

.warehouse-sku-table {
  display: grid;
}

.warehouse-sku-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(100px, 0.8fr) minmax(160px, 1fr) 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.warehouse-sku-model {
  color: var(--ink);
  font-weight: 700;
}

.warehouse-sku-row strong {
  justify-self: end;
  color: var(--ink);
  font-size: 16px;
}

.warehouse-outbound-panel {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-outbound-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.warehouse-outbound-head h3 {
  margin-bottom: 2px;
}

.warehouse-outbound-head span {
  color: var(--muted);
  font-size: 12px;
}

.warehouse-outbound-head svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.warehouse-outbound-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 10px;
}

.warehouse-outbound-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.outbound-row-top,
.outbound-meta div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.outbound-row-top strong {
  font-size: 14px;
}

.outbound-row-top span {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.outbound-product {
  display: grid;
  gap: 2px;
}

.outbound-product strong {
  font-size: 13px;
}

.outbound-product span,
.outbound-meta {
  color: var(--muted);
  font-size: 12px;
}

.outbound-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.outbound-meta dt,
.outbound-meta dd {
  margin: 0;
}

.outbound-meta dd {
  min-width: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.warehouse-outbound-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.warehouse-outbound-empty svg {
  width: 30px;
  height: 30px;
}

.warehouse-outbound-empty strong {
  color: var(--ink);
}

.warehouse-outbound-empty span {
  font-size: 13px;
}

.empty-state.compact {
  min-height: 220px;
}

/* ─── Settings ─── */

.settings-view {
  display: grid;
  min-width: 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}

.settings-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-panel-head h2,
.supplier-row h3,
.settings-warehouse-row h3,
.display-device-row h3 {
  margin: 0;
}

.settings-panel-head p,
.supplier-row p,
.settings-warehouse-row p,
.display-device-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.supplier-list,
.settings-warehouse-list,
.display-device-list {
  display: grid;
}

.supplier-row,
.settings-warehouse-row,
.display-device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.supplier-row:last-child,
.settings-warehouse-row:last-child,
.display-device-row:last-child {
  border-bottom: 0;
}

.supplier-row.disabled,
.settings-warehouse-row.disabled,
.display-device-row.disabled {
  opacity: 0.55;
}

.display-device-row {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.45fr) auto auto;
}

.display-device-scope,
.display-device-permissions {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.display-device-permissions {
  justify-items: end;
}

.display-device-permissions span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
}

.display-device-permissions small {
  color: var(--muted);
}

.supplier-warehouse-summary {
  min-width: 116px;
  text-align: right;
}

.supplier-warehouse-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.supplier-warehouse-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
}

.supplier-actions {
  display: flex;
  gap: 7px;
}

.scope-field {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scope-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.check-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.check-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.check-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.scope-all {
  margin-top: 6px;
}

/* ─── Empty state ─── */

.empty-state {
  display: grid;
  place-items: center;
  min-height: 400px;
  padding: 32px;
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  color: var(--muted);
}

/* ─── Detail hero ─── */

.detail-hero {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 14px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.detail-hero img,
.detail-hero > .image-fallback {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  background: #f0f2f5;
}

.detail-hero img {
  object-fit: cover;
}

.detail-hero > div:not(.image-fallback) {
  min-width: 0;
}

.detail-hero p {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.detail-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 6px;
}

.detail-title-line h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.barcode-svg {
  display: block;
  width: 100%;
  height: 28px;
  fill: var(--ink);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ─── Buttons ─── */

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 14px;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 500;
}

.primary-button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--surface-2);
}

/* ─── Detail stats ─── */

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.detail-stats div {
  padding: 10px;
  border-radius: 7px;
  background: var(--surface-2);
}

.detail-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-stats strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
  font-weight: 700;
}

/* ─── Purchase panel ─── */

.purchase-panel {
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.purchase-panel summary {
  list-style: none;
}

.purchase-panel summary::-webkit-details-marker {
  display: none;
}

.purchase-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.purchase-summary:hover {
  background: #f8fafc;
}

.purchase-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.purchase-title strong {
  font-size: 15px;
}

.purchase-title small {
  color: var(--muted);
  font-size: 13px;
}

.purchase-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.purchase-metrics span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.purchase-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.purchase-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.purchase-panel[open] .purchase-toggle svg {
  transform: rotate(180deg);
}

.product-outbound-panel {
  border-bottom: 1px solid var(--line);
}

.product-outbound-panel summary {
  list-style: none;
}

.product-outbound-panel summary::-webkit-details-marker {
  display: none;
}

.product-outbound-panel[open] .purchase-toggle svg {
  transform: rotate(180deg);
}

.product-outbound-content {
  display: grid;
  gap: 8px;
  padding: 0 14px 12px;
}

.product-outbound-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.purchase-row span,
.purchase-status small {
  color: var(--muted);
  font-size: 13px;
}

.purchase-content {
  padding: 0 14px 12px;
}

.purchase-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  text-align: center;
}

.purchase-list {
  display: grid;
  gap: 7px;
}

.purchase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.purchase-row strong,
.purchase-row span {
  display: block;
}

.purchase-status {
  min-width: 104px;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--blue-light);
  color: var(--blue);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.purchase-status.delivered {
  background: var(--green-light);
  color: var(--green);
}

/* ─── SKU list ─── */

.sku-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 360px);
  min-height: 300px;
  overflow: auto;
  padding: 12px 14px 18px;
}

.sku-row {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.sku-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sku-code {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 650;
  font-size: 14px;
}

.sku-code small {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.sku-barcode-control {
  display: inline-flex;
  align-items: center;
}

.sku-barcode-toggle {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sku-barcode-toggle:hover {
  background: var(--blue-light);
  border-color: var(--blue-mid);
}

.sku-barcode-card {
  display: inline-flex;
  align-items: center;
  width: 128px;
  height: 30px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  cursor: pointer;
}

.sku-barcode-card .barcode-svg {
  height: 24px;
}

.sku-barcode-toggle[hidden],
.sku-barcode-card[hidden] {
  display: none;
}

.sku-sub {
  margin-top: 2px;
  font-size: 12px;
}

.sku-outbound-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.sku-outbound-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.sku-outbound-panel summary::-webkit-details-marker {
  display: none;
}

.sku-outbound-panel summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.sku-outbound-list {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.sku-outbound-list .product-outbound-row {
  background: #ffffff;
}

.qty-pill {
  min-width: 50px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--blue-light);
  color: var(--blue);
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.qty-pill.low {
  background: #fef2f2;
  color: var(--red);
}

/* ─── Warehouse overview panel (default right panel) ─── */

.overview-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.overview-head h3 {
  margin-bottom: 0;
}

.overview-head span {
  color: var(--muted);
  font-size: 12px;
}

.overview-list {
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.overview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.overview-row:hover {
  background: var(--blue-light);
  border-color: var(--blue-mid);
}

.overview-warehouse-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.warehouse-type-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.overview-stock {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.overview-qty {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.overview-qty.has-stock {
  color: var(--ink);
}

.overview-unit {
  font-size: 12px;
  color: var(--muted);
}

.overview-hint {
  margin: auto 0 0;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ─── Warehouse chips (replaces progress bars) ─── */

.warehouse-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.warehouse-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-size: 12px;
}

.chip-name {
  color: var(--muted);
}

.chip-qty {
  font-weight: 700;
  color: var(--muted);
  min-width: 14px;
  text-align: right;
}

.chip-qty.has-stock {
  color: var(--blue);
}

/* ─── Legacy bar classes (kept for safety) ─── */

.warehouse-bars {
  display: grid;
  gap: 6px;
}

.warehouse-line {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

/* ─── Mobile taskbar ─── */

.mobile-taskbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

/* ─── PDA view ─── */

.pda-view {
  max-width: 620px;
}

.pda-shell {
  display: grid;
  gap: 12px;
}

.pda-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pda-header h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.pda-warehouse,
.pda-scan-box,
.pda-outbound-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pda-warehouse select,
.pda-scan-box input,
.pda-outbound-form input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
}

.pda-scan-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pda-scan-box span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 650;
}

.pda-scan-box svg {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

.pda-scan-box input {
  height: 52px;
  font-size: 18px;
  font-weight: 650;
}

.pda-status {
  min-height: 36px;
  padding: 9px 12px;
  border: 1px solid var(--blue-mid);
  border-radius: 8px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.pda-product-card,
.pda-outbound-form {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pda-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.pda-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
}

.pda-empty strong {
  color: var(--ink);
  font-size: 17px;
}

.pda-empty span {
  margin-top: 4px;
  font-size: 13px;
}

.pda-product-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.pda-product-head h3 {
  margin: 8px 0 5px;
  font-size: 24px;
}

.pda-product-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.pda-current-stock {
  min-width: 96px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.pda-current-stock span,
.pda-product-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.pda-current-stock strong {
  display: block;
  margin-top: 3px;
  color: var(--green);
  font-size: 28px;
  line-height: 1;
}

.pda-current-stock strong.danger {
  color: var(--red);
}

.pda-product-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.pda-product-meta span {
  overflow-wrap: anywhere;
}

.pda-stock-list {
  display: grid;
}

.pda-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}

.pda-stock-row:last-child {
  border-bottom: 0;
}

.pda-stock-row.current {
  background: var(--green-light);
}

.pda-stock-row span {
  color: var(--muted);
  font-size: 13px;
}

.pda-stock-row strong {
  font-size: 17px;
}

.pda-outbound-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.pda-outbound-form.disabled {
  opacity: 0.62;
}

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

.pda-submit {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
}

.mobile-taskbar button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 50px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
}

/* ─── Dialogs ─── */

.action-dialog {
  width: min(720px, calc(100vw - 24px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.13);
}

.action-dialog.transfer-dialog {
  width: min(1120px, calc(100vw - 24px));
}

.action-dialog.ink-demo-dialog {
  width: min(1120px, calc(100vw - 24px));
}

.action-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
}

.dialog-card {
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.full-field {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: 2px solid var(--blue-mid);
  outline-offset: 1px;
  border-color: var(--blue);
}

.order-lines-field {
  grid-column: 1 / -1;
  display: none;
  gap: 10px;
}

.order-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.order-lines {
  display: grid;
  gap: 8px;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 120px 44px;
  gap: 8px;
  align-items: center;
}

.order-line .icon-button {
  width: 40px;
  height: 40px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ─── Ink screen demo ─── */

.ink-demo-card {
  background: #f8fafc;
}

.ink-demo-stage {
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ececec;
}

.ink-device-preview {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 235 / 175;
  padding: 5.8%;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(190, 197, 190, 0.54)),
    #d4d8d3;
  box-shadow:
    0 18px 44px rgba(15, 23, 42, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.7),
    inset 0 0 0 10px rgba(177, 184, 176, 0.24);
}

.ink-status-light {
  position: absolute;
  top: 8.2%;
  right: 5.6%;
  width: 16px;
  aspect-ratio: 1;
  border-radius: 2px;
  background: #22d9d1;
}

.ink-barcode {
  position: absolute;
  left: 50%;
  bottom: 4.2%;
  width: 82px;
  height: 18px;
  translate: -50% 0;
  opacity: 0.78;
  background: linear-gradient(
    90deg,
    #111 0 3px,
    transparent 3px 6px,
    #111 6px 8px,
    transparent 8px 13px,
    #111 13px 17px,
    transparent 17px 21px,
    #111 21px 23px,
    transparent 23px 29px,
    #111 29px 35px,
    transparent 35px 39px,
    #111 39px 42px,
    transparent 42px 48px,
    #111 48px 51px,
    transparent 51px 55px,
    #111 55px 61px,
    transparent 61px 66px,
    #111 66px 69px,
    transparent 69px 72px,
    #111 72px 78px,
    transparent 78px 82px
  );
}

.ink-screen-preview {
  display: grid;
  grid-template-columns: 16% 1fr;
  gap: 2.8%;
  width: 100%;
  height: 100%;
  padding: 2.8%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f4f4f1;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.06);
}

.ink-side-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: 14px 10px;
  background: #d51220;
  color: #ffffff;
  text-align: center;
}

.ink-side-label {
  display: block;
  margin-bottom: 7px;
  font-size: clamp(10px, 1vw, 14px);
  font-weight: 800;
  opacity: 0.8;
}

.ink-side-panel strong {
  display: block;
  font-size: clamp(16px, 1.8vw, 26px);
  font-weight: 800;
  line-height: 1.08;
}

.ink-side-summary {
  align-self: center;
}

.ink-side-summary b {
  display: block;
  font-size: clamp(36px, 5.6vw, 74px);
  line-height: 0.94;
}

.ink-side-summary span,
.ink-side-foot small {
  display: block;
  margin-top: 8px;
  font-size: clamp(11px, 1.1vw, 15px);
  font-weight: 700;
  line-height: 1.25;
}

.ink-side-foot {
  display: grid;
  gap: 3px;
}

.ink-side-foot span {
  justify-self: center;
  min-width: 52px;
  padding: 4px 6px;
  border: 2px solid #ffffff;
  font-size: clamp(13px, 1.3vw, 18px);
  font-weight: 800;
  line-height: 1;
}

.ink-main-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  min-width: 0;
}

.ink-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 5px;
  border-bottom: 2px solid #222222;
}

.ink-table-head strong {
  display: block;
  font-size: clamp(18px, 2.35vw, 31px);
  line-height: 1;
}

.ink-table-head span {
  display: block;
  margin-top: 4px;
  color: #4c4c4c;
  font-size: clamp(9px, 0.95vw, 13px);
  font-weight: 700;
}

.ink-table-head b {
  color: #d51220;
  font-size: clamp(20px, 2.85vw, 38px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.ink-table {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.ink-table-row {
  display: grid;
  grid-template-columns: 30% minmax(0, 1fr) 46px;
  gap: 7px;
  align-items: center;
  min-height: 30px;
  padding: 2px 0;
  border-bottom: 1px solid #777777;
}

.ink-table-title {
  min-height: 20px;
  padding: 0 0 3px;
  border-bottom: 2px solid #222222;
  color: #4c4c4c;
  font-size: clamp(8px, 0.82vw, 11px);
  font-weight: 800;
}

.ink-table-title span:last-child {
  text-align: right;
}

.ink-table-pages {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.ink-page {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  opacity: 0;
  pointer-events: none;
}

.ink-page.active {
  opacity: 1;
  pointer-events: auto;
}

.ink-code {
  display: grid;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  font-size: clamp(9px, 0.95vw, 13px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
}

.ink-code b,
.ink-code small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ink-code small {
  color: #4c4c4c;
  font-size: 0.86em;
}

.ink-desc {
  display: grid;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  font-size: clamp(12px, 1.28vw, 18px);
  font-weight: 800;
  line-height: 1.06;
}

.ink-desc strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 1.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ink-desc small {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #4c4c4c;
  font-size: 0.62em;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ink-qty {
  color: #d51220;
  font-size: clamp(15px, 1.9vw, 26px);
  font-weight: 900;
  text-align: right;
}

.ink-empty-screen {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: #4c4c4c;
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 900;
}

.ink-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding-top: 10px;
  border-top: 4px solid #2f2f2f;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 700;
}

.ink-footer span {
  min-width: 0;
  overflow: hidden;
  color: #4c4c4c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ink-footer b {
  color: #d51220;
  font-size: clamp(17px, 2vw, 27px);
}

.ink-carousel-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.ink-carousel-dots span {
  width: 10px;
  height: 10px;
  border: 2px solid #111111;
  background: transparent;
}

.ink-carousel-dots span.active {
  background: #d51220;
  border-color: #d51220;
}

.ink-demo-note {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.action-dialog.ipad-demo-dialog {
  width: min(1180px, calc(100vw - 24px));
  max-width: min(1180px, calc(100vw - 24px));
}

.ipad-demo-card {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.ipad-demo-stage {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 14px;
  background: #eef1f4;
}

.ipad-device-preview {
  position: relative;
  width: min(100%, 1000px);
  aspect-ratio: 4 / 3;
  padding: 26px 38px;
  border: 2px solid #222831;
  border-radius: 38px;
  background: linear-gradient(135deg, #1d222b, #07090d);
  box-shadow: 0 22px 50px rgba(14, 21, 31, 0.28);
}

.ipad-camera {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3a4452;
  transform: translateY(-50%);
}

.ipad-screen-preview {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #f8fafc;
  color: #111827;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ipad-summary-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 28px 22px;
  background: #14314a;
  color: #ffffff;
}

.ipad-summary-panel span,
.ipad-summary-panel small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.ipad-summary-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  line-height: 1;
}

.ipad-big-metric {
  align-self: center;
}

.ipad-big-metric b {
  display: block;
  color: #ffffff;
  font-size: clamp(70px, 9vw, 116px);
  line-height: 0.9;
}

.ipad-big-metric small {
  margin-top: 12px;
  font-size: 16px;
}

.ipad-small-metrics {
  display: grid;
  gap: 10px;
}

.ipad-small-metrics span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
}

.ipad-small-metrics b {
  color: #ffffff;
  font-size: 22px;
}

.ipad-board-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 24px 24px 20px 0;
}

.ipad-board-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid #d8dee6;
}

.ipad-board-head p {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.ipad-board-head h3 {
  margin: 0;
  font-size: clamp(26px, 3.3vw, 42px);
  line-height: 1;
}

.ipad-board-head span {
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.ipad-sku-table {
  min-height: 0;
  overflow: auto;
  padding-top: 12px;
}

.ipad-sku-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1.35fr) minmax(150px, 0.9fr) 62px;
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.ipad-row-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e8edf3;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

.ipad-sku-name,
.ipad-sku-code {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ipad-sku-name strong {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(20px, 2vw, 29px);
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ipad-sku-name small,
.ipad-sku-code small {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ipad-sku-code span {
  overflow: hidden;
  color: #334155;
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ipad-sku-row > b {
  color: #d51220;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
  text-align: right;
}

.ipad-empty-board {
  display: grid;
  place-items: center;
  height: 100%;
  color: #64748b;
  font-size: 28px;
  font-weight: 900;
}

/* ─── Transfer panel ─── */

.transfer-panel {
  display: none;
}

.transfer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 14px;
}

.transfer-matrix-wrap,
.transfer-control {
  min-width: 0;
}

.transfer-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.transfer-section-head h3 {
  margin-bottom: 0;
}

.transfer-section-head span {
  color: var(--muted);
  font-size: 13px;
}

.transfer-matrix {
  overflow: auto;
  max-height: 58vh;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.transfer-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) repeat(var(--warehouse-count), minmax(108px, 1fr));
  min-width: max-content;
}

.transfer-grid-head,
.transfer-sku-cell,
.transfer-stock-cell {
  min-height: 52px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.transfer-grid-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.transfer-grid-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.transfer-grid-head.sku-head {
  left: 0;
  z-index: 2;
  justify-items: start;
  text-align: left;
}

.transfer-sku-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 10px;
  background: #ffffff;
}

.transfer-sku-cell strong,
.transfer-sku-cell small,
.transfer-sku-cell span {
  display: block;
}

.transfer-sku-cell small {
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
}

.transfer-sku-cell span {
  color: var(--muted);
  font-size: 12px;
}

.transfer-stock-cell {
  display: grid;
  place-items: center;
  border-top: 0;
  border-left: 0;
  background: #ffffff;
  color: var(--ink);
}

.transfer-stock-cell span {
  display: grid;
  place-items: center;
  min-width: 46px;
  min-height: 30px;
  border-radius: 6px;
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
  font-size: 14px;
}

.transfer-stock-cell:disabled span {
  background: var(--surface-2);
  color: var(--muted);
}

.transfer-stock-cell.selected {
  box-shadow: inset 0 0 0 2px var(--blue);
  background: var(--blue-light);
}

.transfer-control {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.transfer-control label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.transfer-control input,
.transfer-control select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.transfer-preview {
  display: grid;
  gap: 8px;
  min-height: 110px;
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.transfer-preview strong,
.transfer-preview span {
  display: block;
}

.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.preview-row strong {
  color: var(--ink);
}

/* ─── Mobile execution ─── */

.mobile-execution .workspace {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-execution .detail-panel {
  position: static;
}

/* ─── Responsive ─── */

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .brand div,
  .nav-item span,
  .sidebar-panel small,
  .sidebar-panel span {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }

  .sidebar-panel {
    text-align: center;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-panel {
    position: static;
  }

  .warehouse-detail-layout {
    grid-template-columns: 1fr;
  }

  .warehouse-outbound-panel {
    position: static;
    max-height: none;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 14px 92px;
  }

  .topbar,
  .section-head {
    display: grid;
    align-items: start;
  }

  .topbar-actions {
    width: 100%;
  }

  .pda-mode-button {
    min-width: 96px;
  }

  .search {
    min-width: 0;
    flex: 1;
  }

  .metrics,
  .detail-stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .ink-demo-card {
    padding: 12px;
  }

  .ink-demo-stage {
    padding: 10px;
  }

  .ink-device-preview {
    border-radius: 10px;
  }

  .ink-screen-preview {
    gap: 3.4%;
  }

  .ink-side-panel {
    padding: 10px 8px;
  }

  .ink-main-panel {
    gap: 7px;
  }

  .ink-table-head {
    gap: 8px;
    padding-bottom: 5px;
    border-bottom-width: 2px;
  }

  .ink-table-row {
    grid-template-columns: 39% minmax(0, 1fr) 42px;
    gap: 5px;
    min-height: 28px;
    padding: 2px 0;
    border-bottom-width: 1px;
  }

  .ink-table-title {
    min-height: 20px;
    border-bottom-width: 2px;
  }

  .ink-carousel-dots span {
    width: 8px;
    height: 8px;
  }

  .ink-footer {
    padding-top: 5px;
    border-top-width: 2px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warehouse-global-filters {
    grid-template-columns: 1fr;
  }

  .warehouse-export-button {
    width: 100%;
  }

  .warehouse-view-switch {
    width: 100%;
  }

  .warehouse-view-switch button {
    flex: 1;
  }

  .warehouse-global-group-head,
  .warehouse-global-row {
    grid-template-columns: 1fr;
  }

  .warehouse-global-group-head b,
  .warehouse-global-row strong {
    justify-self: start;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1;
    white-space: nowrap;
  }

  .detail-hero {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .detail-title-line {
    align-items: flex-start;
    gap: 7px;
  }

  .sku-barcode-card {
    width: 112px;
  }

  .detail-actions {
    display: none;
  }

  .purchase-row {
    grid-template-columns: 1fr;
  }

  .purchase-summary {
    align-items: start;
  }

  .purchase-metrics {
    display: none;
  }

  .order-line {
    grid-template-columns: minmax(0, 1fr) 88px 42px;
  }

  .transfer-layout {
    grid-template-columns: 1fr;
  }

  .warehouse-detail-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .warehouse-detail-title {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .warehouse-detail-hero .secondary-button {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
  }

  .warehouse-detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warehouse-detail-meta {
    grid-template-columns: 1fr;
  }

  .warehouse-sku-row {
    grid-template-columns: 1fr;
  }

  .warehouse-sku-row strong {
    justify-self: start;
  }

  .settings-panel-head,
  .supplier-row,
  .settings-warehouse-row,
  .display-device-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .display-device-scope,
  .display-device-permissions {
    justify-items: start;
  }

  .settings-panel-head {
    display: grid;
  }

  .supplier-warehouse-summary {
    text-align: left;
  }

  .supplier-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .sku-list {
    max-height: none;
  }

  .mobile-taskbar {
    display: grid;
  }
}
