/* Valqual Accounting — App-specific styles
 *
 * Loaded AFTER fourlines.css (Pico CSS + shared components).
 * Only contains styles not provided by the fourlines shared library.
 *
 * cache-bust: 2026-05-09
 */

/* ── Semantic color variables ────────────────────────────── */
:root {
  --vq-positive-bg: var(--color-success-light, #dcfce7);
  --vq-positive-bg-light: #f0fff4;
  --vq-negative-bg: var(--color-error-light, #fee2e2);
  --vq-negative-bg-light: #fff5f5;
  --vq-warning-bg: var(--color-warning-light, #fef9c3);
  --vq-warning-bg-light: #fff8e1;
  --vq-info-bg: var(--color-info-light, #dbeafe);
  --vq-info-bg-light: #f0f7ff;
  --vq-purple-bg: #ede9fe;
  --vq-purple-bg-light: #f5f3ff;
  --vq-purple: #5b21b6;
  --vq-card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --vq-card-shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── Page-level typography & background ──────────────────── */
main, [role="main"] {
  background: var(--surface-page);
  min-height: 100vh;
}
main.container {
  padding-top: 20px;
  padding-bottom: 32px;
}
h1 {
  font-family: var(--font-display, "DM Sans", Inter, system-ui, sans-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: var(--tracking-tight, -0.01em);
  margin-bottom: 0.75rem;
  color: var(--gray-800, #292524);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-default, var(--gray-200, #e7e5e4));
}

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.breadcrumb a {
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover {
  color: var(--brand-primary);
}
.breadcrumb-sep {
  font-size: 0.7rem;
  opacity: 0.5;
}

/* ── Skip-to-content (a11y) ──────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.5rem 1rem;
  background: var(--brand-primary);
  color: #fff;
  border-radius: 0 0 6px 6px;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
}

/* ── Card polish ─────────────────────────────────────────── */
.card {
  box-shadow: var(--vq-card-shadow);
  border: 1px solid rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

/* ── Summary stat cards ──────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.summary-grid .card {
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.summary-grid .card h3 {
  font-size: var(--text-xs, 12px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide, 0.02em);
  color: var(--gray-500);
  margin: 0 0 0.35rem;
}
.summary-grid .card .value {
  font-family: var(--font-display, "DM Sans", Inter, system-ui, sans-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}
/* Primary metric emphasis */
.summary-grid .card:first-child {
  border-top: 2px solid var(--accent-amber, #f59e0b);
}
.summary-grid .card:first-child .value {
  color: var(--brand-primary);
}
/* Subtitle under card value */
.summary-subtitle {
  display: block;
  font-size: 0.7rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}
/* Clickable card hover */
.summary-card-clickable {
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}
.summary-card-clickable:hover {
  box-shadow: var(--vq-card-shadow-hover);
}
/* Warning card (low stock) */
.summary-card-warn {
  border-top: 2px solid #f59e0b;
}
.summary-card-warn .value {
  color: #d97706;
}

/* ── Warehouse distribution chart ─────────────────────── */
.wh-chart-card {
  max-width: 800px;
  margin-bottom: 1.25rem;
}
.wh-chart {
  display: flex;
  gap: 2px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
}
.wh-chart-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: #fff;
  min-width: 40px;
  transition: opacity 0.15s;
  position: relative;
}
.wh-chart-bar:nth-child(2) { background: var(--color-success); }
.wh-chart-bar:nth-child(3) { background: #7c3aed; }
.wh-chart-bar:nth-child(4) { background: #0891b2; }
.wh-chart-bar:nth-child(5) { background: #d97706; }
.wh-chart-bar:nth-child(n+6) { background: var(--gray-500); }
.wh-chart-bar:hover { opacity: 0.85; }
.wh-chart-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0.9;
}
.wh-chart-value {
  font-size: 0.65rem;
  opacity: 0.8;
}

/* ── Warm empty states ─────────────────────────────────── */
.empty-state-warm {
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
  color: var(--gray-800);
}
.empty-state-warm p {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.empty-state-icon-wrap {
  margin-bottom: 1rem;
}

/* ── Table base + zebra striping ────────────────────────────
   Pico CSS sets `th, td { padding: var(--pico-spacing) }` which is
   way too tall for data tables (rows look ~50px high). Override to
   normal data-table padding so rows breathe but don't feel oversized.
   Inputs/selects inside cells also get a tight default size so a
   <select> doesn't drag the row to 44px+ on its own. */
.fl-table { font-size: 13px; border-collapse: collapse; }
.fl-table th, .fl-table td {
  padding: 6px 10px;
  vertical-align: middle;
  line-height: 1.35;
}
.fl-table th {
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  color: var(--gray-700, #44403c);
  background: var(--gray-50, #f8fafc);
  border-bottom: 1px solid var(--gray-200, #e7e5e4);
  white-space: nowrap;
}
.fl-table td {
  border-bottom: 1px solid var(--gray-100, #f5f5f4);
}
.fl-table input[type="text"],
.fl-table input[type="number"],
.fl-table input[type="date"],
.fl-table select {
  height: 26px;
  padding: 2px 8px;
  font-size: 12.5px;
  line-height: 1.3;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  background: #fff;
  margin: 0;
  box-sizing: border-box;
}
.fl-table tbody tr:nth-child(even) td { background: var(--surface-page); }
.fl-table tbody tr:hover td { background: var(--gray-100); }

/* ── Empty states ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--gray-500);
  padding: 3rem 1.5rem;
}
.empty-state-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}
.empty-state p {
  font-size: 0.95rem;
  max-width: 360px;
  margin: 0 auto 1rem;
  line-height: 1.6;
}

/* ── Warehouse cards ──────────────────────────────────────── */
.warehouse-card {
  background: var(--surface-card);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  margin-bottom: 2rem;          /* was 1.25rem — give stacked tables room */
  overflow: hidden;
  box-shadow: var(--vq-card-shadow);
  max-width: 1100px;            /* match the rest of the valuation layout */
}
.warehouse-card .overflow-auto { padding: 0.5rem 0.75rem 0.75rem; }
.warehouse-card .fl-table { margin: 0; }
.warehouse-card .fl-table th,
.warehouse-card .fl-table td {
  padding: 0.45rem 0.65rem;     /* slightly more cell padding so the
                                    9-column valuation grid breathes */
}
.warehouse-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-default);
  background: var(--gray-100);
  flex-wrap: wrap;
}
.warehouse-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Row highlights ───────────────────────────────────────── */
tr.low-stock td { background: var(--vq-warning-bg-light); }
tr.recon-discrepancy td, tr.recon-deficit td, tr.recon-surplus td { background: var(--vq-negative-bg-light); }
tr.recon-matched td { background: var(--vq-positive-bg-light); }

/* ── Form layout ──────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row label { flex: 1; min-width: 140px; }
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
}
.arrow {
  font-size: 1.5rem;
  padding-bottom: 6px;
  color: var(--gray-500);
}

/* ── Inventory & cost grids ───────────────────────────────── */
.inventory-grid { max-width: 100%; }
.cost-grid { max-width: 1100px; }
.qty-col { text-align: center; width: 140px; }

/* ── Inventory scroll container ──────────────────────────── */
.inv-scroll {
  overflow: auto;
  max-height: calc(100vh - 320px);
  min-height: 200px;
  border: 1px solid var(--border-default, #e7e5e4);
  border-radius: 6px;
}

/* ── Inventory table: sticky header + frozen columns ─────── */
.inventory-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}
/* Sticky header row — stays at top during vertical scroll */
.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-100, #f5f5f4);
  border-bottom: 2px solid var(--border-default, #e7e5e4);
}
/* Frozen columns — stay left during horizontal scroll */
.col-frozen {
  position: sticky;
  z-index: 3;
  background: var(--surface-card, #fff);
}
.col-sku     { left: 0; min-width: 90px; max-width: 130px; }
.col-product { left: 90px; min-width: 150px; white-space: nowrap; }
.col-total   { left: 240px; min-width: 70px; text-align: center; font-weight: 700; }
/* Corner cells: header + frozen — highest z-index */
thead .col-frozen {
  z-index: 4;
  background: var(--gray-100, #f5f5f4);
}
/* Shadow hint at the freeze boundary */
.col-total::after {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
}
/* Right border on frozen cols for visual separation */
.col-frozen { border-right: 1px solid var(--border-default, #e7e5e4); }

/* ── Inventory toolbar ────────────────────────────────────── */
.inv-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.inv-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.inv-filter-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
}
.inv-filter-label select {
  margin: 0;
  padding: 4px 8px;
  font-size: 13px;
}

/* ── Alert banners ────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 13px;
}
.alert-success { background: var(--vq-positive-bg); color: #0a3622; border: 1px solid #a3cfbb; }
.alert-error { background: #f8d7da; color: #58151c; border: 1px solid #f1aeb5; }
.alert-warn { background: var(--vq-warning-bg); color: #856404; border: 1px solid #ffe69c; }
.alert-info { background: var(--vq-info-bg); color: #1e40af; border: 1px solid #93c5fd; }

/* ── Buttons ─────────────────────────────────────────────── */
/* HARD APP RULE: standard input/select/button sizing across the app.
   Pico CSS defaults form elements to ~40-48px tall with ~14-16px
   font, which makes every form look oversized. Override globally so
   templates don't need inline `style="height:30px;font-size:13px"`
   on every field. Textareas keep auto height (multi-line). */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"],
select {
  height: 30px;
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1.3;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  background: #fff;
  color: var(--gray-900, #1c1917);
  margin: 0;
  box-sizing: border-box;
}
textarea {
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  background: #fff;
  color: var(--gray-900, #1c1917);
  margin: 0;
  box-sizing: border-box;
}

/* HARD APP RULE: no full-width buttons, no oversized buttons. Every
   button is content-width and a uniform standard size. Pico CSS
   defaults `button[type="submit"] { width: 100% }` and lays out
   `<input type="file">` at a much taller height than a normal
   button — neutralized here so every form picks up the correct
   defaults without inline overrides. */
button,
button[type="submit"],
button[type="button"],
button[type="reset"],
input[type="submit"],
input[type="button"],
input[type="reset"] {
  width: auto;
}
input[type="file"] {
  display: inline-block;
  width: auto;
  font-size: 13px;
  padding: 4px 6px;
  line-height: 1.3;
  margin: 0;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 6px;
  background: #fff;
  height: 32px;
  box-sizing: border-box;
}
input[type="file"]::-webkit-file-upload-button {
  font-size: 12px;
  padding: 3px 10px;
  margin-right: 8px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  background: var(--gray-50, #fafaf9);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-size: 12px;
  padding: 3px 10px;
  margin-right: 8px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  background: var(--gray-50, #fafaf9);
  cursor: pointer;
}

/* Base button. The mobile media query at the bottom of this file
   adds min-height: 44px for touch targets at <=768px viewports. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 6px;
  background: #fff;
  color: var(--gray-700, #44403c);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
  width: auto;          /* defensive — never let .btn stretch */
}
.btn:hover { background: var(--gray-50, #fafaf9); border-color: var(--gray-400, #a8a29e); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-sm {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 4px;
}
.btn-primary {
  background: var(--brand-primary, #1565c0);
  color: #fff;
  border-color: var(--brand-primary, #1565c0);
}
.btn-primary:hover {
  background: var(--brand-primary-hover, #0d47a1);
  border-color: var(--brand-primary-hover, #0d47a1);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--gray-500, #78716c);
}
.btn-ghost:hover {
  background: var(--gray-100, #f5f5f4);
  border-color: transparent;
  color: var(--gray-700, #44403c);
}
.btn-danger {
  background: var(--color-danger, #dc2626);
  color: #fff;
  border-color: var(--color-danger, #dc2626);
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
/* Variant: amber warning (legacy class name, predates the rest). */
.btn-warn { background: #f59e0b; color: #fff; border-color: #d97706; }
.btn-warn:hover { background: #d97706; }

/* ── Preview cards (dry-run) ──────────────────────────────── */
.preview-card {
  background: var(--vq-info-bg-light);
  border: 2px solid #a8d1ff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.preview-card h3 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--brand-primary); }
.preview-card h4 { font-size: 0.9rem; margin-bottom: 0.5rem; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border-default);
}
.tab-btn {
  border: none;
  background: none;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.tab-btn:hover {
  color: var(--gray-800);
  background: var(--gray-100);
}
.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--accent-amber, #f59e0b);
  font-weight: 600;
  background: var(--surface-card);
}
.tab-content { margin-top: 0; border-top: none; border-radius: 0 0 8px 8px; }

/* ── Setup checklist ──────────────────────────────────────── */
.setup-checklist { max-width: 700px; }
.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--surface-card);
}
.setup-step.completed { border-left: 4px solid var(--color-success); }
.setup-step.current { border-left: 4px solid var(--brand-primary); background: var(--vq-info-bg-light); }
.setup-step.pending { border-left: 4px solid var(--border-default); opacity: 0.7; }
.setup-step.is-locked {
  border-left: 4px solid var(--gray-300, #d1d5db);
  background: var(--gray-50, #fafaf9);
  opacity: 0.55;
}
.setup-step.is-locked .step-content strong { color: var(--gray-500, #78716c); }
.step-content { flex: 1; min-width: 0; }
/* Direct-child only — without `>`, every nested <strong> inside a <p>
   would also become its own block-level row at heading size, breaking
   inline emphasis (e.g. "Connected to <strong>QuickBooks Online</strong>"
   would put the platform name on its own giant line). */
.step-content > strong { display: block; font-size: 0.95rem; }
.step-content p { font-size: 0.85rem; color: var(--gray-500); margin-top: 2px; }
.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-icon.done { background: var(--vq-positive-bg); color: var(--color-success); }
.step-icon.next { background: var(--vq-info-bg); color: var(--brand-primary); }
.step-icon.wait { background: #e9ecef; color: var(--gray-500); }

/* ── Connection status ────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.status-dot.connected { background: var(--color-success); }
.status-dot.disconnected { background: var(--color-error); }

/* ── CRUD actions column ──────────────────────────────────── */
.actions { white-space: nowrap; }

/* ── Tag color variants ───────────────────────────────────── */
.tag-transfer { background: var(--vq-info-bg); color: #1e40af; }
.tag-sale { background: var(--vq-purple-bg); color: var(--vq-purple); }
.tag-manual { background: var(--vq-info-bg); color: #1e40af; }
.tag-reconcile { background: var(--vq-warning-bg); color: #92400e; }
.tag-starting { background: var(--vq-positive-bg); color: #065f46; }
.tag-matched { background: var(--vq-positive-bg); color: #065f46; }
.tag-discrepancy, .tag-deficit, .tag-surplus { background: var(--vq-negative-bg); color: #991b1b; }
.tag-new { background: var(--vq-info-bg); color: #1e40af; }
.tag-conflict { background: var(--vq-warning-bg); color: #856404; }
.tag-qbo_only { background: #e9ecef; color: #495057; }
.tag-bundle { background: var(--vq-purple-bg); color: var(--vq-purple); font-size: 11px; padding: 1px 6px; border-radius: 3px; }

/* ── Bundle / kit row highlight ──────────────────────────── */
tr.row-bundle td { background: var(--vq-purple-bg-light); }
tr.row-bundle td.col-frozen { background: var(--vq-purple-bg-light); }
thead + tbody tr.row-bundle:hover td { background: var(--vq-purple-bg); }
/* Recon status overrides bundle color in QBO tab */
tr.row-bundle.recon-deficit td,
tr.row-bundle.recon-surplus td { background: var(--vq-negative-bg-light); }
tr.row-bundle.recon-matched td { background: var(--vq-positive-bg-light); }
tr.row-bundle-blocked td { background: var(--vq-warning-bg); opacity: 0.7; }
tr.row-bundle-blocked input[disabled] { cursor: not-allowed; }

/* ── Help tooltips ───────────────────────────────────────── */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border-default, #e7e5e4);
  color: var(--gray-500, #78716c);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  position: relative;
  flex-shrink: 0;
}
.help-tip:hover {
  background: var(--brand-primary, #1565c0);
  color: #fff;
}
.help-tip[title] {
  /* Browser native tooltip — works everywhere */
}

/* ── AI search bar ──────────────────────────────────────── */
.ai-search-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-default);
}
.ai-search-bar label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-search-bar input {
  font-size: 14px;
}
.ai-search-interpreted {
  font-size: 0.85rem;
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: inline-block;
}
.ai-search-fallback {
  font-size: 0.82rem;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--border-default);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: inline-block;
}

/* ── Product detail header ──────────────────────────────── */
.product-detail-header {
  margin-bottom: 1rem;
}
.product-detail-sku code {
  font-size: 1rem;
  padding: 2px 8px;
}
.product-detail-name {
  margin: 0.25rem 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}

/* ── SKU links (dashboard → product detail) ────────────── */
.sku-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  padding: 4px 0;
}
.sku-link:hover code {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

/* ── Period lock bar ─────────────────────────────────────── */
.period-lock-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  font-size: 13px;
}
.tag-locked {
  background: var(--vq-negative-bg);
  color: #991b1b;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-icon {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

/* ── Tab panels ──────────────────────────────────────────── */
.tab-panel { display: none; padding-top: 1rem; }
.tab-panel.active { display: block; }

/* ── Misc ─────────────────────────────────────────────────── */
code {
  font-family: monospace;
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* ── Header: force Pico nav to horizontal flex ─────────── */
body > nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0;
  min-height: 48px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-card);
}
body > nav > ul {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}
body > nav > ul > li {
  list-style: none;
  display: flex;
  align-items: center;
}

/* Slim header — no product brand; optional links only (auth flows, etc.) */
body > nav.nav-slim {
  justify-content: flex-end;
}
body > nav.nav-slim > ul {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
}
body > nav.nav-slim > ul > li {
  list-style: none;
  display: flex;
  align-items: center;
}
body > nav.nav-slim a {
  color: #1565c0;
  font-weight: 500;
  text-decoration: none;
}
body > nav.nav-slim a:hover {
  text-decoration: underline;
}
body > nav.nav-slim a.nav-slim-accent {
  background: #1565c0;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 6px;
}
body > nav.nav-slim a.nav-slim-accent:hover {
  text-decoration: none;
  background: #0d47a1;
}

/* ── Header: brand group (left side) ───────────────────── */
.nav-brand-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav-hamburger {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.nav-hamburger:hover {
  color: var(--gray-800);
  background: var(--gray-100);
}
.nav-logo {
  flex-shrink: 0;
}
.nav-entity-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray-800, #292524);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* ── Org switcher dropdown (header) ─────────────────────── */
.org-switcher {
  position: relative;
}
.org-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.org-switcher-btn:hover {
  background: var(--gray-100);
}
.org-switcher-btn svg {
  opacity: 0.5;
  transition: transform 0.2s;
}
.org-switcher.open .org-switcher-btn svg {
  transform: rotate(180deg);
}
.org-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  max-width: 340px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  z-index: 1001;
  padding: 6px 0;
}
.org-switcher.open .org-dropdown {
  display: block;
}
.org-dropdown hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--border-default);
}
.org-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  font-size: 0.88rem;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}
.org-dropdown-item:hover {
  background: var(--gray-100);
}
.org-dropdown-item.active {
  font-weight: 600;
}
.org-dropdown-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-dropdown-platform {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 3px;
}
.org-dropdown-add {
  color: var(--brand-primary);
  font-weight: 500;
}
.org-dropdown-add svg {
  opacity: 0.7;
}

/* ── Header: right-side controls ───────────────────────── */
.nav-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-header-btn:hover {
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}
.nav-header-btn svg {
  display: block;
}

/* ── User avatar (initials circle) ─────────────────────── */
.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: box-shadow 0.15s;
  line-height: 1;
}
.nav-avatar:hover {
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

/* ── User dropdown ──────────────────────────────────────── */
.nav-user-menu {
  position: relative;
}
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  padding: 6px 0;
}
.user-dropdown.visible {
  display: block;
}
.user-dropdown-email {
  display: block;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--gray-500);
  word-break: break-all;
}
.user-dropdown hr {
  margin: 2px 0;
  border: none;
  border-top: 1px solid var(--border-default);
}
.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  font-size: 0.88rem;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.user-dropdown-item:hover {
  background: var(--gray-100);
}
.user-dropdown-signout:hover {
  color: var(--color-error);
}

/* ── Sidebar overlay ────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ── Sidebar panel (left side) ──────────────────────────────
   Light surface — same family as the rest of the app (cream
   page bg + white cards + amber accent). The previous dark
   zinc-900 fought the warm-light content area; matching the
   design tokens here makes the chrome feel like one piece. */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--surface-card, #ffffff);
  border-right: 1px solid var(--gray-200, #e7e5e4);
  box-shadow: 2px 0 12px rgba(28, 25, 23, 0.06);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-family: var(--font-body, "Inter", system-ui, sans-serif);
}
.sidebar.open {
  transform: translateX(0);
}

/* ── Sidebar header ─────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gray-200, #e7e5e4);
  background: var(--surface-card, #ffffff);
  color: var(--gray-900, #1c1917);
}
.sidebar-header strong {
  font-family: var(--font-display, "DM Sans", "Inter", system-ui, sans-serif);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--gray-900, #1c1917);
}
.sidebar-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-500, #78716c);
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.sidebar-close:hover {
  color: var(--gray-900, #1c1917);
  background: var(--gray-100, #f5f5f4);
}

/* ── Sidebar navigation ─────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0 16px;
}

.sidebar-link {
  display: block;
  padding: 9px 20px;
  color: var(--gray-700, #44403c);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar-link:hover {
  background: var(--gray-50, #fafaf9);
  color: var(--gray-900, #1c1917);
}
.sidebar-link.active {
  color: var(--brand-primary, #1565c0);
  font-weight: 600;
  background: var(--accent-amber-light, #fef3c7);
  border-left-color: var(--accent-amber, #f59e0b);
}

/* ── Collapsible sections ───────────────────────────────── */
.sidebar-section {
  border-bottom: 1px solid var(--gray-100, #f5f5f4);
}
.sidebar-section--locked {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.sidebar-section--locked .sidebar-section-toggle::after {
  content: "🔒";
  font-size: 0.7rem;
  opacity: 0.7;
}
.sidebar-section:last-of-type {
  border-bottom: none;
}
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 20px;
  background: none;
  border: none;
  font-family: var(--font-body, "Inter", system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  color: var(--gray-700, #44403c);
  cursor: pointer;
  transition: color 0.15s, background 0.12s;
}
.sidebar-section-toggle:hover {
  background: var(--gray-50, #fafaf9);
  color: var(--gray-900, #1c1917);
}
.sidebar-section-toggle::after {
  content: "\25B8";        /* ▸ slimmer than ▶ */
  font-size: 0.7rem;
  color: var(--gray-400, #a8a29e);
  transition: transform 0.2s, color 0.15s;
}
.sidebar-section-toggle:hover::after {
  color: var(--gray-700, #44403c);
}
.sidebar-section.open .sidebar-section-toggle::after {
  transform: rotate(90deg);
}
.sidebar-section-items {
  display: none;
  padding-bottom: 6px;
}
.sidebar-section.open .sidebar-section-items {
  display: block;
}
.sidebar-section-items .sidebar-link {
  padding-left: 32px;
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--gray-600, #57534e);
}
.sidebar-section-items .sidebar-link:hover {
  color: var(--gray-900, #1c1917);
}
.sidebar-section-items .sidebar-link.active {
  color: var(--brand-primary, #1565c0);
  font-weight: 600;
}

/* ── Responsive: tablet & below ───────────────────────────── */
@media (max-width: 768px) {
  /* Stack forms */
  .form-row {
    flex-direction: column;
  }
  .form-row label {
    min-width: unset;
    width: 100%;
  }
  .arrow {
    text-align: center;
    transform: rotate(90deg);
    padding: 0;
  }

  /* Summary grid */
  .summary-grid { grid-template-columns: 1fr 1fr; }

  /* Touch targets — only primary action buttons, not icon buttons */
  .btn, .btn-sm { min-height: 44px; }
  .btn-icon-action, .btn-icon, .btn-export, .nav-hamburger, .nav-avatar, .sidebar-close, .sidebar-section-toggle, .tab-btn { min-height: unset; }
  input, select, textarea { font-size: 16px; } /* prevents iOS zoom */

  /* Setup checklist responsive */
  .setup-step { flex-wrap: wrap; }

  /* Header: truncate entity name on small screens */
  .nav-entity-name { max-width: 130px; font-size: 0.85rem; }
}

/* ── Responsive: phone ────────────────────────────────────── */
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }

  /* Scrollable tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Stack warehouse cards */
  .warehouse-header {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ════════════════════════════════════════════════════════════
   Documentation pages
   ════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: 1100px;
}

.docs-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 80px;
  align-self: start;
  padding-right: 1rem;
  border-right: 1px solid var(--border-default);
}

.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-800);
  text-decoration: none;
  transition: background 0.15s;
}
.docs-nav-link:hover { background: var(--gray-100); }
.docs-nav-link.active { background: var(--brand-primary); color: #fff; font-weight: 600; }
.docs-nav-icon { font-size: 15px; width: 20px; text-align: center; }

/* ── Content ────────────────────────────────────────────── */
.docs-content { max-width: 780px; }
.docs-content h2 { margin-top: 0; }
.docs-content h3 { margin-top: 2rem; margin-bottom: 0.75rem; }
.docs-content h4 { margin-top: 0; margin-bottom: 0.25rem; }
.docs-content p { line-height: 1.7; }
.docs-content ul, .docs-content ol { line-height: 1.7; margin-bottom: 1rem; }
.docs-content li { margin-bottom: 0.25rem; }
.docs-lead { font-size: 1.1rem; color: var(--gray-500); line-height: 1.7; margin-bottom: 1.5rem; }

/* ── Hero (index page) ──────────────────────────────────── */
.docs-hero {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-default);
}
.docs-hero-logo {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.docs-hero h2 { margin: 0 0 0.5rem; font-size: 1.8rem; }
.docs-hero-sub { color: var(--gray-500); font-size: 1.1rem; margin: 0; }

/* ── Card grid (index page) ─────────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}
.docs-card {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  text-decoration: none;
  color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.docs-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.docs-card h3 { margin: 0.5rem 0 0.25rem; font-size: 1rem; }
.docs-card-icon { font-size: 1.5rem; }
.docs-card-desc { font-size: 13px; color: var(--gray-500); margin: 0; line-height: 1.5; }

/* ── Feature grid (overview page) ───────────────────────── */
.docs-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.docs-feature {
  padding: 1rem;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--gray-100);
}
.docs-feature-icon { font-size: 1.5rem; }
.docs-feature h4 { margin: 0.5rem 0 0.25rem; }
.docs-feature p { font-size: 13px; color: var(--gray-500); margin: 0; line-height: 1.5; }

/* ── Callout boxes ──────────────────────────────────────── */
.docs-callout {
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-left: 3px solid var(--brand-primary);
  background: var(--gray-100);
  border-radius: 0 6px 6px 0;
}
.docs-callout h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.docs-callout p { margin: 0; font-size: 14px; line-height: 1.6; }

/* ── Import method grid ─────────────────────────────────── */
.docs-import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.docs-import-method {
  padding: 1rem;
  border: 1px solid var(--border-default);
  border-radius: 8px;
}
.docs-import-method h4 { margin: 0 0 0.5rem; }
.docs-import-method p { font-size: 13px; line-height: 1.6; margin-bottom: 0.5rem; }
.docs-import-method ul { font-size: 13px; margin: 0; padding-left: 1.25rem; }

/* ── Steps (historical rebuild page) ────────────────────── */
.docs-steps { margin: 1.5rem 0; }
.docs-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border-default);
  border-radius: 8px;
}
.docs-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.docs-step h4 { margin: 0 0 0.25rem; }
.docs-step p { font-size: 14px; margin: 0; line-height: 1.6; color: var(--gray-500); }

/* ── Next page link ─────────────────────────────────────── */
.docs-next {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-default);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
    padding: 0 0 0.75rem 0;
    margin-bottom: 1rem;
  }
  .docs-sidebar > strong { width: 100%; }
  .docs-nav-link { font-size: 12px; padding: 0.3rem 0.5rem; }
  .docs-feature-grid, .docs-import-grid { grid-template-columns: 1fr; }
}

/* ── Export toolbar ──────────────────────────────────────── */
.export-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  justify-content: flex-end;
}
.export-bar .btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: var(--surface-card);
  color: var(--gray-500);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
}
.export-bar .btn-export:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Download menu — single icon button with format-choice popup.
   Replaces per-table CSV/Excel button strips. Trigger renders as a
   subtle ghost-icon; popup is anchored to the right edge. */
.flcm-export-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.flcm-export-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-default, #e7e5e4);
  border-radius: 4px;
  background: var(--surface-card, #fff);
  color: var(--gray-500, #78716c);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.flcm-export-menu__trigger:hover {
  border-color: var(--brand-primary, #1565c0);
  color: var(--brand-primary, #1565c0);
}
.flcm-export-menu__panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 60;
  min-width: 140px;
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-default, #e7e5e4);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
  padding: 4px 0;
  flex-direction: column;
}
.flcm-export-menu__panel[hidden] { display: none; }
.flcm-export-menu__panel:not([hidden]) { display: flex; }
.flcm-export-menu__panel button {
  text-align: left;
  background: transparent;
  border: 0;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--gray-700, #44403c);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.flcm-export-menu__panel button:hover {
  background: var(--gray-100, #f5f5f4);
  border-left-color: var(--accent-amber, #f59e0b);
}

/* ════════════════════════════════════════════════════════════
   Product data grid — frozen columns & multi-select
   ════════════════════════════════════════════════════════════ */

/* ── Scroll container ────────────────────────────────────── */
.product-scroll {
  overflow: auto;
  max-height: calc(100vh - 320px);
  min-height: 200px;
  border: 1px solid var(--border-default, #e7e5e4);
  border-radius: 6px;
  position: relative;
}

/* ── Product table base ──────────────────────────────────── */
#product-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}
#product-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-100, #f5f5f4);
  border-bottom: 2px solid var(--border-default, #e7e5e4);
}

/* ── Frozen columns ──────────────────────────────────────── */
#product-table .col-check {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  background: var(--surface-card, #fff);
  border-right: none;
}
#product-table .col-actions {
  position: sticky;
  left: 36px;
  z-index: 3;
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  text-align: center;
  background: var(--surface-card, #fff);
  border-right: none;
  white-space: nowrap;
}
#product-table .col-sku {
  position: sticky;
  left: 96px;
  z-index: 3;
  min-width: 100px;
  background: var(--surface-card, #fff);
  border-right: 1px solid var(--border-default, #e7e5e4);
}
/* Shadow at freeze boundary */
#product-table .col-sku::after {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
}
/* Header frozen cells — highest z-index */
#product-table thead .col-check,
#product-table thead .col-actions,
#product-table thead .col-sku {
  z-index: 4;
  background: var(--gray-100, #f5f5f4);
}

/* ── Row state backgrounds (frozen cells must match) ─────── */
#product-table tr.row-bundle td { background: var(--vq-purple-bg-light); }
#product-table tr.row-bundle .col-check,
#product-table tr.row-bundle .col-actions,
#product-table tr.row-bundle .col-sku { background: var(--vq-purple-bg-light); }

#product-table tr.row-inactive td { opacity: 0.55; }

#product-table tr.row-selected td { background: var(--vq-info-bg); }
#product-table tr.row-selected .col-check,
#product-table tr.row-selected .col-actions,
#product-table tr.row-selected .col-sku { background: var(--vq-info-bg); }

/* Selected + bundle combined */
#product-table tr.row-selected.row-bundle td { background: #ddd6fe; }
#product-table tr.row-selected.row-bundle .col-check,
#product-table tr.row-selected.row-bundle .col-actions,
#product-table tr.row-selected.row-bundle .col-sku { background: #ddd6fe; }

/* ── Edit row ────────────────────────────────────────────── */
#product-table tr.edit-row td {
  background: var(--gray-100, #f5f5f4);
}

/* ── Icon buttons ────────────────────────────────────────── */
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--gray-500, #78716c);
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.btn-icon-action:hover {
  background: var(--gray-100, #f5f5f4);
  color: var(--gray-800, #292524);
}
.btn-icon-danger:hover {
  background: var(--vq-negative-bg);
  color: #dc2626;
}
.btn-icon-positive:hover {
  background: var(--vq-positive-bg);
  color: #059669;
}

/* ── Checkbox brand color ────────────────────────────────── */
#product-table input[type="checkbox"] {
  accent-color: var(--brand-primary, #1565c0);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

/* ── Inline tags ─────────────────────────────────────────── */
.tag-kit {
  background: var(--vq-purple-bg);
  color: var(--vq-purple);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.tag-inactive {
  background: var(--vq-negative-bg);
  color: #991b1b;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}

/* ── Bulk action bar ─────────────────────────────────────── */
.bulk-action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-card, #fff);
  border-top: 2px solid var(--border-default, #e7e5e4);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  z-index: 10;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}
.bulk-action-bar.visible {
  transform: translateY(0);
}
.bulk-action-bar .bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}
.bulk-action-bar .bulk-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Product grid responsive ─────────────────────────────── */
@media (max-width: 480px) {
  #product-table .col-amz-sku,
  #product-table .col-type,
  #product-table .col-status { display: none; }

  #product-table .col-check { width: 30px; min-width: 30px; max-width: 30px; }
  #product-table .col-actions { left: 30px; width: 44px; min-width: 44px; max-width: 44px; }
  #product-table .col-sku { left: 74px; min-width: 80px; }
}

/* ── Loading spinner (double-submit prevention) ──────────── */
.btn-loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: wait;
}
.btn-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Focus-visible ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Table row hover ─────────────────────────────────────── */
.fl-table tbody tr:hover td { background: var(--gray-100); }

/* ── Utility classes ─────────────────────────────────────── */
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.d-inline-form { display: inline; margin: 0; }
.empty-state { text-align: center; font-style: italic; color: var(--gray-500); }
.text-positive { color: var(--color-success); }
.text-negative { color: var(--color-error); }
.text-warning { color: #e67e22; }

/* ── Inventory reconcile column backgrounds ──────────────── */
.col-info-bg { background: var(--vq-info-bg-light); }
.col-warn-bg { background: var(--vq-warning-bg-light); }

/* ── Skeleton loading shimmer ──────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
.skeleton * { visibility: hidden; }
.skeleton-text {
  height: 0.9em;
  width: 60%;
  display: inline-block;
}
.skeleton-value {
  height: 1.5em;
  width: 80%;
  display: inline-block;
}
.skeleton-row td {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  height: 2.5em;
}

/* ── QBO Status badges ───────────────────────────────────── */
.qbo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.qbo-badge-noninv { background: #C8E6C9; color: #2E7D32; }
.qbo-badge-inv { background: #FFF9C4; color: #F57C00; }
.qbo-badge-local { background: #F5F5F5; color: #616161; }

/* ── Setup checklist ─────────────────────────────────────── */
.setup-checklist {
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-left: 3px solid var(--border-default, #e7e5e4);
  background: var(--surface-card, #fff);
  transition: border-color 0.2s;
}
/* Make sure the SVG step icon and any action button align with the
   strong heading (top of card), not the visual middle of multi-line
   content. Icon column is fixed-width for consistency across cards. */
.setup-step > .step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding-top: 1px;
}
.setup-step:first-child { border-radius: 8px 8px 0 0; }
.setup-step:last-child { border-radius: 0 0 8px 8px; }
.setup-step.completed { border-left-color: #4CAF50; }
.setup-step.current { border-left-color: var(--brand-primary, #1565c0); background: var(--vq-info-bg, #EBF5FF); }
.setup-step .step-icon { font-size: 1.25rem; min-width: 28px; text-align: center; }
.setup-step .step-content { flex: 1; min-width: 0; }
.setup-step .step-content > strong { display: block; font-size: 0.95rem; }
.setup-step .step-content p { margin: 2px 0 0; font-size: 0.8rem; color: var(--gray-500); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
  color: var(--gray-800);
}
.pagination a:hover { background: var(--gray-100, #f5f5f4); }
.pagination .current-page {
  background: var(--brand-primary, #1565c0);
  color: #fff;
  font-weight: 600;
}
.pagination .disabled { color: var(--gray-500); pointer-events: none; }
.pagination .page-info { font-size: 12px; color: var(--gray-500); margin-left: 1rem; }

/* ── Conversion modal ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--surface-card, #fff);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-box h3 { margin: 0 0 1rem; font-size: 1.1rem; }
.modal-box .modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Search filter bar ───────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
}
.filter-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  font-size: 13px;
}
.filter-bar select {
  padding: 6px 8px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 4px;
  font-size: 13px;
}

/* ── Accordion (account mapping lifecycle) ─────────────────────── */
.flcm-accordion { max-width: 900px; }
.flcm-accordion__section {
  border: 1px solid var(--gray-200, #e7e5e4);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--surface-card, #fff);
  /* No `overflow: hidden`: combo dropdowns inside the body are
     position:absolute and need to escape the section's box. The
     border-radius is applied by the section itself; internal
     content respects it because the children don't paint over the
     rounded corners. */
}
.flcm-accordion__section[open] {
  border-left: 3px solid var(--accent-amber, #f59e0b);
}
.flcm-accordion__header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  user-select: none;
}
.flcm-accordion__header::-webkit-details-marker { display: none; }
.flcm-accordion__header::marker { display: none; content: ""; }
.flcm-accordion__step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100, #f5f5f4);
  color: var(--gray-600, #57534e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.flcm-accordion__section[open] .flcm-accordion__step {
  background: var(--accent-amber, #f59e0b);
  color: #fff;
}
.flcm-accordion__title {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900, #1c1917);
}
.flcm-accordion__chevron {
  margin-left: auto;
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
  color: var(--gray-400, #a8a29e);
  flex-shrink: 0;
}
.flcm-accordion__section[open] .flcm-accordion__chevron {
  transform: rotate(180deg);
}
.flcm-accordion__body {
  padding: 0 20px 20px 60px;
}
.flcm-accordion__desc {
  font-size: 14px;
  color: var(--gray-600, #57534e);
  line-height: 1.6;
  margin-bottom: 16px;
}
.flcm-accordion__field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.flcm-accordion__field label {
  min-width: 200px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700, #44403c);
}
.flcm-accordion__field select {
  flex: 1;
  max-width: 400px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.flcm-accordion__field .flcm-optional {
  font-size: 11px;
  color: var(--gray-400, #a8a29e);
  font-weight: 400;
}
.flcm-accordion__wh-grid {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100, #f5f5f4);
}
.flcm-accordion__wh-grid h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500, #78716c);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.flcm-accordion__empty {
  font-size: 13px;
  color: var(--gray-400, #a8a29e);
  font-style: italic;
}

/* ── Tabs (overhead, etc.) ─────────────────────────────────── */
.flcm-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-default, var(--gray-200, #e7e5e4));
  margin-bottom: 20px;
}
.flcm-tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500, #78716c);
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.flcm-tab-btn:hover {
  color: var(--gray-700, #44403c);
}
.flcm-tab-btn.active {
  color: var(--brand-primary, #1565c0);
  border-bottom-color: var(--brand-primary, #1565c0);
}
.flcm-tab-btn:focus-visible {
  outline: 2px solid var(--brand-primary, #1565c0);
  outline-offset: -2px;
  border-radius: 4px 4px 0 0;
}
.flcm-tab-panel { display: none; }
.flcm-tab-panel.active { display: block; }

/* ── Form utilities ────────────────────────────────────────── */
.flcm-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.flcm-form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700, #44403c);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flcm-input,
.flcm-select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300, #d6d3d1);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-card, #fff);
  color: var(--gray-900, #1c1917);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.flcm-input:focus,
.flcm-select:focus {
  border-color: var(--brand-primary, #1565c0);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
  outline: none;
}
.flcm-input::placeholder {
  color: var(--gray-400, #a8a29e);
}

/* ── Section headers ───────────────────────────────────────── */
.flcm-section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500, #78716c);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}
.flcm-section-divider {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid var(--gray-200, #e7e5e4);
}

/* ── Status badges ─────────────────────────────────────────── */
.flcm-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.flcm-badge--xero    { background: var(--accent-amber, #f59e0b); color: #fff; }
.flcm-badge--csv     { background: var(--gray-400, #a8a29e); color: #fff; }
.flcm-badge--ai      { background: #8b5cf6; color: #fff; }
.flcm-badge--manual  { background: var(--gray-200, #e7e5e4); color: var(--gray-600, #57534e); }
.flcm-badge--success { background: #dcfce7; color: #166534; }
.flcm-badge--warning { background: #fef3c7; color: #92400e; }
.flcm-badge--error   { background: #fecaca; color: #991b1b; }
.flcm-badge--bill    { background: var(--gray-200, #e7e5e4); color: var(--gray-700, #44403c); }
.flcm-badge--credit  { background: #fde68a; color: #92400e; }
.flcm-badge--journal { background: #ddd6fe; color: #5b21b6; }

/* ── Footing summary ───────────────────────────────────────── */
.flcm-footing-ok   { border-left: 3px solid var(--color-success, #16a34a); }
.flcm-footing-fail { border-left: 3px solid var(--color-error, #dc2626); }
.flcm-footing-check { color: var(--color-success, #16a34a); }
.flcm-footing-x     { color: var(--color-error, #dc2626); }

/* ── Spacing utilities ─────────────────────────────────────── */
.flcm-gap-1  { gap: 4px; }
.flcm-gap-2  { gap: 8px; }
.flcm-gap-3  { gap: 12px; }
.flcm-gap-4  { gap: 16px; }
.flcm-gap-6  { gap: 24px; }
.flcm-mb-1   { margin-bottom: 4px; }
.flcm-mb-2   { margin-bottom: 8px; }
.flcm-mb-3   { margin-bottom: 12px; }
.flcm-mb-4   { margin-bottom: 16px; }
.flcm-mb-6   { margin-bottom: 24px; }
.flcm-mt-4   { margin-top: 16px; }
.flcm-mt-6   { margin-top: 24px; }

/* ── Accessibility: focus rings ────────────────────────────── */
.btn:focus-visible,
.flcm-input:focus-visible,
.flcm-select:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-primary, #1565c0);
  outline-offset: 2px;
}

/* ── Fix: remove scale transform on hover (DESIGN.md P3) ─── */
