/* ═══════════════════════════════════════════════
   StoneWare 电商运营后台 · Shared UI
   统一字体、卡片与模块视觉层级
   ═══════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --mh-bg: #f5f5f7;
  --mh-surface: #ffffff;
  --mh-surface-soft: #f7f7f9;
  --mh-surface-cool: #f3f5f9;
  --mh-border: rgba(0, 0, 0, .08);
  --mh-text: #1d1d1f;
  --mh-muted: #6e6e73;
  --mh-muted-light: #9ca3af;
  --mh-blue: #0071e3;
  --mh-blue-dark: #0066cc;
  --mh-blue-light: #eef6ff;
  --mh-green: #0f9f6e;
  --mh-green-light: #edfaf4;
  --mh-amber: #c47f16;
  --mh-amber-light: #fff9ed;
  --mh-shadow-sm: 0 3px 12px rgba(0,0,0,.045);
  --mh-shadow: 0 8px 28px rgba(0,0,0,.055);
  --mh-shadow-lg: 0 16px 44px rgba(0,0,0,.075);
  --mh-radius-sm: 12px;
  --mh-radius: 16px;
  --mh-radius-lg: 20px;
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Helvetica Neue","PingFang SC",sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--mh-text);
  background: #f5f5f7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────── */

.mh-shell {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}

/* ═══════════════════════════════════════════
   Hero / Header
   ═══════════════════════════════════════════ */

.mh-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(480px, 0.95fr);
  gap: 48px;
  align-items: end;
  padding: 56px 0 36px;
}

.mh-hero-brand {
  display: grid;
  gap: 6px;
}

.mh-hero h1 {
  margin: 0;
  font-size: clamp(42px, 5.5vw, 60px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.mh-hero-subtitle {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--mh-text);
}

.mh-layer-kicker {
  width: fit-content;
  margin: 0 0 2px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #5552b8;
  background: rgba(94, 92, 230, .08);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}

.mh-hero-desc {
  max-width: 500px;
  margin: 10px 0 0;
  color: var(--mh-muted);
  font-size: 16px;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════
   Action Panel — 三组功能区
   ═══════════════════════════════════════════ */

.mh-action-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mh-action-group {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
}

.mh-action-label {
  padding: 0 4px;
  color: var(--mh-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mh-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface);
  color: var(--mh-text);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--mh-shadow-sm);
  transition: border-color .15s, box-shadow .15s;
  white-space: nowrap;
  text-align: center;
}

.mh-action-btn:hover {
  border-color: var(--mh-blue);
  box-shadow: 0 4px 16px rgba(37,99,235,.1);
}

.mh-action-btn.primary {
  border-color: var(--mh-blue);
  background: var(--mh-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.22);
}

.mh-action-btn.primary:hover {
  background: var(--mh-blue-dark);
  border-color: var(--mh-blue-dark);
}

.mh-action-btn.secondary {
  background: var(--mh-surface-soft);
}

.mh-action-btn.secondary:hover {
  border-color: var(--mh-muted);
}

/* ── Outline Button ─────────────────────── */

.mh-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 22px;
  border: 1.5px solid var(--mh-blue);
  border-radius: var(--mh-radius-sm);
  background: transparent;
  color: var(--mh-blue);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.mh-btn-outline:hover {
  background: var(--mh-blue);
  color: #fff;
}

/* ═══════════════════════════════════════════
   Metrics / Data Cards
   ═══════════════════════════════════════════ */

.mh-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin: 28px 0;
}

.mh-metrics article {
  display: grid;
  gap: 8px;
  padding: 24px 20px;
  border: 1px solid rgba(230,226,217,.6);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
}

.mh-metrics article span {
  color: var(--mh-muted);
  font-size: 14px;
  font-weight: 600;
}

.mh-metrics article strong {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--mh-text);
}

.mh-metrics article small {
  color: var(--mh-muted);
  font-size: 12px;
  font-weight: 500;
}

.mh-metrics article.is-warning {
  background: var(--mh-amber-light);
  border-color: rgba(196,127,22,.16);
}

.mh-metrics article.is-warning strong {
  color: var(--mh-amber);
}

/* ═══════════════════════════════════════════
   Sections
   ═══════════════════════════════════════════ */

.mh-section {
  margin: 24px 0;
  padding: 32px 32px 36px;
  border: 1px solid rgba(230,226,217,.5);
  border-radius: var(--mh-radius-lg);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow);
}

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

.mh-section-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.mh-section-desc {
  margin: 6px 0 0;
  color: var(--mh-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════════════
   SKU Grid & Cards
   ═══════════════════════════════════════════ */

.mh-sku-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.mh-sku-card {
  overflow: hidden;
  border: 1px solid rgba(230,226,217,.6);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
}

/* ── SKU Image — contain to avoid cropping ── */

.mh-sku-image {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f0ede6;
}

.mh-sku-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 12px;
}

.mh-sku-noimg {
  font-size: 16px;
  font-weight: 600;
  color: var(--mh-muted-light);
}

/* ── SKU Body ───────────────────────────── */

.mh-sku-body {
  display: grid;
  gap: 16px;
  padding: 20px 20px 24px;
}

.mh-sku-body h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--mh-text);
}

.mh-sku-code {
  font-size: 12px;
  font-weight: 600;
  color: var(--mh-muted-light);
  letter-spacing: 0.03em;
}

/* ── Stock Line ─────────────────────────── */

.mh-stock-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--mh-radius-sm);
  background: var(--mh-green-light);
}

.mh-stock-line span {
  color: var(--mh-muted);
  font-size: 14px;
  font-weight: 600;
}

.mh-stock-line strong {
  color: var(--mh-green);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

/* ── Sales Stats ────────────────────────── */

.mh-sku-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mh-stat-box {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
  text-align: center;
}

.mh-stat-box small {
  color: var(--mh-muted);
  font-size: 12px;
  font-weight: 500;
}

.mh-stat-box b {
  color: var(--mh-text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

/* ── Empty Card ─────────────────────────── */

.mh-empty-card .mh-sku-image {
  background: var(--mh-surface-cool);
}

.mh-empty-card .mh-stock-line {
  background: var(--mh-surface-soft);
}

.mh-empty-card .mh-stock-line strong {
  color: var(--mh-muted-light);
}

/* ═══════════════════════════════════════════
   Workbench
   ═══════════════════════════════════════════ */

.mh-workbench {
  background: var(--mh-surface-soft);
}

.mh-workbench-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.mh-workbench-grid a {
  display: grid;
  gap: 6px;
  padding: 24px 20px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}

.mh-workbench-grid a:hover {
  border-color: var(--mh-blue);
  box-shadow: 0 4px 20px rgba(37,99,235,.1);
}

.mh-workbench-grid a strong {
  font-size: 16px;
  font-weight: 700;
}

.mh-workbench-grid a span {
  font-size: 13px;
  font-weight: 500;
  color: var(--mh-muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════
   Login Preview
   ═══════════════════════════════════════════ */

.mh-login-preview {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(170deg, #f9f8f5 0%, #f0ede6 50%, #eae5da 100%);
}

.mh-login-shell {
  width: min(460px, calc(100% - 48px));
}

.mh-login-card {
  display: grid;
  gap: 34px;
  padding: 46px 40px;
  border: 1px solid rgba(230,226,217,.5);
  border-radius: var(--mh-radius-lg);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-lg);
}

.mh-login-brand {
  text-align: center;
}

.mh-login-brand h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.mh-login-subtitle {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--mh-text);
}

.mh-login-desc {
  margin: 12px 0 0;
  color: var(--mh-muted);
  font-size: 15px;
  line-height: 1.65;
}

/* ── Login Form ─────────────────────────── */

.mh-login-form {
  display: grid;
  gap: 18px;
}

.mh-login-form label {
  display: grid;
  gap: 6px;
  color: var(--mh-text);
  font-size: 14px;
  font-weight: 700;
}

.mh-login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border: 1.5px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
  color: var(--mh-text);
  font: inherit;
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.mh-login-form input:focus {
  border-color: var(--mh-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}

.mh-login-form input::placeholder {
  color: #bcc1ca;
}

.mh-login-form button {
  min-height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--mh-radius-sm);
  background: var(--mh-blue);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}

.mh-login-form button:hover {
  background: var(--mh-blue-dark);
  box-shadow: 0 8px 24px rgba(37,99,235,.28);
}

.mh-login-footer {
  margin: -8px 0 0;
  text-align: center;
  font-size: 14px;
}

.mh-login-footer a {
  color: var(--mh-muted);
  font-weight: 600;
  transition: color .15s;
}

.mh-login-footer a:hover {
  color: var(--mh-blue);
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 1080px) {
  .mh-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 860px) {
  .mh-action-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mh-action-group {
    grid-template-columns: auto 1fr 1fr;
    grid-template-rows: auto;
    align-items: center;
    gap: 10px;
  }

  .mh-action-label {
    min-width: 70px;
  }

  .mh-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .mh-workbench-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  :root { font-size: 15px; }

  .mh-shell {
    width: min(100% - 28px, 1200px);
  }

  .mh-hero {
    padding-top: 32px;
  }

  .mh-hero h1 {
    font-size: 34px;
  }

  .mh-hero-subtitle {
    font-size: 20px;
  }

  .mh-action-panel {
    grid-template-columns: 1fr;
  }

  .mh-action-group {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .mh-action-label {
    grid-column: 1 / -1;
  }

  .mh-metrics,
  .mh-sku-grid,
  .mh-workbench-grid {
    grid-template-columns: 1fr;
  }

  .mh-section {
    padding: 24px 20px 28px;
  }

  .mh-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .mh-btn-outline {
    width: 100%;
  }

  .mh-login-card {
    padding: 34px 26px;
  }
}

/* ══════════════════════════════════════════════════════════════
   Production-specific additions
   ══════════════════════════════════════════════════════════════ */

/* ── Image zoom button reset ────────────── */

button.mh-sku-image {
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* ── Quick actions bar ──────────────────── */

.mh-quick-actions {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 0;
}

.mh-quick-actions form {
  display: inline-flex;
}

.mh-quick-actions .mh-action-btn {
  min-height: 36px;
  font-size: 13px;
  padding: 0 18px;
}

/* ── Page shell (used by other pages) ───── */

.page-shell {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}

/* ── Alert / message styling ────────────── */

.alert {
  padding: 14px 18px;
  border-radius: var(--mh-radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.alert.warning {
  background: var(--mh-amber-light);
  color: var(--mh-amber);
  border: 1px solid rgba(196,127,22,.18);
}

.alert.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(220,38,38,.15);
}

.alert.info {
  background: var(--mh-blue-light);
  color: var(--mh-blue-dark);
  border: 1px solid rgba(37,99,235,.15);
}

/* ── Flash messages ─────────────────────── */

.messages {
  margin: 16px 0;
}

.message {
  padding: 12px 18px;
  border-radius: var(--mh-radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.message.success {
  background: var(--mh-green-light);
  color: var(--mh-green);
  border: 1px solid rgba(15,159,110,.15);
}

.message.warning {
  background: var(--mh-amber-light);
  color: var(--mh-amber);
  border: 1px solid rgba(196,127,22,.18);
}

.message.error,
.message.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(220,38,38,.15);
}

.message.info {
  background: var(--mh-blue-light);
  color: var(--mh-blue-dark);
  border: 1px solid rgba(37,99,235,.15);
}

/* ══════════════════════════════════════════════════════════════
   Legacy styles — preserved for backward compatibility
   (quick_stock, purchase_center, mapping_center, etc.)
   ══════════════════════════════════════════════════════════════ */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #e5e8ef;
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --warning: #d46b08;
  --warning-bg: #fff7e6;
  --danger: #d92d20;
  --danger-bg: #fff1f0;
  --success: #079455;
  --success-bg: #ecfdf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
  margin-bottom: 14px;
}

main {
  padding: 20px 24px 36px;
}

.storage-error-page {
  max-width: 680px;
  margin: 80px auto;
}

.storage-error-page h1 {
  margin-bottom: 14px;
}

.storage-error-page p {
  margin-top: 10px;
  line-height: 1.6;
}

.storage-choice-dialog {
  width: min(92vw, 620px);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
}

.storage-choice-dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.storage-choice-dialog form {
  display: grid;
  gap: 12px;
}

.storage-choice-dialog p {
  color: var(--muted);
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid div,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.summary-grid div {
  padding: 14px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  font-size: 26px;
  line-height: 1.15;
  margin-top: 4px;
}

.summary-grid .warning {
  background: var(--warning-bg);
  border-color: #ffd591;
}

.summary-grid .danger {
  background: var(--danger-bg);
  border-color: #ffa39e;
}

.manual-summary {
  margin-bottom: 16px;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.notice-panel {
  display: flex;
  gap: 10px;
  align-items: center;
  border-color: #91caff;
  background: #f7fbff;
  color: #24466f;
}

.notice-panel strong {
  white-space: nowrap;
}

.system-panel {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 420px);
  gap: 16px;
  align-items: start;
}

.system-links {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.storage-status {
  border-radius: 6px;
  margin-bottom: 10px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
}

.storage-status.connected {
  background: var(--success-bg);
  color: var(--success);
}

.storage-status.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.system-links strong {
  color: #175cd3;
  font-weight: 700;
  word-break: break-all;
}

.mobile-address {
  border-radius: 6px;
  padding: 10px;
  background: #eef6ff;
  color: #175cd3;
  font-size: 14px;
  font-weight: 700;
}

.mobile-address a {
  color: #0958d9;
  word-break: break-all;
}

.lan-tip {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.storage-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.storage-actions form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.storage-actions form:first-child {
  grid-template-columns: auto;
}

.system-side {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 12px;
}

.qr-card {
  display: grid;
  gap: 5px;
  justify-items: center;
  color: #175cd3;
  font-size: 12px;
  text-align: center;
}

.qr-card img {
  width: 126px;
  height: 126px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.backup-actions {
  display: grid;
  gap: 10px;
}

.backup-actions form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.backup-actions form:first-child {
  grid-template-columns: auto;
}

.reset-data-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #fda29b;
  border-radius: 6px;
  background: #fff6f5;
  color: #912018;
}

.reset-data-form p,
.reset-data-form label {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
  outline: 0;
}

input[type="file"] {
  margin-bottom: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.small {
  padding: 7px 10px;
  font-size: 13px;
}

.button.primary {
  min-width: 136px;
}

.button.secondary {
  background: #fff;
  border-color: #cfd6e4;
  color: #344054;
}

.button.secondary:hover {
  background: #f5f8ff;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.topbar-actions .subtle-action {
  min-width: auto;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.messages {
  margin-bottom: 16px;
}

.message {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.message.success {
  background: var(--success-bg);
  color: #067647;
}

.message.error {
  background: var(--danger-bg);
  color: var(--danger);
}

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

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

.section-head input {
  max-width: 360px;
}

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

.legacy-table summary {
  cursor: pointer;
  color: #344054;
  font-weight: 700;
  margin-bottom: 8px;
}

.records-table {
  min-width: 780px;
}

.records-table th,
.records-table td {
  font-size: 13px;
}

.dropzone {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px dashed #91caff;
  border-radius: 8px;
  padding: 16px;
  background: #f7fbff;
}

.dropzone.dragging {
  border-color: var(--primary);
  background: #e6f4ff;
}

.dropzone input {
  grid-column: 1 / -1;
  margin: 0;
}

.dropzone p {
  color: var(--muted);
  margin-top: 4px;
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.image-preview img {
  width: 72px;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.sku-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.sku-option-manager {
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #f7f7fa;
}

.sku-option-manager p {
  margin: 4px 0 10px;
}

.sku-option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px;
}

.sku-option-grid form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.sku-create-form label,
.mapping-create-form label,
.quick-actions-grid label,
.sku-controls label,
.merge-form label {
  color: var(--muted);
  font-size: 13px;
}

.sku-create-form .wide,
.mapping-create-form .wide {
  grid-column: span 2;
}

.mapping-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.sales-mapping-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mapping-summary {
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  margin: 12px 0;
}

.mapping-edit-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.8fr) minmax(180px, 1fr) 72px auto;
  gap: 8px;
  margin: 8px 0;
}

.recommendation-list {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.recommendation-list h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.recommendation-card {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.recommendation-card span {
  color: var(--muted);
  font-size: 13px;
}

.recommendation-card form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f7faff;
  border: 1px solid #d8e8ff;
  padding: 8px;
}

.statistics-summary {
  grid-template-columns: repeat(3, minmax(140px, 220px));
}

.statistics-table table {
  min-width: 720px;
}

.sales-mapping-card {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.sales-mapping-card strong,
.sales-mapping-card span,
.sales-mapping-card p {
  display: block;
}

.sales-mapping-card span,
.sales-mapping-card p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.component-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.component-tags span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef4ff;
  color: #175cd3;
  font-weight: 650;
}

.danger-text {
  color: var(--danger) !important;
  background: var(--danger-bg) !important;
}

.inline-component-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 80px auto;
  gap: 8px;
  margin-top: 8px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.quick-actions-grid form.panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.quick-actions-grid h2,
.quick-actions-grid button {
  grid-column: 1 / -1;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, 1fr));
  gap: 10px;
  width: min(100%, 1120px);
}

.bulk-bar {
  display: grid;
  grid-template-columns: auto minmax(150px, 180px) minmax(140px, 1fr) minmax(120px, 150px) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  background: #fbfcff;
}

.merge-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.merge-form select {
  margin-top: 6px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #344054;
  z-index: 1;
}

td input {
  min-width: 110px;
  padding: 7px 8px;
}

td input.number {
  min-width: 76px;
}

.mapping-table {
  min-width: 1040px;
}

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

.sku-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.sku-card.low-stock {
  border-color: #ffd591;
}

.sku-card.emergency-stock {
  border-color: #ff7875;
  box-shadow: inset 4px 0 0 #ff4d4f;
}

.sku-card.abnormal-stock {
  border-color: #ffa39e;
}

.sku-card.out-stock {
  border-color: #ff7875;
}

.sku-card.pending-stock {
  border-color: #91caff;
}

.sku-card.archived-stock {
  border-color: #d0d5dd;
  opacity: 0.72;
}

.sku-card.invalid-stock {
  border-color: #ffccc7;
  background: #fffafa;
}

.sku-detail-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-ranking-list,
.ranking-columns {
  display: grid;
  gap: 10px;
}

.dashboard-ranking-list span,
.ranking-columns p {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfcff;
}

.dashboard-ranking-list b,
.ranking-columns b {
  color: var(--primary);
}

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

.ranking-columns h3 {
  margin-top: 0;
}

.mapping-center-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mapping-center-card {
  display: grid;
  grid-template-columns: auto minmax(220px, 1.5fr) minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mapping-center-card p {
  margin: 4px 0;
  color: var(--muted);
}

.mapping-center-card span,
.mapping-choice b {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mapping-choice select {
  margin: 5px 0;
}

.mapping-card-actions,
.mapping-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.sku-card-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 12px;
  position: relative;
}

.sku-select {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.sku-select input {
  width: auto;
  margin: 0;
}

.sku-image {
  width: 150px;
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f2f4f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  overflow: hidden;
  padding: 0;
  cursor: zoom-in;
}

.sku-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sku-image.large {
  width: 150px;
  height: 150px;
}

.quick-stock-box {
  grid-column: 1;
  display: grid;
  gap: 7px;
}

.stock-stepper {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 6px;
  align-items: center;
}

.stock-stepper button {
  width: 34px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.stock-stepper strong {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fbfcff;
  font-size: 13px;
}

.quick-stock-box form {
  margin: 0;
}

.quick-stock-box .button {
  width: 100%;
}

.quick-restock-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.custom-restock {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 6px;
}

.custom-restock input {
  min-width: 0;
  padding: 7px 8px;
}

.sku-card-main {
  display: grid;
  gap: 7px;
}

.sku-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.sku-heading strong {
  color: #0b3d91;
}

.sku-heading h3 {
  margin: 3px 0;
  font-size: 16px;
}

.sku-heading p {
  color: var(--muted);
  font-size: 13px;
}

.reorder-link {
  display: inline-flex;
  margin-top: 7px;
  color: #0958d9;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.reorder-link:hover {
  text-decoration: underline;
}

.sku-code {
  font-weight: 750;
  color: #0b3d91;
}

.stock-alert {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

.sku-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.sku-stats.compact {
  grid-template-columns: repeat(3, 1fr);
}

.sku-stats div {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: #fbfcff;
}

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

.sku-stats strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  margin-top: 2px;
}

.sku-actions {
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.sku-actions details {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px;
}

.sku-actions details:nth-child(4n) {
  border-right: 0;
}

.sku-actions summary {
  cursor: pointer;
  color: #0b3d91;
  font-weight: 700;
  font-size: 13px;
}

.action-form,
.edit-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.more-actions form {
  margin: 0;
}

.danger-button {
  background: var(--danger);
  border-color: var(--danger);
}

.danger-button:hover {
  background: #b42318;
  border-color: #b42318;
}

.mini-ledger {
  margin-top: 8px;
  display: grid;
  gap: 5px;
  max-height: 180px;
  overflow: auto;
}

.mini-ledger p {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 5px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line input {
  width: auto;
  margin: 0;
}

.legacy-table {
  margin-top: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.ok {
  background: var(--success-bg);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

tr.low-stock {
  background: var(--warning-bg);
}

tr.abnormal-stock {
  background: var(--danger-bg);
}

tr.out-stock {
  background: var(--danger-bg);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 36px;
  background: rgba(15, 23, 42, 0.72);
}

.image-modal[hidden] {
  display: none;
}

.image-modal img {
  max-width: min(92vw, 980px);
  max-height: 88vh;
  border-radius: 8px;
  background: #fff;
}

.image-modal button {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

.capture-panel {
  display: grid;
  gap: 14px;
}

.capture-actions,
.capture-files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.capture-badge {
  align-self: flex-start;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.capture-badge.idle { background: #eef2f7; color: #5d6b7d; }
.capture-badge.running { background: #e7f1ff; color: #1264c8; }
.capture-badge.success { background: #e7f7ee; color: #167549; }
.capture-badge.failed { background: #fff0ed; color: #c03a2b; }

.capture-status {
  border-top: 1px solid #e8edf3;
  padding-top: 12px;
}

.capture-status p {
  margin: 7px 0 10px;
  color: #607086;
}

.capture-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
}

.capture-metrics span {
  background: #f6f8fb;
  border: 1px solid #e7ecf3;
  padding: 8px;
  color: #68778a;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.capture-metrics strong {
  display: block;
  margin-top: 4px;
  color: #172438;
  font-size: 18px;
}

.capture-files {
  margin-top: 10px;
}

.capture-files a {
  color: #1769c2;
  font-size: 13px;
  font-weight: 700;
}

.capture-logs {
  max-height: 240px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid #e5ebf3;
  background: #f8fafc;
  color: #334154;
  font-size: 12px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .upload-grid,
  .merge-form,
  .system-panel,
  .backup-actions form,
  .sku-create-form,
  .mapping-create-form,
  .sales-mapping-card,
  .inline-component-form,
  .quick-actions-grid,
  .quick-actions-grid form.panel,
  .sku-card-layout,
  .sku-actions,
  .filters,
  .bulk-bar,
  .dropzone {
    grid-template-columns: 1fr;
  }

  .system-side {
    grid-template-columns: 132px 1fr;
  }

  .sku-create-form .wide,
  .mapping-create-form .wide,
  .sku-stats {
    grid-column: auto;
  }

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

  .ranking-columns,
  .mapping-center-card {
    grid-template-columns: 1fr;
  }

  .mapping-select {
    position: absolute;
  }

  .mapping-center-card {
    position: relative;
    padding-left: 42px;
  }

  .sku-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .sku-image.large {
    width: 100%;
    height: 230px;
    aspect-ratio: auto;
  }

  .quick-stock-box {
    grid-column: auto;
  }

  .desktop-management,
  .bulk-bar,
  .sku-select,
  .table-wrap {
    display: none;
  }

  .statistics-table {
    display: block;
  }

  .sku-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .sku-stats.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  main {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  main {
    padding: 10px;
  }

  .topbar {
    padding: 14px 12px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 13px;
  }

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

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

  .summary-grid div,
  .panel {
    padding: 12px;
  }

  .summary-grid strong {
    font-size: 22px;
  }

  .system-side {
    grid-template-columns: 1fr;
  }

  .storage-actions form {
    grid-template-columns: 1fr;
  }

  .notice-panel {
    display: grid;
    gap: 6px;
  }

  .qr-card img {
    width: 168px;
    height: 168px;
  }

  .inventory-toolbar .filters {
    gap: 8px;
  }

  .sku-card-layout {
    padding: 10px;
  }

  .sku-image.large {
    height: 210px;
  }

  .sku-heading h3 {
    font-size: 17px;
  }

  .quick-stock-box .button,
  .stock-stepper button,
  .sku-actions summary,
  .action-form .button,
  .edit-form .button {
    min-height: 44px;
  }

  .quick-stock-box .button {
    font-size: 15px;
  }

  .stock-stepper {
    grid-template-columns: 44px 1fr 44px;
  }

  .stock-stepper button {
    width: 44px;
    height: 44px;
  }

  .sku-actions details {
    padding: 12px;
  }

  .sku-actions summary {
    display: flex;
    align-items: center;
  }

  .table-wrap {
    display: none;
  }

  .table-wrap.statistics-table {
    display: block;
    overflow-x: auto;
  }
}

/* iOS-style responsive Web App theme */
:root {
  --bg: #f2f2f7;
  --panel: rgba(255, 255, 255, 0.94);
  --text: #1c1c1e;
  --muted: #6e6e73;
  --border: rgba(60, 60, 67, 0.16);
  --primary: #007aff;
  --primary-dark: #0066d6;
  --warning: #b45309;
  --warning-bg: #fff8e8;
  --danger: #ff3b30;
  --danger-bg: #fff2f2;
  --success: #248a3d;
  --success-bg: #effbf2;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(249, 249, 251, 0.82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.topbar h1 {
  color: #111114;
  font-size: 24px;
  font-weight: 760;
}

.topbar p {
  color: var(--muted);
}

main {
  max-width: 1680px;
  margin: 0 auto;
}

.panel,
.summary-grid > div,
.sku-card,
.mapping-center-card,
.storage-choice-dialog form {
  border-color: var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(32, 39, 50, 0.055);
}

.summary-grid > div {
  min-height: 96px;
  padding: 16px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.summary-grid strong {
  margin-top: 8px;
  color: #111114;
  font-size: 30px;
  line-height: 1;
}

.summary-grid .warning {
  background: #fff9eb;
}

.summary-grid .danger {
  background: #fff3f2;
}

.button,
button,
input,
select,
textarea {
  font: inherit;
}

.button {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 680;
}

.button.small {
  min-height: 38px;
  border-radius: 10px;
}

.button.primary,
.button:not(.secondary):not(.danger-button) {
  background: var(--primary);
}

.button.primary:hover,
.button:not(.secondary):not(.danger-button):hover {
  background: var(--primary-dark);
}

.button.secondary {
  border-color: rgba(0, 122, 255, 0.18);
  background: rgba(0, 122, 255, 0.08);
  color: var(--primary);
}

.danger-button {
  border-color: rgba(255, 59, 48, 0.24);
  background: var(--danger);
  color: #fff;
}

input,
select,
textarea {
  border-color: var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 122, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
  outline: 0;
}

.messages {
  position: sticky;
  top: 86px;
  z-index: 18;
}

.message {
  border-radius: 13px;
  box-shadow: 0 8px 22px rgba(32, 39, 50, 0.09);
}

.notice-panel {
  border-color: rgba(0, 122, 255, 0.18);
  background: rgba(239, 247, 255, 0.94);
}

.capture-status,
.capture-logs,
.reset-data-form,
.quick-stock-box,
.sku-actions details,
.ranking-columns > div {
  border-radius: 13px;
}

#settings,
#sku {
  scroll-margin-top: 92px;
}

.inventory-toolbar {
  position: sticky;
  top: 86px;
  z-index: 12;
  margin: -4px -4px 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(249, 249, 251, 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.filters input[type="search"] {
  min-width: 230px;
}

.sku-grid {
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
}

.sku-card {
  overflow: hidden;
}

.sku-card-layout {
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.sku-image.large {
  width: 208px;
  height: 208px;
  border: 0;
  border-radius: 14px;
  background: #f4f4f6;
}

.sku-image img {
  transition: transform 180ms ease;
}

.sku-image:hover img {
  transform: scale(1.035);
}

.sku-heading h3 {
  margin: 0 0 7px;
  color: #111114;
  font-size: 21px;
  line-height: 1.25;
}

.sku-heading p,
.sku-detail-line {
  color: var(--muted);
}

.sku-primary-stock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 5px;
}

.sku-primary-stock span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sku-primary-stock strong {
  color: var(--primary);
  font-size: 36px;
  line-height: 1;
}

.sku-heading .sku-code-label {
  margin: 0 0 5px;
  color: #8e8e93;
  font-size: 12px;
}

.status-pill {
  border-radius: 999px;
}

.status-pill.ok {
  background: var(--success-bg);
  color: var(--success);
}

.sku-stats {
  gap: 8px;
}

.sku-stats div {
  border-radius: 11px;
  background: #f7f7fa;
}

.sku-stats div:first-child {
  background: rgba(0, 122, 255, 0.09);
}

.sku-stats div:first-child strong {
  color: var(--primary);
  font-size: 21px;
}

.stock-stepper {
  border-radius: 12px;
  background: #fff;
}

.stock-stepper strong {
  color: #111114;
  font-size: 15px;
}

.stock-stepper button {
  border-radius: 10px;
  color: var(--primary);
}

.sku-actions {
  border-top-color: var(--border);
  background: rgba(249, 249, 251, 0.78);
}

.sku-actions summary {
  min-height: 40px;
  color: var(--primary);
  font-weight: 680;
}

.image-modal {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-actions {
    display: flex;
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions .button {
    min-height: 36px;
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 13px;
  }

  .topbar-actions .subtle-action {
    padding: 7px 10px;
    font-size: 12px;
  }

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

  main {
    padding: 12px;
  }

  .panel {
    border-radius: 15px;
  }

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

  .summary-grid > div {
    min-height: 82px;
    padding: 13px;
    border-radius: 14px;
  }

  .summary-grid strong {
    font-size: 28px;
  }

  .inventory {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

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

  .sku-card {
    min-width: 0;
  }

  .inventory-toolbar {
    top: 111px;
    margin: 0 0 12px;
    padding: 9px;
    border-radius: 15px;
  }

  .inventory-toolbar h2 {
    font-size: 17px;
  }

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

  .filters input[type="search"] {
    min-width: 0;
    min-height: 46px;
    grid-column: 1 / -1;
    border-radius: 13px;
    font-size: 16px;
  }

  .filters select {
    min-width: 0;
  }

  .sku-card-layout {
    grid-template-columns: 142px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .sku-image.large {
    width: 142px;
    height: 142px;
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: 1;
  }

  .sku-card-main {
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
  }

  .sku-heading {
    display: block;
  }

  .sku-heading h3 {
    overflow-wrap: anywhere;
    font-size: 18px;
  }

  .sku-primary-stock strong {
    font-size: 32px;
  }

  .sku-heading p,
  .sku-detail-line,
  .reorder-link {
    font-size: 12px;
  }

  .status-pill {
    display: inline-flex;
    margin-top: 5px;
  }

  .quick-stock-box {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sku-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
  }

  .sku-stats div {
    padding: 8px 6px;
  }

  .sku-stats span {
    font-size: 11px;
  }

  .sku-stats strong {
    font-size: 15px;
  }

  .sku-detail-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .sku-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 10px 12px 12px;
  }

  .sku-actions details {
    padding: 8px;
  }

  .sku-actions summary {
    justify-content: center;
    min-height: 40px;
    font-size: 14px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(249, 249, 251, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }

  .bottom-nav a {
    display: grid;
    min-height: 54px;
    place-items: center;
    align-content: center;
    gap: 2px;
    border-radius: 10px;
    color: #6e6e73;
    text-decoration: none;
  }

  .bottom-nav span {
    font-size: 19px;
    line-height: 1;
  }

  .bottom-nav b {
    font-size: 11px;
    font-weight: 650;
  }

  .bottom-nav .active {
    color: var(--primary);
  }
}

@media (max-width: 560px) {
  main {
    padding: 10px 10px 14px;
  }

  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .system-panel,
  .mapping-center-card {
    overflow-wrap: anywhere;
  }

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

  .qr-card img {
    max-width: 100%;
  }

  .stock-stepper {
    grid-template-columns: 50px minmax(0, 1fr) 50px;
  }

  .stock-stepper button {
    width: 50px;
    height: 46px;
  }

  .quick-stock-box .button {
    min-height: 44px;
  }
}

.quick-entry-panel {
  border-color: #c7ddff;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.quick-stock-filter-panel {
  border-color: #dbe4f3;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.quick-stock-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 220px);
  gap: 12px;
  align-items: end;
}

.quick-stock-toolbar label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.quick-stock-toolbar input,
.quick-stock-toolbar select {
  min-height: 40px;
}

.fixed-hot-sku-panel {
  border-color: #d7e1ef;
  background: #fff;
}

.fixed-hot-sku-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.fixed-hot-sku-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.fixed-hot-sku-form select {
  min-height: 40px;
}

.fixed-hot-slot {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbff;
}

.fixed-hot-slot-head,
.fixed-hot-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.fixed-hot-slot-head {
  justify-content: space-between;
}

.fixed-hot-move-actions {
  display: inline-flex;
  gap: 6px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.fixed-hot-image {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
}

.fixed-hot-preview h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.fixed-hot-preview p {
  margin: 2px 0;
}

.fixed-hot-save {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.quick-stock-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  max-width: 1240px;
  margin: 0 auto;
  justify-content: center;
  gap: 16px;
  align-items: start;
}

.quick-stock-card {
  padding: 0;
  min-width: 0;
  width: 100%;
  overflow: visible;
}

.quick-stock-card-layout {
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  align-items: start;
}

.quick-stock-card .sku-image.large {
  width: 120px;
  height: 120px;
}

.quick-stock-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.quick-stock-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.quick-stock-heading h3 {
  overflow-wrap: anywhere;
}

.quick-status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
  align-content: start;
}

.quick-card-actions {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.quick-card-action-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid #e5e8ef;
  border-radius: 12px;
  background: #fbfcff;
  min-width: 0;
}

.quick-card-action-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-card-action-form input {
  min-height: 40px;
  min-width: 0;
  width: 100%;
}

.quick-card-action-form .button {
  justify-self: end;
  width: fit-content;
  white-space: nowrap;
}

.quick-card-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e8ef;
  border-radius: 12px;
  background: #f8fbff;
  min-width: 0;
}

.quick-card-settings-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-card-settings-form .wide {
  grid-column: 1 / -1;
}

.quick-card-settings-form .button {
  grid-column: 1 / -1;
  width: 100%;
}

.quick-stock-tools-panel {
  margin-bottom: 14px;
}

.quick-stock-top-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.quick-stock-tool,
.quick-stock-cleanup-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.quick-stock-tool summary {
  list-style: none;
  cursor: pointer;
}

.quick-stock-tool summary::-webkit-details-marker {
  display: none;
}

.quick-stock-tool[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.quick-stock-tool-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 0 0 14px 14px;
  background: #fff;
  min-width: 0;
}

.quick-stock-tool-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
}

.quick-stock-tool-form .wide {
  grid-column: 1 / -1;
}

.quick-stock-tool-form input,
.quick-stock-tool-form select {
  min-width: 0;
}

.quick-stock-tool-form .button {
  grid-column: 1 / -1;
  width: 100%;
}

.quick-stock-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.quick-stock-form label,
.date-inline {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.quick-stock-form .wide,
.quick-selected-card {
  grid-column: span 2;
}

.quick-selected-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.sku-image.tiny {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f2f4f7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
}

.sku-image.tiny img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-sku-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.quick-sku-mini {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.quick-sku-mini .sku-image {
  width: 100%;
  height: 120px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.batch-stock-table th,
.batch-stock-table td {
  min-width: 120px;
}

.batch-stock-table th:first-child,
.batch-stock-table td:first-child {
  min-width: 260px;
}

.danger-text {
  color: var(--danger) !important;
  font-weight: 700;
}

.low-stock-list {
  display: grid;
  gap: 10px;
}

.low-stock-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.low-stock-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.low-stock-actions {
  display: grid;
  gap: 7px;
  justify-items: stretch;
}

.low-stock-actions form {
  margin: 0;
}

.low-stock-actions .button,
.low-stock-actions form .button {
  width: 100%;
}

@media (max-width: 900px) {
  .quick-stock-toolbar,
  .quick-stock-card-layout,
  .low-stock-item {
    grid-template-columns: 1fr;
  }

  .quick-status-stack {
    justify-items: start;
  }
}

@media (max-width: 1180px) {
  .quick-stock-grid {
    grid-template-columns: repeat(2, minmax(360px, 1fr));
  }
}

@media (max-width: 760px) {
  .quick-stock-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-card-action-form,
  .quick-card-settings-form {
    grid-template-columns: 1fr;
  }

  .quick-card-action-form .button,
  .quick-card-settings-form .button {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 980px) {
  .quick-stock-top-actions {
    grid-template-columns: 1fr;
  }

  .quick-stock-tool-form {
    grid-template-columns: 1fr;
  }
}


.secondary-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.secondary-page-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.secondary-page-card strong {
  font-size: 18px;
}

.secondary-page-card span {
  color: rgba(71, 85, 105, 0.9);
  line-height: 1.5;
}

.hot-sku-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.hot-sku-card {
  min-height: 100%;
}

.empty-hot-slot {
  border-style: dashed;
}

@media (max-width: 760px) {
  .fixed-hot-sku-form {
    grid-template-columns: 1fr;
  }

  .fixed-hot-save {
    justify-content: stretch;
  }

  .fixed-hot-save .button {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════

/* ══════════════════════════════════════════════════════════════
   Quick Stock Page v3 — compact, 3-col, high-density ops
   ══════════════════════════════════════════════════════════════ */

/* ── Wider shell ────────────────────────── */
.mh-shell-wide {
  width: min(1340px, calc(100% - 48px));
}

/* ── Compact hero ───────────────────────── */
.mh-hero-compact {
  padding: 28px 0 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
}



.mh-hero-back { align-self: center; }

/* ── Compact sections ──────────────────── */
.mh-section {
  margin: 14px 0;
  padding: 18px 20px 22px;
}

.mh-section-head {
  margin-bottom: 14px;
  gap: 12px;
}

.mh-section-head h2 {
  font-size: 18px;
}

.mh-section-desc {
  font-size: 12px;
  margin-top: 4px;
}

/* ── Filter bar ─────────────────────────── */
.mh-filter-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.mh-filter-bar input,
.mh-filter-bar select {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.mh-filter-bar input:focus {
  border-color: var(--mh-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}

.mh-filter-bar input::placeholder { color: var(--mh-muted-light); }

.mh-filter-bar select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7385' stroke-width='1.8' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none;
  appearance: none;
}

/* ── Tool actions ───────────────────────── */
.mh-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mh-tool-details { flex: 1; min-width: 180px; }

.mh-tool-details > summary { width: 100%; cursor: pointer; list-style: none; }
.mh-tool-details > summary::-webkit-details-marker { display: none; }

.mh-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1.5px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface);
  color: var(--mh-text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--mh-shadow-sm);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  white-space: nowrap;
}

.mh-action-btn.primary {
  border-color: var(--mh-blue); background: var(--mh-blue); color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.18);
}

.mh-action-btn.primary:hover { background: var(--mh-blue-dark); border-color: var(--mh-blue-dark); }
.mh-action-btn.secondary { background: var(--mh-surface-soft); color: var(--mh-muted); }
.mh-action-btn:hover { border-color: var(--mh-blue); box-shadow: 0 4px 16px rgba(37,99,235,.1); }
.mh-action-btn.wide { width: 100%; }

.mh-tool-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 16px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface-soft);
}

.mh-tool-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; }

.mh-tool-form input,
.mh-tool-form select {
  min-height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.mh-tool-form input:focus,
.mh-tool-form select:focus {
  border-color: var(--mh-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.mh-form-note { margin: 0; font-size: 11px; color: var(--mh-muted); }
.mh-tool-inline { display: flex; align-items: stretch; }

/* ── Compact Hot SKU panel ──────────────── */
.mh-hot-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mh-hot-slot {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface-soft);
}

.mh-hot-slot-head { display: flex; align-items: center; justify-content: space-between; }
.mh-hot-slot-head strong { font-size: 13px; font-weight: 800; }

.mh-hot-move { display: flex; gap: 3px; }

.mh-hot-move button {
  width: 28px; height: 28px;
  border: 1px solid var(--mh-border);
  border-radius: 6px;
  background: var(--mh-surface);
  font-size: 13px;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--mh-muted);
}

.mh-hot-move button:hover:not(:disabled) { border-color: var(--mh-blue); color: var(--mh-blue); }
.mh-hot-move button:disabled { opacity: .35; cursor: not-allowed; }

.mh-hot-preview {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
}

.mh-hot-img {
  aspect-ratio: 1/1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0ede6;
  display: grid; place-items: center;
}

.mh-hot-img img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.mh-hot-info h3 { margin: 0; font-size: 13px; font-weight: 700; }
.mh-hot-info p { margin: 2px 0 0; font-size: 12px; color: var(--mh-muted); }
.mh-hot-sku { font-size: 11px; color: var(--mh-muted-light); }

.mh-hot-select-label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; }

.mh-hot-select-label select {
  min-height: 34px;
  padding: 0 10px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.mh-hot-save {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

/* ═══════════════════════════════════════════
   SKU Cards v3 — 3 columns, compact
   ═══════════════════════════════════════════ */

.mh-qs2-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.mh-qs2-card {
  border: 1px solid rgba(230,226,217,.6);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
  overflow: hidden;
  display: grid;
}

/* ── Card top: image + info ─────────────── */
.mh-qs2-top {
  display: grid;
  grid-template-columns: 150px 1fr;
}

.mh-qs2-img {
  width: 100%;
  aspect-ratio: 1/1;
  border: 0; padding: 0;
  cursor: pointer;
  background: #f0ede6;
  display: grid; place-items: center;
  overflow: hidden;
  -webkit-appearance: none; appearance: none;
}

.mh-qs2-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 8px;
}

/* ── Info ───────────────────────────────── */
.mh-qs2-info {
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.mh-qs2-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.mh-qs2-sku {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--mh-muted-light);
}

/* ── Stats ──────────────────────────────── */
.mh-qs2-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mh-qs2-stat {
  display: grid; gap: 1px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--mh-surface-soft);
  text-align: center;
}

.mh-qs2-stat span { font-size: 11px; font-weight: 600; color: var(--mh-muted); }

.mh-qs2-stat strong {
  font-size: 18px; font-weight: 800;
  line-height: 1; color: var(--mh-text);
}

.mh-qs2-stat-stock { background: var(--mh-green-light); }
.mh-qs2-stat-stock strong { color: var(--mh-green); }

/* ── Tags ───────────────────────────────── */
.mh-qs2-tags {
  display: flex; flex-wrap: wrap;
  gap: 4px; align-items: center;
}

.mh-qs2-badge {
  display: inline-flex; align-items: center;
  min-height: 20px; padding: 0 8px;
  border-radius: 5px;
  font-size: 11px; font-weight: 700;
}

.badge-ok { background: var(--mh-green-light); color: var(--mh-green); }
.badge-warn { background: var(--mh-amber-light); color: var(--mh-amber); }
.badge-danger { background: #fef2f2; color: #dc2626; }

.mh-qs2-tag {
  padding: 1px 8px;
  border-radius: 5px;
  background: var(--mh-surface-cool);
  font-size: 11px; color: var(--mh-muted);
}

/* ── Dates ──────────────────────────────── */
.mh-qs2-dates {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  font-size: 11px; color: var(--mh-muted);
}

.mh-qs2-dates b { font-weight: 700; }

/* ═══════════════════════════════════════════
   Actions v3 — compact 3-column
   ═══════════════════════════════════════════ */

.mh-qs2-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--mh-border);
}

.mh-qs2-act {
  display: grid; gap: 5px;
  padding: 10px 10px 12px;
  background: var(--mh-surface-soft);
}

.mh-qs2-act + .mh-qs2-act { border-left: 1px solid var(--mh-border); }

.mh-qs2-act-label {
  font-size: 11px; font-weight: 700;
  color: var(--mh-muted);
}

.mh-qs2-act-row {
  display: flex; gap: 6px; align-items: center;
}

.mh-qs2-act input {
  width: 52px;
  min-height: 32px;
  padding: 0 6px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit; font-size: 14px;
  text-align: center; outline: none;
  flex-shrink: 0;
}

.mh-qs2-act input:focus {
  border-color: var(--mh-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.mh-qs2-act button {
  flex: 1; min-height: 32px;
  padding: 0 10px; border: 0;
  border-radius: 8px;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}

.mh-qs2-in button { background: var(--mh-blue); color: #fff; }
.mh-qs2-in button:hover { background: var(--mh-blue-dark); }
.mh-qs2-out button { background: #dc2626; color: #fff; }
.mh-qs2-out button:hover { background: #b91c1c; }
.mh-qs2-adj button {
  background: var(--mh-surface-cool);
  color: var(--mh-blue-dark);
  border: 1.5px solid var(--mh-blue);
}
.mh-qs2-adj button:hover { background: var(--mh-blue); color: #fff; }

/* ═══════════════════════════════════════════
   Settings v3 — compact
   ═══════════════════════════════════════════ */

.mh-qs2-settings {
  display: flex; flex-wrap: wrap;
  gap: 8px; align-items: end;
  padding: 10px 12px;
  background: var(--mh-surface);
  border-top: 1px solid var(--mh-border);
}

.mh-qs2-settings label {
  display: flex; align-items: center;
  gap: 4px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}

.mh-qs2-settings select,
.mh-qs2-settings input {
  min-height: 30px;
  padding: 0 6px;
  border: 1.5px solid var(--mh-border);
  border-radius: 6px;
  background: #fff;
  font: inherit; font-size: 12px;
  outline: none;
}

.mh-qs2-settings select { width: 60px; }
.mh-qs2-settings input { width: 52px; }

.mh-qs2-settings button {
  min-height: 30px;
  padding: 0 12px;
  border: 1.5px solid var(--mh-blue);
  border-radius: 6px;
  background: var(--mh-blue);
  color: #fff;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  margin-left: auto;
}

.mh-qs2-settings button:hover { background: var(--mh-blue-dark); }

/* ── Card modifiers ─────────────────────── */
.is-archived { opacity: .55; }
.is-out { border-color: rgba(220,38,38,.25); }
.is-emergency { border-color: rgba(196,127,22,.25); }
.is-low { border-color: rgba(196,127,22,.15); }

/* ── Empty ──────────────────────────────── */
.mh-empty {
  text-align: center; padding: 60px 20px;
  grid-column: 1 / -1;
  color: var(--mh-muted-light);
  font-size: 16px; font-weight: 600;
}

/* ═══════════════════════════════════════════
   Responsive — Quick Stock v3
   ═══════════════════════════════════════════ */

@media (max-width: 1300px) {
  .mh-qs2-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .mh-hero-compact {
  padding: 28px 0 18px; grid-template-columns: 1fr; gap: 12px; }
  .mh-filter-bar { grid-template-columns: 1fr; }
  .mh-tool-actions { flex-direction: column; }
  .mh-hot-form { grid-template-columns: 1fr; }
  .mh-qs2-grid { grid-template-columns: 1fr; }
  .mh-qs2-top { grid-template-columns: 1fr; }
  .mh-qs2-img { aspect-ratio: 2/1; max-height: 200px; }
}

@media (max-width: 600px) {
  .mh-shell-wide { width: min(100% - 24px, 1340px); }
  .mh-hero-compact {
  padding: 28px 0 18px; padding: 16px 0 10px; }
  .mh-section { padding: 14px 14px 18px; }
  .mh-qs2-actions { grid-template-columns: 1fr; }
  .mh-qs2-act + .mh-qs2-act { border-left: 0; border-top: 1px solid var(--mh-border); }
  .mh-qs2-stats { grid-template-columns: repeat(3, 1fr); }
  .mh-qs2-settings { flex-direction: column; align-items: stretch; }
  .mh-qs2-settings button { margin-left: 0; width: 100%; }
  .mh-hot-preview { grid-template-columns: 48px 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   Purchase Center Page
   ══════════════════════════════════════════════════════════════ */

/* ── 4-column metrics ───────────────────── */
.mh-metrics-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Notice bar ─────────────────────────── */
.mh-notice {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 16px;
  padding: 14px 20px;
  border: 1px solid rgba(37,99,235,.15);
  border-radius: var(--mh-radius);
  background: var(--mh-blue-light);
  font-size: 14px;
  line-height: 1.6;
}

.mh-notice strong { flex-shrink: 0; font-size: 14px; color: var(--mh-blue-dark); }
.mh-notice span { color: var(--mh-muted); }

/* ── Filter tabs ────────────────────────── */
.mh-pc-filter {
  display: flex; gap: 0;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  overflow: hidden;
  width: fit-content;
}

.mh-pc-tab {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 120px; min-height: 38px; padding: 0 20px;
  font-size: 14px; font-weight: 700;
  color: var(--mh-muted);
  background: var(--mh-surface);
  border-right: 1px solid var(--mh-border);
  transition: background .15s, color .15s;
}

.mh-pc-tab:last-child { border-right: 0; }

.mh-pc-tab.active {
  background: var(--mh-blue);
  color: #fff;
}

.mh-pc-tab:hover:not(.active) {
  background: var(--mh-surface-soft);
}

/* ── Upload form ────────────────────────── */
.mh-pc-upload {
  display: grid; gap: 16px;
  padding: 24px;
  border: 2px dashed var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface-soft);
  transition: border-color .15s;
}

.mh-pc-upload:hover { border-color: var(--mh-blue); }

.mh-pc-upload-body {
  display: flex; align-items: center; gap: 14px;
}

.mh-pc-upload-icon {
  font-size: 36px; line-height: 1;
  user-select: none;
}

.mh-pc-upload-body strong {
  font-size: 15px; font-weight: 700;
}

.mh-pc-upload-body p {
  margin: 4px 0 0;
  font-size: 13px; color: var(--mh-muted);
}

.mh-pc-upload-actions {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}

.mh-pc-upload-actions input[type="file"] {
  flex: 1; min-width: 200px;
  font-size: 14px;
}

.mh-pc-upload-actions .mh-action-btn {
  flex-shrink: 0;
}

/* ── Purchase items ─────────────────────── */
.mh-pc-list {
  display: grid; gap: 12px;
}

.mh-pc-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px; align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
}

.mh-pc-item-info strong {
  display: block; margin-bottom: 4px;
  font-size: 15px; font-weight: 700;
}

.mh-pc-item-spec {
  margin: 0 0 6px;
  font-size: 12px; color: var(--mh-muted-light);
}

.mh-pc-item-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12px; color: var(--mh-muted);
}

.mh-pc-item-meta b { font-weight: 700; color: var(--mh-text); }

/* ── Item actions ───────────────────────── */
.mh-pc-item-actions {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.mh-pc-map {
  display: flex; align-items: center; gap: 8px;
}

.mh-pc-map span {
  font-size: 12px; font-weight: 600; color: var(--mh-muted);
  white-space: nowrap;
}

.mh-pc-map select {
  min-height: 36px; min-width: 160px;
  padding: 0 12px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit; font-size: 13px;
  outline: none;
  cursor: pointer;
}

.mh-pc-map select:focus { border-color: var(--mh-blue); }

.mh-pc-map button,
.mh-pc-ignore button {
  min-height: 36px; padding: 0 16px;
  border: 0; border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}

.mh-pc-map button {
  background: var(--mh-blue); color: #fff;
}

.mh-pc-map button:hover { background: var(--mh-blue-dark); }

.mh-pc-ignore button {
  background: var(--mh-surface-soft);
  color: var(--mh-muted);
  border: 1px solid var(--mh-border);
}

.mh-pc-ignore button:hover {
  background: #fef2f2; color: #dc2626; border-color: #fecaca;
}

/* ── State badges ───────────────────────── */
.mh-pc-state {
  display: inline-flex; align-items: center;
  min-height: 26px; padding: 0 12px;
  border-radius: 7px;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.state-ok { background: var(--mh-green-light); color: var(--mh-green); }
.state-warn { background: var(--mh-amber-light); color: var(--mh-amber); }
.state-neutral { background: var(--mh-surface-cool); color: var(--mh-muted); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .mh-metrics-4 { grid-template-columns: repeat(2, 1fr); }

  .mh-pc-item {
    grid-template-columns: 1fr;
  }

  .mh-pc-item-actions {
    flex-direction: column; align-items: stretch; gap: 8px;
  }

  .mh-pc-map {
    flex-wrap: wrap;
  }

  .mh-pc-map select { flex: 1; min-width: 120px; }

  .mh-notice { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 540px) {
  .mh-metrics-4 { grid-template-columns: 1fr; }
  .mh-pc-upload-actions { flex-direction: column; }
  .mh-pc-upload-actions .mh-action-btn { width: 100%; }
  .mh-pc-filter { width: 100%; }
  .mh-pc-tab { flex: 1; }
}

/* ══════════════════════════════════════════════════════════════
   Mapping Center Page
   ══════════════════════════════════════════════════════════════ */

/* ── Section head wrap ──────────────────── */
.mh-section-head-wrap { flex-wrap: wrap; }

/* ── Batch bar ──────────────────────────── */
.mh-batch-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
}

.mh-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.mh-checkbox input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--mh-blue); }

.mh-batch-btns {
  display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto;
}

/* ── Danger button variant ──────────────── */
.mh-action-btn.mh-btn-danger {
  background: #fef2f2; color: #dc2626;
  border-color: rgba(220,38,38,.25);
}

.mh-action-btn.mh-btn-danger:hover {
  background: #dc2626; color: #fff; border-color: #dc2626;
}

/* ── Mapping items ──────────────────────── */
.mh-mc-list {
  display: grid; gap: 10px;
}

.mh-mc-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px; align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
}

.mh-mc-check {
  display: grid; place-items: center;
}

.mh-mc-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--mh-blue); }

.mh-mc-info strong {
  display: block; margin-bottom: 2px;
  font-size: 14px; font-weight: 700;
}

.mh-mc-spec {
  margin: 0 0 4px; font-size: 12px; color: var(--mh-muted-light);
}

.mh-mc-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 11px; color: var(--mh-muted);
}

.mh-mc-meta b { font-weight: 700; color: var(--mh-text); }

/* ── Map select area ────────────────────── */
.mh-mc-map {
  display: grid; gap: 6px;
}

.mh-mc-map span {
  font-size: 11px; font-weight: 700; color: var(--mh-muted);
}

.mh-mc-map select {
  min-height: 34px; min-width: 180px;
  padding: 0 10px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit; font-size: 12px;
  outline: none; cursor: pointer;
}

.mh-mc-map select:focus { border-color: var(--mh-blue); }

.mh-mc-score {
  font-size: 11px; font-weight: 700; color: var(--mh-green);
}

/* ── Item action buttons ────────────────── */
.mh-mc-actions {
  display: flex; flex-direction: column; gap: 5px;
}

.mh-mc-actions button {
  min-height: 30px; padding: 0 14px;
  border: 0; border-radius: 6px;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}

.mh-mc-actions button:first-child {
  background: var(--mh-surface-cool); color: var(--mh-muted);
  border: 1px solid var(--mh-border);
}

.mh-mc-actions button:first-child:hover {
  background: var(--mh-blue-light); color: var(--mh-blue-dark);
}

.mh-mc-btn-primary {
  background: var(--mh-blue) !important; color: #fff !important;
}

.mh-mc-btn-primary:hover { background: var(--mh-blue-dark) !important; }

.mh-mc-btn-ignore {
  background: transparent !important; color: var(--mh-muted) !important;
}

.mh-mc-btn-ignore:hover { background: #fef2f2 !important; color: #dc2626 !important; }

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .mh-mc-item {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .mh-mc-map { grid-column: 1 / -1; }
  .mh-mc-actions {
    grid-column: 1 / -1;
    flex-direction: row; flex-wrap: wrap;
  }

  .mh-batch-bar { flex-direction: column; align-items: stretch; }
  .mh-batch-btns { margin-left: 0; }
}

@media (max-width: 540px) {
  .mh-mc-item { grid-template-columns: 1fr; }
  .mh-mc-check { display: none; }
  .mh-mc-map select { width: 100%; }
  .mh-batch-btns { flex-direction: column; }
  .mh-batch-btns .mh-action-btn { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   Statistics Page (sales + purchase)
   ══════════════════════════════════════════════════════════════ */

/* ── 3-column metrics ───────────────────── */
.mh-metrics-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Active outline button ──────────────── */
.mh-btn-outline.active {
  background: var(--mh-blue-light); color: var(--mh-blue-dark); border-color: rgba(0, 113, 227, .22);
}

/* ── Rankings ───────────────────────────── */
.mh-st-rankings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mh-st-rank-card {
  padding: 20px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  background: var(--mh-surface);
  box-shadow: var(--mh-shadow-sm);
}

.mh-st-rank-card h3 {
  margin: 0 0 14px;
  font-size: 16px; font-weight: 800;
}

.mh-st-rank-list {
  margin: 0; padding: 0;
  list-style: none;
  display: grid; gap: 8px;
}

.mh-st-rank-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--mh-surface-soft);
}

.mh-st-rank-list li:nth-child(-n+3) {
  background: var(--mh-surface-soft);
}

.mh-st-rank-pos {
  font-size: 11px; font-weight: 800; color: var(--mh-muted);
  min-width: 42px; flex-shrink: 0;
}

.mh-st-rank-name {
  font-size: 13px; font-weight: 600;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mh-st-rank-qty {
  font-size: 18px; font-weight: 800;
  color: var(--mh-green);
  flex-shrink: 0; text-align: right; min-width: 36px;
}

/* ── Small empty ────────────────────────── */
.mh-empty-sm {
  padding: 24px 12px;
  font-size: 13px;
}

/* ── Hero back multi-button ─────────────── */
.mh-hero-back { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
  .mh-st-rankings { grid-template-columns: 1fr; }
  .mh-metrics-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
  .mh-metrics-3 { grid-template-columns: 1fr; }
  .mh-hero-back { flex-direction: column; align-items: stretch; }
  .mh-hero-back .mh-btn-outline { width: 100%; text-align: center; }
}

/* ══════════════════════════════════════════════════════════════
   Capture Center Page
   ══════════════════════════════════════════════════════════════ */

/* ── Badge ──────────────────────────────── */
.mh-cap-badge {
  display: inline-flex; align-items: center;
  min-height: 28px; padding: 0 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}

.cap-idle   { background: var(--mh-surface-cool); color: var(--mh-muted); }
.cap-running{ background: var(--mh-blue-light);  color: var(--mh-blue); }
.cap-ok     { background: var(--mh-green-light); color: var(--mh-green); }
.cap-err    { background: #fef2f2;               color: #dc2626; }

/* ── Date range ─────────────────────────── */
.mh-cap-range {
  display: flex; flex-wrap: wrap; align-items: end; gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
}

.mh-cap-range label {
  display: grid; gap: 4px;
  font-size: 12px; font-weight: 700;
}

.mh-cap-range select,
.mh-cap-range input {
  min-height: 34px; padding: 0 10px;
  border: 1.5px solid var(--mh-border);
  border-radius: 8px;
  background: #fff;
  font: inherit; font-size: 13px;
  outline: none;
}

.mh-cap-range select { min-width: 120px; }
.mh-cap-range input[type="date"] { min-width: 140px; }

/* ── Action buttons ─────────────────────── */
.mh-cap-btns {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}

/* ── Note ───────────────────────────────── */
.mh-cap-note {
  margin: 0 0 14px;
  font-size: 12px; color: var(--mh-muted);
  line-height: 1.6;
}

/* ── Status area ────────────────────────── */
.mh-cap-status {
  padding: 16px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
}

.mh-cap-status strong {
  display: block; margin-bottom: 6px;
  font-size: 14px;
}

.mh-cap-status p {
  margin: 0 0 10px; font-size: 13px; color: var(--mh-muted);
}

.mh-cap-debug {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.mh-cap-files { font-size: 12px; color: var(--mh-muted); }

.mh-cap-logs {
  margin: 8px 0 0; padding: 12px;
  border-radius: 8px;
  background: #1f2933;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ── Summary grid ───────────────────────── */
.mh-cap-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.mh-cap-stat {
  display: grid; gap: 4px;
  padding: 16px;
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-sm);
  background: var(--mh-surface-soft);
  text-align: center;
}

.mh-cap-stat span {
  font-size: 12px; font-weight: 600; color: var(--mh-muted);
}

.mh-cap-stat strong {
  font-size: 28px; font-weight: 800; line-height: 1;
  color: var(--mh-text);
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 600px) {
  .mh-cap-btns { flex-direction: column; }
  .mh-cap-btns .mh-action-btn { width: 100%; }
  .mh-cap-debug { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════
   Inventory Focus — Apple-like visual convergence
   Presentation only; no workflow or data changes
   ═══════════════════════════════════════════ */
.mh-preview .mh-hero-compact {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 64px 0 38px;
}

.mh-preview .mh-hero-compact .mh-hero-subtitle {
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 750;
  letter-spacing: -.045em;
}

.mh-preview .mh-hero-compact .mh-hero-desc {
  max-width: 620px;
  color: #86868b;
  font-size: 15px;
}

.mh-preview .mh-section {
  margin: 30px 0;
  padding: 36px;
  border-color: transparent;
  border-radius: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .045);
}

.mh-preview .mh-section-head h2 {
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 740;
  letter-spacing: -.035em;
}

.mh-preview .mh-tool-actions {
  justify-content: center;
  gap: 14px;
}

.mh-preview .mh-qs2-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.mh-preview .mh-qs2-card {
  border-color: transparent;
  border-radius: 22px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .055);
}

.mh-preview .mh-qs2-top {
  grid-template-columns: 168px 1fr;
}

.mh-preview .mh-qs2-info {
  padding: 18px 20px;
  gap: 10px;
}

.mh-preview .mh-qs2-info h3 {
  font-size: 19px;
  letter-spacing: -.02em;
}

.mh-preview .mh-qs2-actions,
.mh-preview .mh-qs2-settings {
  border-color: rgba(0, 0, 0, .055);
}

.mh-qs2-delete-form {
  display: flex;
  justify-content: flex-end;
  padding: 0 14px 14px;
  background: var(--mh-surface);
}

.mh-qs2-delete-form button {
  padding: 7px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d70015;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.mh-qs2-delete-form button:hover {
  background: rgba(215, 0, 21, .07);
}

@media (max-width: 980px) {
  .mh-preview .mh-qs2-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .mh-preview .mh-hero-compact {
    grid-template-columns: 1fr;
    padding-top: 36px;
  }
  .mh-preview .mh-section { padding: 24px 18px; }
  .mh-preview .mh-qs2-top { grid-template-columns: 118px 1fr; }
}

/* ═══════════════════════════════════════════
   Apple Enterprise Minimal · Scheme A
   Visual-only convergence; structure and behavior stay unchanged
   ═══════════════════════════════════════════ */
:root {
  --mh-bg: #f7f7f8;
  --mh-surface-soft: #fafafa;
  --mh-border: rgba(0, 0, 0, .055);
  --mh-muted: #77777c;
  --mh-muted-light: #a1a1a6;
  --mh-shadow-sm: 0 4px 16px rgba(0, 0, 0, .032);
  --mh-shadow: 0 10px 32px rgba(0, 0, 0, .04);
  --mh-shadow-lg: 0 18px 48px rgba(0, 0, 0, .055);
}

body {
  background: var(--mh-bg);
}

.mh-hero h1,
.mh-preview .mh-hero-subtitle {
  color: #1d1d1f;
  font-weight: 780;
  letter-spacing: -.045em;
}

.mh-section-head h2 {
  color: #1d1d1f;
  font-weight: 740;
  letter-spacing: -.032em;
}

.mh-qs2-info h3,
.mh-hot-info h3 {
  color: #242426;
  font-weight: 690;
  letter-spacing: -.018em;
}

.mh-hero-desc,
.mh-section-desc,
.mh-metrics article small,
.mh-qs2-dates,
.mh-qs2-sku,
.mh-hot-sku {
  color: var(--mh-muted-light);
  font-weight: 450;
}

.mh-metrics {
  gap: 22px;
  margin: 34px 0;
}

.mh-metrics article {
  gap: 10px;
  padding: 30px 26px;
  border: .5px solid var(--mh-border);
  border-radius: 20px;
  box-shadow: var(--mh-shadow-sm);
}

.mh-metrics article strong {
  font-size: clamp(46px, 4.5vw, 56px);
  font-weight: 820;
  letter-spacing: -.05em;
}

.mh-preview .mh-section {
  margin: 36px 0;
  padding: 40px;
  border: .5px solid rgba(0, 0, 0, .035);
  box-shadow: var(--mh-shadow);
}

.mh-preview .mh-section-head {
  margin-bottom: 30px;
}

.mh-preview .mh-qs2-grid {
  gap: 28px;
}

.mh-preview .mh-qs2-card,
.mh-hot-slot {
  border: .5px solid rgba(0, 0, 0, .045);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .04);
}

.mh-preview .mh-qs2-info {
  padding: 22px 24px;
  gap: 12px;
}

.mh-preview .mh-qs2-stats {
  gap: 8px;
}

.mh-preview .mh-qs2-stat {
  padding: 10px;
  background: rgba(0, 0, 0, .022);
}

.mh-preview .mh-qs2-stat strong {
  font-size: 22px;
  font-weight: 790;
  letter-spacing: -.025em;
}

.mh-preview .mh-qs2-actions,
.mh-preview .mh-qs2-settings {
  border-color: rgba(0, 0, 0, .04);
}

@media (max-width: 680px) {
  .mh-metrics { gap: 14px; margin: 24px 0; }
  .mh-metrics article { padding: 24px 20px; }
  .mh-metrics article strong { font-size: 42px; }
  .mh-preview .mh-section { margin: 24px 0; padding: 26px 20px; }
  .mh-preview .mh-section-head { margin-bottom: 22px; }
  .mh-preview .mh-qs2-grid { gap: 20px; }
  .mh-preview .mh-qs2-info { padding: 18px; }
}

/* ═══════════════════════════════════════════
   Cloud UI refinement · compact analysis hierarchy
   Presentation only; no route or data behavior changes
   ═══════════════════════════════════════════ */
.mh-preview .mh-hero-compact {
  padding: 30px 0 20px;
}

.mh-preview .mh-hero h1,
.mh-preview .mh-hero-compact .mh-hero-subtitle {
  font-size: clamp(26px, 3.2vw, 30px);
  font-weight: 740;
  line-height: 1.15;
  letter-spacing: -.035em;
}

.mh-preview .mh-hero-desc,
.mh-preview .mh-section-desc {
  color: #929297;
  font-size: 13px;
  line-height: 1.55;
}

.mh-preview .mh-section-head h2 {
  font-size: clamp(20px, 2.2vw, 22px);
  font-weight: 700;
  letter-spacing: -.025em;
}

.mh-preview .mh-st-rank-card h3,
.mh-preview .mh-qs2-info h3,
.mh-preview .mh-hot-info h3 {
  font-size: 20px;
  font-weight: 680;
}

.mh-preview .mh-metrics {
  gap: 14px;
  margin: 20px 0;
}

.mh-preview .mh-metrics article {
  padding: 20px;
  border: .5px solid rgba(0, 0, 0, .04);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .035);
}

.mh-preview .mh-metrics article strong {
  font-size: clamp(36px, 4vw, 44px);
  font-weight: 790;
}

.mh-preview .mh-section {
  margin: 22px 0;
  padding: 24px;
  border: .5px solid rgba(0, 0, 0, .035);
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .035);
}

.mh-preview .mh-section-head {
  margin-bottom: 18px;
}

.mh-preview .mh-st-rankings {
  gap: 14px;
}

.mh-preview .mh-st-rank-card {
  padding: 18px;
  border: .5px solid rgba(0, 0, 0, .04);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .03);
}

.mh-preview .statistics-table th,
.mh-preview .statistics-table td,
.mh-preview .table-wrap th,
.mh-preview .table-wrap td {
  padding: 9px 10px;
  border-bottom-color: rgba(0, 0, 0, .055);
  font-size: 12px;
}

.mh-preview .mh-btn-outline {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(0, 0, 0, .08);
  color: #6e6e73;
  background: rgba(255, 255, 255, .74);
  box-shadow: none;
  font-size: 12px;
  font-weight: 560;
}

body:has(.mh-metrics-3) .mh-hero-back > a:first-child,
body:has(.statistics-table) .mh-hero-back > a:first-child {
  display: none;
}

@media (max-width: 680px) {
  .mh-preview .mh-hero-compact { padding: 22px 0 14px; }
  .mh-preview .mh-section { margin: 16px 0; padding: 20px 16px; }
  .mh-preview .mh-metrics article { padding: 18px 16px; }
  .mh-preview .mh-metrics article strong { font-size: 36px; }
}
