:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #374151;
  --accent: #38bdf8;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --card: #111827;
  --input: #0b1220;
  --shadow: 0 10px 25px rgba(0,0,0,0.25);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, #0b1220 0%, #111827 60%, #0f172a 100%);
  color: var(--text);
  font-family: Inter, Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
header {
  background: rgba(15, 23, 42, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 20px 10px;
}
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.subtle { color: var(--muted); font-size: 12px; }
.subtle.bad-text { color: #fecaca; }
.good-text { color: #bbf7d0; }
.bad-text { color: #fecaca; }
nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
nav button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
nav button.active, nav button:hover { background: #0ea5e9; border-color: #0ea5e9; color: white; }
main { max-width: 1500px; margin: 0 auto; padding: 20px; }
.panel {
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h2, .panel h3 { margin: 0 0 12px; }
.subpanel {
  background: rgba(11, 18, 32, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}
.backup-schedule-panel h3 {
  margin-bottom: 8px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; }
.kpi {
  background: linear-gradient(180deg, #1f2937, #111827);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.kpi .value.good { color: var(--good); }
.kpi .value.bad { color: var(--bad); }
.kpi .value.warn { color: var(--warn); }
.income-tax-rate-form {
  margin-bottom: 16px;
}
.tax-rate-panel form {
  display: flex;
  flex-direction: column;
  height: calc(100% - 34px);
}
.rate-card-note {
  min-height: 42px;
  display: flex;
  align-items: center;
}
.report-income-tax-grid {
  margin: 16px 0;
}
.income-tax-overview {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.income-tax-grid {
  align-items: stretch;
}
.income-tax-card {
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.income-tax-card h2 {
  margin-bottom: 8px;
}
.income-tax-value {
  margin: 4px 0 10px;
  font-size: 26px;
  font-weight: 800;
}
.income-tax-value.good { color: var(--good); }
.income-tax-value.bad { color: var(--bad); }
.income-tax-value.warn { color: var(--warn); }
.income-tax-mini-table {
  margin-top: 6px;
}
.income-tax-mini-table td {
  padding: 5px 0;
  border-bottom-color: rgba(55, 65, 81, 0.65);
}
.income-tax-mini-table td:last-child {
  text-align: right;
  font-weight: 700;
}
.income-tax-card .good,
.income-tax-breakdown .good { color: var(--good); }
.income-tax-card .bad,
.income-tax-breakdown .bad { color: var(--bad); }
.income-tax-card .warn,
.income-tax-breakdown .warn { color: var(--warn); }
.income-tax-breakdown {
  background: rgba(11, 18, 32, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 12px;
}
.income-tax-breakdown h2 {
  margin-bottom: 10px;
}
.income-tax-equation-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.income-tax-equation-grid div {
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 9px 10px;
  min-width: 0;
}
.income-tax-equation-grid span,
.income-tax-equation-grid small {
  display: block;
  color: var(--muted);
}
.income-tax-equation-grid strong {
  display: block;
  font-size: 18px;
  margin: 3px 0;
}
.income-tax-breakdown-table {
  margin-bottom: 8px;
}
.tax-command-center {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
.tax-command-center .panel {
  margin: 0;
}
.tax-command-table table {
  min-width: 760px;
}
.tax-command-table td.amount,
.tax-command-table th.amount {
  text-align: right;
  white-space: nowrap;
  font-weight: 800;
}
.tax-command-table .muted {
  color: var(--muted);
  font-size: 12px;
}
.tax-review-list {
  display: grid;
  gap: 10px;
}
.tax-review-flag {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.48);
}
.tax-review-flag.bad {
  border-color: rgba(239, 68, 68, 0.72);
  background: rgba(127, 29, 29, 0.18);
}
.tax-review-flag.warn {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(120, 53, 15, 0.18);
}
.tax-review-flag.good {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(20, 83, 45, 0.16);
}
.tax-review-flag.info {
  border-color: rgba(56, 189, 248, 0.52);
}
.tax-review-flag-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-weight: 800;
}
.tax-review-action,
.tax-review-meta,
.tax-home-setup .subtle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.tax-home-setup {
  display: grid;
  gap: 10px;
}
.dashboard-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(210px, 0.55fr) minmax(0, 1.55fr);
  gap: 18px;
  margin-bottom: 16px;
}
.metric-group {
  min-width: 0;
}
.metric-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.metric-group-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  flex: 0 0 auto;
}
.metric-group-listings .metric-group-title::before { background: var(--warn); }
.metric-group-profit .metric-group-title::before { background: var(--good); }
.metric-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}
.metric-group-listings .metric-group-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dashboard-metrics .kpi {
  border-radius: 8px;
  min-height: 82px;
  padding: 13px;
}
.dashboard-metrics .kpi .label {
  color: #b6c4d6;
}
.updates-markdown {
  max-height: 720px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: #dbe4f0;
  background: rgba(11,18,32,0.45);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.scanner-layout {
  align-items: start;
}
.scanner-kpis {
  margin-top: 12px;
}
.scanner-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 14px;
}
.scanner-card {
  background: rgba(11, 18, 32, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}
.scanner-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.scanner-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.scanner-ocr-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.08);
}
.scanner-ocr-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.scanner-ocr-details {
  margin: 8px 0;
}
.scanner-ocr-details details {
  margin-top: 6px;
}
.scanner-ocr-details summary {
  cursor: pointer;
  color: #93c5fd;
  font-weight: 700;
}
.scanner-ocr-details pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 8px;
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}
.scanner-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.scanner-images > div {
  min-width: 0;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 8px;
}
.scanner-images .product-img,
.scanner-images .placeholder-img {
  width: 100%;
  max-width: 180px;
  height: 240px;
  object-fit: contain;
  display: block;
  margin: 6px auto;
}
.scanner-item-form textarea {
  min-height: 48px;
}
.scanner-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
  }
  .scanner-batch-wrap {
    max-height: 340px;
  }
  .scanner-review-section {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    background: rgba(15, 23, 42, 0.44);
  }
  .scanner-review-section h3 {
    margin: 0 0 8px;
    font-size: 14px;
  }
  .scanner-link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0;
    font-size: 12px;
  }
  .scanner-variant-guess {
    margin: 6px 0 8px;
  }
  .scanner-candidate-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
  }
  .scanner-candidate {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    padding: 8px;
    background: rgba(11, 18, 32, 0.7);
  }
  .scanner-candidate.selected {
    border-color: rgba(34, 197, 94, 0.85);
    background: rgba(22, 101, 52, 0.18);
  }
  .scanner-candidate-image img,
  .scanner-candidate-image .placeholder-img {
    width: 48px;
    height: 68px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #020617;
  }
  .scanner-candidate-title {
    font-weight: 800;
    line-height: 1.25;
  }
  .scanner-candidate-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
  }
  .scanner-candidate-actions {
    display: flex;
    justify-content: flex-end;
  }
.opening-ocr-panel {
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.opening-ocr-paths,
.opening-ocr-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.opening-ocr-review:empty {
  display: none;
}
.opening-ocr-guide {
  margin-top: 8px;
  line-height: 1.45;
}
.opening-ocr-batch {
  margin-top: 12px;
}
.opening-ocr-groups {
  margin-top: 8px;
  overflow-x: auto;
}
.opening-ocr-groups table {
  min-width: 760px;
  table-layout: fixed;
}
.opening-ocr-groups th,
.opening-ocr-groups td {
  overflow-wrap: normal;
  word-break: normal;
}
.opening-ocr-groups th:nth-child(1),
.opening-ocr-groups td:nth-child(1) { width: auto; }
.opening-ocr-groups th:nth-child(2),
.opening-ocr-groups td:nth-child(2) { width: 92px; white-space: nowrap; }
.opening-ocr-groups th:nth-child(3),
.opening-ocr-groups td:nth-child(3) { width: 52px; white-space: nowrap; }
.opening-ocr-groups th:nth-child(4),
.opening-ocr-groups td:nth-child(4) { width: 92px; white-space: nowrap; }
.opening-ocr-groups th:nth-child(5),
.opening-ocr-groups td:nth-child(5) { width: 92px; }
.opening-ocr-groups th:nth-child(6),
.opening-ocr-groups td:nth-child(6) { width: 156px; }
.opening-ocr-groups td:nth-child(5) .badge,
.opening-ocr-groups td:nth-child(6) button {
  white-space: nowrap;
}
.opening-ocr-group-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.opening-ocr-card-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.opening-ocr-group-scan {
  width: 28px;
  height: 40px;
  object-fit: contain;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 4px;
  background: #020617;
  cursor: zoom-in;
}
.opening-ocr-review-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.opening-ocr-review-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}
.opening-ocr-scan-image img,
.opening-ocr-scan-image .placeholder-img {
  width: 110px;
  height: 154px;
  object-fit: contain;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  background: #020617;
}
.opening-ocr-scan-image .image-preview-target,
.opening-ocr-candidate .image-preview-target {
  cursor: zoom-in;
}
.opening-ocr-repair-actions {
  align-items: center;
}
.opening-ocr-repair-actions .opening-ocr-card-number {
  width: 150px;
  min-width: 130px;
  padding: 6px 8px;
  font-size: 12px;
}
.opening-ocr-scan-image .image-preview-target:focus-visible,
.opening-ocr-candidate .image-preview-target:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
.opening-ocr-candidates {
  margin-top: 8px;
}
.opening-ocr-candidate {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}
.opening-ocr-candidate img {
  width: 40px;
  height: 56px;
  object-fit: contain;
  border-radius: 4px;
}
.opening-tcg-link {
  white-space: nowrap;
  font-weight: 700;
}
.small-text {
  font-size: 12px;
}
.catalog-search-inline {
  margin-top: 10px;
  grid-column: 1 / -1;
}
.logs-table-wrap table {
  min-width: 850px;
}
.sources-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.settings-column {
  min-width: 0;
}
.settings-column .panel {
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: top; }
th { color: #cbd5e1; background: #1f2937; }
tr:hover td { background: rgba(56, 189, 248, 0.05); }
.table-wrap { overflow: auto; max-height: 630px; border: 1px solid var(--line); border-radius: 12px; }
input, select, textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
}
.input-like {
  display: flex;
  min-height: 39px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
}
textarea { min-height: 78px; resize: vertical; }
label { display: block; color: #cbd5e1; font-size: 12px; margin: 8px 0 4px; }
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 1px solid rgba(186, 230, 253, 0.72);
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.12);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  outline: none;
}
.info-tip::before,
.info-tip::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 10000;
}
.info-tip::before {
  content: "";
  top: calc(100% + 3px);
  border: 5px solid transparent;
  border-bottom-color: #020617;
}
.info-tip::after {
  content: attr(data-tip);
  top: calc(100% + 12px);
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020617;
  box-shadow: 0 12px 28px rgba(0,0,0,0.42);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}
.info-tip:hover::before,
.info-tip:hover::after,
.info-tip:focus::before,
.info-tip:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.info-tip:focus-visible {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}
.form-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.form-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.wizard-step-pill {
  background: rgba(15, 23, 42, 0.82);
  border-color: var(--line);
  color: var(--muted);
  justify-content: center;
}
.wizard-step-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.wizard-step-pill.complete {
  color: #bbf7d0;
  border-color: #166534;
}
.wizard-step {
  display: grid;
  gap: 12px;
}
.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.intake-review-box {
  margin-top: 8px;
}
.wizard-defaults {
  display: grid;
  gap: 10px;
}
.wizard-defaults > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.48);
}
.wizard-defaults strong,
.wizard-defaults span {
  display: block;
}
.wizard-defaults span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}
button, .button {
  background: #2563eb;
  color: white;
  border: 1px solid #2563eb;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button.secondary, .button.secondary { background: transparent; border-color: var(--line); color: var(--text); }
button.good { background: #16a34a; border-color: #16a34a; }
button.warn { background: #d97706; border-color: #d97706; }
button.danger-outline {
  background: rgba(220, 38, 38, 0.12);
  border-color: #dc2626;
  color: #fecaca;
}
button.bad { background: #dc2626; border-color: #dc2626; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); color: #cbd5e1; }
.badge.good { color: #bbf7d0; border-color: #166534; background: rgba(34,197,94,0.12); }
.badge.bad { color: #fecaca; border-color: #7f1d1d; background: rgba(239,68,68,0.12); }
.badge.warn { color: #fde68a; border-color: #92400e; background: rgba(245,158,11,0.12); }
.badge.info { color: #bae6fd; border-color: #075985; background: rgba(14,165,233,0.12); }
.button-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
}
.button-badge.warn {
  color: #fffbeb;
  border: 1px solid #f59e0b;
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}
.owner-user-row td { background: rgba(14,165,233,0.06); }
.owner-user-row input:disabled, .owner-user-row select:disabled { opacity: 0.85; }
.notice { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(31, 41, 55, 0.7); color: #cbd5e1; }
.notice.good { border-color: #166534; color: #bbf7d0; }
.notice.bad { border-color: #7f1d1d; color: #fecaca; }
.notice.warn { border-color: #92400e; color: #fde68a; }
.price-refresh-live {
  display: grid;
  gap: 10px;
}
.price-refresh-progress {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.52);
}
.price-refresh-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  transition: width 180ms ease;
}
.price-refresh-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.price-refresh-metrics > div {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.45);
  padding: 9px 10px;
}
.price-refresh-metrics .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}
.price-refresh-metrics strong {
  display: block;
  overflow-wrap: anywhere;
}
.price-refresh-live-table {
  max-height: 320px;
}
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 260px;
  max-width: 520px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #111827;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
}
#toast.show { display: block; }
#toast.good { border-color: #166534; }
#toast.bad { border-color: #7f1d1d; }
.product-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid var(--line);
}
.placeholder-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
}
.product-image-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0 2px;
}
.product-image-actions .actions { margin-top: 0; }
.inline-save {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 180px;
}
.product-activity-wrap table,
.singles-table,
.shipping-table,
.listing-board-table,
.facebook-orders-table {
  min-width: 980px;
}
.shipping-table th:nth-child(6), .shipping-table td:nth-child(6) { min-width: 112px; }
.shipping-table .badge { white-space: nowrap; }
.chart { width: 100%; height: 220px; background: #0b1220; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
svg { overflow: visible; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.right { text-align: right; }
.hidden { display: none !important; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
@media (max-width: 1100px) {
  .dashboard-metrics { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .grid.two, .grid.three, .grid.four, .form-row, .form-row.two, .form-row.three, .wizard-stepper { grid-template-columns: 1fr; }
  th { position: static; }
}
@media (max-width: 650px) {
  main { padding: 12px; }
  .header-inner { padding: 12px; }
  .metric-group-grid { grid-template-columns: 1fr; }
  .metric-group-listings .metric-group-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
}


/* Responsive table/layout hardening. Prevents sticky header width drift and fixes Chrome/Edge
   cases where opening DevTools triggers a reflow that otherwise makes headers line up. */
.panel, .grid > *, .form-row > *, main, header, nav { min-width: 0; }
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  width: 100%;
  min-width: 980px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}
.table-wrap.compact-table table { min-width: 760px; }
.table-wrap th {
  position: static;
}
th, td { overflow-wrap: anywhere; }
td .small, th .small, .mono { word-break: break-word; }
pre { max-width: 100%; overflow: auto; white-space: pre-wrap; }
input, select, textarea { max-width: 100%; min-width: 0; }
button.small, .button.small { padding: 5px 8px; border-radius: 8px; font-size: 12px; }
.table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.table-sort-button:hover,
.table-sort-button.active {
  color: #7dd3fc;
}
.sort-indicator {
  min-width: 10px;
  color: #38bdf8;
  font-size: 11px;
  line-height: 1;
}
.inventory-table { min-width: 2680px; }
.inventory-table th:nth-child(3), .inventory-table td:nth-child(3) { min-width: 220px; }
.inventory-table th:last-child, .inventory-table td:last-child { min-width: 190px; }
.sales-table th:nth-child(3), .sales-table td:nth-child(3) { min-width: 240px; }
.form-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.form-row.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.image-link { display: inline-flex; text-decoration: none; border-radius: 8px; }
.clickable-img { cursor: pointer; }
.image-preview-popover {
  position: fixed;
  z-index: 81000;
  width: min(360px, calc(100vw - 24px));
  max-height: min(500px, calc(100vh - 24px));
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.96);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.48);
  pointer-events: none;
}
.image-preview-popover.pinned {
  z-index: 82000;
  width: min(520px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - 24px));
  pointer-events: auto;
  cursor: zoom-out;
}
.image-preview-popover img {
  display: block;
  width: 100%;
  max-height: calc(min(500px, 100vh - 24px) - 20px);
  object-fit: contain;
  border-radius: 8px;
  background: #0b1220;
}
.image-preview-popover.pinned img {
  max-height: calc(min(720px, 100vh - 24px) - 20px);
}
.opening-ocr-scan-image .image-preview-target,
.opening-ocr-candidate .image-preview-target {
  cursor: zoom-in;
}
.inventory-set-qty-panel {
  margin-top: 12px;
}
.price-result-table table { min-width: 860px; }
.retailers-table th:nth-child(1), .retailers-table td:nth-child(1) { min-width: 160px; }
.retailers-table th:nth-child(5), .retailers-table td:nth-child(5) { min-width: 190px; }
@media (max-width: 1100px) {
  .form-row.five { grid-template-columns: 1fr; }
  .form-row.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* Tax tab reference tables: keep column headers on one line and use horizontal scrolling instead of wrapping. */
.tax-reference-stack {
  display: grid;
  gap: 16px;
}
.tax-reference-panel h2 {
  white-space: nowrap;
}
.tax-ledger-wrap table {
  /* Fill the full reference panel when there is room, but keep a wide minimum
     so narrow screens use the horizontal scrollbar instead of squeezing headers. */
  width: 100%;
  min-width: 1320px;
}
.tax-ledger-wrap th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.tax-ledger-wrap th:nth-child(1), .tax-ledger-wrap td:nth-child(1) { min-width: 92px; }
.tax-ledger-wrap th:nth-child(2), .tax-ledger-wrap td:nth-child(2) { min-width: 112px; }
.tax-ledger-wrap th:nth-child(3), .tax-ledger-wrap td:nth-child(3) { min-width: 150px; }
.tax-ledger-wrap th:nth-child(4), .tax-ledger-wrap td:nth-child(4) { min-width: 430px; max-width: 620px; }
.tax-ledger-wrap th:nth-child(5), .tax-ledger-wrap td:nth-child(5) { min-width: 112px; }
.tax-ledger-wrap th:nth-child(6), .tax-ledger-wrap td:nth-child(6) { min-width: 104px; }
.tax-ledger-wrap th:nth-child(7), .tax-ledger-wrap td:nth-child(7) { min-width: 98px; }
.tax-ledger-wrap th:nth-child(8), .tax-ledger-wrap td:nth-child(8) { min-width: 140px; }
.tax-ledger-wrap td {
  overflow-wrap: normal;
  word-break: normal;
}
.tax-ledger-wrap td:nth-child(4) {
  white-space: normal;
  overflow-wrap: break-word;
}
.tax-readiness-grid {
  align-items: start;
}
.tax-readiness-finding {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.tax-readiness-samples {
  max-height: 240px;
  margin-top: 4px;
}
.tax-readiness-samples table {
  min-width: 780px;
}
.tax-readiness-fees table {
  min-width: 1180px;
}

.federal-tax-reference {
  margin-top: 18px;
}
.tax-standard-deductions {
  display: grid;
  gap: 4px;
  margin: 10px 0;
}
.federal-bracket-wrap {
  max-height: 320px;
}
.federal-bracket-table {
  min-width: 780px;
}
.federal-bracket-table th,
.federal-bracket-table td {
  white-space: nowrap;
  overflow-wrap: normal;
}
.federal-bracket-table th:first-child,
.federal-bracket-table td:first-child {
  width: 64px;
  text-align: right;
}
.business-tax-grid {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}
.business-tax-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  padding: 9px 10px;
}
.business-tax-card strong {
  display: block;
  margin-bottom: 3px;
}
.tax-source-box {
  margin-top: 10px;
}
.tax-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.tax-source-links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  text-decoration: none;
  background: rgba(11, 18, 32, 0.4);
}

.receipt-table-wrap { max-height: 420px; }
.receipt-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.receipt-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1220;
}
.receipt-calc-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.receipt-calc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 8px 10px;
}
.receipt-calc-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}
.receipt-calc-card strong {
  display: block;
}
@media (max-width: 900px) {
  .income-tax-equation-grid { grid-template-columns: 1fr; }
  .receipt-calc-grid { grid-template-columns: 1fr; }
}

/* Sales ledger: keep headers readable and let the table use horizontal scrolling instead of squeezing words. */
.sales-table {
  min-width: 2740px;
  table-layout: auto;
}
.sales-table th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.sales-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.sales-table th:nth-child(1), .sales-table td:nth-child(1) { min-width: 42px; text-align: center; }
.sales-table th:nth-child(2), .sales-table td:nth-child(2) { min-width: 92px; }
.sales-table th:nth-child(3), .sales-table td:nth-child(3) { min-width: 118px; }
.sales-table th:nth-child(4), .sales-table td:nth-child(4) { min-width: 108px; }
.sales-table th:nth-child(5), .sales-table td:nth-child(5) { min-width: 120px; }
.sales-table th:nth-child(6), .sales-table td:nth-child(6) { min-width: 410px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(7), .sales-table td:nth-child(7) { min-width: 92px; }
.sales-table th:nth-child(8), .sales-table td:nth-child(8) { min-width: 190px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(9), .sales-table td:nth-child(9) { min-width: 210px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(10), .sales-table td:nth-child(10) { min-width: 112px; }
.sales-table th:nth-child(11), .sales-table td:nth-child(11) { min-width: 150px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(12), .sales-table td:nth-child(12) { min-width: 210px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(13), .sales-table td:nth-child(13) { min-width: 94px; }
.sales-table th:nth-child(14), .sales-table td:nth-child(14) { min-width: 280px; white-space: normal; overflow-wrap: break-word; }
.sales-table th:nth-child(15), .sales-table td:nth-child(15) { min-width: 360px; }
.sale-notes-cell {
  display: grid;
  gap: 6px;
  line-height: 1.35;
  max-width: 42rem;
}
.sale-note-line {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  overflow-wrap: anywhere;
}
.sale-note-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.compact-tcg-id {
  width: 9.5rem;
  min-width: 9.5rem;
}
.combine-shipment-table-wrap table { min-width: 1020px; }

/* Dashboard Recent Sales: keep headers on one line and use side-scroll instead of broken words. */
.recent-sales-table {
  min-width: 1180px;
  table-layout: auto;
}
.recent-sales-table th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.recent-sales-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.recent-sales-table th:nth-child(1), .recent-sales-table td:nth-child(1) { min-width: 100px; }
.recent-sales-table th:nth-child(2), .recent-sales-table td:nth-child(2) { min-width: 120px; }
.recent-sales-table th:nth-child(3), .recent-sales-table td:nth-child(3) { min-width: 640px; white-space: normal; overflow-wrap: break-word; }
.recent-sales-table th:nth-child(4), .recent-sales-table td:nth-child(4) { min-width: 90px; }
.recent-sales-table th:nth-child(5), .recent-sales-table td:nth-child(5) { min-width: 90px; }
.recent-sales-table th:nth-child(6), .recent-sales-table td:nth-child(6) { min-width: 110px; }


/* Mileage Log: keep headers readable and use horizontal scrolling instead of breaking words. */
.mileage-table {
  min-width: 1180px;
  table-layout: auto;
}
.mileage-table th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.mileage-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.mileage-table th:nth-child(1), .mileage-table td:nth-child(1) { min-width: 104px; }
.mileage-table th:nth-child(2), .mileage-table td:nth-child(2) { min-width: 120px; }
.mileage-table th:nth-child(3), .mileage-table td:nth-child(3) { min-width: 170px; }
.mileage-table th:nth-child(4), .mileage-table td:nth-child(4) { min-width: 150px; }
.mileage-table th:nth-child(5), .mileage-table td:nth-child(5) { min-width: 80px; }
.mileage-table th:nth-child(6), .mileage-table td:nth-child(6) { min-width: 80px; }
.mileage-table th:nth-child(7), .mileage-table td:nth-child(7) { min-width: 112px; }
.mileage-table th:nth-child(8), .mileage-table td:nth-child(8) { min-width: 560px; white-space: normal; overflow-wrap: break-word; }
.mileage-table th:nth-child(9), .mileage-table td:nth-child(9) { min-width: 120px; }

/* General table polish: keep headers on one line unless a table opts out. */
.table-wrap th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.table-wrap td {
  overflow-wrap: normal;
  word-break: normal;
}
.alerts-scroll {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(11,18,32,0.35);
}
.login-panel {
  max-width: 760px;
  margin: 48px auto;
}
.saved-notes-list {
  display: grid;
  gap: 12px;
}
.saved-note {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11,18,32,0.32);
}
.saved-note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.saved-note-heading {
  min-width: 0;
}
.saved-note-heading h3 {
  margin: 7px 0 0;
  font-size: 18px;
  line-height: 1.3;
}
.saved-note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.saved-note-actions {
  flex: 0 0 auto;
  margin: 0;
}
.saved-note-body {
  max-width: 105ch;
  padding-top: 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.saved-note-body h4,
.saved-note-body h5,
.saved-note-body h6 {
  margin: 18px 0 7px;
  line-height: 1.35;
  letter-spacing: 0;
}
.saved-note-body h4 { font-size: 17px; }
.saved-note-body h5 { font-size: 15px; }
.saved-note-body h6 { font-size: 14px; }
.saved-note-body p {
  margin: 0 0 9px;
}
.saved-note-body ul,
.saved-note-body ol {
  margin: 5px 0 12px;
  padding-left: 23px;
}
.saved-note-body li {
  margin: 5px 0;
}
.saved-note-body hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.saved-note-body code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(148,163,184,0.13);
}
.info-list {
  margin-top: 8px;
  padding-left: 22px;
}
.info-list li {
  margin: 8px 0;
}
.report-detail-table {
  min-width: 920px;
}
@media (max-width: 900px) {
  .grid.two, .grid.three, .grid.four, .kpi-grid { grid-template-columns: 1fr; }
  .form-row, .form-row.two, .form-row.three, .form-row.four, .form-row.five, .form-row.six { grid-template-columns: 1fr; }
  .saved-note-header { display: block; }
  .saved-note-actions { margin-top: 12px; }
}

/* Giveaway tab */
.spin-box {
  min-height: 140px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at top left, rgba(56,189,248,0.18), transparent 42%), #0b1220;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 32px;
  font-weight: 800;
  color: #e5e7eb;
  letter-spacing: .3px;
}
.spin-box.winner {
  color: #fde68a;
  border-color: #f59e0b;
  box-shadow: 0 0 35px rgba(245,158,11,0.25);
}
.spin-detail {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15,23,42,0.72);
  color: #dbeafe;
  padding: 10px 12px;
  line-height: 1.45;
}
.giveaway-admin-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(460px, .95fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.giveaway-admin-left,
.giveaway-admin-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.giveaway-admin-left > .panel,
.giveaway-admin-left > section.panel,
.giveaway-admin-right > .panel,
.giveaway-admin-right > section.panel {
  margin-bottom: 0;
}
.giveaway-spin-panel .spin-box {
  min-height: 118px;
  font-size: 28px;
}
.giveaway-review-panel .table-wrap {
  max-height: 260px;
}
.giveaway-entries-panel .table-wrap {
  max-height: 630px;
}
.giveaway-review-panel .notice,
.giveaway-entries-panel .notice {
  margin-bottom: 10px;
}
.giveaway-table-wrap table { min-width: 1280px; }
.giveaway-table th { white-space: nowrap; }
.giveaway-table th:nth-child(2), .giveaway-table td:nth-child(2) { min-width: 180px; }
.giveaway-table th:nth-child(5), .giveaway-table td:nth-child(5) { min-width: 260px; white-space: normal; overflow-wrap: break-word; }
.giveaway-table th:nth-child(7), .giveaway-table td:nth-child(7) { min-width: 260px; white-space: normal; overflow-wrap: break-word; }
.giveaway-history-wrap table { min-width: 1000px; }
.giveaway-history-table th:nth-child(5), .giveaway-history-table td:nth-child(5) { min-width: 360px; white-space: normal; overflow-wrap: break-word; }
.giveaway-prize-thumb { max-width: 220px; max-height: 140px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; display: block; }
.giveaway-icon-thumb { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; display: block; background: #0b1220; }
.giveaway-history-thumb { max-width: 120px; max-height: 80px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; margin-top: 6px; }
.inline-check { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.inline-check.no-margin { margin-top: 0; }
.inline-check input { width: auto; }
.duplicate-link { margin: 2px 0; font-size: 12px; }
.giveaway-table-wrap table { min-width: 1600px; }
.giveaway-table th:nth-child(7), .giveaway-table td:nth-child(7) { min-width: 300px; white-space: normal; overflow-wrap: break-word; }
.giveaway-setup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.giveaway-form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15,23,42,0.45);
  padding: 12px;
}
.giveaway-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: #dbeafe;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}
.giveaway-setup-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}
.giveaway-source-row {
  align-items: start;
}
.source-pull-button {
  margin-top: 8px;
  width: max-content;
  max-width: 100%;
}
.source-save-button {
  margin-top: 8px;
  width: max-content;
  max-width: 100%;
}
.facebook-source-panel h2 {
  margin-bottom: 12px;
}
.giveaway-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.giveaway-media-card {
  min-height: 156px;
  border: 1px solid rgba(55,65,81,0.9);
  border-radius: 10px;
  background: rgba(11,18,32,0.55);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.giveaway-media-card .form-row.two {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
}
.giveaway-prize-media-card {
  grid-column: 1 / -1;
}
.prize-upload-row {
  align-items: end;
}
.swap-check {
  align-self: flex-start;
  color: #dbeafe;
}
.giveaway-prize-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}
.giveaway-image-preview {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2,6,23,0.28);
  padding: 9px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
}
.giveaway-preview-label {
  grid-column: 1 / -1;
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 800;
}
.giveaway-image-preview .inline-check {
  margin-top: 0;
}
.giveaway-icon-media-card {
  grid-column: 1 / -1;
  min-height: 142px;
}
.giveaway-icon-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, .45fr);
  gap: 12px;
  align-items: stretch;
  height: 100%;
}
.giveaway-icon-controls {
  display: grid;
  gap: 10px;
}
.giveaway-icon-preview {
  display: flex;
}
.giveaway-icon-preview .giveaway-preview-row,
.giveaway-icon-preview .giveaway-empty-preview {
  width: 100%;
}
.giveaway-setup-form input[type="file"] {
  min-height: 40px;
}
.giveaway-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  margin-top: auto;
}
.giveaway-empty-preview {
  min-height: 96px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(2,6,23,0.28);
  margin-top: auto;
}
.giveaway-preview-row .giveaway-prize-thumb {
  width: 72px;
  height: 96px;
  max-width: 72px;
  max-height: 96px;
  object-fit: cover;
}
.giveaway-preview-row .giveaway-icon-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}
.copy-row textarea {
  min-height: 132px;
}
.giveaway-settings-row {
  margin-top: 10px;
}
.giveaway-form-actions {
  margin-top: 2px;
}
@media (max-width: 900px) {
  .giveaway-media-grid { grid-template-columns: 1fr; }
  .giveaway-media-card .form-row.two { grid-template-columns: 1fr; }
  .giveaway-prize-preview-grid { grid-template-columns: 1fr; }
  .giveaway-icon-layout { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .sources-settings-layout { grid-template-columns: 1fr; }
  .giveaway-admin-layout { grid-template-columns: 1fr; }
  .giveaway-entries-panel .table-wrap { max-height: 630px; }
}

/* Sales Ledger action buttons: prevent vertical word-splitting and give the Actions column room. */
.sales-table { min-width: 2850px; }
.sales-table th:nth-child(14), .sales-table td:nth-child(14),
.sales-table th:last-child, .sales-table td:last-child {
  min-width: 540px;
  width: 540px;
  white-space: normal;
}
.sales-actions-cell {
  min-width: 540px;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
.sales-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 430px;
}
.sales-action-buttons button,
.sales-action-buttons .button {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  flex: 0 0 auto;
}

/* Giveaway table v3: readable linked flags, fixed action width, no split buttons. */
.giveaway-table-wrap table.giveaway-table {
  min-width: 1720px;
  table-layout: auto;
}
.giveaway-table th,
.giveaway-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.giveaway-table th:nth-child(1), .giveaway-table td:nth-child(1) { min-width: 44px; width: 44px; }
.giveaway-table th:nth-child(2), .giveaway-table td:nth-child(2) { min-width: 54px; width: 54px; }
.giveaway-table th:nth-child(3), .giveaway-table td:nth-child(3) { min-width: 180px; }
.giveaway-table th:nth-child(4), .giveaway-table td:nth-child(4) { min-width: 230px; }
.giveaway-table th:nth-child(5), .giveaway-table td:nth-child(5) { min-width: 110px; white-space: nowrap; }
.giveaway-table th:nth-child(6), .giveaway-table td:nth-child(6) { min-width: 310px; white-space: normal; }
.giveaway-table th:nth-child(7), .giveaway-table td:nth-child(7) { min-width: 360px; white-space: normal; }
.giveaway-table th:nth-child(8), .giveaway-table td:nth-child(8) { min-width: 170px; white-space: nowrap; }
.giveaway-table th:nth-child(9), .giveaway-table td:nth-child(9) { min-width: 270px; white-space: normal; }
.giveaway-table th:nth-child(10), .giveaway-table td:nth-child(10) { min-width: 170px; width: 170px; white-space: nowrap; }
.flag-badge {
  margin: 2px 4px 2px 0;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1.25;
  width: auto;
  display: inline-flex;
  white-space: normal;
  text-align: left;
}
.flag-badge:hover,
.duplicate-link:hover {
  filter: brightness(1.15);
  text-decoration: underline;
}
.duplicate-link {
  display: block;
  width: 100%;
  margin: 2px 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: normal;
}
.giveaway-actions-cell,
.giveaway-action-buttons {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.giveaway-action-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}
.giveaway-action-buttons button,
.giveaway-actions-cell button {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  flex: 0 0 auto;
}
.row-flash td {
  animation: th3RowFlash 1.8s ease-in-out;
}
@keyframes th3RowFlash {
  0%, 100% { background: transparent; }
  18%, 70% { background: rgba(245, 158, 11, 0.22); }
}

/* Giveaway v4: add block reason column and prevent action button wrapping/splitting. */
.giveaway-table-wrap table.giveaway-table {
  min-width: 1920px;
  table-layout: auto;
}
.giveaway-table th:nth-child(10), .giveaway-table td:nth-child(10) { min-width: 240px; white-space: normal; }
.giveaway-table th:nth-child(11), .giveaway-table td:nth-child(11) { min-width: 230px; width: 230px; white-space: nowrap; }
.giveaway-actions-cell { min-width: 230px; width: 230px; }
.giveaway-action-buttons { min-width: 210px; flex-wrap: nowrap; }
.giveaway-action-buttons button { min-width: max-content; }
.giveaway-ban-wrap { max-height: 360px; }
.giveaway-attempts-wrap { max-height: 360px; }

/* Giveaway v4 visibility/security fixes */
.giveaway-security-settings { border-color: rgba(245, 158, 11, .7); background: rgba(245, 158, 11, .08); }
.giveaway-actions-cell { min-width: 190px !important; width: 190px !important; white-space: nowrap !important; }
.giveaway-action-buttons { display: flex !important; flex-direction: row !important; gap: 8px; align-items: center; flex-wrap: nowrap; }
.giveaway-action-buttons button { white-space: nowrap !important; min-width: 72px; }
.giveaway-ban-wrap, .giveaway-attempts-wrap { max-height: 260px; overflow: auto; }
.facebook-import-panel textarea { min-height: 190px; }
.entry-breakdown {
  margin-top: 4px;
  line-height: 1.35;
  white-space: nowrap;
}
.tagged-friends-line {
  margin-top: 3px;
  line-height: 1.35;
}
.tagged-friends-line a {
  display: inline;
  word-break: break-word;
}
.giveaway-table-wrap table.giveaway-table { min-width: 2320px; }
.giveaway-table th:nth-child(4), .giveaway-table td:nth-child(4) { min-width: 90px; width: 90px; text-align: right; white-space: nowrap; }
.giveaway-table th:nth-child(10), .giveaway-table td:nth-child(10) { min-width: 220px; white-space: normal; }
.giveaway-table th:nth-child(11), .giveaway-table td:nth-child(11) { min-width: 180px; white-space: nowrap; }
.giveaway-table th:nth-child(12), .giveaway-table td:nth-child(12) { min-width: 240px; white-space: normal; }
.giveaway-table th:nth-child(13), .giveaway-table td:nth-child(13) { min-width: 230px; white-space: normal; }
.giveaway-table th:nth-child(14), .giveaway-table td:nth-child(14) { min-width: 190px; width: 190px; white-space: nowrap; }

/* Compact dropdown header navigation */
nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  overflow: visible;
  padding-bottom: 6px;
}
.nav-group {
  position: relative;
  flex: 0 0 auto;
}
/* Invisible hover bridge so dropdowns don't close when the cursor crosses the small gap. */
.nav-group::after {
  content: "";
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  width: max(100%, 210px);
  height: 12px;
  z-index: 9998;
}
.nav-group:hover::after,
.nav-group:focus-within::after {
  display: block;
}
nav button.nav-trigger,
nav button.nav-link,
nav button.nav-logout {
  white-space: nowrap;
}
.nav-trigger .chevron {
  font-size: 11px;
  opacity: 0.75;
  margin-left: 4px;
}
.nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9999;
  min-width: 210px;
  margin-top: 0;
  padding: 8px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.38);
}
.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: grid;
  gap: 6px;
}
.nav-menu button.nav-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 10px;
  padding: 8px 10px;
  white-space: nowrap;
}
.nav-group.active > .nav-trigger {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: white;
}
.nav-logout {
  margin-left: auto;
  flex: 0 0 auto;
}
@media (max-width: 760px) {
  .title-row { align-items: flex-start; flex-direction: column; }
  nav { flex-wrap: wrap; gap: 6px; }
  nav button {
    padding: 7px 10px;
  }
  h1 { font-size: 18px; }
  .nav-logout { margin-left: 0; }
}


/* Header dropdown update: slightly rounded tabs + no hover gap between trigger and dropdown. */
nav button,
nav button.nav-trigger,
nav button.nav-link,
nav button.nav-logout {
  border-radius: 6px !important;
}
.nav-menu {
  border-radius: 6px !important;
}
.nav-menu button.nav-menu-item {
  border-radius: 4px !important;
}
.nav-menu {
  top: 100% !important;
  margin-top: -1px !important;
  padding: 6px !important;
}
.nav-group::after {
  display: none !important;
  height: 0 !important;
}
.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: grid;
  gap: 4px;
}
.nav-menu button.nav-menu-item {
  border-left: 0;
  border-right: 0;
}
.disabled-link {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}
.view-only-notice { margin-bottom: 16px; }
.users-table-wrap table { min-width: 1100px; }
.users-table th, .users-table td { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.user-actions-cell { min-width: 260px; }
.user-action-buttons { display:flex; gap:6px; align-items:center; flex-wrap:nowrap; white-space:nowrap; }
.giveaway-table-wrap table { min-width: 1700px; }
.giveaway-actions-cell { min-width: 190px; }
.giveaway-action-buttons { display:flex; gap:6px; align-items:center; flex-wrap:nowrap; white-space:nowrap; }
.giveaway-review-wrap { max-height: 360px; overflow: auto; }
.giveaway-review-wrap table { min-width: 1180px; }
.giveaway-review-wrap th:nth-child(4), .giveaway-review-wrap td:nth-child(4) { min-width: 320px; white-space: normal; overflow-wrap: break-word; }
.giveaway-history-table th:last-child, .giveaway-history-table td:last-child { min-width: 140px; white-space: nowrap; }
.archived-row { opacity: .66; }
.square-summary-grid {
  margin: 12px 0;
}
.square-summary-card {
  width: 100%;
  display: block;
  text-align: left;
  min-height: 58px;
}
.square-difference-filter {
  display: grid;
  gap: 6px;
  align-content: start;
}
.square-summary-card:hover,
.square-summary-card.active {
  border-color: #0ea5e9;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.35);
}
.square-summary-card.active,
.square-summary-card.warn.active {
  background: rgba(14, 165, 233, 0.18);
  color: var(--text);
}
.square-summary-card.active .subtle,
.square-summary-card.warn.active .subtle {
  color: #dbeafe;
}
.square-difference-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(14, 165, 233, 0.55);
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.12);
  color: #e0f2fe;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.2;
}
.square-difference-status button {
  flex: 0 0 auto;
}
.square-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.product-page-stack {
  display: grid;
  gap: 16px;
}
.product-search-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto auto 1fr;
  gap: 10px;
  align-items: end;
}
.product-search-toolbar button {
  min-height: 42px;
}
.product-search-toolbar button.secondary {
  grid-column: auto;
}
.product-results {
  margin-top: 12px;
}
.product-write-all {
  display: grid;
  grid-template-columns: 64px auto;
  gap: 6px;
  align-items: center;
  min-width: 130px;
}
.product-write-all input {
  min-width: 0;
  width: 64px;
  padding: 6px 8px;
}
.product-write-all .subtle {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.2;
}
.inline-tcg-id {
  display: grid;
  grid-template-columns: 86px auto;
  gap: 6px;
  align-items: center;
  min-width: 155px;
}
.inline-tcg-id input {
  min-width: 0;
  width: 86px;
  padding: 6px 8px;
}
.inline-tcg-id .subtle {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.2;
}
.product-tcg-saved {
  min-width: 120px;
}
.tcg-inventory-table {
  min-width: 1780px;
}
.compare-inventory-table {
  min-width: 1580px;
}
.tcg-inventory-table th,
.tcg-inventory-table td,
.compare-inventory-table th,
.compare-inventory-table td {
  vertical-align: top;
}
.tcg-inventory-table th:nth-child(10),
.tcg-inventory-table td:nth-child(10) {
  min-width: 118px;
}
.tcg-inventory-table th:nth-child(11),
.tcg-inventory-table td:nth-child(11) {
  min-width: 180px;
}
.tcg-inventory-table th:nth-child(12),
.tcg-inventory-table td:nth-child(12) {
  min-width: 230px;
}
.tcg-inventory-table td:nth-child(10) .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}
.diff-cell {
  border-left: 3px solid transparent;
  font-weight: 700;
}
.diff-cell .diff-value {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}
.diff-cell.diff-mismatch {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.13);
  color: #fecaca;
}
.diff-cell.diff-mismatch .badge {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  color: #fee2e2;
}
.diff-cell.diff-match {
  color: #bbf7d0;
}
.diff-cell.diff-missing {
  color: var(--muted);
}
.tcg-row-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  min-width: 230px;
}
.tcg-row-actions button {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}
.tcg-row-actions button:first-child {
  width: 96px;
}
.tcg-live-item-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.tcg-live-item-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.inline-edit-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}
.inline-edit-stack .compact-input {
  min-width: 0;
  width: 82px;
  padding: 6px 8px;
}
.compare-inventory-table td:nth-child(7) {
  min-width: 150px;
}
.compare-inventory-table td:nth-child(8) {
  min-width: 460px;
}
.compare-write-price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 6px;
  align-items: end;
}
.compare-write-price-grid label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}
.compare-write-price-grid input {
  width: 100%;
  min-width: 0;
}
.platform-profit-line {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.platform-create-action {
  margin-top: 6px;
}
.inventory-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  min-width: 300px;
}
.inventory-action-stack button {
  white-space: nowrap;
}
.compare-write-form {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
}
.compare-write-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.compare-write-result .notice {
  margin: 4px 0 0;
  padding: 8px;
}
.inventory-platform-cell {
  border-left: 3px solid transparent;
  min-width: 118px;
}
.inventory-platform-cell strong {
  display: inline-block;
  min-width: 38px;
}
.inventory-platform-cell.inventory-platform-mismatch {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.13);
  color: #fecaca;
}
.inventory-platform-cell.inventory-platform-match strong {
  color: #bbf7d0;
}
.inventory-platform-cell.inventory-platform-missing {
  color: var(--muted);
}
.square-sales-import-form .notice {
  margin-bottom: 12px;
}
.import-review-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.import-review-indicator .small {
  margin-left: auto;
}
.square-import-result {
  margin-top: 12px;
}
.square-import-details {
  margin: 8px 0 0;
  padding-left: 20px;
}
.square-import-details li {
  margin: 4px 0;
}
.product-results .type-tabs {
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.35);
}
.product-results .type-tab {
  padding: 6px 10px;
}
.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}
.table-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 8px;
}
.table-search input {
  min-height: 40px;
}
.table-search-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.table-search-count {
  padding-bottom: 10px;
  white-space: nowrap;
}
.type-tab {
  border: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.72);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}
.type-tab span {
  color: var(--muted);
  margin-left: 6px;
}
.type-tab.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}
.type-tab.active span {
  color: rgba(255,255,255,.82);
}
.square-page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.square-sync-table table {
  min-width: 1320px;
}
.square-sync-table th:nth-child(7),
.square-sync-table td:nth-child(7) {
  text-align: center;
}
.square-sync-table td:nth-child(7) .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  min-width: 78px;
}
.square-row-actions {
  display: block;
  min-width: 320px;
}
.square-link-actions,
.square-inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.square-link-actions select {
  flex: 1 1 220px;
  min-width: 220px;
}
.square-inventory-actions {
  min-width: 124px;
}
.square-row-actions button {
  white-space: nowrap;
}
.recent-purchases-table {
  min-width: 1780px;
  table-layout: auto;
}
.recent-purchases-table th,
.recent-purchases-table td {
  overflow-wrap: normal;
  word-break: normal;
}
.recent-purchases-table th:nth-child(2),
.recent-purchases-table td:nth-child(2) {
  min-width: 112px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(3),
.recent-purchases-table td:nth-child(3) {
  min-width: 96px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(4),
.recent-purchases-table td:nth-child(4) {
  min-width: 260px;
  white-space: normal;
  overflow-wrap: break-word;
}
.recent-purchases-table th:nth-child(5),
.recent-purchases-table td:nth-child(5),
.recent-purchases-table th:nth-child(6),
.recent-purchases-table td:nth-child(6),
.recent-purchases-table th:nth-child(7),
.recent-purchases-table td:nth-child(7) {
  min-width: 76px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(8),
.recent-purchases-table td:nth-child(8),
.recent-purchases-table th:nth-child(9),
.recent-purchases-table td:nth-child(9),
.recent-purchases-table th:nth-child(10),
.recent-purchases-table td:nth-child(10),
.recent-purchases-table th:nth-child(11),
.recent-purchases-table td:nth-child(11) {
  min-width: 92px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(12),
.recent-purchases-table td:nth-child(12) {
  min-width: 116px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(13),
.recent-purchases-table td:nth-child(13) {
  min-width: 132px;
  white-space: nowrap;
}
.recent-purchases-table th:nth-child(14),
.recent-purchases-table td:nth-child(14) {
  min-width: 420px;
  max-width: 560px;
  white-space: normal;
  overflow-wrap: break-word;
}
.recent-purchases-table th:nth-child(15),
.recent-purchases-table td:nth-child(15) {
  width: 150px;
  min-width: 150px;
  white-space: nowrap;
}
.purchase-receipt-link {
  gap: 6px;
}
.purchase-action-buttons {
  display: grid;
  gap: 6px;
  justify-items: start;
}
.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-heading-row h2 {
  margin: 0;
}
.drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 80000;
  display: grid;
  grid-template-columns: 1fr minmax(420px, 720px);
}
.drawer-shell.hidden {
  display: none;
}
.drawer-shell.drawer-wide {
  grid-template-columns: 1fr minmax(720px, min(82vw, 1320px));
}
.drawer-shell.drawer-opening {
  grid-template-columns: minmax(0, 60vw) minmax(0, 40vw);
}
.drawer-backdrop {
  background: rgba(2, 6, 23, 0.58);
}
.drawer-panel {
  background: #0f172a;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 36px rgba(0,0,0,0.38);
  height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.98);
  border-bottom: 1px solid var(--line);
}
.drawer-header h2 {
  margin: 0;
  font-size: 18px;
}
.drawer-body {
  padding: 16px;
  min-width: 0;
  max-width: 100%;
}
.drawer-body > *,
.drawer-body form,
.drawer-body .form-row,
.drawer-body .form-row > * {
  min-width: 0;
  max-width: 100%;
}
.drawer-panel .info-tip::before,
.drawer-panel .info-tip::after {
  left: 0;
  transform: translateX(0) translateY(-2px);
}
.drawer-panel .info-tip::after {
  width: min(260px, calc(100vw - 48px));
}
.drawer-panel .info-tip:hover::before,
.drawer-panel .info-tip:hover::after,
.drawer-panel .info-tip:focus::before,
.drawer-panel .info-tip:focus::after {
  transform: translateX(0) translateY(0);
}
.product-history-actions { margin-top: 0; }
.product-history-summary { margin: 12px 0; }
.product-ledger-wrap table { min-width: 1280px; }
.product-sale-reconciliation-wrap table { min-width: 1040px; }
.history-notes { max-width: 520px; white-space: pre-wrap; }
body.drawer-open {
  overflow: hidden;
}
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.52);
}
.bulk-count {
  font-weight: 700;
  margin-right: 4px;
}
.product-results-table-wrap table {
  min-width: 1540px;
}
.product-results-table-wrap th:first-child,
.product-results-table-wrap td:first-child {
  width: 42px;
  min-width: 42px;
  text-align: center;
}
.maintenance-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.maintenance-summary-card,
.merge-product-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(11, 18, 32, 0.52);
  border-radius: 8px;
  padding: 12px;
}
.maintenance-summary-card .label {
  color: var(--muted);
  font-size: 12px;
}
.maintenance-summary-card .value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
}
.maintenance-summary-card .value.good { color: var(--good); }
.maintenance-summary-card .value.warn { color: var(--warn); }
.duplicate-group {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.duplicate-group:first-child {
  border-top: 0;
  padding-top: 0;
}
.merge-grid {
  margin: 12px 0;
}
.merge-product-card h3 {
  margin-top: 8px;
}
.maintenance-list ul {
  margin-top: 6px;
  padding-left: 18px;
}
.maintenance-list li {
  margin: 4px 0;
}
.download-file-table {
  min-width: 980px;
}
.download-file-table th:last-child,
.download-file-table td:last-child {
  min-width: 178px;
  width: 178px;
  white-space: nowrap;
}
.download-file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.download-file-button {
  min-width: 76px;
  white-space: nowrap;
}
.tcg-catalog-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.tcg-catalog-card {
  align-items: start;
}
.tcg-catalog-description {
  margin-top: 8px;
}
.prewrap {
  white-space: pre-wrap;
}
.live-write-debug {
  margin-top: 8px;
}
.debug-pre {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  color: #cbd5e1;
}
@media (max-width: 760px) {
  .drawer-shell,
  .drawer-shell.drawer-wide,
  .drawer-shell.drawer-opening {
    grid-template-columns: 1fr;
  }
  .drawer-backdrop {
    display: none;
  }
  .drawer-panel {
    width: 100%;
  }
  .maintenance-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .square-page-heading {
    display: block;
  }
  .product-search-toolbar {
    grid-template-columns: 1fr;
  }
  .product-search-toolbar button.secondary {
    grid-column: auto;
  }
  .product-search-toolbar button {
    width: 100%;
  }
  .table-search {
    grid-template-columns: 1fr;
  }
  .table-search-actions {
    align-items: stretch;
  }
  .table-search-actions button {
    flex: 1;
  }
  .table-search-count {
    padding-bottom: 0;
  }
  .tcg-catalog-result-grid {
    grid-template-columns: 1fr;
  }
  .opening-ocr-review-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }
  .opening-ocr-panel > .panel-heading-row {
    display: block;
  }
  .opening-ocr-panel > .panel-heading-row .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 8px;
  }
  .opening-ocr-groups table {
    width: 100%;
    min-width: 0;
  }
  .opening-ocr-groups th:nth-child(2),
  .opening-ocr-groups td:nth-child(2),
  .opening-ocr-groups th:nth-child(5),
  .opening-ocr-groups td:nth-child(5),
  .opening-ocr-groups th:nth-child(6),
  .opening-ocr-groups td:nth-child(6) {
    display: none;
  }
  .opening-ocr-groups th:nth-child(3),
  .opening-ocr-groups td:nth-child(3) {
    width: 42px;
    white-space: nowrap;
  }
  .opening-ocr-groups th:nth-child(4),
  .opening-ocr-groups td:nth-child(4) {
    width: 82px;
    white-space: nowrap;
  }
  .opening-ocr-scan-image img,
  .opening-ocr-scan-image .placeholder-img {
    width: 76px;
    height: 106px;
  }
  .opening-ocr-candidate {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .opening-ocr-candidate img {
    display: none;
  }
}

/* Keep the main app header in normal page flow so it scrolls away. */
body > header,
body > header .header-inner {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

/* Keep table/container headers from sticking while scrolling inside dashboard panels. */
th,
.table-wrap th {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

/* Keep header dropdowns opaque and above page content without making the header sticky. */
body > header {
  position: relative !important;
  top: auto !important;
  z-index: 70000 !important;
}
body > header .header-inner {
  position: relative !important;
  top: auto !important;
  z-index: 70001 !important;
}
main {
  position: relative;
  z-index: 1;
}
.nav-group {
  z-index: 70002;
}
.nav-group:hover,
.nav-group:focus-within {
  z-index: 70010;
}
.nav-menu {
  z-index: 70020 !important;
  background: #0f172a !important;
  border-color: #475569 !important;
  box-shadow: 0 18px 42px rgba(0,0,0,0.65) !important;
  backdrop-filter: none !important;
}
.nav-menu button.nav-menu-item {
  background: #111827 !important;
}
.nav-menu button.nav-menu-item:hover,
.nav-menu button.nav-menu-item.active {
  background: #0ea5e9 !important;
}


/* Sales Notifier header status pill */
.sales-notifier-page .square-page-heading {
  align-items: center;
}
.sales-notifier-page .square-page-heading .actions.compact {
  margin-top: 0;
  align-items: center;
  flex-wrap: nowrap;
}
.sales-notifier-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 82px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.sales-notifier-status.on {
  color: #bbf7d0;
  border-color: #166534;
  background: rgba(34,197,94,0.12);
}
.sales-notifier-status.off {
  color: #bae6fd;
  border-color: #075985;
  background: rgba(14,165,233,0.12);
}
@media (max-width: 700px) {
  .sales-notifier-page .square-page-heading .actions.compact {
    margin-top: 12px;
    flex-wrap: wrap;
  }
}

/* Code Dispenser tool */
.code-dispenser-page .kpi-grid { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.code-dispenser-grid { align-items: start; }
.code-dispenser-page code { background: rgba(15, 23, 42, .85); border: 1px solid rgba(148, 163, 184, .25); border-radius: 7px; padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-dispenser-page .mini-table-wrap { max-height: 460px; overflow: auto; }
.code-dispenser-page .danger { border-color: rgba(239, 68, 68, .6); color: #fecaca; }

/* Per-order shipping supply usage */
.shipping-supply-picker {
  min-width: 0;
  margin: 16px 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.shipping-supply-picker legend {
  padding: 0 8px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}
.shipping-supply-header,
.shipping-supply-row {
  display: grid;
  grid-template-columns: 42px minmax(180px, 1fr) 100px 90px 100px;
  gap: 10px;
  align-items: center;
}
.shipping-supply-header {
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.shipping-supply-row {
  min-height: 48px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
}
.shipping-supply-row > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}
.shipping-supply-row > input[type="number"] {
  width: 100%;
  min-width: 0;
}
.shipping-supply-total {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
}
.shipping-supply-summary {
  min-width: 180px;
  line-height: 1.45;
}
@media (max-width: 700px) {
  .shipping-supply-header,
  .shipping-supply-row {
    grid-template-columns: 32px minmax(110px, 1fr) 72px 64px 78px;
    gap: 6px;
  }
  .shipping-supply-header,
  .shipping-supply-row {
    font-size: 12px;
  }
}
