/* ===== ANIMATIONS ===== */
@keyframes shimmer-bar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ===== BOOT SCREEN =====
 * App.init adds `app-booting` to <body> on first paint and removes
 * it once auth resolves. Without this, the user sees a flash of the
 * post-signin setup welcome step while JS is deciding which top-
 * level screen to display. The pseudo-element overlays everything
 * (above splash + auth + app), painting the canvas color and a
 * small centered spinner so the page feels like it's loading
 * rather than rendering then re-rendering.
 */
body.app-booting::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--bg, #F7F4EE);
}
body.app-booting::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid rgba(0,0,0,0.12);
  border-top-color: rgba(0,0,0,0.55);
  border-radius: 50%;
  z-index: 100001;
  animation: app-boot-spin 0.8s linear infinite;
}
html.dark-mode body.app-booting::after {
  border-color: rgba(255,255,255,0.18);
  border-top-color: rgba(255,255,255,0.7);
}
@keyframes app-boot-spin {
  to { transform: rotate(360deg); }
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Light mode (default) */
:root {
  --bg: #F7F4EE;
  --sf: #FDFCF9;
  --sf2: #EDE9DF;
  --sf3: #E0DBCF;
  --bd: #DDD8CE;
  --bd2: #DDD8CE;
  --tx: #2A2520;
  --tx2: #4A433C;
  --tx3: #7A7168;
  --ac: #2A2520;
  --ac2: #4A433C;
  --ac-text: #FDFCF9;
  --acl: #EDE9DF;
  --acb: #E0DBCF;
  --gn: #1E4D35;
  --gnl: #E8F0EB;
  --gnb: #B4D7C4;
  --bl: #1E3A5F;
  --bll: #E8EEF4;
  --blb: #B4C8DE;
  --am: #B45309;
  --aml: #FEF3C7;
  --amb: #FDE68A;
  --rd: #C0392B;
  --rdl: #FEE2E2;
  --rdb: #FECACA;
  --ghost: #7A7168;
  --pending-bg: #FEF3C7;
  --pending-text: #B45309;
  --se: 'Fraunces', serif;
  --sa: 'DM Sans', sans-serif;
  --sidebar-w: 240px;
  --radius-card: 12px;
  --radius-btn: 100px;
  --sh: none;
  --shs: none;
  --transition: 0.15s ease;
}

/* Dark mode (manual toggle) */
html.dark-mode {
  --bg: #0D0D0D;
  --sf: #1A1A1A;
  --sf2: #232323;
  --sf3: #2C2C2C;
  --bd: #2A2A2A;
  --bd2: #333333;
  --tx: #FFFFFF;
  --tx2: #B0B0B0;
  --tx3: #777777;
  --ghost: #555555;
  --acl: #1A1510;
  --acb: #3A2A1A;
  --gnl: #0D2A1F;
  --gnb: #166534;
  --bll: #0D1A2E;
  --blb: #1E3A5F;
  --aml: #2A2000;
  --amb: #4A3A00;
  --rdl: #2A0D0D;
  --rdb: #4A1A1A;
  --pending-bg: #2A2000;
  --pending-text: #FBBF24;
  /* The five "strong" colors (used as foreground text on dark-tint
   * backgrounds and as solid pill backgrounds) need a flip in dark
   * mode. Without these overrides --ac/--gn/--bl/--am/--rd inherit
   * their light-mode values, so things like "Review all N brands"
   * (--ac on --aml), the OWNER role badge (--bl on --bll), and the
   * inventory dashboard preview footers (--ac) render as dark text
   * on dark backgrounds — invisible.
   *
   * Components that use these as a SOLID pill background (e.g.
   * `.btn-primary` extensions, `.export-step-dot.active`) get a
   * lighter-but-saturated pill in dark mode, which matches the
   * existing pattern of light buttons (`.btn-primary` itself uses
   * --tx/--sf and renders as a white pill in dark mode). */
  --ac: #F5EBD8;        /* warm cream — used as text on --acl, or as a light button bg */
  --ac-text: #1A1510;   /* dark text on top of --ac */
  --ac2: #D6CDB8;
  --gn: #4ADE80;        /* emerald 400 */
  --bl: #93C5FD;        /* sky 300 */
  --am: #FBBF24;        /* amber 400 */
  --rd: #F87171;        /* red 400 */
}

/* Sidebar active state in dark mode — the cross-mode default
 * (`background: var(--tx)`) flips to a stark white pill, which
 * jars against the dark sidebar. Use a subtle elevation instead.
 * Border-left accent pulls the eye without a high-contrast block. */
html.dark-mode .sidebar-item.active {
  background: var(--sf2);
  color: var(--tx);
  border-left-color: var(--ac);
}
html.dark-mode .sidebar-item.active .sidebar-item-badge {
  background: rgba(255, 255, 255, 0.10);
  color: var(--tx);
}

html.dark-mode .data-mode-btn.active {
  background: var(--sf2);
  border-color: var(--sf2);
}

html.dark-mode .data-mode-btn.active .data-mode-label { color: var(--tx); }
html.dark-mode .data-mode-btn.active .data-mode-desc { color: var(--tx3); }
html.dark-mode .data-mode-btn.active .data-mode-icon { color: var(--tx3); }
html.dark-mode .data-mode-btn.active::after { background: var(--tx); color: var(--sf); }

html.dark-mode .pill.active { background: var(--sf2); border-color: var(--sf2); color: var(--tx); }
html.dark-mode .pill.active .pill-hint { color: var(--tx3); }

html.dark-mode .sb-product-icon { background: var(--tx); color: var(--bg); }
html.dark-mode .sb-avatar { background: var(--tx); color: var(--bg); }

html.dark-mode .generate-bar { background: rgba(13,13,13,0.95); }
html.dark-mode .topbar { background: rgba(26,26,26,0.95); }

html.dark-mode .empty-state-card { border-color: var(--bd); }

/* Tabs & filters in dark mode */
html.dark-mode .tab { background: var(--sf2); border-color: var(--bd); color: var(--tx2); }
html.dark-mode .tab:hover { color: var(--tx); }
html.dark-mode .tab.active { background: var(--sf3); border-color: var(--tx3); color: var(--tx); }

/* Source role badges in dark mode */
html.dark-mode .source-role.sales { background: #1A2A3A; color: #7AB8E8; border-color: #2A3A4A; }
html.dark-mode .source-role.inventory { background: #1A2E1F; color: #5EC47A; border-color: #2A3E2F; }
html.dark-mode .source-role.both { background: #2A2000; color: #E8B830; border-color: #3A3010; }

/* History in dark mode */
html.dark-mode .history-status.completed { color: #4ADE80; }
html.dark-mode .history-status.in-progress { color: #FBBF24; }
html.dark-mode .history-po-range { color: var(--tx) !important; }

html.dark-mode .main-area::before { background: #5A4A32; opacity: 0.1; }
html.dark-mode .main-area::after { background: #3A5A3E; opacity: 0.1; }
html.dark-mode .bg-blob-3 { background: #3A4A5A; opacity: 0.1; }
html.dark-mode .bg-blob-4 { background: #5A4A32; opacity: 0.06; }

/* Auto dark mode — follows system preference when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  html:not(.light-mode) {
    --bg: #0D0D0D;
    --sf: #1A1A1A;
    --sf2: #232323;
    --sf3: #2C2C2C;
    --bd: #2A2A2A;
    --bd2: #333333;
    --tx: #FFFFFF;
    --tx2: #B0B0B0;
    --tx3: #777777;
    --ghost: #555555;
    --acl: #1A1510;
    --acb: #3A2A1A;
    --gnl: #0D2A1F;
    --gnb: #166534;
    --bll: #0D1A2E;
    --blb: #1E3A5F;
    --aml: #2A2000;
    --amb: #4A3A00;
    --rdl: #2A0D0D;
    --rdb: #4A1A1A;
    --pending-bg: #2A2000;
    --pending-text: #FBBF24;
  }

  html:not(.light-mode) .data-mode-btn.active {
    background: var(--sf2);
    border-color: var(--sf2);
  }
  html:not(.light-mode) .data-mode-btn.active .data-mode-label { color: var(--tx); }
  html:not(.light-mode) .data-mode-btn.active .data-mode-desc { color: var(--tx3); }
  html:not(.light-mode) .data-mode-btn.active .data-mode-icon { color: var(--tx3); }
  html:not(.light-mode) .data-mode-btn.active::after { background: var(--tx); color: var(--sf); }

  html:not(.light-mode) .pill.active { background: var(--sf2); border-color: var(--sf2); color: var(--tx); }
  html:not(.light-mode) .pill.active .pill-hint { color: var(--tx3); }

  html:not(.light-mode) .sb-product-icon { background: var(--tx); color: var(--bg); }
  html:not(.light-mode) .sb-avatar { background: var(--tx); color: var(--bg); }

  html:not(.light-mode) .generate-bar { background: rgba(13,13,13,0.95); }
  html:not(.light-mode) .topbar { background: rgba(26,26,26,0.95); }

  html:not(.light-mode) .empty-state-card { border-color: var(--bd); }

  html:not(.light-mode) .tab { background: var(--sf2); border-color: var(--bd); color: var(--tx2); }
  html:not(.light-mode) .tab:hover { color: var(--tx); }
  html:not(.light-mode) .tab.active { background: var(--sf3); border-color: var(--tx3); color: var(--tx); }
  html:not(.light-mode) .source-role.sales { background: #1A2A3A; color: #7AB8E8; border-color: #2A3A4A; }
  html:not(.light-mode) .source-role.inventory { background: #1A2E1F; color: #5EC47A; border-color: #2A3E2F; }
  html:not(.light-mode) .source-role.both { background: #2A2000; color: #E8B830; border-color: #3A3010; }
  html:not(.light-mode) .history-status.completed { color: #4ADE80; }
  html:not(.light-mode) .history-status.in-progress { color: #FBBF24; }
  html:not(.light-mode) .history-po-range { color: var(--tx) !important; }

  html:not(.light-mode) .main-area::before { background: #5A4A32; opacity: 0.1; }
  html:not(.light-mode) .main-area::after { background: #3A5A3E; opacity: 0.1; }
  html:not(.light-mode) .bg-blob-3 { background: #3A4A5A; opacity: 0.1; }
  html:not(.light-mode) .bg-blob-4 { background: #5A4A32; opacity: 0.06; }
}

html, body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sa);
  font-size: 14px;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--tx3); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--tx); }

/* ===== TYPOGRAPHY ===== */
h1 { font-family: var(--se); font-size: 22px; font-weight: 400; margin-bottom: 4px; color: var(--tx); }
h2 { font-family: var(--se); font-size: 20px; font-weight: 400; margin-bottom: 8px; color: var(--tx); }
h3 { font-family: var(--se); font-size: 18px; font-weight: 400; margin-bottom: 3px; color: var(--tx); }

/* ===== LOGO / WORDMARK ===== */
/* Delegate brand */
.sb-brand {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 400;
  color: var(--tx3);
}

.sb-brand-lg {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 400;
  color: var(--tx3);
  margin-bottom: 6px;
}

.sb-brand-md {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 400;
  color: var(--tx3);
  margin-bottom: 4px;
}

.sb-product {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.sb-product-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--tx);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--se);
  font-size: 15px;
  font-weight: 400;
}

.sb-product-name {
  font-family: var(--se);
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  letter-spacing: -0.3px;
}

.sb-product-desc {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 400;
  color: var(--tx3);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx3);
  transition: all var(--transition);
  margin-top: 10px;
}

.theme-toggle:hover { background: var(--sf2); color: var(--tx); }

.theme-toggle-icon { font-size: 14px; }

.delegate-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 400;
  color: var(--tx3);
  padding: 14px 10px 0;
}

.delegate-badge span {
  font-weight: 500;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.sb-wordmark {
  font-family: var(--se);
  font-size: 18px;
  font-weight: 300;
  color: var(--tx);
  line-height: 1;
}
.sb-wordmark-lg { font-size: 36px; }
.sb-wordmark-md { font-size: 26px; }

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--sa);
  font-weight: 500;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-btn);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 12px;
}

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

.btn-primary {
  background: var(--tx);
  color: var(--sf);
  padding: 7px 18px;
}
.btn-primary:hover:not(:disabled) { background: var(--tx2); }

.btn-secondary {
  background: transparent;
  color: var(--tx2);
  border: 1px solid var(--bd);
  padding: 6px 16px;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--tx3); color: var(--tx); }

.btn-outline {
  background: transparent;
  color: var(--tx2);
  border: 1px solid var(--bd);
  padding: 6px 16px;
}
.btn-outline:hover:not(:disabled) { border-color: var(--tx3); color: var(--tx); }

.btn-danger {
  background: var(--rd);
  color: #fff;
  padding: 6px 16px;
}
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-sm { padding: 6px 16px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 13px; }

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== SETUP SCREENS ===== */
.screen { min-height: 100vh; }

.setup-step {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.setup-step.active { display: flex; }

.setup-container {
  text-align: center;
  max-width: 400px;
  width: 100%;
  padding: 2rem;
}

.setup-logo {
  margin-bottom: 0.75rem;
}

.setup-tagline {
  font-size: 14px;
  color: var(--tx3);
  font-weight: 600;
  margin-bottom: 2rem;
}

.setup-container form {
  text-align: left;
  margin-top: 1.5rem;
}

.setup-container form .btn { width: 100%; margin-top: 1rem; }

/* Wider container for path picker / provider picker / configure
   modal — those steps need more horizontal room than the company
   form. */
.setup-container-wide {
  max-width: 720px;
  text-align: left;
}
.setup-container-wide h2 { text-align: center; }
.setup-subtitle {
  text-align: center;
  color: var(--tx3);
  font-size: 14px;
  margin-bottom: 2rem;
}

/* Step progress bar (top of viewport). Renders the breadcrumb of
   onboarding steps so the user knows how far they are. */
.setup-progress {
  position: fixed;
  top: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 11px;
  color: var(--tx3);
  pointer-events: none;
  z-index: 100;
}
.setup-progress-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.setup-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--bd);
  border: 1px solid var(--bd);
}
.setup-progress-step.is-active {
  color: var(--tx);
  font-weight: 600;
}
.setup-progress-step.is-active .setup-progress-dot {
  background: var(--tx);
  border-color: var(--tx);
}
.setup-progress-step.is-done {
  color: var(--tx2);
}
.setup-progress-step.is-done .setup-progress-dot {
  background: var(--gn);
  border-color: var(--gn);
}

/* Step 3: path picker — two big cards */
.setup-path-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 1.5rem 0;
}
@media (max-width: 720px) {
  .setup-path-grid { grid-template-columns: 1fr; }
}
.setup-path-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 24px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--tx);
  transition: all 0.15s ease;
}
.setup-path-card:hover {
  border-color: var(--tx);
  background: var(--acl);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.setup-path-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.setup-path-card h3 {
  font-size: 18px;
  margin: 0 0 8px;
}
.setup-path-card p {
  font-size: 13px;
  color: var(--tx2);
  margin: 0 0 12px;
  line-height: 1.5;
}
.setup-path-best-for {
  font-size: 12px;
  color: var(--tx3);
  margin-bottom: 16px;
}
.setup-path-best-for strong { color: var(--tx2); }
.setup-path-cta {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
}

.setup-skip-link {
  display: block;
  margin: 1rem auto 0;
  background: transparent;
  border: 0;
  color: var(--tx3);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}
.setup-skip-link:hover { color: var(--tx); }

.setup-back {
  background: transparent;
  border: 0;
  color: var(--tx3);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 12px;
}
.setup-back:hover { color: var(--tx); }

/* Step 4a.1: provider picker */
.setup-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 1.5rem 0;
}
@media (max-width: 720px) {
  .setup-provider-grid { grid-template-columns: 1fr; }
}
.setup-provider-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 24px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.setup-provider-card:hover {
  border-color: var(--tx);
  background: var(--acl);
}
.setup-provider-logo {
  font-family: var(--se);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}
.setup-provider-shopify { color: #5a8a3a; }
.setup-provider-zoho    { color: #c8202c; }
.setup-provider-desc {
  font-size: 13px;
  color: var(--tx2);
  line-height: 1.5;
}
.setup-fineprint {
  text-align: center;
  font-size: 12px;
  color: var(--tx3);
  margin-top: 1rem;
}

/* Step 4a.2: configure channel — role checkbox cards */
.setup-role-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}
.setup-role-card:hover {
  border-color: var(--tx);
}
.setup-role-card input[type="checkbox"] {
  margin-top: 3px;
}
.setup-role-card-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.setup-role-card-body p {
  font-size: 12px;
  color: var(--tx2);
  margin: 0;
  line-height: 1.5;
}
.setup-role-card-nested {
  margin-left: 28px;
  background: var(--bg);
}
.setup-role-card-nested.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.setup-role-card-hint {
  font-style: italic;
}

/* Step 4a.3: sync status */
.setup-sync-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 1.5rem 0;
}
.setup-sync-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 13px;
  color: var(--tx2);
}
.setup-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--bd);
  flex-shrink: 0;
}
.setup-sync-step.is-done {
  color: var(--tx);
  background: var(--gnl);
  border-color: var(--gnb);
}
.setup-sync-step.is-done .setup-sync-dot {
  background: var(--gn);
}
.setup-sync-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--tx3);
  font-variant-numeric: tabular-nums;
}
.setup-sync-status.done { color: var(--gn); font-weight: 600; }

/* Step 4b: excel landing — checklist of next steps */
.setup-checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 1.5rem 0;
}
.setup-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.setup-checklist-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--tx);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--se);
  font-size: 14px;
  font-weight: 600;
}
.setup-checklist-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.setup-checklist-item p {
  font-size: 12px;
  color: var(--tx2);
  margin: 0;
  line-height: 1.5;
}
.setup-excel-cta {
  display: flex;
  gap: 12px;
  margin-top: 1.5rem;
}
.setup-excel-cta .btn { flex: 1; }
@media (max-width: 480px) {
  .setup-excel-cta { flex-direction: column; }
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--tx3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea {
  width: 100%;
  font-family: var(--sa);
  font-weight: 500;
  font-size: 13px;
  padding: 9px 12px;
  border: 1.5px solid var(--bd);
  border-radius: var(--radius-btn);
  background: var(--sf);
  color: var(--tx);
  transition: all var(--transition);
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--tx3);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--ac);
  background: var(--sf);
}

.form-group textarea { resize: vertical; }

.form-tip {
  display: block;
  font-size: 11px;
  color: var(--tx3);
  font-weight: 400;
  margin-top: 4px;
}

.required { color: var(--am); }

.tip-box {
  background: var(--acl);
  border: 1px solid var(--acb);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--tx2);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--ac);
  cursor: pointer;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sf);
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 100;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.sb-logo {
  padding: 20px 18px 20px;
  border-bottom: 1px solid var(--bd);
}

.sidebar-section-label {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--tx3);
  padding: 20px 16px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sa);
  font-size: 14px;
  font-weight: 400;
  padding: 9px 14px;
  margin: 1px 6px;
  color: var(--tx2);
  text-decoration: none;
  transition: all var(--transition);
  border-left: none;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-item:hover {
  color: var(--tx);
  background: var(--sf2);
  text-decoration: none;
}
/* Sidebar item label/badge layout. Most items don't have a badge
 * so they default to a single label. Smart Reorder + future items
 * can render a count chip on the right that floats to the end. */
.sidebar-item-label { flex: 1; min-width: 0; }
.sidebar-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--tx2);
  background: var(--sf3);
  border-radius: 999px;
  flex-shrink: 0;
}
.sidebar-item-badge.is-critical {
  color: #fff;
  background: var(--rd);
}
.sidebar-item.active .sidebar-item-badge {
  background: rgba(255, 255, 255, 0.15);
  color: var(--sf);
}
.sidebar-item.active .sidebar-item-badge.is-critical {
  background: var(--rd);
  color: #fff;
}

.sidebar-item.active {
  color: var(--sf);
  background: var(--tx);
  border-left-color: transparent;
  font-weight: 500;
  position: relative;
}

.sidebar-item.active::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gnl);
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.sidebar-item.disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.coming-soon-badge {
  font-family: var(--sa);
  font-size: 9px;
  font-weight: 500;
  color: var(--tx3);
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 100px;
  padding: 1px 6px;
  margin-left: auto;
}

.sidebar-bottom {
  padding: 14px 16px;
  border-top: 1px solid var(--bd);
}

.sb-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.sb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tx);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--se);
  font-size: 11px;
  color: var(--bg);
  font-weight: 400;
  flex-shrink: 0;
}

.sidebar-profile-name {
  font-family: var(--sa);
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-link {
  font-size: 10px;
  color: var(--tx3);
}

/* ===== MAIN AREA ===== */
.main-area {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  width: calc(100vw - var(--sidebar-w));
  position: relative;
}

/* Background decorative blobs */
.main-area::before,
.main-area::after {
  content: '';
  position: fixed;
  border-radius: 60% 40% 50% 50%;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.main-area::before {
  width: 380px;
  height: 280px;
  background: #C4A882;
  top: 60px;
  right: -40px;
  transform: rotate(-15deg);
}

.main-area::after {
  width: 220px;
  height: 200px;
  background: #8BAF8E;
  top: 300px;
  right: 80px;
  border-radius: 40% 60% 50% 50%;
  transform: rotate(10deg);
}

.bg-blob-3,
.bg-blob-4 {
  position: fixed;
  border-radius: 50% 50% 40% 60%;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.bg-blob-3 {
  width: 180px;
  height: 150px;
  background: #A8B4C4;
  top: 520px;
  right: -10px;
  transform: rotate(-8deg);
}

.bg-blob-4 {
  width: 80px;
  height: 80px;
  background: #C4A882;
  top: 200px;
  right: 280px;
  border-radius: 50%;
  opacity: 0.1;
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--bd);
  background: rgba(253,252,249,0.95);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  /* z-index 250 (was 50) — needs to sit ABOVE the notification
     drawer's overlay (z-index 199). The topbar's position:sticky
     creates a stacking context for everything inside it (including
     the notification drawer hanging below it). If the topbar's
     z-index is below the overlay, the entire drawer becomes
     unclickable in the area where the overlay covers — which is
     basically everywhere outside the bell icon. */
  z-index: 250;
}

.topbar-left { flex: 1; }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sa);
  font-size: 12px;
}

.breadcrumb-root {
  font-weight: 400;
  color: var(--tx3);
}

.breadcrumb-sep {
  color: var(--tx3);
  opacity: 0.4;
}

.breadcrumb-active {
  font-weight: 500;
  color: var(--tx);
}

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

.btn-topbar {
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
}

.topbar-title {
  font-family: var(--se);
  font-size: 19px;
  font-weight: 400;
  color: var(--tx);
  margin-bottom: 2px;
}

.topbar-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: var(--tx3);
}

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

/* ===== NOTIFICATION BELL & DRAWER ===== */
.btn-icon-topbar {
  position: relative;
  background: none;
  border: 1px solid var(--bd);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tx2);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  margin-left: 8px;
}
.btn-icon-topbar:hover {
  border-color: var(--tx3);
  color: var(--tx);
}
/* In dark mode --bd is #2A2A2A, only ~6% above the canvas, so the
 * bell icon's ring nearly disappears against the topbar. Bump it
 * to a more visible elevated stroke + a subtle filled bg so the
 * notification entry point reads at a glance. */
html.dark-mode .btn-icon-topbar {
  border-color: var(--bd2);
  background: var(--sf);
}
html.dark-mode .btn-icon-topbar:hover {
  border-color: var(--tx3);
  background: var(--sf2);
}
.btn-icon-topbar svg { pointer-events: none; }
.btn-icon-topbar .notif-badge { pointer-events: none; }

/* dl8 active org chip in the topnav. Two render modes from
   js/orgs.js → Orgs._renderTopnav():
   - Solo user (1 org): static chip showing the org name
   - Multi-org user: button + dropdown switcher */
.topnav-org {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  font-size: 12px;
  color: var(--tx2);
}
.topnav-org-name {
  padding: 6px 10px;
  border: 1px solid var(--bd);
  border-radius: 999px;
  font-weight: 500;
  background: var(--sf);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav-org-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--bd);
  border-radius: 999px;
  background: var(--sf);
  color: var(--tx2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.topnav-org-button:hover {
  border-color: var(--tx3);
  color: var(--tx);
}
.topnav-org-caret {
  font-size: 10px;
  color: var(--tx3);
  line-height: 1;
}
.topnav-org-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: 4px;
  z-index: 50;
}
.topnav-org-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--tx);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.topnav-org-item:hover {
  background: var(--sf2);
}
.topnav-org-item.is-active {
  color: var(--tx);
  font-weight: 600;
}
.topnav-org-check {
  color: var(--bl);
  font-size: 12px;
}

/* Activation screen — shown when user has dl8 orgs but the active
   one doesn't have Orderly enabled. Defensive scaffold; for Samad's
   case (Orderly already active on MK Distro) this never renders. */
#activation-screen {
  position: fixed;
  inset: 0;
  background: var(--sf2);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  z-index: 100;
  overflow-y: auto;
}
.activation-card {
  width: 100%;
  max-width: 480px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.06);
}
.activation-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx3);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.activation-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--tx);
}
.activation-desc {
  font-size: 14px;
  color: var(--tx2);
  line-height: 1.55;
  margin: 0 0 24px 0;
}
.activation-orgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.activation-org-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.activation-org-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--tx);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.activation-org-role {
  font-size: 10px;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--bd);
  border-radius: 4px;
}
.activation-divider {
  text-align: center;
  margin: 16px 0;
  color: var(--tx3);
  font-size: 12px;
  position: relative;
}
.activation-divider::before,
.activation-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--bd);
}
.activation-divider::before { left: 0; }
.activation-divider::after  { right: 0; }
.activation-divider span { padding: 0 8px; background: var(--sf); }
.activation-create-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--bd);
  border-radius: 10px;
  color: var(--tx2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.activation-create-btn:hover {
  border-color: var(--tx3);
  color: var(--tx);
}
.activation-error {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--rl);
  border: 1px solid var(--rb);
  border-radius: 8px;
  color: var(--r);
  font-size: 13px;
}

/* Members tab — list of org members + pending invitations */
.members-card {
  margin-bottom: 16px;
}
.members-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.members-card-header h3 {
  margin: 0;
  font-size: 14px;
}
.members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 13px;
}
.member-row-pending {
  background: var(--sf);
  border-style: dashed;
  color: var(--tx2);
}
.member-id {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.member-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--acl);
  color: var(--ac);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.member-text {
  min-width: 0;
  flex: 1;
}
.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-email {
  font-size: 12px;
  color: var(--tx3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-you {
  font-size: 10px;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--bd);
  border-radius: 4px;
}
.member-role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx3);
  padding: 2px 8px;
  border: 1px solid var(--bd);
  border-radius: 4px;
}
.member-role-owner {
  color: var(--bl);
  background: var(--bll);
  border-color: var(--blb);
}
.member-role-admin {
  color: var(--gn);
  background: var(--gnl);
  border-color: var(--gnb);
}
.empty-state-small {
  padding: 12px;
  font-size: 13px;
  color: var(--tx3);
  text-align: center;
}

/* Alert feed cards (in-app notification drawer + Overview alert feed).
   One row per alert with a colored severity icon, title, description,
   and relative-time meta line. Clicking routes to the relevant screen
   (stockouts → reorder, sync errors → integrations). */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
  transition: background var(--transition);
}
.alert-card:last-child { border-bottom: none; }
.alert-card:hover { background: var(--sf2); }
.alert-card.alert-resolved { opacity: 0.65; }

.alert-card-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}
.alert-card.alert-warning .alert-card-icon {
  color: var(--am);
  background: var(--aml);
  border: 1px solid var(--amb);
}
.alert-card.alert-error .alert-card-icon {
  color: var(--r);
  background: var(--rl);
  border: 1px solid var(--rb);
}
.alert-card.alert-success .alert-card-icon {
  color: var(--gn);
  background: var(--gnl);
  border: 1px solid var(--gnb);
}
.alert-card.alert-info .alert-card-icon {
  color: var(--bl);
  background: var(--bll);
  border: 1px solid var(--blb);
}

.alert-card-body {
  flex: 1;
  min-width: 0;
}
.alert-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-card-desc {
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.45;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.alert-card-meta {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 4px;
}
.alert-card-action {
  font-size: 12px;
  color: var(--tx2);
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--sf2);
  border-left: 2px solid var(--bl);
  border-radius: 4px;
  line-height: 1.45;
}
.alert-card-action strong {
  color: var(--tx);
  font-weight: 600;
}
/* Subtle indicator that an alert hasn't been seen yet — matches the
   bell badge state. Disappears as soon as the drawer is opened. */
.alert-card.alert-unread .alert-card-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bl);
  margin-right: 6px;
  vertical-align: middle;
}

/* "Mark all read" + "Open overview" sit side-by-side in the
   drawer footer. Both use .btn .btn-secondary; the markAllRead
   button id is preserved so app.js can hide it when there's
   nothing unread. */

/* Stat-card 'attention' modifier — flips an Overview stat card
   (currently just the stockouts card) to a red-tinted warning state
   when its value is non-zero. Subtle by design; we don't want the
   Overview to look alarmed for a single stockout. */
.stat-card.stat-card-attention {
  background: var(--rl);
  border-color: var(--rb);
}
.stat-card.stat-card-attention .stat-value {
  color: var(--r);
}

/* Notification preferences (Settings → Notifications card). Three
   channel rows (email / Slack / in-app), then a divider, then a
   per-kind subscription list. */
.notif-prefs-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--bd);
}
.notif-prefs-section:last-of-type {
  border-bottom: none;
}
.notif-prefs-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  padding: 8px 0;
}
.notif-prefs-row input[type="checkbox"] {
  margin: 0;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--bl);
}
.notif-prefs-row input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.notif-prefs-row-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--tx);
}
.notif-prefs-row-desc {
  font-size: 12px;
  color: var(--tx3);
  margin-top: 2px;
  line-height: 1.45;
}
.notif-prefs-divider {
  height: 1px;
  background: var(--bd);
  margin: 8px 0 14px 0;
}
.notif-prefs-kinds-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.notif-prefs-kind-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--tx2);
}
.notif-prefs-kind-row input[type="checkbox"] {
  margin: 0;
  margin-top: 2px;
  flex: none;
  accent-color: var(--bl);
  cursor: pointer;
}
.notif-prefs-kind-row strong {
  color: var(--tx);
}

/* Slack channel-picker modal — list of channels with hash/lock icons.
   Mirrors Slack's own channel-picker UX so the affordance reads
   immediately. */
.slack-channel-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
}
.slack-channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--bd);
  text-align: left;
  font-size: 13px;
  color: var(--tx);
  cursor: pointer;
  transition: background var(--transition);
}
.slack-channel-row:last-child {
  border-bottom: none;
}
.slack-channel-row:hover {
  background: var(--sf2);
}
.slack-channel-hash {
  color: var(--tx3);
  flex: none;
  font-size: 14px;
  width: 16px;
  text-align: center;
}
.slack-channel-name {
  flex: 1;
  font-weight: 500;
}
.slack-channel-members {
  font-size: 11px;
  color: var(--tx3);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--ac);
  color: var(--ac-text);
  font-family: var(--sa);
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  /* Tiny outer ring so the badge reads as separated from the bell
   * icon in both modes — matches Slack/Linear-style notification dots. */
  box-shadow: 0 0 0 2px var(--bg);
}

.notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
  display: none;
}
.notif-overlay.open { display: block; }

.notif-dropdown {
  /* Dropdown is anchored to its relative-positioned topbar parent.
     The parent doesn't establish a high enough stacking context, so
     a plain z-index:200 here sometimes loses to the fixed overlay's
     z-index:199 in cross-context comparison — which lets the overlay
     intercept clicks on the dropdown's footer buttons. Pin to 1000
     so the dropdown unambiguously sits above the overlay regardless
     of the parent's stacking. */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--sf);
  z-index: 1000;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.notif-dropdown.open { display: flex; }

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bd);
}
.notif-drawer-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--tx3);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.notif-drawer-close:hover { color: var(--tx); }

.notif-dropdown-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  max-height: 360px;
}

.notif-dropdown-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--bd);
}

.notif-run-item {
  padding: 14px 16px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.notif-run-item:hover { border-color: var(--tx3); }

.notif-run-date {
  font-family: var(--sa);
  font-size: 11px;
  font-weight: 500;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.notif-run-title {
  font-family: var(--se);
  font-size: 15px;
  font-weight: 400;
  color: var(--tx);
  margin-bottom: 4px;
}
.notif-run-meta {
  font-family: var(--sa);
  font-size: 12px;
  color: var(--tx3);
}
.notif-run-status {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.notif-run-status.completed { background: var(--gnl); color: var(--gn); }
.notif-run-status.in_progress { background: #fef3cd; color: #856404; }

.notif-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--tx3);
  font-family: var(--sa);
  font-size: 13px;
}

/* ===== APP CONTENT ===== */
.app-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.app-content.active { display: block; }

.content-wrapper {
  width: 100%;
  /* Bumped from the original 860px cap so data-heavy pages
   * (Suppliers grid, Smart Reorder tables, Dashboard report grid)
   * stretch on wider monitors. 1400px is a comfortable upper bound —
   * wide enough for ~6-column tables, narrow enough that text
   * stays readable on ultrawide displays. */
  max-width: 1400px;
  padding-bottom: 160px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 8px;
}

.page-header-eyebrow {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tx3);
  margin-bottom: 12px;
}

.page-header-title {
  font-family: var(--se);
  font-size: 44px;
  font-weight: 300;
  color: var(--tx);
  letter-spacing: -0.8px;
  line-height: 1.08;
  margin-bottom: 14px;
}

.page-header-title em {
  font-style: italic;
  font-weight: 300;
}

.page-header-desc {
  font-family: var(--sa);
  font-size: 14px;
  font-weight: 400;
  color: var(--tx3);
  line-height: 1.65;
  max-width: 520px;
}

.page-header-divider {
  border-top: 1px solid var(--bd);
  margin-top: 28px;
  margin-bottom: 28px;
}

/* Two-column layout — title block on the left, action cluster on
 * the right. Used by Smart Reorder so Refresh + Reorder Settings
 * sit at the page level (matching the Dashboard's pattern) rather
 * than getting buried in the dense actions bar below. The divider
 * stays full-width via `grid-column` so it spans both columns. */
.page-header.page-header-with-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 24px;
  align-items: start;
}
.page-header.page-header-with-actions .page-header-titles { min-width: 0; }
.page-header.page-header-with-actions .page-header-divider {
  grid-column: 1 / -1;
}
.page-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: end;
  margin-top: 14px; /* aligns visually with title baseline */
}

/* Reorder refresh button — same is-refreshing/spin pattern as
 * the dashboard's .dash-refresh-btn. Reused class so the two
 * pages have identical Refresh affordances. */
.reorder-refresh-icon {
  display: inline-block;
  margin-right: 2px;
  font-weight: 700;
}
.reorder-refresh-btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}
.reorder-refresh-btn.is-refreshing .reorder-refresh-icon {
  animation: dash-refresh-spin 0.8s linear infinite;
}

/* ===== INTRO BANNER (legacy) ===== */
.intro-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  margin-bottom: 24px;
  position: relative;
}

.intro-banner-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.intro-banner-content h3 {
  font-family: var(--se);
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 4px;
}

.intro-banner-content p {
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.5;
}

.intro-banner-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--tx3);
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

.intro-banner-close:hover { color: var(--tx); }

/* ===== DATA MODE SELECTOR ===== */
.data-mode-options {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.data-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 24px;
  height: 200px;
  border-radius: var(--radius-card);
  border: 1.5px solid var(--bd);
  background: var(--sf);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.data-mode-btn:hover {
  border-color: var(--tx3);
  background: var(--bg);
}

.data-mode-btn.active {
  background: var(--tx);
  border-color: var(--tx);
}

.data-mode-btn.active::after {
  content: '✓';
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sf);
  color: var(--tx);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.data-mode-btn.active .data-mode-icon {
  color: rgba(253,252,249,0.5);
}

.data-mode-icon {
  font-size: 24px;
  color: var(--tx3);
}

.data-mode-text {
  margin-top: auto;
}

.data-mode-label {
  font-family: var(--se);
  font-size: 18px;
  font-weight: 400;
  color: var(--tx);
  display: block;
  margin-bottom: 6px;
}

.data-mode-desc {
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 400;
  color: var(--tx3);
  line-height: 1.55;
  display: block;
}

.data-mode-btn.active .data-mode-label {
  color: var(--sf);
}

.data-mode-btn.active .data-mode-desc {
  color: rgba(253,252,249,0.55);
}

/* ===== CARDS ===== */
.card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 24px 26px;
  margin-bottom: 28px;
  box-shadow: var(--shs);
  width: 100%;
}

.card h3 {
  font-family: var(--se);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 4px;
}

.card-danger {
  border-color: var(--rdb);
}

/* Yellow-bordered "watch out, this affects everything" card.
 * Used for org-wide settings whose impact is global (e.g. SKU
 * exclusions). Subtler than card-danger but still visually flags
 * the user. */
.card-warning {
  border-color: #f0c050;
  background: linear-gradient(180deg, rgba(240, 192, 80, 0.04), transparent);
}

/* === Global SKU exclusions card === */
.excl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.excl-count {
  flex-shrink: 0;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx3);
  background: var(--sf);
  border-radius: 999px;
}
.excl-count-active {
  color: #8a5a00;
  background: #fff5d6;
  border: 1px solid #f0d27a;
}
.excl-warning {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #6a4400;
  background: #fff5d6;
  border: 1px solid #f0d27a;
  border-radius: 8px;
}
.excl-warning strong { color: #4a2e00; }
.excl-rule {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.excl-rule select,
.excl-rule input {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
}
.excl-rule select { min-width: 140px; }
.excl-rule input { flex: 1; min-width: 120px; }
.excl-rule input:disabled { background: var(--sf); color: var(--tx3); }
.excl-rule-remove {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--bd);
  border-radius: 6px;
  font-size: 14px;
  color: var(--tx3);
  cursor: pointer;
  flex-shrink: 0;
}
.excl-rule-remove:hover {
  color: var(--rd);
  border-color: var(--rd);
}
.excl-empty {
  font-size: 13px;
  color: var(--tx3);
  font-style: italic;
  margin: 8px 0 12px;
}
.excl-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.excl-combinator {
  margin-left: auto;
  font-size: 13px;
  color: var(--tx3);
}
.excl-combinator select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
}

/* "Currently matching" preview list — shown under the rule editor
 * so users see exactly which SKUs will be hidden before saving. */
.excl-preview {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bd);
}
.excl-preview-loading {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bd);
  font-size: 13px;
  color: var(--tx3);
  font-style: italic;
}
.excl-preview-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.excl-preview-header strong { font-size: 13px; color: var(--tx); }
.excl-preview-count {
  font-size: 12px;
  font-weight: 600;
  color: #8a5a00;
  background: #fff5d6;
  border: 1px solid #f0d27a;
  padding: 1px 8px;
  border-radius: 999px;
}
.excl-preview-desc {
  font-size: 12px;
  color: var(--tx3);
  margin: 0 0 10px;
}
.excl-preview-empty {
  font-size: 13px;
  color: var(--tx3);
  font-style: italic;
  margin: 8px 0 0;
}
.excl-preview-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
}
.excl-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--bd);
}
.excl-preview-row:last-child { border-bottom: none; }
.excl-preview-row:hover { background: var(--sf); }
.excl-preview-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx);
}
.excl-preview-sku {
  font-size: 11px;
  color: var(--tx3);
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.excl-preview-vendor {
  font-size: 11px;
  color: var(--tx3);
  flex-shrink: 0;
}
.excl-preview-archived-tag {
  font-size: 11px;
  color: var(--tx3);
  font-weight: 500;
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.excl-preview-row-archived .excl-preview-name {
  color: var(--tx3);
  font-style: italic;
}
.excl-preview-overflow {
  margin-top: 8px;
  font-size: 12px;
  color: var(--tx3);
  font-style: italic;
  text-align: center;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-heading {
  margin-bottom: 14px;
  margin-top: 32px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-desc {
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 400;
  color: var(--tx3);
  margin-top: 6px;
  line-height: 1.5;
}

.sources-section-label {
  font-family: var(--sa);
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
  margin-top: 20px;
}

.sources-section-label:first-child {
  margin-top: 0;
}

.sources-section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.source-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--sf);
  border: 1.5px dashed var(--bd);
  border-radius: var(--radius-card);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.source-placeholder:hover {
  border-color: var(--tx3);
  background: var(--bg);
}

.source-placeholder-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sf2);
  color: var(--tx3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 300;
  margin-bottom: 4px;
}

.source-placeholder-label {
  font-family: var(--sa);
  font-size: 14px;
  font-weight: 500;
  color: var(--tx);
}

.source-placeholder-hint {
  font-family: var(--sa);
  font-size: 12px;
  font-weight: 400;
  color: var(--tx3);
}

.source-placeholder-ghost {
  opacity: 0.45;
  border-style: dashed;
}

.source-placeholder-ghost:hover {
  opacity: 0.7;
}

.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--sf);
  border: 1px dashed var(--bd);
  border-radius: var(--radius-card);
  padding: 40px 24px;
  text-align: center;
  color: var(--tx3);
  font-size: 13px;
  margin-bottom: 28px;
}

.section-heading h3 {
  font-family: var(--se);
  font-size: 24px;
  font-weight: 400;
  color: var(--tx);
}

.step-badge {
  font-family: var(--sa);
  font-size: 10px;
  font-weight: 500;
  color: var(--tx3);
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 100px;
  padding: 3px 9px;
  margin-left: 8px;
  vertical-align: middle;
  font-style: normal;
}

.card-desc {
  font-family: var(--sa);
  font-size: 14px;
  color: var(--tx2);
  font-weight: 400;
  margin-bottom: 18px;
}

/* ===== PILL SELECTOR (Match Key) ===== */
.pill-selector {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--sa);
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--bd);
  background: var(--sf);
  color: var(--tx2);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pill-main {
  font-weight: 400;
}

.pill-hint {
  font-size: 9px;
  font-weight: 400;
}

.pill:hover { border-color: var(--tx3); color: var(--tx); }

.pill.active {
  background: var(--tx);
  border-color: var(--tx);
  color: var(--sf);
}

.pill.active .pill-hint { color: rgba(253,252,249,0.55); }

/* ===== TOGGLE SWITCH ===== */
.fuzzy-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.fuzzy-bracket {
  font-weight: 400;
  color: var(--tx3);
  font-size: 10px;
}

.fuzzy-explain {
  font-size: 10.5px;
  color: var(--tx3);
  line-height: 1.4;
  margin: 0;
  padding-left: 44px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--tx2);
}

.toggle-label input { display: none; }

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--bd2);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: none;
}

.toggle-label input:checked + .toggle-switch {
  background: var(--ac);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

/* ===== FUZZY MATCHING PANEL ===== */
.fuzzy-panel {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 10px;
}

.fuzzy-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.fuzzy-slider-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--tx3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fuzzy-slider-value {
  font-size: 13px;
  font-weight: 800;
  color: var(--ac);
  min-width: 36px;
  text-align: right;
}

.fuzzy-slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--bd2);
  outline: none;
}

.fuzzy-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ac);
  cursor: pointer;
  border: 2px solid var(--sf);
  box-shadow: none;
}

.fuzzy-example {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 10px 14px;
}

.fuzzy-example-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.fuzzy-example-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 980px;
  background: var(--acl);
  border: 1px solid var(--acb);
  color: var(--ac);
}

.fuzzy-example-badge.risky {
  background: var(--aml);
  border-color: var(--amb);
  color: var(--am);
}

.fuzzy-example-badge.danger {
  background: var(--rdl);
  border-color: var(--rdb);
  color: var(--rd);
}

.fuzzy-example-desc {
  font-size: 11px;
  color: var(--tx3);
  font-weight: 600;
}

.fuzzy-example-match {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fuzzy-example-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fuzzy-example-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--tx3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fuzzy-example-item span:last-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--tx);
}

.fuzzy-example-arrow {
  font-size: 14px;
  color: var(--tx3);
  flex-shrink: 0;
}

/* ===== SETTINGS GRID ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== SOURCES ===== */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.sources-empty {
  display: block;
  margin-bottom: 28px;
}

.source-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shs);
}

.source-card.sc-border-green { border-color: var(--gnb); }
.source-card.sc-border-blue { border-color: var(--blb); }

.sc-top {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bd);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sc-top > div:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.source-card .source-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 2px;
}

.source-card .source-role {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 980px;
  margin-bottom: 7px;
}

.source-role.sales { background: var(--acl); color: var(--ac); border: 1.5px solid var(--acb); }
.source-role.inventory { background: var(--bll); color: var(--bl); border: 1.5px solid var(--blb); }
.source-role.both { background: var(--aml); color: var(--am); border: 1.5px solid var(--amb); }

.source-card .source-file {
  font-size: 11px;
  color: var(--tx3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-body {
  padding: 12px 14px;
}

.sc-status {
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
}

.sc-status-ok {
  color: var(--gn);
  background: var(--gnl);
  border: 1px solid var(--gnb);
}

.sc-status-warn {
  color: var(--am);
  background: var(--aml);
  border: 1px solid var(--amb);
}

.sc-edit-link {
  font-size: 10px;
  color: var(--tx3);
  text-decoration: underline;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--sa);
  font-weight: 600;
}

.sc-edit-link:hover { color: var(--tx); }

.sc-stats {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.sc-stat {
  font-size: 10px;
  font-weight: 600;
  background: var(--sf2);
  border: 1px solid var(--bd);
  padding: 3px 8px;
  border-radius: 980px;
  color: var(--tx2);
}

.source-remove {
  font-size: 16px;
  color: var(--tx3);
  cursor: pointer;
  border: 1.5px solid var(--bd);
  background: var(--sf2);
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
  transition: all var(--transition);
}
.source-remove:hover { background: var(--rdl); color: var(--rd); border-color: var(--rdb); }

/* ===== FILE DROP ===== */
.file-drop {
  border: 1.5px dashed var(--bd2);
  border-radius: 7px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--sf2);
}

.file-drop:hover, .file-drop.dragover {
  border-color: var(--ac);
  background: var(--acl);
}

.file-drop-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  margin-bottom: 4px;
}

.file-drop-text strong { color: var(--ac); }

.file-drop-hint {
  font-size: 10px;
  color: var(--tx3);
}

/* ===== MAPPING ===== */
.mapping-grid {
  display: grid;
  gap: 9px;
}

.mapping-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 9px;
}

.mapping-row label {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: var(--tx2);
}

.mapping-row label .required { margin-left: 2px; }

.mapping-row select {
  width: 100%;
  font-family: var(--sa);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 9px;
  border: 1.5px solid var(--bd);
  border-radius: 7px;
  background: var(--sf2);
  color: var(--tx);
  outline: none;
}
.mapping-row select:focus { border-color: var(--ac); background: var(--sf); }

.mapping-row select option:disabled {
  color: var(--bd2);
  background: var(--sf2);
  font-style: italic;
}

.mapping-preview {
  margin-top: 12px;
  font-size: 11px;
  color: var(--tx3);
  max-height: 140px;
  overflow-y: auto;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 10px;
}

.mapping-preview table {
  width: 100%;
  border-collapse: collapse;
}

.mapping-preview th,
.mapping-preview td {
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid var(--bd);
  font-size: 10px;
}

.mapping-preview th { font-weight: 800; color: var(--tx3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
}

.tab {
  font-family: var(--sa);
  font-weight: 700;
  padding: 6px 13px;
  border: 1.5px solid var(--bd2);
  background: var(--sf2);
  color: var(--tx3);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab:hover { color: var(--tx); }
.tab.active { background: var(--acl); border-color: var(--acb); color: var(--ac); }

.tabs-primary { margin-bottom: 6px; }
.tabs-secondary { margin-bottom: 14px; }

.history-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-controls-row .tabs-secondary {
  margin-bottom: 0;
}

.history-sort {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-sort-label {
  font-size: 11px;
  color: var(--tx3);
  font-weight: 600;
}

.history-sort select {
  font-family: var(--sa);
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--bd2);
  border-radius: 6px;
  background: var(--sf);
  color: var(--tx);
  cursor: pointer;
}
.tab-sm { padding: 4px 10px; font-size: 10px; border-radius: 5px; }

/* ===== AGGREGATED HISTORY CARDS ===== */
.history-agg-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: var(--shs);
  margin-bottom: 10px;
  overflow: hidden;
}

.history-agg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.history-agg-header:hover { background: var(--sf2); }

.history-agg-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 2px;
}

.history-agg-meta {
  font-size: 11px;
  color: var(--tx3);
  display: flex;
  gap: 12px;
}

.history-agg-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.history-agg-body {
  display: none;
  padding: 0 16px 12px;
  border-top: 1px solid var(--bd);
}

.history-agg-card.expanded .history-agg-body {
  display: block;
  padding-top: 12px;
}

.history-agg-card.expanded .history-expand-icon {
  transform: rotate(180deg);
}

/* ===== PO DASHBOARD ===== */
.dashboard-bulk-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dashboard-error-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--aml);
  border: 1px solid var(--amb);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--am);
  margin-bottom: 14px;
}

.dashboard-fuzzy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bll);
  border: 1px solid var(--blb);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bl);
  margin-bottom: 14px;
}

.po-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ===== DATA WARNING BANNER ===== */
.data-warning-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--aml);
  border: 1px solid var(--amb);
  border-radius: 10px;
  padding: 14px 16px;
}

.data-warning-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.data-warning-banner h4 {
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 700;
  font-style: normal;
  color: var(--am);
}

.data-warning-banner .card-desc {
  color: var(--tx2);
  margin-bottom: 0;
}

/* ===== SUPPLIERS TOOLBAR ===== */
/* Sits above the suppliers grid. Two render modes:
   - Default: filter (category + brand) + sort dropdowns
   - Selection mode: count + select-all + cancel + delete buttons */
.suppliers-toolbar {
  margin-bottom: 14px;
}
.suppliers-toolbar:empty { display: none; }
.suppliers-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.suppliers-toolbar-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.suppliers-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.suppliers-toolbar-control select {
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--sf);
  color: var(--tx);
  font-size: 13px;
  cursor: pointer;
}
.suppliers-toolbar-control select:focus {
  outline: none;
  border-color: var(--bl);
}
.suppliers-toolbar-clear {
  margin-left: auto;
  background: none;
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--bl);
  cursor: pointer;
  border-radius: 6px;
}
.suppliers-toolbar-clear:hover {
  background: var(--bll);
}
/* Pushed to the right edge of the toolbar so it sits opposite
 * the filter/sort controls. Same flex-pattern as the Clear filters
 * button — `margin-left: auto` claims the remaining space. When
 * Clear filters is also visible it sits to the LEFT of Resync;
 * the small gap from the toolbar-row's `gap` keeps them tidy. */
.suppliers-toolbar-resync {
  margin-left: auto;
  flex-shrink: 0;
}

/* Active / Dismissed view tabs. Pill-shaped segmented control to
   the LEFT of the filter cluster — first thing the user sees. */
.suppliers-view-tabs {
  display: inline-flex;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.suppliers-view-tab {
  border: 0;
  background: transparent;
  color: var(--tx2);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.suppliers-view-tab:hover { color: var(--tx); }
.suppliers-view-tab.is-active {
  background: var(--sf);
  color: var(--tx);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.suppliers-view-tab-count {
  font-size: 11px;
  color: var(--tx3);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.suppliers-view-tab.is-active .suppliers-view-tab-count {
  color: var(--tx);
  background: var(--sf);
}
.suppliers-toolbar-hint {
  font-size: 12px;
  color: var(--tx3);
  margin-left: 12px;
}

/* Dismissed-card variant: muted, no drag handle, prominent badge.
   Restore is the primary action; Delete-permanently is destructive. */
.supplier-card-dismissed {
  opacity: 0.78;
  background: var(--sf);
}
.supplier-card-dismissed:hover { opacity: 1; }
.supplier-dismissed-badge {
  font-size: 10px;
  letter-spacing: 0.04em;
  background: var(--bg);
  color: var(--tx3);
  border: 1px solid var(--bd);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Selection mode bar */
.suppliers-toolbar-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bll);
  border: 1px solid var(--blb);
  border-radius: 10px;
}
.suppliers-toolbar-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--bl);
  flex: 1;
}

/* ===== SUPPLIERS GRID ===== */
.suppliers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.supplier-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shs);
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

/* Drag-drop visual states */
.supplier-card[draggable="true"] { cursor: grab; }
.supplier-card[draggable="true"]:active { cursor: grabbing; }
.supplier-card.supplier-dragging { opacity: 0.4; }
.supplier-card.supplier-drag-over {
  border-color: var(--bl);
  box-shadow: 0 0 0 2px var(--bll);
}
.supplier-card.supplier-card-selected {
  border-color: var(--bl);
  background: var(--bll);
}

/* Header row: checkbox, drag handle, name, source tags */
.supplier-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.supplier-card-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  margin-top: 3px;
  flex: none;
  cursor: pointer;
  accent-color: var(--bl);
}
.supplier-drag-handle {
  color: var(--tx3);
  font-size: 14px;
  letter-spacing: -3px;
  user-select: none;
  cursor: grab;
  margin-top: 1px;
  padding: 0 2px;
  flex: none;
}
.supplier-drag-handle:active { cursor: grabbing; }
.supplier-card-header-main {
  flex: 1;
  min-width: 0;
}

/* Category chips (auto-derived from products.product_type per brand) */
.supplier-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 9px;
}
.supplier-category-chip {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--sf2);
  color: var(--tx2);
  border: 1px solid var(--bd);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.supplier-category-chip-more {
  color: var(--tx3);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.supplier-card .supplier-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 8px;
}

.supplier-card .supplier-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 9px;
}

.brand-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--acl);
  color: var(--ac);
  border: 1px solid var(--acb);
  border-radius: 980px;
}

.supplier-contact {
  font-size: 11px;
  color: var(--tx3);
  line-height: 1.6;
}

.supplier-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--bd);
}

/* ===== HISTORY ===== */
.history-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: var(--shs);
  margin-bottom: 10px;
  overflow: hidden;
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.history-card-header:hover { background: var(--sf2); }

.history-info { flex: 1; }

.history-info .history-po-range {
  font-size: 13px;
  font-weight: 700;
  color: var(--ac);
  margin-bottom: 2px;
}

.history-info .history-meta {
  font-size: 11px;
  color: var(--tx3);
  display: flex;
  gap: 12px;
}

.history-status {
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 980px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-status.completed { background: var(--gnl); color: var(--gn); border: 1px solid var(--gnb); }
.history-status.in-progress { background: var(--acl); color: var(--ac); border: 1px solid var(--acb); }

.history-expand-icon {
  font-size: 12px;
  color: var(--tx3);
  transition: transform var(--transition);
  margin-left: 12px;
}

.history-card.expanded .history-expand-icon {
  transform: rotate(180deg);
}

.history-card-body {
  display: none;
  padding: 0 16px 12px;
  border-top: 1px solid var(--bd);
}

.history-card.expanded .history-card-body { display: block; padding-top: 12px; }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bd);
  font-size: 12px;
}

.history-row:last-child { border-bottom: none; }

.history-row-info { flex: 1; }
.history-row-actions { display: flex; gap: 5px; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.modal {
  background: var(--sf);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

.modal-lg { max-width: 520px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--se);
  font-size: 18px;
  font-style: italic;
  margin-bottom: 0;
}

.modal-close {
  font-size: 18px;
  color: var(--tx3);
  cursor: pointer;
  border: none;
  background: none;
  padding: 3px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--sf2); }

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 13px 22px;
  border-top: 1px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--sf);
}

/* ===== EXPORT FLOW ===== */
.export-steps-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 12px;
  flex: 1;
  justify-content: center;
}

.export-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bd2);
  transition: all var(--transition);
}

.export-step-dot.active { background: var(--ac); width: 20px; border-radius: 4px; }
.export-step-dot.done { background: var(--gn); }

.export-section { margin-bottom: 16px; }
.export-section h4 {
  font-family: var(--se);
  font-size: 16px;
  font-style: italic;
  font-weight: 400;
  margin-bottom: 5px;
}

.export-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 300px;
  overflow-y: auto;
}

.export-checklist label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
}

.export-checklist label:last-child { border-bottom: none; }

.export-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.export-format-option {
  padding: 15px;
  border: 2px solid var(--bd2);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
}

.export-format-option:hover { border-color: var(--ac); }
.export-format-option.selected { border-color: var(--ac); background: var(--acl); color: var(--ac); }

.export-delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.export-delivery-option {
  padding: 13px;
  border: 1.5px solid var(--bd2);
  border-radius: 9px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
}

.export-delivery-option:hover { border-color: var(--ac); }
.export-delivery-option.selected { border-color: var(--ac); background: var(--acl); color: var(--ac); }
.export-delivery-option.disabled { opacity: 0.5; cursor: not-allowed; }

/* Send/Download table */
.send-table {
  width: 100%;
  border-collapse: collapse;
}

.send-table th,
.send-table td {
  text-align: left;
  padding: 7px 9px;
  font-size: 11px;
  border-bottom: 1px solid var(--bd);
}

.send-table th {
  font-size: 10px;
  font-weight: 800;
  color: var(--tx3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--sf2);
}

.status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-badge.done { background: var(--gnl); color: var(--gn); border: 1px solid var(--gnb); }
.status-badge.pending { background: var(--sf2); color: var(--tx3); border: 1px solid var(--bd); }

/* Review stats */
.review-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 15px;
}

.stat-card {
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 12px;
}

.stat-card .stat-value {
  font-family: var(--se);
  font-size: 28px;
  color: var(--tx);
  line-height: 1;
  margin-bottom: 2px;
}

.stat-card .stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.financial-summary {
  border: 1px solid var(--bd);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.financial-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--bd);
}

.financial-row:last-child { border-bottom: none; }
.financial-row .label { font-weight: 600; color: var(--tx2); }
.financial-row .value { font-weight: 700; color: var(--tx); }

/* ===== REORDER STAT CARDS ===== */
.reorder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.reorder-stat {
  background: var(--sf);
  border: 1.5px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shs);
  cursor: pointer;
  transition: border-color var(--transition);
}

.reorder-stat:hover { border-color: var(--tx3); }

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bd);
  color: var(--tx3);
  font-family: var(--se);
  font-size: 9px;
  font-style: italic;
  font-weight: 600;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
}

.info-icon::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tx);
  color: var(--sf);
  font-family: var(--sa);
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 12px;
  border-radius: 8px;
  width: 220px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 100;
}

.info-icon:hover::after {
  opacity: 1;
}

.reorder-label {
  font-family: var(--sa);
  font-size: 9px;
  font-weight: 600;
  color: var(--tx3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.reorder-value {
  font-family: var(--se);
  font-size: 36px;
  font-weight: 300;
  color: var(--tx);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 2px;
}


.reorder-value-sm {
  font-size: 18px;
}

.reorder-unit {
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 400;
  color: var(--tx3);
  margin-top: 4px;
}

.reorder-input {
  width: 100%;
  font-family: var(--sa);
  font-weight: 800;
  font-size: 24px;
  padding: 4px 6px;
  border: 2px solid var(--ac);
  border-radius: 6px;
  background: var(--sf);
  color: var(--tx);
  outline: none;
  margin-bottom: 2px;
}

select.reorder-input {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 6px;
}

/* ===== GENERATE BAR ===== */
.generate-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(247,244,238,0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--bd);
  padding: 16px 32px;
  z-index: 50;
}

.generate-status {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
}

.generate-status-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--tx3);
}

.generate-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bd2);
  flex-shrink: 0;
}

.generate-dot.ready { background: var(--gn); }

.generate-status strong {
  color: var(--tx2);
}

.generate-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ===== ACTION ROW ===== */
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--tx3);
  font-size: 12px;
  font-weight: 400;
}

/* ===== ERROR BANNER ===== */
.error-banner {
  background: var(--aml);
  border: 1px solid var(--amb);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.error-banner-text {
  flex: 1;
  font-size: 12px;
  color: var(--am);
  font-weight: 600;
}

.error-banner-text strong {
  font-weight: 800;
}

.error-banner-link {
  font-size: 11px;
  font-weight: 700;
  color: var(--am);
  text-decoration: underline;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--sa);
  white-space: nowrap;
  flex-shrink: 0;
}

.error-banner-link:hover { color: var(--tx); }

/* ===== PROGRESS OVERLAY ===== */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.progress-card {
  background: var(--sf);
  border-radius: 18px;
  padding: 32px 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: none;
  text-align: center;
}

.progress-title {
  font-family: var(--sa);
  font-size: 18px;
  font-weight: 800;
  color: var(--tx);
  margin-bottom: 20px;
}

.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--sf2);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--bd);
}

.progress-bar-fill {
  height: 100%;
  background: var(--ac);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 6px;
}

.progress-eta {
  font-size: 11px;
  font-weight: 700;
  color: var(--ac);
  margin-bottom: 16px;
}

.progress-tips {
  text-align: left;
  font-size: 11px;
  color: var(--tx3);
  line-height: 1.6;
}

.progress-tip {
  background: var(--aml);
  border: 1px solid var(--amb);
  border-radius: 7px;
  padding: 8px 11px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--am);
  font-weight: 600;
}

/* ===== LIVE DASHBOARD ===== */
.live-progress-bar {
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.live-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.live-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--tx);
}

.live-progress-eta {
  font-size: 11px;
  color: var(--tx3);
}

.live-progress-brand-count {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 6px;
}

.live-progress-leave {
  font-size: 10px;
  color: var(--tx3);
  margin-top: 8px;
  text-align: center;
}

.live-brand-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--sf);
  border: 1px solid var(--bd2);
  border-left: 3px solid var(--gn);
  border-radius: 8px;
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.live-brand-enter {
  opacity: 0;
  transform: translateY(-8px);
}

.live-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
}

.live-brand-meta {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 2px;
}

.live-brand-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.live-brand-status {
  font-size: 10px;
  color: var(--gn);
  font-weight: 600;
}

.live-summary {
  margin-bottom: 14px;
}

.progress-leave-note {
  margin-top: 14px;
  font-size: 11px;
  color: var(--tx3);
  text-align: center;
  padding: 8px 12px;
  background: var(--sf2);
  border-radius: 6px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tx);
  color: var(--sf);
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 12px;
  font-weight: 700;
  z-index: 2000;
  box-shadow: none;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== SUPPLIER ASSIGNMENT ===== */
.assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 7px;
  margin-bottom: 7px;
  gap: 10px;
}

.assignment-brand { font-size: 12px; font-weight: 700; color: var(--tx); flex-shrink: 0; }

.assignment-row select {
  font-family: var(--sa);
  font-weight: 600;
  font-size: 11px;
  padding: 5px 8px;
  border: 1.5px solid var(--bd);
  border-radius: 6px;
  background: var(--sf);
  min-width: 140px;
  outline: none;
}

/* ===== DELIVERY TABS ===== */
.delivery-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
}

.delivery-tab {
  font-family: var(--sa);
  font-weight: 700;
  padding: 6px 13px;
  border: 1.5px solid var(--bd2);
  background: var(--sf2);
  color: var(--tx3);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
}

.delivery-tab.active {
  background: var(--acl);
  border-color: var(--acb);
  color: var(--ac);
}

/* ===== MOBILE MENU BUTTON (hidden on desktop) ===== */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--tx);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.mobile-menu-btn:hover { background: var(--sf2); }

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.mobile-overlay.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .app-content { padding: 16px 18px 30px; }
  .topbar { padding: 14px 18px; }
  .main-area::before, .main-area::after, .bg-blob-3, .bg-blob-4 { display: none; }
}

@media (max-width: 768px) {
  /* -- Sidebar: slide-in overlay instead of hidden -- */
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    width: 260px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-btn { display: block; }

  /* -- Main area -- */
  .main-area {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    padding: 12px 16px;
  }

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

  .topbar-title { font-size: 16px !important; }
  .topbar-subtitle { font-size: 10px !important; }

  .app-content { padding: 14px 16px 30px; }

  /* -- Page header -- */
  .page-header-title {
    font-size: 28px;
  }

  .intro-banner {
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
  }

  .intro-banner-icon { font-size: 20px; }

  /* -- Data mode selector -- */
  .data-mode-options {
    flex-direction: column;
  }

  .data-mode-btn {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }

  .data-mode-icon { font-size: 18px; flex-shrink: 0; }
  .data-mode-label { font-size: 13px; }
  .data-mode-desc { font-size: 10px; }

  /* -- Cards -- */
  .card { padding: 14px 16px; }
  .card h3 { font-size: 14px; }

  /* -- Grids -- */
  .settings-grid { grid-template-columns: 1fr; }
  .sources-grid { grid-template-columns: 1fr; }
  .suppliers-grid { grid-template-columns: 1fr; }

  /* -- Match key pills -- */
  .pill-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .pill {
    padding: 8px 10px;
    border-radius: 10px;
    text-align: center;
  }

  /* -- Fuzzy row -- */
  .fuzzy-explain { padding-left: 0; margin-top: 4px; }

  /* -- Mapping modal -- */
  .mapping-row { grid-template-columns: 1fr; gap: 3px; }
  .mapping-row label { text-align: left; }

  /* -- Reorder settings -- */
  .reorder-grid { grid-template-columns: 1fr 1fr; }

  /* -- Generate bar -- */
  .generate-bar {
    left: 0;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    text-align: center;
    padding: 14px 16px;
  }

  .generate-bar .btn-lg {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
  }

  /* -- History -- */
  .history-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .history-sort {
    justify-content: flex-end;
  }

  .history-row {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .history-row-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    width: 100%;
  }

  .history-row-actions .btn { flex: 1; min-width: 0; justify-content: center; font-size: 10px; padding: 5px 6px; }

  /* -- Modals -- */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-lg { max-width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* -- Export dashboard -- */
  .review-stats { grid-template-columns: 1fr 1fr; }
  .export-format-grid { grid-template-columns: 1fr; }
  .export-delivery-grid { grid-template-columns: 1fr; }
  .dashboard-bulk-actions { flex-direction: column; }
  .dashboard-bulk-actions .btn { width: 100%; justify-content: center; }

  /* -- PO table: card layout on mobile -- */
  .send-table thead { display: none; }
  .send-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid var(--bd);
    gap: 4px;
  }
  .send-table td { padding: 2px 0; font-size: 12px; border: none; }
  .po-actions { flex-wrap: wrap; }
  .po-actions .btn { flex: 1; min-width: 0; justify-content: center; font-size: 10px; }

  /* -- Live dashboard -- */
  .live-brand-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

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

  .live-brand-actions .btn { flex: 1; min-width: 0; justify-content: center; }

  /* -- Export checklist (brand picker) -- */
  .export-checklist label {
    font-size: 12px;
    padding: 8px 4px;
  }

  /* -- Supplier cards -- */
  .supplier-card { padding: 12px; }

  /* -- Setup screens -- */
  .setup-container { padding: 1.5rem 1rem; max-width: 100%; }
  .sb-wordmark-lg { font-size: 32px !important; }
  .sb-wordmark-md { font-size: 24px !important; }

  /* -- File drop zone -- */
  .file-drop { padding: 16px; }

  /* -- Source card -- */
  .source-card { padding: 12px; }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 380px) {
  .reorder-grid { grid-template-columns: 1fr; }
  .pill-selector { grid-template-columns: 1fr; }
  .review-stats { grid-template-columns: 1fr; }
  .data-mode-btn { padding: 10px 12px; }
  .topbar-title { font-size: 14px !important; }
}

/* ===== Supplier modal — brand picker search + add ===== */
.brand-picker-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  overflow: hidden;
  transition: border-color var(--transition);
}
.brand-picker-group:focus-within {
  border-color: var(--tx);
}
.brand-picker-input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  padding: 10px 14px;
  font-family: var(--sa);
  font-size: 14px;
  color: var(--tx);
  outline: none;
}
.brand-picker-input::placeholder { color: var(--tx3); }
.brand-picker-add {
  flex-shrink: 0;
  border: 0;
  border-left: 1px solid var(--bd);
  border-radius: 0;
  background: var(--gn);
  color: #FFFFFF;
  padding: 0 16px;
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition);
}
.brand-picker-add:hover { background: #16513A; }
.brand-picker-add:active { background: #123D2A; }

html.dark-mode .brand-picker-group { background: var(--sf2); }
html.dark-mode .brand-picker-add { background: #1E8A5C; }
html.dark-mode .brand-picker-add:hover { background: #26A06B; }

/* ===== AUTH SCREEN (v2) — split layout ===== */
#auth-screen {
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  display: block;
}
#auth-screen-body {
  min-height: 100vh;
  width: 100%;
}
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

/* ---------- LEFT column: brand + form ---------- */
.auth-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 72px;
  max-width: 640px;
  width: 100%;
  margin-left: auto;   /* pull toward the seam so form sits near the middle */
}
.auth-brand-xl {
  margin-bottom: 28px;
}
.auth-brand-delegate {
  font-family: var(--sa);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--tx3);
  margin-bottom: 6px;
}
.auth-wordmark {
  font-family: var(--se);
  font-style: italic;
  font-weight: 400;
  font-size: 88px;
  line-height: 0.95;
  color: var(--tx);
  letter-spacing: -1.5px;
}
.auth-tagline {
  margin-top: 14px;
  color: var(--tx3);
  font-size: 15px;
  letter-spacing: 0.2px;
  max-width: 420px;
}
.auth-form-block {
  max-width: 440px;
  width: 100%;
}
.auth-heading {
  font-family: var(--se);
  font-size: 22px;
  font-weight: 400;
  color: var(--tx);
  line-height: 1.2;
  margin: 0 0 6px;
}
.auth-subheading {
  color: var(--tx3);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
  max-width: 420px;
}
/* Two form-groups side by side (first/last name row) */
.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.auth-field-row .form-group { margin-bottom: 14px; }

/* Step indicator ( ● ○ Step 1 of 2 ) */
.auth-step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.auth-step-dot {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: var(--bd2);
  transition: background var(--transition);
}
.auth-step-dot.active { background: var(--tx); }
.auth-step-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tx3);
  margin-left: 4px;
}

/* Step 2 footer — Back + Create account side by side */
.auth-step-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 6px;
}
.auth-step-actions .btn-secondary {
  padding-left: 18px;
  padding-right: 18px;
}
.auth-step-actions .auth-submit { margin-top: 0; }

/* ---------- Onboarding questionnaire ---------- */
.auth-onboard-fields { display: block; }
.auth-onboard-fields .form-group { margin-bottom: 10px; }

.onboard-field { position: relative; }
.onboard-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  color: var(--tx3);
  font-family: var(--sa);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.onboard-select:hover { border-color: var(--tx3); }
.onboard-select.has-value { color: var(--tx); }
.onboard-field.open .onboard-select {
  border-color: var(--tx);
  color: var(--tx);
}
.onboard-select-chevron {
  font-size: 10px;
  color: var(--tx3);
  line-height: 1;
}

.onboard-panel {
  margin-top: 6px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.onboard-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--tx);
  font-family: var(--sa);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.onboard-option:hover { background: var(--sf2); }
.onboard-option.checked,
.onboard-option.selected { background: var(--sf2); }
.onboard-checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--bd2);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--sf);
  background: var(--sf);
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}
.onboard-option.checked .onboard-checkbox {
  background: var(--tx);
  border-color: var(--tx);
  color: var(--sf);
}

html.dark-mode .onboard-select { background: var(--sf2); }
html.dark-mode .onboard-panel { background: var(--sf2); }
html.dark-mode .onboard-option:hover { background: var(--sf3); }
html.dark-mode .onboard-option.checked,
html.dark-mode .onboard-option.selected { background: var(--sf3); }
html.dark-mode .onboard-checkbox { background: var(--sf2); border-color: var(--bd2); }
html.dark-mode .onboard-option.checked .onboard-checkbox {
  background: var(--tx);
  border-color: var(--tx);
  color: var(--bg);
}

/* SSO buttons (Google + Apple) — placeholders for now */
.auth-sso-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.auth-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  font-family: var(--sa);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.auth-sso-btn svg { flex-shrink: 0; }
.auth-sso-btn--google {
  background: #FFFFFF;
  border: 1px solid var(--bd);
  color: #1F1F1F;
}
.auth-sso-btn--google:hover {
  background: #F7F7F7;
  border-color: var(--tx3);
}
.auth-sso-btn--apple {
  background: #000000;
  border: 1px solid #000000;
  color: #FFFFFF;
}
.auth-sso-btn--apple:hover { background: #1A1A1A; }

/* "or continue with email" divider */
.auth-divider {
  position: relative;
  text-align: center;
  margin: 2px 0 12px;
  font-size: 12px;
  color: var(--tx3);
  letter-spacing: 0.4px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 80px);
  height: 1px;
  background: var(--bd);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-divider span {
  background: var(--bg);
  padding: 0 12px;
  position: relative;
}

.auth-form-block .form-group { margin-bottom: 11px; }
.auth-form-block .form-group label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--tx2);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.auth-form-block .form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  color: var(--tx);
  font-family: var(--sa);
  font-size: 14px;
  transition: border-color var(--transition), background var(--transition);
}
.auth-form-block .form-group input:focus {
  outline: none;
  border-color: var(--tx);
  background: var(--sf);
}
.auth-form-block .form-tip {
  display: block;
  margin-top: 6px;
  color: var(--tx3);
  font-size: 11.5px;
}
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 58px; }
.auth-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--tx3);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.auth-password-toggle:hover {
  color: var(--tx);
  background: var(--sf2);
}
.auth-submit {
  width: 100%;
  margin-top: 6px;
}
.auth-alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.auth-alert-error {
  background: var(--rdl);
  color: var(--rd);
  border: 1px solid var(--rdb);
}
.auth-alert-success {
  background: var(--gnl);
  color: var(--gn);
  border: 1px solid var(--gnb);
}
.auth-linkbtn {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--tx);
  font-family: var(--sa);
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.auth-linkbtn:hover { color: var(--tx2); }
.auth-forgot {
  display: block;
  margin: 12px auto 0;
  font-size: 13px;
  color: var(--tx3);
  font-weight: 400;
}
.auth-toggle {
  margin-top: 14px;
  color: var(--tx3);
  font-size: 13.5px;
}
.auth-toggle .auth-linkbtn { margin-left: 6px; }

/* ---------- RIGHT column: value-prop slider ---------- */
.auth-right {
  position: relative;
  background: var(--sf2);
  border-left: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 64px 48px;
  overflow: hidden;
}
.auth-slides {
  width: 100%;
  max-width: 480px;
}
.auth-slide {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  animation: auth-slide-fade 0.5s ease both;
}
@keyframes auth-slide-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-slide-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--tx);
  margin-bottom: 32px;
}
.auth-slide[data-tint="bll"] .auth-slide-icon { background: var(--bll); }
.auth-slide[data-tint="gnl"] .auth-slide-icon { background: var(--gnl); }
.auth-slide[data-tint="acb"] .auth-slide-icon { background: var(--acb); }
.auth-slide[data-tint="amb"] .auth-slide-icon { background: var(--amb); }
.auth-slide-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx3);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.auth-slide-title {
  font-family: var(--se);
  font-size: 40px;
  font-weight: 400;
  color: var(--tx);
  line-height: 1.1;
  margin: 0 0 20px;
  letter-spacing: -0.5px;
}
.auth-slide-body {
  font-size: 15px;
  color: var(--tx2);
  line-height: 1.55;
  max-width: 420px;
  margin: 0;
}
.auth-slide-dots {
  display: flex;
  gap: 8px;
  margin-top: 48px;
}
.auth-slide-dot {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  border: 0;
  background: var(--bd2);
  padding: 0;
  cursor: pointer;
  transition: background var(--transition), width var(--transition);
}
.auth-slide-dot:hover { background: var(--tx3); }
.auth-slide-dot.active {
  background: var(--tx);
  width: 44px;
}

/* ---------- Short viewports: tighten further ---------- */
@media (max-height: 780px) {
  .auth-left { padding-top: 28px; padding-bottom: 28px; }
  .auth-brand-xl { margin-bottom: 20px; }
  .auth-wordmark { font-size: 68px; }
  .auth-subheading { margin-bottom: 10px; }
  .auth-sso-group { margin-bottom: 10px; }
  .auth-divider { margin: 0 0 8px; }
  .auth-form-block .form-group { margin-bottom: 9px; }
  .auth-toggle { margin-top: 10px; }
}

/* ---------- Responsive: collapse to single column ---------- */
@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-left {
    padding: 40px 28px;
    margin-left: 0;
    max-width: 520px;
    align-items: stretch;
    margin: 0 auto;
  }
  .auth-wordmark { font-size: 64px; }
  .auth-brand-xl { margin-bottom: 36px; }
  .auth-right { display: none; }
}
@media (max-width: 520px) {
  .auth-left { padding: 28px 20px; }
  .auth-wordmark { font-size: 54px; }
  .auth-brand-xl { margin-bottom: 28px; }
}

/* ---------- Dark mode ---------- */
html.dark-mode .auth-right {
  background: var(--sf);
  border-left-color: var(--bd);
}
html.dark-mode .auth-form-block .form-group input {
  background: var(--sf2);
  border-color: var(--bd);
}
html.dark-mode .auth-form-block .form-group input:focus {
  border-color: var(--tx);
  background: var(--sf);
}
html.dark-mode .auth-password-toggle:hover { background: var(--sf3); }
html.dark-mode .auth-slide-dot { background: var(--bd); }
html.dark-mode .auth-slide-dot.active { background: var(--tx); }

/* ===== Backfill progress pulse ===== */
.shimmer-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gn);
  margin-right: 6px;
  animation: shimmer-pulse 1.2s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes shimmer-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Connected badge — shown on ready connection cards */
.conn-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--gn);
  background: var(--gnl);
  border: 1px solid var(--gnb);
  border-radius: 999px;
  line-height: 1.5;
  white-space: nowrap;
}
.conn-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gn);
  box-shadow: 0 0 0 2px rgba(30, 77, 53, 0.18);
}

/* ====================================================================
   Smart Reorder screen
   ==================================================================== */
.reorder-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.reorder-stat {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 14px 16px;
}
.reorder-stat-label {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ghost);
  font-weight: 500;
  margin-bottom: 6px;
}
.reorder-stat-value {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  color: var(--tx);
}
.reorder-stat-critical { color: var(--rd); }
.reorder-stat-warning  { color: #B9851B; }

/* Diagnostic stat strip in the Smart Reorder empty state — quieter
 * than the main .reorder-stats row so it reads as informational
 * rather than the primary KPI band. */
.reorder-empty-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}
.reorder-empty-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--tx3);
}
.reorder-empty-stat strong {
  color: var(--tx);
  font-size: 15px;
  font-weight: 600;
}

.reorder-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 12px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.reorder-actions-info {
  font-size: 13px;
  color: var(--tx);
}

.reorder-group {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.reorder-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
}
.reorder-group-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Collapse chevron in the group title. Small + minimal so it doesn't
 * compete with the supplier name. Active region is the whole button
 * so it's easy to hit on touch. */
.reorder-group-collapse-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 4px;
  margin: 0;
  font-size: 12px;
  line-height: 1;
  color: var(--ghost);
  cursor: pointer;
  transition: color 0.15s ease;
}
.reorder-group-collapse-btn:hover {
  color: var(--ink);
}
.reorder-group.is-collapsed .reorder-group-header {
  /* Collapsed: trim the bottom padding since there's no table below. */
  padding-bottom: 12px;
}

/* Excluded SKUs footer — appears below the supplier groups when the
 * user has marked any SKUs as "exclude from this run" via the bulk
 * action bar. Without this surface, once a SKU is excluded there's
 * no way to get it back short of a full Recompute (which would also
 * wipe all qty edits). The footer collapsed shows just the count;
 * expanding reveals per-SKU Restore chips. */
.reorder-excluded-footer {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--bd);
  background: var(--bg-soft, var(--bg));
  border-radius: 8px;
  font-size: 12px;
  color: var(--tx2, var(--ghost));
}
.reorder-excluded-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.reorder-excluded-summary strong {
  color: var(--ink);
}
.reorder-excluded-toggle {
  background: transparent;
  border: 0;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--ac);
  cursor: pointer;
  text-decoration: underline;
}
.reorder-excluded-toggle:hover { color: var(--ink); }
.reorder-excluded-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reorder-excluded-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--bd-soft, var(--bd));
  border-radius: 14px;
  font-size: 11px;
}
.reorder-excluded-chip-sku {
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  color: var(--ink);
}
.reorder-excluded-chip-name {
  color: var(--ghost);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reorder-excluded-chip-restore {
  background: transparent;
  border: 0;
  padding: 0 2px;
  font-size: 11px;
  color: var(--ac);
  cursor: pointer;
}
.reorder-excluded-chip-restore:hover { color: var(--ink); text-decoration: underline; }
.reorder-excluded-tail {
  color: var(--ghost);
  font-size: 11px;
  padding: 4px 8px;
}

/* Per-supplier rounding picker in the group header. Sits flush with
 * the +Add Item / totals row. Quiet styling so it doesn't compete
 * with the more important Units/Cost/Margin stats. */
.reorder-group-rounding {
  height: 28px;
  padding: 0 24px 0 8px;
  margin-right: 8px;
  border: 1px solid var(--bd);
  background: var(--bg);
  color: var(--ink);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  max-width: 220px;
}
.reorder-group-rounding:hover { border-color: var(--ghost); }

/* Per-supplier "ignore in-transit stock" toggle in the group header.
 * Quiet by default; picks up an accent treatment when on so it's
 * obvious that this table's qtys are computed differently. */
.reorder-group-ignore-transit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  margin-right: 8px;
  border: 1px solid var(--bd);
  background: var(--bg);
  color: var(--ghost);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.reorder-group-ignore-transit:hover { border-color: var(--ghost); }
.reorder-group-ignore-transit input { margin: 0; cursor: pointer; }
.reorder-group-ignore-transit.is-on {
  color: var(--ac, #2563eb);
  border-color: color-mix(in srgb, var(--ac, #2563eb) 45%, transparent);
  background: color-mix(in srgb, var(--ac, #2563eb) 8%, transparent);
  font-weight: 500;
}
.reorder-group-meta {
  font-size: 12px;
  color: var(--ghost);
  margin: 2px 0 0;
}
/* Split-brand warning under the group title — flags when a brand in
 * this group is also carried by another supplier, so the user knows
 * why an expected supplier is missing and that they can reroute. */
.reorder-group-split-hint {
  font-size: 11px;
  color: var(--rd, #c84);
  margin: 4px 0 0;
  cursor: help;
  font-weight: 500;
}

/* Per-group sort-metric badge under the supplier name. Surfaces
 * why this group is at its current position so the ordering is
 * legible at a glance. Style is quiet — informational, not the
 * headline of the card. */
.reorder-group-sort-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ac, #2c6fff);
  background: rgba(44, 111, 255, 0.10);
  border-radius: 999px;
}
.reorder-group-sort-badge-critical {
  color: var(--rd);
  background: rgba(220, 53, 69, 0.10);
}

/* Bulk select column — first cell on every row + a "select all in
 * this group" checkbox in the table header. Narrow column; the
 * checkbox aligns with the row-level Include checkbox visually. */
.reorder-th-bulk {
  width: 40px;
  text-align: center;
  padding: 8px 6px !important;
}
.reorder-td-bulk {
  width: 40px;
  text-align: center;
  padding: 6px;
}
.reorder-tr.is-bulk-selected {
  background: rgba(44, 111, 255, 0.06);
}
.reorder-tr.is-bulk-selected:hover {
  background: rgba(44, 111, 255, 0.10);
}

/* Bulk action bar — appears under the main actions bar when at
 * least one row is selected. Sticky-ish in feel: surfaces the
 * primary batch ops (set qty, reroute supplier, exclude, reset).
 * Designed to be informative at a glance — count badge on the
 * left, all action controls in a single horizontal flow. */
.reorder-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  background: rgba(44, 111, 255, 0.06);
  border: 1px solid rgba(44, 111, 255, 0.20);
  border-radius: 10px;
  flex-wrap: wrap;
}
.reorder-bulk-count {
  font-size: 13px;
  color: var(--tx);
}
.reorder-bulk-count strong { font-size: 15px; color: var(--ac, #2c6fff); }
.reorder-bulk-label {
  font-size: 13px;
  color: var(--tx2);
}
.reorder-bulk-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reorder-bulk-qty input {
  width: 70px;
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
}
.reorder-bulk-reroute-wrap {
  position: relative;
  display: inline-block;
}

/* "Group by Supplier / Brand" segmented control. Sits at the
 * left of the actions bar. Visually a single pill split into two
 * buttons; the active half gets a filled background. */
.reorder-group-toggle {
  display: inline-flex;
  border: 1px solid var(--bd);
  border-radius: var(--radius-btn);
  overflow: hidden;
  background: var(--bg);
}
.reorder-group-toggle-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.reorder-group-toggle-btn + .reorder-group-toggle-btn {
  border-left: 1px solid var(--bd);
}
.reorder-group-toggle-btn:hover { background: var(--sf); }
.reorder-group-toggle-btn.is-active {
  background: var(--ac);
  color: var(--ac-text);
  font-weight: 600;
}
.reorder-group-toggle-btn.is-active:hover { background: var(--ac); }

/* Sort dropdown (next to "Sort: <label>" toolbar button). */
.reorder-sort-wrap {
  position: relative;
  display: inline-block;
}
.reorder-sort-toggle .reorder-sort-caret {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.7;
}
.reorder-sort-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
  overflow: hidden;
}
.reorder-sort-menu.open { display: block; }
.reorder-sort-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--tx);
  cursor: pointer;
  white-space: nowrap;
}
.reorder-sort-item:hover { background: var(--sf); }
.reorder-sort-item.active {
  background: var(--sf);
  font-weight: 600;
  color: var(--ac, #2c6fff);
}
.reorder-group-total {
  text-align: right;
}
.reorder-group-total-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ghost);
}
.reorder-group-total-value {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  color: var(--tx);
}

.reorder-table-scroll {
  overflow-x: auto;
  max-width: 100%;
  position: relative;
}

/* Sticky group + thead clone (built by SmartReorder._setupStickyHeaders).
 * Lives at the body level (position: fixed) so it isn't trapped by
 * the overflow-x: auto wrapper that would break pure-CSS sticky.
 * Wraps two stacked children:
 *   1. .reorder-group-header (cloned) — supplier name, totals
 *   2. an inner overflow-clip box around a cloned table holding
 *      only the original <thead>, translated by scrollLeft to keep
 *      column labels aligned with the body data when horizontally
 *      scrolled.
 * Background opaque + subtle shadow gives the visual "parked at
 * top" seam users expect. */
.reorder-sticky-thead {
  /* position/top/z-index/display set inline by JS — this rule
   * just handles the look. */
  background: var(--bg);
  box-shadow: 0 4px 8px -4px rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid var(--bd);
}
html.dark-mode .reorder-sticky-thead {
  box-shadow: 0 4px 8px -4px rgba(0, 0, 0, 0.6);
}
.reorder-sticky-thead .reorder-table {
  /* The cloned table's columns get pixel widths set inline to
   * match the original; `table-layout: fixed` keeps them pinned
   * even if content suggests otherwise. */
  table-layout: fixed;
}
.reorder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.reorder-th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ghost);
  font-weight: 500;
  border-bottom: 1px solid var(--bd);
  white-space: nowrap;
}
.reorder-td {
  padding: 12px 14px;
  vertical-align: top;
  border-top: 1px solid var(--bd);
}
.reorder-tr:first-child .reorder-td { border-top: none; }
.reorder-td-product { min-width: 200px; max-width: 320px; }
.reorder-td-sku code {
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}
.reorder-td-urgency  { width: 92px; }
.reorder-td-stock    { min-width: 110px; white-space: nowrap; }
.reorder-td-days     { width: 80px; text-align: right; }
.reorder-td-money    { white-space: nowrap; }
.reorder-td-qty      { width: 110px; }
.reorder-td-include  { width: 60px; text-align: center; }
.reorder-muted { color: var(--ghost); font-weight: 400; }
.reorder-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.reorder-sku-name {
  font-weight: 500;
  color: var(--tx);
  line-height: 1.3;
}
.reorder-sub {
  font-size: 11px;
  color: var(--ghost);
  margin-top: 2px;
}
.reorder-days-big {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  line-height: 1;
  color: var(--tx);
}
.reorder-days-critical { color: var(--rd); }
.reorder-days-warning  { color: #B9851B; }
.reorder-days-ok       { color: var(--gn); }

.reorder-urgency {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}
.reorder-urgency-critical { background: var(--rdl); color: var(--rd); }
.reorder-urgency-warning  { background: #FCEFD4; color: #8A6210; }
.reorder-urgency-ok       { background: var(--gnl); color: var(--gn); }

.reorder-oversold {
  font-size: 11px;
  color: var(--rd);
  font-weight: 500;
}
.reorder-oos {
  font-size: 11px;
  color: var(--ghost);
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
}
.reorder-sales-only {
  font-size: 11px;
  color: #8a5a00;
  background: #fff5d6;
  border: 1px solid #f0d27a;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
}
/* Low-confidence flag — surfaced when engine velocity is built on
 * very few historical sales (<5 in last 90d). The math is still
 * mathematically correct under the engine's ex-OOS model, but the
 * sample size is too small to trust without a manual sanity-check.
 * Same warm-amber palette as .reorder-sales-only so users associate
 * "yellow-ish chip" with "review me before shipping the PO." */
.reorder-low-confidence {
  font-size: 11px;
  color: var(--am);
  background: var(--aml);
  border: 1px solid var(--amb);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
  white-space: nowrap;
}
/* Multi-homed chip — this SKU's brand is carried by 2+ suppliers, so
 * it appears under each supplier's table. Blue/informational (not a
 * warning) — it's expected behaviour, just a heads-up not to push
 * both POs. */
.reorder-multi-homed {
  font-size: 11px;
  color: var(--bl, #2563eb);
  background: var(--bll, color-mix(in srgb, #2563eb 10%, transparent));
  border: 1px solid var(--blb, color-mix(in srgb, #2563eb 30%, transparent));
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
  white-space: nowrap;
}
/* Pre-push "this SKU won't push cleanly" warning. Shown on Smart
 * Reorder rows where the SKU is inactive in inventory, only on a
 * sales channel, or untracked anywhere. Red palette signals it's
 * blocking the push (vs amber for "review before shipping"). */
.reorder-bad-sku {
  font-size: 11px;
  color: var(--rd);
  background: var(--rdl);
  border: 1px solid var(--rdb);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
  white-space: nowrap;
}

/* Sales-only review panel: collapsed banner + expanded list. Lives
   between the page summary and the actions bar. The expanded body
   shares its visual language with the page-level cards (rounded,
   subtle border, hairline divider above each item). */
.reorder-salesonly {
  margin: 12px 0 16px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--sf);
  overflow: hidden;
}
.reorder-salesonly.is-expanded { box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
.reorder-salesonly-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--tx);
  font-family: inherit;
}
.reorder-salesonly-banner:hover { background: var(--sf); }
.reorder-salesonly.is-expanded .reorder-salesonly-banner {
  border-bottom: 1px solid var(--bd);
  background: var(--sf);
}
.reorder-salesonly-icon {
  font-size: 14px;
  color: #b8851a;
}
.reorder-salesonly-headline { flex: 1; }
.reorder-salesonly-accent {
  color: var(--gn);
  font-weight: 600;
}
.reorder-salesonly-caret {
  font-size: 12px;
  color: var(--tx3);
}
.reorder-salesonly-help {
  font-size: 12px;
  color: var(--tx2);
  padding: 12px 16px 4px;
  line-height: 1.5;
}
.reorder-salesonly-help ul {
  margin: 6px 0 4px 16px;
  padding: 0;
}
.reorder-salesonly-help li { margin: 4px 0; }
.reorder-salesonly-list {
  padding: 4px 0 8px;
}
.reorder-salesonly-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--bd);
}
.reorder-salesonly-row:first-child { border-top: 0; }
.reorder-salesonly-row.is-accepted {
  background: rgba(16, 185, 129, 0.06);
}
.reorder-salesonly-row.is-dismissed {
  opacity: 0.6;
}
.reorder-salesonly-row-main { flex: 1; min-width: 0; }
.reorder-salesonly-sku {
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.reorder-salesonly-state {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.reorder-salesonly-state-accepted {
  background: rgba(16, 185, 129, 0.15);
  color: var(--gn);
}
.reorder-salesonly-state-dismissed {
  background: var(--sf);
  color: var(--tx3);
}
.reorder-salesonly-match {
  font-size: 12px;
  margin: 4px 0 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.reorder-salesonly-arrow {
  color: var(--tx3);
}
.reorder-salesonly-confidence {
  font-size: 11px;
  color: var(--tx3);
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
}
.reorder-salesonly-reason,
.reorder-salesonly-stats {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 2px;
}
.reorder-salesonly-nomatch {
  font-size: 12px;
  color: var(--tx3);
  margin: 4px 0;
  font-style: italic;
}
.reorder-salesonly-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Merge badge on a main suggestion row that absorbed sales-only
   velocity. Echoes the green-leaning accent of the accepted state. */
.reorder-salesonly-merged {
  font-size: 11px;
  color: var(--gn);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: help;
}

.reorder-qty-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--tx);
  font-size: 13px;
  font-family: inherit;
}
.reorder-qty-input:focus {
  outline: none;
  border-color: var(--tx);
}

.reorder-exclude {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ghost);
  cursor: pointer;
  user-select: none;
}
.reorder-exclude input { margin: 0; }

/* Tier A column chips — channel breakdowns, tags, status pills.
   Channel chips get a provider-tinted left border so the user can
   skim a column and see "Shopify (blue) vs Zoho (green)" at a glance
   without reading labels. Sized to fit two stacked chips inside a
   single table cell at default zoom. */
.reorder-cell-chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.reorder-channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--sf);
  border-left: 3px solid var(--bd);
  color: var(--ghost);
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reorder-channel-chip[data-provider="shopify"] { border-left-color: #5e8e3e; }
.reorder-channel-chip[data-provider="zoho_inventory"] { border-left-color: #d65b34; }
.reorder-channel-chip strong {
  color: var(--tx);
  font-weight: 500;
}
.reorder-tag-chip {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--sf);
  color: var(--ghost);
  margin: 1px 2px 1px 0;
  white-space: nowrap;
}
.reorder-status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}
.reorder-status-active   { background: var(--gnl); color: var(--gn); }
.reorder-status-draft    { background: #FCEFD4; color: #8A6210; }
.reorder-status-archived { background: var(--sf); color: var(--ghost); }

/* Column header decorators — Phase 6.4. ℹ tooltip and ⋯ mode picker
   sit alongside the label without disturbing the sort indicator. */
.reorder-th-help,
.reorder-th-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  font-size: 10px;
  line-height: 1;
  color: var(--ghost);
  cursor: help;
  border-radius: 50%;
  background: transparent;
  vertical-align: middle;
  user-select: none;
}
.reorder-th-help:hover { background: var(--sf); color: var(--tx); }
.reorder-th-mode {
  cursor: pointer;
  font-size: 12px;
  border-radius: 3px;
}
.reorder-th-mode:hover { background: var(--sf); color: var(--tx); }
.reorder-th-mode-active {
  color: var(--tx);
  background: var(--acl);
  border: 1px solid var(--acb);
}

@media (max-width: 860px) {
  .reorder-stats { grid-template-columns: repeat(2, 1fr); }
  .reorder-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .reorder-row-header { display: none; }
}

/* ====================================================================
   Connected Channels — role chips, provider tag, add-channel menu
   ==================================================================== */
.channel-provider-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ghost);
  background: var(--acl);
  border: 1px solid var(--acb);
  border-radius: 4px;
  line-height: 1.6;
}

/* "Beta" pill — surfaces next to channel names that aren't yet
   battle-tested in production. Currently only Zoho. Using yellow
   so it reads as "still maturing" without alarming the user. */
.channel-beta-pill {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a16207; /* amber-700 */
  background: #fef3c7; /* amber-100 */
  border: 1px solid #fde68a; /* amber-200 */
  border-radius: 980px;
  line-height: 1.4;
  vertical-align: middle;
}

/* Phase progress bar shown on a setting-up Zoho card. The fill width
   is computed from sync_progress.completed_phases.length / 5. Thin so
   it doesn't dominate the card; muted so it reads as supporting
   info, not the headline. */
.setup-progress-bar {
  margin-top: 8px;
  height: 4px;
  background: var(--sf2, var(--sf));
  border-radius: 980px;
  overflow: hidden;
}
.setup-progress-bar-fill {
  height: 100%;
  background: var(--bl);
  border-radius: 980px;
  transition: width 400ms ease-out;
}
.setup-progress-bar-paused .setup-progress-bar-fill {
  /* Muted fill so a stalled bar reads as paused rather than active. */
  background: var(--tx3);
}

/* Static amber dot for "paused" / "not currently running" states.
   Distinct from .shimmer-dot which animates. Same diameter so cards
   that toggle between live and paused don't jump around. */
.status-dot-paused {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b; /* amber-500 */
  margin-right: 6px;
  vertical-align: middle;
}

/* ====================================================================
   Integrations: top-of-page health rollup
   Yellow banner that summarizes unresolved sync_failed / sync_stale
   alerts across all channels. Silent when everything's healthy.
   ==================================================================== */
.health-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fef3c7;     /* amber-100 */
  border: 1px solid #fde68a; /* amber-200 */
  border-radius: 10px;
  color: #78350f;          /* amber-900 */
}
.health-banner-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f59e0b;     /* amber-500 */
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.health-banner-body {
  flex: 1 1 auto;
  min-width: 0;
}
.health-banner-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.health-banner-list {
  margin: 4px 0 8px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
}
.health-banner-list li strong {
  display: inline; /* override the block-style header above */
  font-weight: 600;
  margin-bottom: 0;
}
.health-banner-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #92400e;          /* amber-800 */
}
.health-banner-hint em {
  font-style: normal;
  font-weight: 600;
}

/* ====================================================================
   Integrations: "How syncing works" inline help panel
   Default-collapsed card on the Integrations page that demystifies
   sync frequency, first-vs-incremental pulls, real-time webhooks,
   manual sync, push, and API limits. Saves a separate help-center
   page from existing — most users only need this once.
   ==================================================================== */
.how-it-works-card {
  margin-bottom: 16px;
  padding: 0; /* let the toggle button + body provide their own */
}
.how-it-works-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--tx);
}
.how-it-works-toggle:hover {
  background: var(--sf2, var(--sf));
}
.how-it-works-toggle strong {
  font-size: 14px;
}
.how-it-works-caret {
  display: inline-block;
  width: 14px;
  font-size: 11px;
  color: var(--tx3);
}
.how-it-works-hint {
  font-size: 12px;
  color: var(--tx3);
  margin-left: auto;
}
.how-it-works-body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--bd);
}
.how-it-works-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--bd);
}
.how-it-works-section:last-child {
  border-bottom: none;
}
.how-it-works-section h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--tx);
}
.how-it-works-section p,
.how-it-works-section li {
  font-size: 13px;
  line-height: 1.55;
  color: var(--tx2, var(--tx));
  margin: 4px 0;
}
.how-it-works-section ul {
  margin: 4px 0 4px 20px;
  padding: 0;
}
.how-it-works-section li {
  margin-bottom: 4px;
}
.how-it-works-section strong {
  color: var(--tx);
  font-weight: 600;
}
.how-it-works-tip {
  margin-top: 6px !important;
  padding: 6px 10px;
  background: var(--sf, var(--sf2));
  border-left: 3px solid var(--bl);
  border-radius: 4px;
  font-size: 12px !important;
  color: var(--tx3) !important;
}

/* (?) icon next to per-card status text. Clicks expand the inline
   "How syncing works" panel and scroll to the relevant section.
   Default styling reads as helper, not a primary action — small,
   muted, brightens on hover. */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--bd);
  border-radius: 50%;
  background: transparent;
  color: var(--tx3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.help-icon:hover {
  background: var(--bll);
  color: var(--bl);
  border-color: var(--bl);
}
/* Inline variant for body-text contexts ("Last synced: X ago [?]"),
   where it should sit on the baseline rather than as a flex chip. */
.help-icon-inline {
  width: 16px;
  height: 16px;
  font-size: 10px;
  margin-left: 4px;
}

/* ====================================================================
   Mobile breakpoints for the integrations-page additions:
   - Health banner: stack icon above text on tight viewports
   - How-it-works panel: tighten padding, collapse the hint text
   - Brand-candidates / dedupe panels: ensure they don't overflow
   - PO drawer's flag chips and find-similar buttons: wrap rather
     than horizontally scroll on narrow screens
   ==================================================================== */
@media (max-width: 720px) {
  .health-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
  }
  .health-banner-icon {
    align-self: flex-start;
  }

  .how-it-works-toggle {
    padding: 12px 14px;
    gap: 8px;
  }
  /* Drop the inline hint on narrow screens — the toggle title +
     caret are enough; the hint text is preview-only. */
  .how-it-works-hint {
    display: none;
  }
  .how-it-works-body {
    padding: 4px 14px 14px;
  }
  .how-it-works-section h4 {
    font-size: 14px;
  }

  .brand-candidates-panel,
  .dedupe-panel {
    padding: 10px 12px;
  }
  .brand-candidates-header {
    flex-direction: column;
    gap: 2px;
  }
  /* Dedupe pair actions break onto their own row below the names
     so a 3-button group doesn't squish into a strip. */
  .dedupe-pair {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .dedupe-pair-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }

  /* PO drawer's per-row action strip — Edit / Mark Issued / Push /
     Delete can pile up. Wrap them rather than letting them push the
     row off the right edge. */
  .po-drawer-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* Section flash — the openHelp() helper adds this class to the
   targeted section briefly, fading a subtle highlight in and out so
   the user's eye finds the right paragraph after the panel scrolls
   into view. */
.how-it-works-section-flash {
  animation: how-it-works-flash 1.6s ease-out;
}
@keyframes how-it-works-flash {
  0%   { background: transparent; }
  20%  { background: var(--bll); }
  100% { background: transparent; }
}

.channel-roles {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.channel-role-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  cursor: pointer;
  user-select: none;
}
.channel-role-toggle-label {
  letter-spacing: 0.01em;
}
.channel-role-switch {
  position: relative;
  width: 34px;
  height: 20px;
  background: var(--bd);
  border: none;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: none;
  font-family: inherit;
}
.channel-role-switch:hover { filter: brightness(0.96); }
.channel-role-switch:focus-visible {
  outline: 2px solid var(--tx);
  outline-offset: 2px;
}
.channel-role-switch.on {
  background: var(--gn);
}
.channel-role-switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.2s ease;
}
.channel-role-switch.on .channel-role-switch-dot {
  left: 16px;
}

.channel-add-menu {
  position: absolute;
  width: 260px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.channel-add-menu-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 8px 10px 6px;
}
.channel-add-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--tx);
  transition: background 0.1s ease;
}
.channel-add-menu-item:not([disabled]):hover {
  background: var(--acl);
}
.channel-add-menu-item[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.channel-add-menu-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--acl);
  border-radius: 8px;
  font-weight: 600;
  color: var(--tx);
}
.channel-add-menu-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}
.channel-add-menu-sub {
  font-size: 11px;
  color: var(--ghost);
  margin-top: 2px;
}

/* Column chooser popover (Smart Reorder) */
.column-chooser-menu {
  position: absolute;
  width: 220px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.column-chooser-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 8px 10px 6px;
}
.column-chooser-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tx);
  transition: background 0.1s ease;
}
.column-chooser-item:hover { background: var(--acl); }
.column-chooser-item input { margin: 0; }
.column-chooser-required { opacity: 0.6; cursor: default; }
.column-chooser-hint {
  margin-left: auto;
  font-size: 10px;
  color: var(--ghost);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Smart Reorder screen needs more horizontal real estate than the
   default 860px content-wrapper — the suggestions table has up to
   a dozen columns the user can enable. Override the wrapper cap
   on this screen only so other screens stay readable. */
#screen-reorder .content-wrapper {
  max-width: none;
}

.reorder-product-sku {
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--tx);
  white-space: nowrap;
}

/* ====================================================================
   Smart Reorder — Filter builder popover
   ==================================================================== */
.filter-builder-menu {
  position: absolute;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 12px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
}
.filter-clear-all {
  background: none;
  border: none;
  color: var(--rd);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: inherit;
}
.filter-clear-all:hover { text-decoration: underline; }

.filter-combinator-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--tx);
}
.filter-combinator-row select {
  padding: 3px 8px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--sf);
  color: var(--tx);
  font-size: 12px;
  font-family: inherit;
}

.filter-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-empty {
  padding: 12px;
  background: var(--acl);
  border: 1px dashed var(--bd);
  border-radius: 8px;
  color: var(--ghost);
  font-size: 12px;
  text-align: center;
}
.filter-rule {
  display: grid;
  grid-template-columns: 130px 160px 1fr auto;
  gap: 6px;
  align-items: center;
}
.filter-rule select,
.filter-rule input {
  padding: 6px 8px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--sf);
  color: var(--tx);
  font-size: 12px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.filter-rule select:focus,
.filter-rule input:focus {
  outline: none;
  border-color: var(--tx);
}
.filter-value-wrap { position: relative; }
.filter-value-placeholder {
  color: var(--ghost);
  font-size: 12px;
  padding: 6px 8px;
}
.filter-rule-remove {
  width: 26px;
  height: 26px;
  border: 1px solid var(--bd);
  background: var(--sf);
  color: var(--ghost);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  font-family: inherit;
}
.filter-rule-remove:hover {
  border-color: var(--rd);
  color: var(--rd);
}

.filter-actions {
  display: flex;
  justify-content: flex-start;
}

.filter-count-badge {
  display: inline-block;
  min-width: 16px;
  padding: 1px 5px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: var(--sf);
  background: var(--tx);
  border-radius: 8px;
  line-height: 1.4;
}

/* Searchable dropdown for filter values (combobox) */
.filter-value-dropdown {
  position: absolute;
  max-height: 240px;
  overflow-y: auto;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 130;
  padding: 4px;
}
.filter-value-option {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--tx);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-value-option:hover { background: var(--acl); }

/* Sortable column headers in Smart Reorder table */
.reorder-th-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.1s ease, background 0.1s ease;
}
.reorder-th-sortable:hover {
  color: var(--tx);
  background: var(--acl);
}
.reorder-th-active {
  color: var(--tx);
}
.reorder-th-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: var(--tx);
  vertical-align: baseline;
}
.reorder-th-arrow-idle {
  color: var(--bd);
}
.reorder-th-sortable:hover .reorder-th-arrow-idle {
  color: var(--ghost);
}

/* Column drag affordance */
.reorder-th[draggable="true"] { cursor: grab; }
.reorder-th[draggable="true"]:active { cursor: grabbing; }

/* Supplier group — multi-stat totals (units + cost + revenue + margin) */
.reorder-group-totals {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.reorder-group-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.reorder-group-stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ghost);
}
.reorder-group-stat-value {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  line-height: 1.1;
  color: var(--tx);
  white-space: nowrap;
}
.reorder-group-currency {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--ghost);
  margin-left: 2px;
}

/* Saved Views menu */
.views-menu {
  position: absolute;
  width: 260px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 6px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.views-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 8px 10px 6px;
}
.views-empty {
  padding: 12px;
  color: var(--ghost);
  font-size: 12px;
  text-align: center;
  background: var(--acl);
  border-radius: 8px;
  margin: 4px 6px;
}
.views-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px;
}
.views-item-apply {
  flex: 1;
  text-align: left;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--tx);
  transition: background 0.1s ease;
}
.views-item-apply:hover { background: var(--acl); }
.views-item-delete {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ghost);
  font-size: 16px;
  line-height: 1;
  font-family: inherit;
}
.views-item-delete:hover { background: var(--rdl); color: var(--rd); }
.views-footer {
  padding: 6px 6px 2px;
  border-top: 1px solid var(--bd);
  margin-top: 4px;
}
.views-footer .btn {
  width: 100%;
}

/* Drag feedback for column reordering */
.reorder-th-dragging { opacity: 0.35; }
.reorder-th-drop {
  background: var(--gnl);
  color: var(--gn);
}
/* Green edge on the side the dragged column will land */
.reorder-th-drop-left {
  box-shadow: inset 4px 0 0 var(--gn);
}
.reorder-th-drop-right {
  box-shadow: inset -4px 0 0 var(--gn);
}
.reorder-th-drop .reorder-th-arrow { color: var(--gn); }

/* Zoho-imported supplier tag on the supplier card */
.supplier-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.supplier-source-tag {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gn);
  background: var(--gnl);
  border: 1px solid var(--gnb);
  border-radius: 4px;
  line-height: 1.5;
}
.supplier-no-brands {
  font-size: 11px;
  color: var(--ghost);
  font-style: italic;
}

/* Configure Channel modal */
.config-role-block {
  padding: 12px 0;
  border-top: 1px solid var(--bd);
}
.config-role-block:first-of-type { border-top: none; padding-top: 0; }
.config-role-nested {
  margin-top: 12px;
  margin-left: 28px;
  padding: 6px 0 6px 14px;
  border-top: none;
  border-left: 2px solid var(--bd);
  background: transparent;
}
.config-role-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.config-role-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  /* Lock dimensions in the inline-flex label so a long label text
     doesn't make flex shrink the checkbox. The Supplier row's
     "Also import its supplier / vendor list" was long enough to
     trigger that on narrow modal widths. */
  flex: none;
  accent-color: var(--bl);
}
.config-role-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.config-role-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--tx);
}
.config-role-help {
  display: block;
  margin-top: 6px;
  margin-left: 28px;
  font-size: 12px;
  color: var(--ghost);
  line-height: 1.45;
}

/* Needs-configuration state on the channel card */
.channel-needs-config {
  background: var(--aml);
  border: 1px solid var(--amb);
  color: var(--am);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.channel-configure-link {
  color: var(--tx);
  text-decoration: underline;
  font-weight: 500;
}
.channel-configure-link:hover { color: var(--bl); }

/* Per-provider colour on supplier source tags. The base
   .supplier-source-tag already sets border-radius, padding, etc.
   (from the Zoho-only version); these override colours per source
   and style linked (secondary) tags smaller + muted. */
.supplier-source-tag.supplier-source-zoho {
  color: var(--gn);
  background: var(--gnl);
  border-color: var(--gnb);
}
.supplier-source-tag.supplier-source-shopify {
  color: var(--bl);
  background: var(--bll);
  border-color: var(--blb);
}
.supplier-source-tag.supplier-source-generic {
  color: var(--ghost);
  background: var(--acl);
  border-color: var(--bd);
}
.supplier-source-tag.supplier-source-tag-linked {
  opacity: 0.72;
  font-size: 9px;
  padding: 1px 6px;
}

/* Brand suggestions surfaced from PO history. Visually distinct from
   confirmed brand-tag chips (lighter, dashed border) so the user
   immediately reads them as "pending action" rather than mistaking
   them for already-linked brands. The accept (+) button uses the
   blue accent; dismiss (×) is muted. */
.supplier-suggestions {
  margin-bottom: 9px;
  padding: 8px 10px;
  background: var(--sf2);
  border: 1px dashed var(--bd);
  border-radius: 6px;
}
.supplier-suggestions-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--tx3);
  margin-bottom: 6px;
  cursor: help;
}

/* ===== Purchase Orders page =====
   Unified list of orderly_pos + inbound_pos rows. Status tabs filter
   by lifecycle state; each row expands to a drawer with line items
   and (for Orderly POs) status-update actions. */
.po-status-tabs {
  display: inline-flex;
  margin: 16px 0 12px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}
.po-status-tab {
  border: 0;
  background: transparent;
  color: var(--tx2);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.po-status-tab:hover { color: var(--tx); }
.po-status-tab.is-active {
  background: var(--sf);
  color: var(--tx);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.po-status-tab-count {
  font-size: 11px;
  color: var(--tx3);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.po-status-tab.is-active .po-status-tab-count {
  color: var(--tx);
  background: var(--sf);
}

.po-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.po-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--tx);
  font-size: 13px;
  font-family: inherit;
}
.po-search:focus {
  outline: none;
  border-color: var(--blb);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.po-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.po-control-label {
  font-size: 10px;
  color: var(--tx3);
  text-transform: none;
}
.po-control select {
  padding: 7px 10px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--tx);
  font-size: 13px;
  font-family: inherit;
}

.po-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.po-row {
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  overflow: hidden;
}
.po-row.is-expanded {
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.po-row-main {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(140px, 1.5fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(120px, 1fr) 32px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
}
.po-row-main:hover { background: var(--sf); }
.po-row.is-expanded .po-row-main { background: var(--sf); border-bottom: 1px solid var(--bd); }
.po-row-cell { min-width: 0; }
.po-muted { font-size: 11px; color: var(--tx3); margin-top: 2px; }
.po-row-toggle {
  text-align: right;
  color: var(--tx3);
  font-size: 14px;
}

.po-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  margin-right: 6px;
}
.po-status-draft     { background: var(--sf); color: var(--tx2); border: 1px solid var(--bd); }
.po-status-issued    { background: rgba(59, 130, 246, 0.15); color: #1e40af; }
.po-status-pushed    { background: rgba(16, 185, 129, 0.15); color: #047857; }
/* Amber — "in progress, not done." Visually distinct from
   issued (blue, not started) and received (green, complete). */
.po-status-partially_received { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.po-status-received  { background: rgba(34, 197, 94, 0.15); color: #166534; }
.po-status-cancelled { background: rgba(239, 68, 68, 0.15); color: #991b1b; }

/* Inline progress count inside the partially-received badge
   (e.g. "Partially received  500/1000"). Slightly darker tone so
   the number reads as the actionable detail. */
.po-status-badge-progress {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.po-origin-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.po-origin-orderly {
  /* Match the sidebar's "O" icon — dark warm text on cream
     accent. Same palette as the rest of Orderly's typography. */
  background: var(--acl);
  color: var(--tx);
  border: 1px solid var(--acb);
  font-weight: 700;
}
.po-origin-external {
  background: var(--sf);
  color: var(--tx3);
  border: 1px solid var(--bd);
  font-weight: 500;
}
.po-origin-arrow {
  color: var(--tx3);
  font-size: 11px;
  margin: 0 4px;
}

/* Orderly-originated PO rows match the sidebar "O" icon's dark-on-
   cream palette so the highlight reads as a piece with the rest of
   the app. Left-border in the dominant text colour, soft cream tint
   on the inner edge that fades to normal card. */
.po-row.is-orderly {
  border-left: 3px solid var(--tx);
  background: linear-gradient(90deg, var(--acl) 0%, var(--sf) 100px);
}
.po-row.is-orderly.is-expanded {
  background: linear-gradient(90deg, var(--acl) 0%, var(--sf) 100px);
}
.po-row.is-orderly .po-row-main:hover {
  background: linear-gradient(90deg, var(--acl) 0%, var(--sf) 100px);
}

/* Drawer */
.po-drawer {
  padding: 14px 16px 16px;
  background: var(--bg);
  border-top: 1px solid var(--bd);
}

/* Top strip — timeline + engine note on the left, lifecycle
   actions (Edit / Mark Issued / Move to Draft / Delete) on the
   right. One row, no floating sections. */
.po-drawer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bd);
}
.po-drawer-top-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.po-drawer-top-meta .po-timeline { margin-bottom: 0; }
/* Engine note sits below the top strip — pin it tight to the
   divider so there's no excess gap. */
.po-drawer > .po-engine-note {
  margin-top: -4px;
  margin-bottom: 8px;
}

/* Toolbar above the items table — only the column-chooser pair
   on the right. Tight against the table so it reads as the
   table's own toolbar, not a separate floating element. */
.po-drawer-table-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.po-drawer-table-tools:empty { display: none; }

.po-drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.po-drawer-action-group {
  margin-top: 12px;
}
.po-drawer-action-group + .po-drawer-action-group { margin-top: 8px; }
.po-drawer-action-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--tx3);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
/* Export & send footer — flush full-width bar at the bottom of
   the drawer. Looks like a deliberate footer rather than a
   leftover button row. */
.po-drawer-export {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
}

/* Engine context summary above the line items table — counts of
   critical/warning rows so the user can quickly see "this was a
   high-urgency reorder run." */
/* Compact one-line caption under the action row. No card chrome —
   just a thin muted text line so it fits right under the buttons
   without taking a card's worth of vertical space. */
.po-engine-note {
  font-size: 11px;
  color: var(--tx3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0 0 8px;
  background: transparent;
  border: 0;
}
.po-engine-stat strong { color: var(--tx2); font-weight: 600; }

/* Urgency pill on each line item — same colour mapping as Smart
   Reorder so the user has a continuous visual language. */
.po-urgency {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.po-urgency-critical { background: rgba(239, 68, 68, 0.15); color: #991b1b; }
.po-urgency-warning  { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.po-urgency-ok       { background: rgba(16, 185, 129, 0.15); color: #047857; }

/* Match-type tag (Manual / Fuzzy badges next to the item name on
   non-engine rows). */
.po-match-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  margin-left: 4px;
}
.po-match-manual { background: var(--gnl); color: var(--gn); border: 1px solid var(--gnb); }
.po-match-fuzzy  { background: var(--sf); color: var(--tx3); border: 1px solid var(--bd); }

/* Edit-mode controls inside the drawer. Inline qty input, remove
   button, footer with live totals + Save/Cancel/Add. */
.po-edit-qty {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
  font-size: 12px;
  text-align: right;
}
.po-edit-qty:focus {
  outline: none;
  border-color: var(--blb);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.po-edit-remove {
  background: transparent;
  border: 0;
  color: var(--rd);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.po-edit-remove:hover { color: var(--rd); opacity: 0.8; }

.po-edit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gnl);
  border: 1px solid var(--gnb);
  border-radius: 8px;
  margin-top: 10px;
}
.po-edit-totals {
  font-size: 12px;
  color: var(--tx2);
}
.po-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Warning banner shown above the edit footer when the user is editing
 * a PO that's already been pushed to a connected channel. Mirrors the
 * confirm dialog's language — emphasises that the next Push will
 * REPLACE the existing PO (swap pattern: POST new + DELETE old). */
.po-edit-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--rd, #c84) 30%, transparent);
  background: color-mix(in srgb, var(--rd, #c84) 8%, transparent);
  color: var(--ink);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.po-edit-banner-icon {
  font-size: 14px;
  line-height: 1.2;
  flex: 0 0 auto;
}

/* Drawer header — single action row. Export buttons + lifecycle
   actions + danger actions all on ONE line, separated by tiny
   vertical dividers so the destructive Delete is visually
   distinct from the rest. Wraps to a second line only when the
   viewport really can't fit. */
.po-drawer-header {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.po-drawer-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.po-drawer-header-actions .btn {
  white-space: nowrap;
}
.po-drawer-actions-sep {
  width: 1px;
  height: 18px;
  background: var(--bd);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Bulk-edit action bar — appears between header and items table
   when at least one row is bulk-selected in edit mode. */
.po-edit-bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gnl);
  border: 1px solid var(--gnb);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}
.po-edit-bulk-count strong { color: var(--gn); }
.po-edit-bulk-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}
.po-edit-bulk-label {
  color: var(--tx2);
  font-size: 12px;
}
.po-edit-bulk-qty .po-edit-qty {
  width: 80px;
}

.po-bulk-th, .po-bulk-td {
  width: 32px;
  text-align: center;
}
.po-drawer-table tr.is-bulk-selected td {
  background: var(--acl);
}

/* List-level bulk select — checkbox column on each PO row, action
   bar pinned above the list when ≥1 row is selected. Use grid so
   the drawer can span full-width below the bulk + main row. */
.po-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
}
.po-row-bulk {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-right: 1px solid var(--bd);
  background: var(--sf);
  grid-column: 1;
  grid-row: 1;
}
.po-row.is-bulk-selected {
  outline: 2px solid var(--tx);
  outline-offset: -2px;
}
.po-row-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
.po-drawer {
  grid-column: 1 / -1;
  grid-row: 2;
}

.po-list-bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--acl);
  border: 1px solid var(--acb);
  border-radius: 10px;
  margin-bottom: 12px;
}
.po-list-bulk-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  margin-right: 8px;
}
.po-list-bulk-count strong { font-weight: 700; }

/* Run header — collapsed view of N POs from one Generate-POs click.
   Same earthy palette as Orderly POs but a touch heavier so it
   reads as a parent of multiple rows. */
.po-run-header {
  border: 1px solid var(--acb);
  border-left: 3px solid var(--tx);
  border-radius: 10px;
  background: var(--acl);
  margin-bottom: 8px;
  overflow: hidden;
}
.po-run-header.is-expanded {
  margin-bottom: 4px;
}
.po-run-main {
  display: grid;
  /* Leading 38px column matches the per-row .po-row-bulk column
     width exactly, so the run-header checkbox sits in the same
     visual rail as child-row checkboxes when the run is expanded.
     The remaining six columns are the original run summary layout. */
  grid-template-columns: 38px minmax(140px, 1.2fr) minmax(180px, 1.5fr) minmax(180px, 1.2fr) minmax(140px, 1fr) minmax(120px, 1fr) 32px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
}
.po-run-main:hover { background: var(--acb); }
.po-run-cell { min-width: 0; }
/* "RUN" badge that prefixes the run-header label, replacing the
   earlier ▦ glyph (which fell back to an empty square on some
   font stacks). Compact pill so it reads as a tag, not a button. */
.po-run-badge {
  display: inline-block;
  padding: 2px 7px;
  margin-right: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bl);
  background: var(--bll);
  border: 1px solid var(--bl);
  border-radius: 4px;
  line-height: 1.4;
  vertical-align: middle;
}
.po-run-suppliers {
  font-size: 12px;
  color: var(--tx2);
}
.po-run-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.po-run-toggle {
  text-align: right;
  color: var(--tx3);
}
/* Run-level select-all checkbox sits in the leading grid column,
   matching the per-row .po-row-bulk styling so the rail reads
   continuous from header into expanded child rows. */
.po-run-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Children of an expanded run get a left indent so the parent-child
   relationship is visually clear. */
.po-run-child {
  margin-left: 16px;
  margin-bottom: 4px;
}
.po-run-child .po-row {
  border-radius: 8px;
}

/* PO drawer warnings — surface "SKU not in inventory" and fuzzy-
   match issues above the items table so the user fixes them before
   pushing. Two severities: error (Zoho will reject) and warn
   (review recommended). */
.po-warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.po-warning {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.5;
}
.po-warning code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  margin: 0 4px;
}
.po-warning-error {
  background: var(--rdl);
  color: var(--rd);
  border: 1px solid var(--rdb);
}
.po-warning-warn {
  background: var(--aml);
  color: var(--am);
  border: 1px solid var(--amb);
}

/* Column-chooser modal — two-tab layout. Available shows columns
   grouped by category with checkboxes; Active shows the selected
   subset with drag handles + remove buttons in render order. */
/* Two-popover column chooser pattern.
   Replaces the older modal/drawer with two distinct positioned
   popovers — one anchored to the "Columns" button (Available
   picker, ~600px wide), one to the "N active" pill (compact
   Active list with drag-reorder + remove). */

/* Paired button: Columns | N active */
.col-btn-pair {
  display: inline-flex;
  border: 1px solid var(--bd);
  border-radius: 999px;
  background: var(--sf);
  overflow: hidden;
  height: 30px;
}
.col-btn-pair > button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  padding: 0 12px;
  cursor: pointer;
  color: var(--tx);
}
.col-btn-pair > button:hover { background: var(--acl); }
.col-btn-main {
  font-weight: 500;
  border-right: 1px solid var(--bd) !important;
}
.col-btn-active-count {
  color: var(--tx2);
  font-weight: 600;
}

/* Popover base — positioned dropdown with backdrop-free dismiss
   (outside-click handler in JS). Stays anchored to the trigger
   button via inline top/right positions set at open time. */
.col-popover {
  position: absolute;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
  z-index: 1000;
  font-size: 13px;
  animation: col-popover-fade 0.12s ease;
}
@keyframes col-popover-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Available popover — wider, two-pane (categories sidebar + list). */
.col-popover-available {
  width: 600px;
  max-width: calc(100vw - 16px);
  max-height: 540px;
  display: flex;
  flex-direction: column;
}
.col-popover-search-wrap {
  padding: 12px 14px 8px;
}
.col-popover-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--tx);
  font-size: 13px;
  font-family: inherit;
}
.col-popover-search:focus {
  outline: none;
  border-color: var(--bl);
}
.col-popover-meta {
  padding: 0 14px 8px;
  font-size: 11px;
  color: var(--tx3);
  border-bottom: 1px solid var(--bd);
}
.col-popover-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.col-popover-sidebar {
  width: 180px;
  flex-shrink: 0;
  border-right: 1px solid var(--bd);
  padding: 8px 8px 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.col-popover-sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--tx3);
  letter-spacing: 0.04em;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.col-popover-cat {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--tx2);
}
.col-popover-cat:hover { background: var(--acl); color: var(--tx); }
.col-popover-cat.is-active {
  background: var(--acl);
  color: var(--tx);
  font-weight: 600;
}
.col-popover-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.col-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.col-popover-item:hover { background: var(--acl); }
.col-popover-item.is-required { cursor: default; opacity: 0.6; }
.col-popover-item-label { flex: 1; }
.col-popover-item-group {
  font-size: 10px;
  color: var(--tx3);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 999px;
}
.col-popover-check {
  color: var(--gn);
  font-weight: 700;
  width: 14px;
  text-align: center;
}
.col-popover-check-empty { width: 14px; }
.col-popover-empty {
  padding: 24px;
  text-align: center;
  color: var(--tx3);
  font-size: 12px;
}

/* Active popover — narrower, compact list with drag-reorder. */
.col-popover-active {
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: 480px;
  display: flex;
  flex-direction: column;
}
.col-popover-active-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tx3);
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--bd);
}
.col-popover-active-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.col-popover-active-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: grab;
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.col-popover-active-row:hover { background: var(--acl); }
.col-popover-active-row:active { cursor: grabbing; }
.col-popover-active-row.is-dragging {
  opacity: 0.35;
  transform: scale(0.98);
}

/* Drop indicator — a 2px green line above or below the hovered
   row showing exactly where the dragged item will land. Uses
   pseudo-elements positioned with `position: relative` on the row
   so the indicator overlays the gap between rows. */
.col-popover-active-row.drop-above::before,
.col-popover-active-row.drop-below::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  background: var(--gn);
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}
.col-popover-active-row.drop-above::before  { top: -2px; }
.col-popover-active-row.drop-below::after   { bottom: -2px; }
/* Small dot at the leading edge of the indicator so the user's
   eye snaps to it. Same accent green as the line. */
.col-popover-active-row.drop-above::before {
  box-shadow: -3px 0 0 var(--gn), 0 0 0 1px var(--sf) inset;
}
.col-popover-active-row.drop-below::after {
  box-shadow: -3px 0 0 var(--gn), 0 0 0 1px var(--sf) inset;
}
.col-popover-drag {
  color: var(--tx3);
  letter-spacing: -2px;
  user-select: none;
}
.col-popover-active-label { flex: 1; }
.col-popover-required-tag {
  font-size: 10px;
  color: var(--tx3);
  font-style: italic;
}
.col-popover-remove {
  background: transparent;
  border: 0;
  color: var(--rd);
  font-size: 16px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.col-popover-remove:hover { opacity: 0.7; }
/* Older `.po-col-modal-*` classes (centered-modal column chooser)
   were removed when the chooser switched to the two-popover
   pattern. The popover styles live above as `.col-popover-*`. */

/* Per-row flags (combined into a single Flags cell). Three
   severities: error / warn / info. */
.po-row-flag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  margin-right: 4px;
  cursor: help;
}
.po-row-flag-error { background: var(--rdl); color: var(--rd); border: 1px solid var(--rdb); }
.po-row-flag-warn  { background: var(--aml); color: var(--am); border: 1px solid var(--amb); }
.po-row-flag-info  { background: var(--acl); color: var(--tx); border: 1px solid var(--acb); }
/* Interactive flag — clickable, looks like a slightly stronger
   chip with hover affordance. Used for Not tracked / Archived
   flags that launch the Find Similar replacement flow. */
.po-row-flag-btn {
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: filter 0.1s ease;
}
.po-row-flag-btn:hover { filter: brightness(0.95); }

/* Find Similar replacement modal — list of fuzzy-matched
   inventory items with a Replace button per row. Reuses the
   shared modal-overlay shell. */
.po-find-similar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 6px;
  background: var(--bg);
}
.po-find-similar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--sf);
}
.po-find-similar-info { flex: 1; min-width: 0; }
.po-find-similar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 4px;
}
.po-find-similar-title code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
}
.po-find-similar-score {
  font-size: 11px;
  color: var(--tx3);
  background: var(--acl);
  padding: 1px 6px;
  border-radius: 999px;
}
.po-find-similar-meta {
  font-size: 11px;
  color: var(--tx3);
}
.po-find-similar-empty {
  padding: 24px;
  text-align: center;
  color: var(--tx3);
  font-size: 12px;
}

/* Smart Reorder: dedicated num-cell class so the new sold30/60/90
   columns align right and use tabular figures. */
.reorder-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 8px 10px;
}
.po-drawer-readonly {
  margin-top: 10px;
  font-size: 12px;
  color: var(--tx3);
  font-style: italic;
}
.po-drawer-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--sf);
}
.po-drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.po-drawer-table thead {
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
}
.po-drawer-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  color: var(--tx2);
  font-size: 11px;
}
.po-drawer-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--bd);
}
.po-drawer-table .po-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.po-drawer-table code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Timeline */
.po-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding-left: 4px;
}
.po-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.po-timeline-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blb);
  margin-top: 5px;
}
.po-timeline-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
}
.po-timeline-date {
  font-size: 11px;
  color: var(--tx3);
}

@media (max-width: 720px) {
  .po-row-main {
    grid-template-columns: 1fr 1fr;
  }
  .po-row-cell { padding: 4px 0; }
  .po-row-toggle { grid-column: 2; text-align: right; }
}

.export-add-sku-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--tx);
  font-size: 14px;
  font-family: inherit;
}
.export-add-sku-search-input:focus {
  outline: none;
  border-color: var(--blb);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Add Item modal — typeahead results list.
   Used by ExportFlow.openAddSkuToPo to drop an inventory item
   onto an existing PO at review time. */
.export-add-sku-results {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
  margin-top: 10px;
  background: var(--bg);
}
.export-add-sku-hint {
  padding: 16px;
  text-align: center;
  color: var(--tx3);
  font-size: 12px;
}
.export-add-sku-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--bd);
}
.export-add-sku-row:first-child { border-top: 0; }
.export-add-sku-row.is-already-in-po { background: var(--sf); }
.export-add-sku-row.is-archived { opacity: 0.7; }
.export-add-sku-row-info { flex: 1; min-width: 0; }
.export-add-sku-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 4px;
}
.export-add-sku-row-title code {
  font-size: 11px;
  background: var(--sf);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.export-add-sku-row-meta {
  font-size: 11px;
  color: var(--tx3);
}
.export-add-sku-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.export-add-sku-qty {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
  font-size: 13px;
  text-align: right;
}

/* Generic per-section header on supplier cards. Used for the
   "Brands", "Categories", and "Suggested brands" groupings so the
   user can read each chip cluster without ambiguity. Sentence case,
   not all-caps — matches the rest of the v2 typography. */
.supplier-section {
  margin-top: 10px;
}
.supplier-section:first-of-type { margin-top: 0; }
.supplier-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  margin-bottom: 6px;
  cursor: help;
}
.supplier-section-label-suggested {
  color: var(--tx3);
}
.supplier-suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.brand-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--sf);
  color: var(--tx);
  border: 1px dashed var(--bd);
  border-radius: 980px;
}
.brand-suggestion-name {
  line-height: 1.4;
}
.brand-suggestion-accept,
.brand-suggestion-dismiss {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-suggestion-accept {
  color: var(--bl);
  background: var(--bll);
}
.brand-suggestion-accept:hover {
  background: var(--bl);
  color: #fff;
}
.brand-suggestion-dismiss {
  color: var(--tx3);
}
.brand-suggestion-dismiss:hover {
  color: var(--tx);
  background: var(--sf3, var(--sf2));
}

/* ===== Brand candidates panel ====================================
 * Sits above the supplier grid when products.vendor turns up names
 * not yet represented as a supplier. Per-chip + creates a stub
 * supplier; × adds the name to a localStorage dismiss list.
 * Visually distinct from the per-supplier suggestion chips so the
 * user understands these are catalog-wide, not tied to one card.
 * ================================================================ */
.brand-candidates-panel {
  grid-column: 1 / -1;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.brand-candidates-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.brand-candidates-header strong {
  font-size: 13px;
}
.brand-candidates-sub {
  font-size: 11px;
  color: var(--tx3);
}
.brand-candidates-search {
  margin-left: auto;
  flex: 0 1 240px;
  min-width: 160px;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--bg);
  color: var(--tx);
}
.brand-candidates-search:focus {
  border-color: var(--ac);
  outline: none;
}
.brand-candidates-empty {
  margin-top: 8px;
  font-size: 12px;
  color: var(--tx3);
}
/* Bulk-select bar: shown only when one or more brand chips are
   ticked. Lets the user create a single supplier OR merge into an
   existing one in one shot rather than clicking + on each chip. */
.brand-candidates-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  flex-wrap: wrap;
}
.brand-candidates-bulk-bar strong {
  font-size: 12px;
  margin-right: 4px;
}
.brand-candidate-chip.is-selected {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--ac);
}
.brand-candidate-toggle {
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  padding: 0 2px;
  color: var(--tx2);
}
.brand-candidate-chip.is-selected .brand-candidate-toggle {
  color: var(--ac);
}
.brand-candidate-name {
  cursor: pointer;
}
.brand-candidates-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.brand-candidate-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg, #fff);
  color: var(--tx);
  border: 1px solid var(--bd);
  border-radius: 980px;
}
.brand-candidate-name {
  line-height: 1.4;
}
.brand-candidate-count {
  font-size: 10px;
  color: var(--tx3);
  background: var(--sf2, var(--sf));
  padding: 1px 6px;
  border-radius: 980px;
}
.brand-candidate-add,
.brand-candidate-dismiss {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-candidate-add {
  color: var(--bl);
  background: var(--bll);
}
.brand-candidate-add:hover {
  background: var(--bl);
  color: #fff;
}
.brand-candidate-dismiss {
  color: var(--tx3);
}
.brand-candidate-dismiss:hover {
  color: var(--tx);
  background: var(--sf3, var(--sf2));
}
.brand-candidate-more {
  font-size: 11px;
  color: var(--bl);
  text-decoration: none;
  margin-left: 6px;
}
.brand-candidate-more:hover {
  text-decoration: underline;
}

/* ===== Supplier dedupe review panel ============================
 * Surfaces near-match supplier-name pairs (typos, casing diffs, etc.)
 * with a one-click merge action. Grid-spans the full width like the
 * brand-candidates panel, sits above the supplier cards.
 * ================================================================ */
.dedupe-panel {
  grid-column: 1 / -1;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.dedupe-panel-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.dedupe-panel-header strong {
  font-size: 13px;
}
.dedupe-panel-sub {
  font-size: 11px;
  color: var(--tx3);
}
.dedupe-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 10px;
  border-top: 1px solid var(--bd);
}
.dedupe-pair:first-of-type {
  border-top: none;
  padding-top: 4px;
}
.dedupe-pair-names {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.dedupe-pair-primary {
  font-weight: 600;
}
.dedupe-pair-secondary {
  color: var(--tx2, var(--tx));
}
.dedupe-pair-arrow {
  color: var(--tx3);
  font-size: 14px;
}
.dedupe-pair-score {
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 10px;
  color: var(--tx3);
  background: var(--sf2, var(--sf));
  border-radius: 980px;
}
.dedupe-pair-reason {
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 980px;
  text-transform: uppercase;
}
.dedupe-reason-email {
  /* Strongest signal — solid colored pill so it reads as confident. */
  color: #fff;
  background: var(--bl);
}
.dedupe-reason-phone {
  /* Strong signal but a hair below email. Tinted, not solid. */
  color: var(--bl);
  background: var(--bll);
}
.dedupe-reason-name {
  /* Heuristic match — softer styling so users skim past unless the
     similarity score also looks right. */
  color: var(--tx3);
  background: var(--sf2, var(--sf));
}
.dedupe-pair-meta {
  font-size: 11px;
  color: var(--tx3);
}
.dedupe-pair-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

/* ===== Dashboard / Overview redesign (Phase A) =====
 * Inventory-focused dashboard. Three regions:
 *   1. Header with channel toggle
 *   2. KPI tiles (5-up grid) + 1 chart panel
 *   3. Report-card grid (sectioned by domain)
 * Click any report card → opens .dash-drawer overlay from the right.
 */

.dash-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  gap: 8px;
}
.dash-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-header h1 {
  font-family: var(--se);
  font-weight: 400;
  font-size: 28px;
  margin: 0;
  color: var(--tx);
}
.dash-header h1 em { font-style: italic; }

/* Right-aligned meta cluster: "Last updated · Xm ago" + Refresh.
 * Sits between the title and the channel sentence. */
.dash-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.dash-last-updated,
.reorder-last-computed {
  font-size: 12px;
  color: var(--tx3);
  white-space: nowrap;
}
.reorder-empty-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.dash-refresh-icon {
  display: inline-block;
  margin-right: 2px;
  font-weight: 700;
}

/* While a refresh is in flight, every .dash-refresh-btn on the
 * page (header + drawer) flips into a "busy" state — icon spins,
 * button is disabled, label changes to "Refreshing…". Stops the
 * "did I press it?" click-spamming the user mentioned. */
.dash-refresh-btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}
.dash-refresh-btn.is-refreshing .dash-refresh-icon {
  animation: dash-refresh-spin 0.8s linear infinite;
}
@keyframes dash-refresh-spin {
  to { transform: rotate(360deg); }
}

.dash-scope-toggles {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
/* Sentence-style picker — two pills inline with explanatory text
 * so the cross-reference between sales-source and inventory-source
 * is read as one combined view rather than two independent toggles. */
.dash-scope-sentence {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
  color: var(--tx2);
  line-height: 1.6;
}
.dash-scope-sentence .dash-channel-toggle {
  padding: 4px 10px;
  font-size: 13px;
}
.dash-scope-caption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--tx3);
  line-height: 1.5;
  max-width: 640px;
}
.dash-scope-caption strong { color: var(--tx); font-weight: 600; }

/* Cross-channel intersection toggle. Sits under the scope-sentence
 * caption. Defaults ON for multi-channel users (the cross-reference
 * is what most merchants actually want); toggling off expands the
 * view to the full inventory catalogue. The label and helper line
 * are state-aware so the toggle reads like a sentence. */
.dash-scope-intersect {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
  max-width: 720px;
  transition: background-color 0.18s, border-color 0.18s;
}
.dash-scope-intersect.is-on {
  background: linear-gradient(180deg, rgba(44, 111, 255, 0.06), rgba(44, 111, 255, 0.02));
  border-color: rgba(44, 111, 255, 0.25);
}
.dash-scope-intersect strong { color: var(--tx); font-weight: 600; }
.dash-scope-intersect .dash-toggle-switch { margin-top: 1px; }
.dash-scope-intersect-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.dash-scope-intersect-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.dash-scope-intersect-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ac, #2c6fff);
  background: rgba(44, 111, 255, 0.10);
  border-radius: 999px;
}
.dash-scope-intersect-pair-sep { opacity: 0.55; }
.dash-scope-intersect-state {
  color: var(--tx3);
  font-size: 11.5px;
  line-height: 1.45;
}
.dash-scope-intersect.is-on .dash-scope-intersect-state strong { color: var(--ac, #2c6fff); }

/* Generic toggle switch — reusable. iOS-style sliding pill. The
 * <input> is visually hidden; the slider's pseudo-element is the
 * thumb. Drives off :checked + sibling combinator. */
.dash-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.dash-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.dash-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bd);
  border-radius: 20px;
  transition: background-color 0.2s;
}
.dash-toggle-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.dash-toggle-switch input:checked + .dash-toggle-slider {
  background-color: var(--ac, #2c6fff);
}
.dash-toggle-switch input:checked + .dash-toggle-slider::before {
  transform: translateX(16px);
}
.dash-toggle-switch input:focus-visible + .dash-toggle-slider {
  outline: 2px solid var(--ac, #2c6fff);
  outline-offset: 2px;
}

/* "Cross-referenced" chip on each KPI tile when intersection mode
 * is active. Quiet styling — informational, not the headline. */
/* Inline pill-toggle inside a KPI tile. Currently used by the
   Out of stock tile (30 / 60 / 90 / All sales window). Same pill
   look as the page-level segmented controls but smaller. */
.dash-kpi-toggle {
  display: inline-flex;
  border: 1px solid var(--bd);
  border-radius: 999px;
  background: var(--bg);
  padding: 2px;
  gap: 1px;
  margin-top: 6px;
  align-self: flex-start;
}
.dash-kpi-toggle-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--tx2);
  letter-spacing: 0.02em;
}
.dash-kpi-toggle-btn:hover { color: var(--tx); }
.dash-kpi-toggle-btn.is-active {
  background: var(--sf);
  color: var(--tx);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.dash-kpi-intersect {
  /* Pin the chip to the bottom of the tile so it sits on the same
     baseline across every KPI card regardless of how much content
     (number, sub-text) sits above it. Tiles without a sub-line
     would otherwise have the chip floating higher than tiles with
     one — looked misaligned across the row. */
  margin-top: auto;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ac, #2c6fff);
  background: rgba(44, 111, 255, 0.08);
  border: 1px solid rgba(44, 111, 255, 0.18);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-channel-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-btn);
  font-size: 13px;
  color: var(--tx);
  cursor: pointer;
  transition: var(--transition);
}
.dash-channel-toggle:hover { background: var(--sf2); }
.dash-channel-toggle.dash-channel-toggle-static,
.dash-channel-toggle.dash-channel-toggle-disabled {
  cursor: default;
}
.dash-channel-toggle.dash-channel-toggle-disabled {
  opacity: 0.6;
}
.dash-channel-toggle .dash-scope-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tx3);
}
.dash-channel-toggle .dash-scope-value {
  font-weight: 500;
  color: var(--tx);
}
.dash-channel-toggle .dash-channel-caret { color: var(--tx3); font-size: 10px; }

.dash-channel-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  z-index: 50;
  padding: 6px;
  display: none;
}
.dash-channel-menu.open { display: block; }
.dash-channel-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--tx);
  cursor: pointer;
  transition: var(--transition);
}
.dash-channel-menu-item:hover { background: var(--sf2); }
.dash-channel-menu-item.active { background: var(--acl); font-weight: 600; }
.dash-channel-menu-item .dash-channel-meta {
  font-size: 11px; color: var(--tx3); margin-left: auto;
}

/* KPI tiles */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1280px) { .dash-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .dash-kpi-row { grid-template-columns: repeat(2, 1fr); } }

.dash-kpi {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 84px;
}
.dash-kpi-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tx3);
}

/* ===== Edit-mode affordances (drag handles, hide buttons,
 * hidden-items strip, reset link). Used by both KPI tiles and
 * report cards — same visual language so the edit experience
 * feels unified. */

/* Tile / card visual cue when edit mode is active — dashed
 * border + grab cursor so users intuit "this is moveable". */
.dash-kpi.is-editing,
.dash-preview-card.is-editing {
  border: 2px dashed var(--bd);
  cursor: grab;
  position: relative;
}
.dash-kpi.is-editing:active,
.dash-preview-card.is-editing:active { cursor: grabbing; }
.dash-kpi.is-editing:hover,
.dash-preview-card.is-editing:hover {
  border-color: var(--ac, #2c6fff);
}
[data-dash-drag].is-dragging { opacity: 0.4; }
[data-dash-drag].is-drop-target {
  background: rgba(44, 111, 255, 0.10);
  border-color: var(--ac, #2c6fff) !important;
}

/* Drag handle icon — top-left corner. Pure decoration to signal
 * "you can grab this" since the whole tile is draggable. */
.dash-drag-handle {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 14px;
  color: var(--tx3);
  font-weight: 700;
  letter-spacing: -2px;
  pointer-events: none;
}

/* Hide button — top-right corner. Click removes the tile/card
 * from the visible layout (still recoverable via the hidden
 * strip below). */
.dash-kpi-hide,
.dash-card-hide {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--tx3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
}
.dash-kpi-hide:hover,
.dash-card-hide:hover {
  color: var(--rd);
  background: var(--bg);
  border-color: var(--rd);
}

/* Hidden-items strip — appears under the visible KPI row /
 * reports grid in edit mode. Each chip is a one-click "+ Title"
 * button that puts the item back. */
.dash-hidden-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--sf);
  border: 1px dashed var(--bd);
  border-radius: 10px;
}
.dash-hidden-label {
  font-size: 12px;
  color: var(--tx3);
  font-weight: 600;
}
.dash-hidden-chip {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ac, #2c6fff);
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.dash-hidden-chip:hover {
  background: var(--ac, #2c6fff);
  color: var(--ac-text);
  border-color: var(--ac, #2c6fff);
}

/* "Reset to default layout" footer — shown only in edit mode.
 * Quiet styling because it's an escape hatch, not a primary
 * action. */
.dash-edit-footer {
  display: flex;
  justify-content: center;
  margin: 16px 0 8px;
}
.dash-kpi-value {
  font-family: var(--se);
  font-weight: 400;
  font-size: 26px;
  color: var(--tx);
  line-height: 1.1;
}
.dash-kpi-value.dim { color: var(--tx3); }
.dash-kpi-sub {
  font-size: 11px;
  color: var(--tx3);
  margin-top: auto;
}
.dash-kpi-sub.warning { color: var(--am); }
.dash-kpi-sub.danger  { color: var(--rd); }
/* Loading skeletons. Shown while a KPI hasn't resolved yet — prevents
   the "—" flash that made the tiles look empty for the first ~5s on
   cold loads. Width-matched to typical "$1.6M" / "1101" output so the
   tile doesn't visibly resize when real data arrives. */
.dash-kpi-value-skeleton {
  display: block;
  width: 110px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bd) 0%, var(--sf) 50%, var(--bd) 100%);
  background-size: 200% 100%;
  animation: dash-kpi-shimmer 1.4s ease-in-out infinite;
}
.dash-kpi-sub-skeleton {
  display: block;
  width: 80px;
  height: 12px;
  margin-top: auto;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bd) 0%, var(--sf) 50%, var(--bd) 100%);
  background-size: 200% 100%;
  animation: dash-kpi-shimmer 1.4s ease-in-out infinite;
}
@keyframes dash-kpi-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Chart panel */
.dash-chart-panel {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin-bottom: 24px;
}
.dash-chart-panel h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tx3);
}

/* Charts row — brand-stack chart on the left, reorder-health donut
 * on the right. Stacks on narrow viewports. */
.dash-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  /* Stretch instead of align-start so the Top brands card matches
     the Reorder health card's height — no orphan gap below the
     bars when the reorder donut is the taller of the two. */
  align-items: stretch;
}
.dash-charts-row > #dash-chart-host,
.dash-charts-row > #dash-reorder-health-host {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* Card panels inside fill their grid cell vertically so the two
   panels match heights regardless of which has more content. */
.dash-charts-row .dash-chart-panel,
.dash-charts-row .dash-donut-panel {
  flex: 1;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
@media (max-width: 900px) {
  .dash-charts-row { grid-template-columns: 1fr; align-items: start; }
}

/* Reorder health donut panel. */
.dash-donut-panel {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  cursor: pointer;
  transition: var(--transition);
}
.dash-donut-panel:hover { background: var(--sf2); }
.dash-donut-panel h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tx3);
}
.dash-donut-body {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}
.dash-donut-svg {
  display: block;
}
.dash-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.dash-donut-total {
  font-family: var(--se);
  font-size: 26px;
  font-weight: 400;
  color: var(--tx);
  line-height: 1;
}
.dash-donut-total-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--tx3);
}
.dash-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-donut-legend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.dash-donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.dash-donut-legend-label { color: var(--tx2); }
.dash-donut-legend-value { color: var(--tx); font-weight: 600; }
.dash-donut-age {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--bd);
  font-size: 11px;
  color: var(--tx3);
}

/* Per-brand bars beneath the donut. Each row is a click target —
 * navigates to Smart Reorder pre-filtered to that brand. The bar
 * is two-tone: full bar = total flagged, inner red segment =
 * critical share so urgent brands stand out instantly. */
.dash-brandbar-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}
.dash-brandbar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx3);
  margin-bottom: 8px;
}
.dash-brandbar-row {
  display: grid;
  grid-template-columns: minmax(60px, 1fr) 2fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.dash-brandbar-row:hover { background: var(--sf2); }
.dash-brandbar-name {
  font-size: 12px;
  color: var(--tx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-brandbar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--bd);
}
.dash-brandbar-fill {
  height: 100%;
  background: #7c8db5; /* same as donut "low cover" segment */
  border-radius: 4px 0 0 4px;
  position: relative;
}
.dash-brandbar-fill-critical {
  height: 100%;
  background: var(--rd);
  border-radius: 4px 0 0 4px;
}
.dash-brandbar-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx2);
  min-width: 36px;
  text-align: right;
}
.dash-brandbar-critical {
  color: var(--rd);
  margin-right: 2px;
}
.dash-brandbar-expand {
  display: block;
  margin: 8px auto 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ac, #2c6fff);
  background: transparent;
  border: 1px dashed var(--bd);
  border-radius: 999px;
  cursor: pointer;
}
.dash-brandbar-expand:hover {
  background: var(--sf2);
  border-color: var(--ac, #2c6fff);
}

/* Expand button on the pending-reorder task's brand-chip strip.
 * Same look as a chip but uses dashed border to feel less primary. */
.dash-task-brand-expand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ac, #2c6fff);
  background: transparent;
  border: 1px dashed var(--bd);
  border-radius: 999px;
  cursor: pointer;
}
.dash-task-brand-expand:hover {
  background: var(--sf2);
  border-color: var(--ac, #2c6fff);
}

/* Pending-reorder task tone. The action-items widget already
 * styles the base card; this just colours the left edge to
 * communicate severity at a glance. */
.dash-task-tone-critical { border-left: 3px solid var(--rd); }
.dash-task-tone-warning { border-left: 3px solid #B9851B; }

/* Brand chip strip on the pending-reorder task card. Each chip is
 * its own click target; the card-level click navigates to Smart
 * Reorder un-filtered, but a chip click filters to that brand. */
.dash-task-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.dash-task-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.dash-task-brand-chip:hover {
  border-color: var(--ac, #2c6fff);
  color: var(--ac, #2c6fff);
}
.dash-task-brand-chip.is-critical {
  border-color: var(--rd);
  color: var(--rd);
  background: rgba(220, 53, 69, 0.06);
}
.dash-task-brand-chip.is-critical:hover {
  background: var(--rd);
  color: #fff;
}
.dash-task-brand-name { font-weight: 500; }
.dash-task-brand-count {
  font-weight: 600;
  font-size: 11px;
  opacity: 0.9;
}
.dash-chart-panel .dash-chart-headline {
  font-family: var(--se);
  font-weight: 400;
  font-size: 22px;
  color: var(--tx);
  margin-bottom: 14px;
}

/* Hand-rolled SVG horizontal bar chart */
.dash-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}
.dash-bar-label { color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track {
  height: 18px; background: var(--sf2); border-radius: 6px; overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ac) 0%, var(--ac2) 100%);
  border-radius: 6px;
}
.dash-bar-value { color: var(--tx2); text-align: right; font-variant-numeric: tabular-nums; }

/* Report-card grid */
.dash-section {
  margin-bottom: 28px;
}
.dash-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tx2);
  margin: 0 0 12px 2px;
}
.dash-section-title-icon { font-size: 14px; }

/* Preview-card grid — wider cards (each shows a mini-table). */
.dash-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}
@media (max-width: 880px) {
  .dash-card-grid { grid-template-columns: 1fr; }
}

.dash-preview-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px 18px 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}
.dash-preview-card:hover {
  border-color: var(--ac);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.dash-preview-card.compact {
  /* Phase C / placeholder reports — no preview yet; render small. */
  min-height: auto;
}

.dash-preview-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-preview-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
}
.dash-preview-star {
  color: var(--am);
  font-size: 13px;
}
.dash-preview-summary {
  font-size: 12px;
  color: var(--tx3);
  font-variant-numeric: tabular-nums;
}

.dash-preview-table-wrap {
  flex: 1;
  border-top: 1px solid var(--bd);
  margin: 0 -18px;
  /* Hide overflow so wide tables truncate inside the card rather
   * than bleeding into the neighbour tile. Cells use ellipsis below. */
  overflow: hidden;
}
.dash-preview-table {
  font-size: 12px;
  width: 100%;
  table-layout: fixed;
}
.dash-preview-table th,
.dash-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--bd2);
  /* Truncate long product names / supplier names / PO numbers
   * with an ellipsis so each row stays one line. Full text shows
   * in the drawer table. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-preview-table th {
  font-size: 10px;
  background: transparent;
  color: var(--tx3);
  position: static;
  cursor: default;
}
.dash-preview-table tbody tr:hover { background: transparent; }
.dash-preview-table tbody tr:last-child td { border-bottom: 0; }

.dash-preview-footer {
  font-size: 12px;
  color: var(--ac);
  font-weight: 500;
  text-align: right;
  padding-top: 4px;
}
.dash-preview-loading,
.dash-preview-empty {
  font-size: 12px;
  color: var(--tx3);
  text-align: center;
  padding: 24px 0;
  font-style: italic;
}

/* Drawer overlay */
.dash-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
}
.dash-drawer-backdrop.open { display: block; }
.dash-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(640px, 90vw);
  background: var(--bg);
  border-left: 1px solid var(--bd);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.08);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.25s ease, width 0.25s ease;
  display: flex; flex-direction: column;
}
.dash-drawer.open { transform: translateX(0); }
.dash-drawer.fullscreen { width: 100vw; }

.dash-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}
.dash-drawer-title {
  font-family: var(--se);
  font-weight: 400;
  font-size: 18px;
  color: var(--tx);
  margin: 0;
}
.dash-drawer-actions { display: flex; gap: 6px; }
.dash-drawer-btn {
  background: transparent;
  border: 1px solid var(--bd);
  color: var(--tx2);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
  font-size: 14px;
}
.dash-drawer-btn:hover { background: var(--sf2); color: var(--tx); }
.dash-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  font-size: 14px;
  color: var(--tx);
  line-height: 1.6;
}
.dash-drawer-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--tx3);
}
.dash-drawer-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Inline tile placeholder text for tiles that don't apply to the
 * selected channel (e.g. inventory tile when channel is sales-only). */
.dash-kpi-na {
  font-size: 11px;
  color: var(--tx3);
  font-style: italic;
}

/* ---- Phase B: report drawer body ---- */

.dash-report-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bd);
  margin-bottom: 14px;
}
.dash-report-summary-stat {
  flex: 0 0 auto;
}
.dash-report-summary-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--tx3);
  margin-bottom: 2px;
}
.dash-report-summary-stat-value {
  font-family: var(--se);
  font-weight: 400;
  font-size: 18px;
  color: var(--tx);
}

.dash-report-desc {
  font-size: 12px;
  color: var(--tx3);
  margin: 0 0 10px;
  line-height: 1.5;
}

.dash-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.dash-report-actions .dash-report-rowcount {
  font-size: 11px;
  color: var(--tx3);
  margin-left: auto;
}

.dash-report-table-wrap {
  /* Lets wide tables scroll horizontally inside the drawer
   * without breaking the layout. Fullscreen mode gets the full
   * viewport so most reports won't need horizontal scroll there. */
  overflow-x: auto;
  border: 1px solid var(--bd);
  border-radius: 8px;
}
.dash-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--sf);
}
.dash-report-table th,
.dash-report-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bd);
  vertical-align: middle;
}
.dash-report-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tx3);
  background: var(--sf2);
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.dash-report-table th.sortable:hover { color: var(--tx); }
.dash-report-table th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.5;
  font-size: 10px;
}
.dash-report-table th.sorted .sort-indicator { opacity: 1; }
.dash-report-table tbody tr:hover { background: var(--sf2); }
.dash-report-table tbody tr:last-child td { border-bottom: 0; }
.dash-report-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dash-report-table .muted { color: var(--tx3); }
.dash-report-table .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.dash-report-table .pill.warning { background: var(--aml); color: var(--am); }
.dash-report-table .pill.danger  { background: var(--rdl); color: var(--rd); }
.dash-report-table .pill.ok      { background: var(--gnl); color: var(--gn); }

.dash-report-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--tx3);
  font-size: 13px;
}
.dash-report-loading {
  padding: 32px 20px;
  text-align: center;
  color: var(--tx3);
  font-size: 13px;
}

/* Per-report filter bar inside the drawer */
.dash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 12px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: 8px;
  margin-bottom: 12px;
}
.dash-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
  min-width: 160px;
}
.dash-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tx3);
}
.dash-filter-input {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 6px;
  color: var(--tx);
}
.dash-filter-input:focus {
  outline: none;
  border-color: var(--ac);
}
.dash-filter-multi {
  padding: 4px 6px;
}
.dash-filter-clear {
  align-self: flex-end;
  flex: 0 0 auto;
}

/* ===== Smart Reorder: supplier reroute menu ===== */
.reorder-supplier-link {
  color: var(--tx);
  text-decoration: none;
  border-bottom: 1px dashed var(--bd);
  cursor: pointer;
}
.reorder-supplier-link:hover {
  color: var(--ac);
  border-bottom-color: var(--ac);
}

.reorder-reroute-undo {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--tx3);
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
}
.reorder-reroute-undo:hover { color: var(--rd); }

.reorder-reroute-menu {
  position: absolute;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  min-width: 240px;
  max-width: 320px;
  padding: 6px;
  z-index: 1100;
}
.reorder-reroute-header {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--tx3);
  border-bottom: 1px solid var(--bd);
  margin-bottom: 4px;
}
.reorder-reroute-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.reorder-reroute-item:hover { background: var(--sf2); }
.reorder-reroute-name { font-weight: 500; color: var(--tx); }
.reorder-reroute-meta { font-size: 11px; color: var(--tx3); }
.reorder-reroute-empty {
  padding: 14px 12px;
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.5;
}

/* ===== Supplier modal: MOQ per-brand table ===== */
.sup-moq-explain {
  font-size: 12px;
  color: var(--tx3);
  line-height: 1.5;
  padding: 8px 0 12px;
}
.sup-moq-explain strong {
  color: var(--tx);
  font-weight: 600;
}
.sup-moq-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 8px;
  background: var(--sf2);
}
.sup-moq-row {
  display: grid;
  grid-template-columns: 1fr 110px 110px;
  gap: 10px;
  align-items: end;
}
.sup-moq-brand {
  font-size: 13px;
  color: var(--tx);
  padding-bottom: 6px;
  align-self: end;
  font-weight: 500;
}
.sup-moq-input {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sup-moq-input label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tx3);
}
.sup-moq-input input {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  background: var(--sf);
  color: var(--tx);
  width: 100%;
}
.sup-moq-input input:focus {
  outline: none;
  border-color: var(--ac);
}

/* ===== Dashboard onboarding checklist ===== */
.dash-onboarding {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 24px;
}
.dash-onboarding-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.dash-onboarding-progress {
  flex-shrink: 0;
  width: 120px;
  height: 6px;
  background: var(--sf2);
  border-radius: 100px;
  overflow: hidden;
}
.dash-onboarding-progress-fill {
  height: 100%;
  background: var(--gn);
  transition: width 0.3s ease;
}
.dash-onboarding-step.active {
  border-color: var(--ac);
  background: var(--acl);
}
.dash-onboarding-step.active .dash-onboarding-step-icon {
  background: var(--ac);
  color: var(--ac-text);
}
.dash-onboarding-title {
  font-family: var(--se);
  font-weight: 400;
  font-size: 18px;
  color: var(--tx);
  margin: 0 0 2px;
}
.dash-onboarding-subtitle {
  font-size: 12px;
  color: var(--tx3);
  margin: 0;
}
.dash-onboarding-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-onboarding-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--sf2);
  border-radius: 8px;
  border: 1px solid transparent;
}
.dash-onboarding-step.gated { opacity: 0.55; }
.dash-onboarding-step.done {
  background: var(--gnl);
  border-color: var(--gnb);
}
.dash-onboarding-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sf3);
  color: var(--tx2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.dash-onboarding-step.done .dash-onboarding-step-icon {
  background: var(--gn);
  color: white;
}
.dash-onboarding-step-body {
  flex: 1;
  min-width: 0;
}
.dash-onboarding-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}
.dash-onboarding-step-desc {
  font-size: 12px;
  color: var(--tx3);
  margin-top: 2px;
  line-height: 1.4;
}
.dash-onboarding-step-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gn);
  flex-shrink: 0;
}
.dash-onboarding-step-status.muted { color: var(--tx3); }

/* ===== First-visit welcome modal ===== */
.orderly-welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.orderly-welcome-modal.open { opacity: 1; }
.orderly-welcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.orderly-welcome-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 16px;
  width: min(540px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 36px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  transform: translateY(8px);
  transition: transform 0.2s ease;
}
.orderly-welcome-modal.open .orderly-welcome-card { transform: translateY(0); }
.orderly-welcome-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--tx3);
  margin-bottom: 8px;
}
.orderly-welcome-title {
  font-family: var(--se);
  font-weight: 400;
  font-size: 32px;
  margin: 0 0 12px;
  color: var(--tx);
}
.orderly-welcome-title em { font-style: italic; }
.orderly-welcome-subtitle {
  font-size: 14px;
  color: var(--tx2);
  line-height: 1.55;
  margin: 0 0 20px;
}
.orderly-welcome-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.orderly-welcome-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.orderly-welcome-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ac);
  color: var(--ac-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.orderly-welcome-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}
.orderly-welcome-step-desc {
  font-size: 12px;
  color: var(--tx3);
  line-height: 1.4;
  margin-top: 2px;
}
.orderly-welcome-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.orderly-welcome-actions .btn-link {
  background: transparent;
  border: 0;
  color: var(--tx3);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: underline;
}
.orderly-welcome-actions .btn-link:hover { color: var(--tx); }

/* ===== Dashboard tasks widget ===== */
.dash-tasks {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.dash-tasks-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.dash-tasks-title {
  font-family: var(--se);
  font-weight: 400;
  font-size: 16px;
  color: var(--tx);
  margin: 0;
}
.dash-tasks-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--am);
  color: white;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}
.dash-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--aml);
  border: 1px solid var(--amb);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.dash-task-card:hover {
  background: var(--sf2);
  border-color: var(--am);
}
.dash-task-icon {
  font-size: 18px;
  color: var(--am);
  flex-shrink: 0;
}
.dash-task-body {
  flex: 1;
  min-width: 0;
}
.dash-task-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}
.dash-task-summary {
  font-size: 12px;
  color: var(--tx2);
  margin-top: 2px;
  line-height: 1.4;
}
.dash-task-action {
  font-size: 12px;
  color: var(--ac);
  font-weight: 500;
  flex-shrink: 0;
}
/* Secondary action under the task summary — used for the "Tune
   thresholds" link on the pending-reorder card. Styled as a subtle
   inline link so it doesn't compete with the primary right-side
   action chevron. */
.dash-task-secondary-action {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--tx2);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}
.dash-task-secondary-action:hover {
  color: var(--ac);
  text-decoration-style: solid;
}

/* PO errors task drawer body */
.dash-poerr-runs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-poerr-run {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 12px 14px;
}
.dash-poerr-run-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.dash-poerr-run-meta {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 2px;
}
.dash-poerr-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.dash-poerr-type {
  background: var(--sf2);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.dash-poerr-type:last-child { margin-bottom: 0; }
.dash-poerr-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.dash-poerr-type-header .muted { font-size: 11px; color: var(--tx3); }
.dash-poerr-source {
  font-size: 12px;
  color: var(--tx2);
  padding: 4px 0;
}
.dash-poerr-source .muted { color: var(--tx3); }
.dash-poerr-samples {
  font-size: 11px;
  color: var(--tx3);
  margin-top: 3px;
}
.dash-poerr-samples code {
  background: var(--sf3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  margin-right: 4px;
}

/* Live data-quality drawer — replaces the old PO-errors drawer.
 * One section per category (no_inventory / no_supplier / no_cost),
 * each with a header, descriptive blurb, and a table of items. No
 * dismissal — items vanish from the next render once the underlying
 * data is fixed. */
.dash-dq-category {
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--sf);
}
.dash-dq-category:last-child { margin-bottom: 0; }
.dash-dq-category-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.dash-dq-category-header strong {
  font-size: 14px;
  color: var(--tx);
}
.dash-dq-category-header .muted {
  font-size: 12px;
  color: var(--tx3);
}
.dash-dq-category-desc {
  font-size: 12px;
  color: var(--tx3);
  line-height: 1.4;
  margin: 0 0 12px;
}
.dash-dq-overflow {
  margin-top: 8px;
  font-size: 12px;
  color: var(--tx3);
  font-style: italic;
}
/* "Clean" empty-category affirmation. Quieter background + green
 * tag so the user can scan and see at a glance which checks passed
 * vs which surfaced items. */
.dash-dq-category.dash-dq-category-clean {
  background: transparent;
  border-style: dashed;
}
.dash-dq-category.dash-dq-category-clean .dash-dq-category-desc {
  margin: 0;
}
.dash-dq-clean-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1f7a3a;
  background: #e8f5ee;
  border-radius: 999px;
}

/* Reusable inline notice on a card (e.g. Integrations cards' "reconnect
 * to enable feature X" banner). Yellow tint = action recommended;
 * not blocking. */
.card-banner {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--tx);
  line-height: 1.45;
}
.card-banner-warning {
  background: var(--aml);
  border: 1px solid var(--amb);
  color: #6B3F03;
}
.card-banner-warning .btn { margin-top: 0; }

/* ===== Tooltip (ⓘ info icons) ===== */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sf3);
  color: var(--tx3);
  font-size: 10px;
  font-weight: 600;
  font-style: italic;
  font-family: var(--se);
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  user-select: none;
}
.tooltip-icon:hover { background: var(--ac); color: var(--ac-text); }
.tooltip-icon.is-pinned {
  background: var(--ac);
  color: var(--ac-text);
}

/* Tooltip portal — single body-level <div class="tooltip-portal">
 * managed by utils.js's _wireTooltipPortal(). One bubble for the
 * whole app, positioned via JS using getBoundingClientRect() so it
 * always escapes any ancestor's `overflow: hidden` (e.g.
 * .reorder-group's rounded-corner clip) and never clips the
 * viewport. position: fixed pins it to the viewport during scroll
 * so the pinned state stays anchored to its trigger. */
.tooltip-portal {
  position: fixed;
  z-index: 9999;
  background: var(--ac);
  color: var(--ac-text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  font-family: var(--sa);
  line-height: 1.4;
  max-width: 320px;
  text-align: left;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* Allow line-wrapping for long messages so the bubble doesn't
   * clip text when the diagnostic surfaces 4+ buckets. */
  white-space: normal;
  word-wrap: break-word;
}
/* When pinned (user clicked the ⓘ), the bubble becomes
 * interactive — text-selectable for copy/paste, slightly larger
 * max-width to fit longer error diagnostics. Hover-only stays
 * pointer-events:none so the cursor can move through the bubble
 * to the icon below. */
.tooltip-portal.is-pinned {
  pointer-events: auto;
  user-select: text;
  cursor: text;
  max-width: 480px;
}

/* ============================================================ */
/* SKU lookup — topbar search box + right-side detail drawer.   */
/* Lives in the topbar; reachable from every page.              */
/* ============================================================ */

.sku-lookup-box {
  position: relative;
  flex: 0 1 320px;
  margin: 0 12px;
  min-width: 0;
}
.sku-lookup-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: var(--bg-soft, var(--bg));
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sku-lookup-input::placeholder { color: var(--ghost); }
.sku-lookup-input:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ac) 25%, transparent);
}

.sku-lookup-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 200;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.sku-lookup-result {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--bd-soft, var(--bd));
}
.sku-lookup-result:last-child { border-bottom: 0; }
.sku-lookup-result:hover { background: var(--bg-soft, var(--bg)); }
.sku-lookup-result-sku {
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 2px;
}
.sku-lookup-result-name {
  font-size: 13px;
  color: var(--ink);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.sku-lookup-result mark {
  background: color-mix(in srgb, var(--ac) 25%, transparent);
  color: inherit;
  padding: 0;
}
.sku-lookup-vendor {
  font-size: 11px;
  color: var(--ghost);
}
.sku-lookup-archived {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--bd);
  color: var(--ghost);
  border-radius: 4px;
  text-transform: uppercase;
}
.sku-lookup-empty {
  padding: 12px;
  text-align: center;
  color: var(--ghost);
  font-size: 13px;
}

/* Right-side drawer. Slides in from the right edge over a dimmed
 * overlay. Shares the structural pattern of the notif drawer but
 * is wider (sales tiles + per-channel table need the room). */
.sku-lookup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.sku-lookup-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.sku-lookup-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 460px;
  max-width: 92vw;
  height: 100vh;
  z-index: 1000;
  background: var(--bg);
  border-left: 1px solid var(--bd);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sku-lookup-drawer.is-open { transform: translateX(0); }
.sku-lookup-drawer-close {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ghost);
  cursor: pointer;
  padding: 4px 8px;
}
.sku-lookup-drawer-close:hover { color: var(--ink); }
.sku-lookup-drawer-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--bd);
  flex: 0 0 auto;
}
.sku-lookup-drawer-header h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  padding-right: 30px; /* leave room for close button */
  display: flex;
  align-items: center;
  gap: 8px;
}
.sku-lookup-drawer-subhead {
  font-size: 12px;
  color: var(--ghost);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.sku-lookup-mono {
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
}
.sku-lookup-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 24px;
}
.sku-lookup-section {
  margin-bottom: 20px;
}
.sku-lookup-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 8px;
}
.sku-lookup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.sku-lookup-tile {
  background: var(--bg-soft, var(--bg));
  border: 1px solid var(--bd-soft, var(--bd));
  border-radius: 6px;
  padding: 10px 12px;
}
.sku-lookup-tile-label {
  font-size: 11px;
  color: var(--ghost);
  margin-bottom: 2px;
}
.sku-lookup-tile-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.sku-lookup-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bd-soft, var(--bd));
  font-size: 13px;
}
.sku-lookup-row:last-child { border-bottom: 0; }
.sku-lookup-label {
  color: var(--ghost);
  font-size: 12px;
  flex: 0 0 auto;
}
.sku-lookup-value {
  color: var(--ink);
  text-align: right;
}
.sku-lookup-muted { color: var(--ghost); }
.sku-lookup-meta {
  font-size: 11px;
  color: var(--ghost);
  margin-top: 4px;
}
.sku-lookup-stock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sku-lookup-stock-table th,
.sku-lookup-stock-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--bd-soft, var(--bd));
  text-align: left;
}
.sku-lookup-stock-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sku-lookup-stock-table th {
  color: var(--ghost);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.sku-lookup-tag {
  display: inline-block;
  font-size: 9px;
  background: var(--bd);
  color: var(--ghost);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sku-lookup-skeleton {
  height: 200px;
  background: linear-gradient(90deg, var(--bd-soft, var(--bd)) 25%, var(--bg-soft, var(--bg)) 50%, var(--bd-soft, var(--bd)) 75%);
  background-size: 200% 100%;
  animation: sku-lookup-shimmer 1.4s linear infinite;
  border-radius: 6px;
}
@keyframes sku-lookup-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sku-lookup-error {
  color: var(--rd, #c43);
  font-size: 13px;
}

/* Hide the topbar search on small viewports — the topbar gets
 * cramped and the existing breadcrumb / actions take priority.
 * Drawer remains accessible programmatically from page-internal
 * links once we add them. */
@media (max-width: 720px) {
  .sku-lookup-box { display: none; }
}

/* ============================================================ */
/* Channel match audit — modals, banner, results table.         */
/* ============================================================ */

/* Match-key picker modal options */
.ca-key-options { display: flex; flex-direction: column; gap: 10px; }
.ca-key-opt {
  display: flex; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--bd); border-radius: 8px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ca-key-opt:hover { border-color: var(--ghost); }
.ca-key-opt.is-selected {
  border-color: var(--ac, #2563eb);
  background: color-mix(in srgb, var(--ac, #2563eb) 6%, transparent);
}
.ca-key-opt input { margin-top: 3px; flex: 0 0 auto; }
.ca-key-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.ca-key-desc { font-size: 12px; color: var(--ghost); line-height: 1.45; }
.ca-key-tag {
  display: inline-block; font-size: 10px; font-weight: 600;
  background: color-mix(in srgb, var(--ac, #2563eb) 18%, transparent);
  color: var(--ac, #2563eb);
  padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.ca-key-tag-warn {
  background: color-mix(in srgb, var(--rd, #c43) 18%, transparent);
  color: var(--rd, #c43);
}
.ca-trigger-note {
  margin-top: 14px; padding: 10px 12px;
  background: color-mix(in srgb, var(--ac, #2563eb) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--ac, #2563eb) 28%, transparent);
  border-radius: 6px; font-size: 12px; color: var(--ink);
}

/* Audit modal */
.ca-loading, .ca-error, .ca-clean {
  padding: 20px; text-align: center; font-size: 13px;
  border-radius: 6px;
}
.ca-error {
  background: color-mix(in srgb, var(--rd, #c43) 8%, transparent);
  color: var(--rd, #c43);
}
.ca-clean {
  background: color-mix(in srgb, var(--gn, #2a8) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--gn, #2a8) 30%, transparent);
  color: var(--ink); text-align: left;
}
.ca-summary {
  background: var(--bg-soft, var(--bg));
  border: 1px solid var(--bd);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
}
.ca-summary-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; padding: 4px 0;
}
.ca-summary-label {
  color: var(--ghost); width: 170px; flex: 0 0 auto;
}
.ca-summary-bar {
  position: relative; height: 24px; margin-top: 10px;
  border-radius: 12px; overflow: hidden;
  background: color-mix(in srgb, var(--rd, #c43) 14%, transparent);
}
.ca-summary-bar.is-ok {
  background: color-mix(in srgb, var(--gn, #2a8) 14%, transparent);
}
.ca-summary-bar.is-info {
  background: color-mix(in srgb, var(--am, #c84) 14%, transparent);
}
.ca-summary-bar-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
}
.ca-summary-bar-fill.ca-bar-matched {
  background: color-mix(in srgb, var(--gn, #2a8) 45%, transparent);
}
.ca-summary-bar-fill.ca-bar-inactive {
  background: color-mix(in srgb, var(--am, #c84) 50%, transparent);
}
.ca-summary-bar-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--ink);
}
/* Three-bucket breakdown under the summary bar. Replaces the
 * comma-separated text that looked like a hierarchy. Each row gets
 * a color-coded dot matching its bar segment so the eye links the
 * count to the corresponding bar slice. */
.ca-summary-breakdown {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ca-bk {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
}
.ca-bk-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  position: relative;
  top: 1px;
}
.ca-bk-matched .ca-bk-dot { background: color-mix(in srgb, var(--gn, #2a8) 55%, transparent); }
.ca-bk-inactive .ca-bk-dot { background: color-mix(in srgb, var(--am, #c84) 60%, transparent); }
.ca-bk-unmatched .ca-bk-dot { background: color-mix(in srgb, var(--rd, #c43) 55%, transparent); }
.ca-bk strong { font-variant-numeric: tabular-nums; }
.ca-bk-detail {
  color: var(--ghost);
  font-size: 11px;
  margin-left: 2px;
}
.ca-warning {
  margin-bottom: 14px; padding: 12px 14px;
  background: color-mix(in srgb, var(--rd, #c43) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--rd, #c43) 30%, transparent);
  border-radius: 6px; font-size: 13px; line-height: 1.5;
}
/* Informational box — for the "matched but inactive" section.
 * Amber palette signals "FYI, not blocking" vs the red error
 * palette used by .ca-warning. */
.ca-info {
  margin-bottom: 14px; padding: 12px 14px;
  background: color-mix(in srgb, var(--am, #c84) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--am, #c84) 30%, transparent);
  border-radius: 6px; font-size: 13px; line-height: 1.5;
}
.ca-warn-detail { font-size: 12px; color: var(--ghost); }
/* Inline status pill for the "Inventory status" column on the
 * matched-but-inactive table. */
.ca-status-pill {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--am, #c84) 18%, transparent);
  color: var(--am, #c84);
  font-weight: 600;
}
/* Fuzzy "possible match" cell in the unmatched-items table.
 * Two-line layout: probable inventory item name on top (with
 * inactive status pill when applicable), SKU + confidence below
 * in a muted second line. Wide enough to read; doesn't crowd
 * the other columns. */
.ca-match-name {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}
.ca-match-meta {
  font-size: 11px;
  color: var(--ghost);
  margin-top: 2px;
}
.ca-match-meta code {
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
}
.ca-table-wrap {
  max-height: 360px; overflow: auto;
  border: 1px solid var(--bd); border-radius: 6px;
  margin-bottom: 14px;
}
.ca-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.ca-table th, .ca-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--bd-soft, var(--bd));
  text-align: left;
}
.ca-table th {
  position: sticky; top: 0;
  background: var(--bg);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--ghost);
}
.ca-table code { font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace); }
.ca-reason { color: var(--rd, #c43); font-size: 11px; }
.ca-muted { color: var(--ghost); }
.ca-table-tail {
  padding: 10px 14px; font-size: 12px;
  color: var(--ghost); text-align: center;
  border-top: 1px solid var(--bd-soft, var(--bd));
}
.ca-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 6px;
}
.ca-link-btn {
  background: transparent; border: 0;
  color: var(--ac, #2563eb); font-size: 11px;
  cursor: pointer; text-decoration: underline;
  padding: 0 4px;
}

/* Smart Reorder banner — shown when sales channels have unaudited
 * mismatches against the inventory master. */
.ca-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin: 0 0 14px;
  background: color-mix(in srgb, var(--rd, #c43) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--rd, #c43) 30%, transparent);
  border-radius: 8px;
  font-size: 13px; line-height: 1.45;
}
.ca-banner-icon { font-size: 16px; flex: 0 0 auto; }
.ca-banner-body { flex: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ca-banner-body > div { flex: 1; min-width: 0; }
