/* ============================================================================
 * motion.css — the "alive" layer.
 *
 * Loaded AFTER style.css so it overrides where it needs to. It does three
 * things:
 *   1. Adds smooth transitions to every interactive surface.
 *   2. Lifts panels / cards / buttons / tags / nav items on hover.
 *   3. Drives a few keyframe animations (logo gradient, soon-badge pulse,
 *      pending-banner shimmer, mouse-follow glow).
 *
 * Honors prefers-reduced-motion at the bottom — everything decays to a
 * static look for users who've asked for less motion.
 * ============================================================================ */

/* ============================================================================
 * motion.css — design system + "alive" layer.
 *
 * Loaded AFTER style.css. It does three things:
 *   1. Sets the design-system tokens (palette / spacing / type / shadow)
 *      that the rest of the app uses.
 *   2. Standardizes cards and buttons via variable-driven overrides.
 *   3. Adds the motion layer — transitions, hover lifts, mouse-follow glow.
 *
 * Honors prefers-reduced-motion at the bottom — everything decays to a
 * static look for users who've asked for less motion.
 * ============================================================================ */

/* ----------  Light theme: refined modern SaaS palette  ---------- */
[data-theme="light"] {
  /* Surfaces */
  --bg: #f8f9fb;
  --panel: #ffffff;
  --panel-elevated: #ffffff;
  --bg-input: #f8f9fb;
  --bg-hover: #f3f4f6;
  /* Borders */
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  /* Text */
  --text: #1a1d21;
  --text-strong: #0a0d11;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  /* Semantic colors */
  --ok: #10b981;
  --wait: #f59e0b;
  --fail: #ef4444;
  /* SINGLE accent (modern indigo). Replaces the blue / purple mix. */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-soft-border: rgba(79, 70, 229, 0.25);
  --btn-primary-text: #ffffff;
}

/* ----------  Dark theme: matched palette  ---------- */
[data-theme="dark"] {
  --bg: #0b0d12;
  --panel: #14171f;
  --panel-elevated: #1a1e29;
  --bg-input: #0b0d12;
  --bg-hover: #1a1e29;
  --border: #232633;
  --border-strong: #2d3142;
  --text: #e8ecf3;
  --text-strong: #ffffff;
  --muted: #9ca3af;
  --muted-strong: #cbd5e1;
  --ok: #34d399;
  --wait: #fbbf24;
  --fail: #f87171;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.10);
  --accent-soft-border: rgba(129, 140, 248, 0.28);
  --btn-primary-text: #0b0d12;
}

/* ----------  Design tokens (palette-independent)  ---------- */
:root {
  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Type scale */
  --text-page-title: 28px;
  --text-section-label: 11px;
  --text-body: 14px;
  --text-table: 13px;
  --text-meta: 12px;
  --text-micro: 11px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  /* Single shadow token — used everywhere a card/elevation is needed */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.06);

  /* Motion — page reveal sped up so it doesn't feel sluggish */
  --motion-fast: 120ms;
  --motion-med: 200ms;
  --motion-slow: 220ms;
  --easing: cubic-bezier(.2, .8, .2, 1);
  --easing-soft: cubic-bezier(.4, 0, .2, 1);

  /* Legacy aliases kept so other rules still resolve */
  --lift-shadow: var(--shadow-md);
  --glow-accent: 0 0 0 1px var(--accent-soft-border),
                 0 0 0 4px var(--accent-soft);
}

/* ----------  Typography  ---------- */
body, .app-body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-body);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
}
.page-title { font-size: var(--text-page-title); font-weight: 600; letter-spacing: -0.02em; }
.page-subtitle { font-size: var(--text-body); color: var(--muted); }
.data-table th, .panel-head h2 {
  font-size: var(--text-section-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.data-table { font-size: var(--text-table); }
.data-table th { background: var(--panel); border-bottom: 1px solid var(--border); }
.conn-desc { font-size: var(--text-micro); color: var(--muted); }

/* ----------  Standardized cards / panels  ---------- */
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-4);
}

/* ----------  Standardized buttons (36px height, consistent spacing)  ---------- */
.btn-primary, .btn-ghost {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  margin-top: 0;
  transition:
    background-color var(--motion-fast) var(--easing-soft),
    border-color var(--motion-fast) var(--easing-soft),
    color var(--motion-fast) var(--easing-soft),
    box-shadow var(--motion-fast) var(--easing);
}
.btn-primary {
  background: var(--accent);
  color: var(--btn-primary-text);
  border: 1px solid var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-ghost {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--accent-soft-border);
  color: var(--accent);
}
.btn-danger, .btn-ghost.btn-danger:hover {
  color: var(--fail);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}
/* Small in-row action button — same shape, smaller hit area. Use for
 * per-row "Apply", "AI suggest", "Push", "Remove" etc. so they don't
 * shout louder than the surrounding primary actions. */
.btn-primary.btn-sm,
.btn-ghost.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Position-pill for the Keywords/Ads tab Org-pos column. Color-coded by
 * SERP-position bucket; renders as "#4.8" with a clear unit prefix. */
.pos-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.pos-top3  { background: rgba(16, 185, 129, 0.18); color: var(--ok);   border-color: rgba(16, 185, 129, 0.30); }
.pos-top10 { background: rgba(79, 70, 229, 0.14);  color: var(--accent); border-color: var(--accent-soft-border); }
.pos-page1 { background: rgba(245, 158, 11, 0.16); color: var(--wait); border-color: rgba(245, 158, 11, 0.30); }
.pos-deep  { background: var(--bg-hover);          color: var(--muted); border-color: var(--border); }

/* ----------  global ease  ---------- */
a, button, input, textarea, select,
.card, .panel, .tag, .pill, .nav-item, .btn-primary, .btn-ghost,
.collection-card, .bucket-btn, .chat-scope-btn,
details > summary, .product-tab, .product-tab-link,
.in-ads-badge, .tag-primary, .tag-neg, .charcount {
  transition:
    background-color var(--motion-fast) var(--easing-soft),
    color            var(--motion-fast) var(--easing-soft),
    border-color     var(--motion-fast) var(--easing-soft),
    box-shadow       var(--motion-med)  var(--easing),
    transform        var(--motion-med)  var(--easing),
    opacity          var(--motion-med)  var(--easing-soft),
    filter           var(--motion-med)  var(--easing-soft);
  /* NB: do NOT set `will-change: transform` here. It promotes every
   * element to its own compositor layer + creates a stacking context,
   * which breaks `position: sticky` on descendants (the keyword-rank
   * table's first column was being hidden because of this). Browsers
   * will hint composite layers themselves when transitions are actually
   * running. */
}

/* ----------  ambient mouse-follow glow (set by motion.js)  ---------- */
.app-body {
  position: relative;
  --mx: 50%;
  --my: 20%;
}
.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      600px circle at var(--mx) var(--my),
      rgba(124, 156, 255, 0.10),
      transparent 60%
    );
  opacity: 0.85;
  transition: background-position 80ms linear;
}
[data-theme="light"] .app-body::before {
  background:
    radial-gradient(
      600px circle at var(--mx) var(--my),
      rgba(79, 109, 217, 0.07),
      transparent 60%
    );
}
.app-shell, .app-header { position: relative; z-index: 1; }

/* ----------  header  ---------- */
.app-header {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.app-logo {
  background: linear-gradient(
    90deg,
    var(--text-strong) 0%,
    var(--accent) 40%,
    var(--text-strong) 80%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-pan 8s linear infinite;
}
@keyframes logo-pan {
  to { background-position: -200% 0; }
}
.app-logo:hover {
  filter: drop-shadow(0 0 8px rgba(124, 156, 255, 0.45));
  transform: translateY(-1px);
}

.theme-toggle {
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  transform: rotate(15deg) scale(1.08);
  box-shadow: var(--glow-accent);
}
.theme-toggle:active { transform: rotate(15deg) scale(0.95); }

.app-logout:hover {
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* ----------  side nav (icon + label, active state, dividers)  ---------- */
.app-nav nav {
  display: flex;
  flex-direction: column;
}
.nav-section {
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.nav-section:first-of-type { border-top: none; padding-top: 0; }
.nav-heading {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.nav-item {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 2px 6px;
  border-radius: var(--radius-md);
  color: var(--muted-strong);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}
.nav-item > span:not(.nav-badge) { flex: 1 1 auto; }
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color var(--motion-fast) var(--easing);
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}
.nav-item:hover .nav-icon { color: var(--accent); }

/* Active item: tinted background + colored icon/text + accent left bar */
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-item.is-active::before {
  transform: scaleY(1) !important;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: -6px; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform var(--motion-fast) var(--easing);
}

/* "Soon" items — visibly disabled. */
.nav-item.is-soon {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--muted);
  border: 1px solid var(--border);
  margin-left: auto;
}

/* Hide the old hover slide + duplicate ::before from earlier rules. */
/* (old over-styled nav rules removed — superseded by the new icon-aware
 * block above. translateX hover, scaling badge, etc. all dropped to keep
 * the sidebar quiet and modern.) */

/* ----------  tab bar (Overview / Images / SEO / Ads / etc.)  ---------- */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { height: 4px; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 6px 6px 0 0;
  transition: color var(--motion-fast) var(--easing),
              background-color var(--motion-fast) var(--easing),
              border-color var(--motion-fast) var(--easing);
}
.tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  border-bottom-width: 3px;
  font-weight: 600;
  background: var(--accent-soft);
}

/* ----------  channel chips on product overview (capped + +N more)  ---------- */
.channel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.channel-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
  cursor: default;
}
.channel-chips:not(.expanded) .channel-chip.is-extra { display: none; }
.channel-chip-more {
  cursor: pointer;
  color: var(--accent);
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  font-weight: 600;
}
.channel-chip-more:hover { background: var(--accent); color: var(--btn-primary-text); }

/* Cards / panels — quiet hover (subtle elevation only). Standardized look
 * already set up top via the new design tokens. */
.card:hover, .panel:hover {
  box-shadow: var(--shadow-md);
}

/* Button extras (lift on hover, removed the old shimmer + scale).
 * Heights + colors live in the top design-system block. */
.btn-primary:active { transform: translateY(0); }
.btn-ghost:active { transform: translateY(0); }

/* ----------  inputs / textareas / selects  ---------- */
input:not([type="checkbox"]):not([type="radio"]),
textarea, select {
  transition:
    border-color var(--motion-fast) var(--easing),
    box-shadow var(--motion-med) var(--easing),
    background-color var(--motion-fast) var(--easing-soft);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}
input[type="checkbox"], input[type="radio"] {
  transition: transform var(--motion-fast) var(--easing);
}
input[type="checkbox"]:hover, input[type="radio"]:hover { transform: scale(1.15); }

/* ----------  tags / pills / badges  ---------- */
.tag, .pill, .in-ads-badge {
  position: relative;
  transform-origin: center;
}
.tag:hover, .pill:hover, .in-ads-badge:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.08);
}
.tag-primary, .in-ads-primary {
  background-image: linear-gradient(
    100deg,
    var(--accent-soft) 0%,
    var(--accent-soft) 45%,
    rgba(124, 156, 255, 0.18) 55%,
    var(--accent-soft) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

.pill-warn, .pill-wait {
  animation: gentle-pulse 2.4s ease-in-out infinite;
}
@keyframes gentle-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18); }
}

.nav-badge {
  animation: gentle-pulse 3.6s ease-in-out infinite;
}

/* ----------  tables  ---------- */
.kw-table tbody tr, .data-table tbody tr {
  position: relative;
}
/* Accent stripe on row hover. Attached to the FIRST <td>, not the <tr>:
 * a ::before on a display:table-row generates an anonymous table cell,
 * which adds a phantom column and shifts every body cell out of alignment
 * with the header. Putting it on the first cell sidesteps that entirely. */
.kw-table tbody tr > td:first-child,
.data-table tbody tr > td:first-child {
  position: relative;
}
.kw-table tbody tr > td:first-child::before,
.data-table tbody tr > td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform var(--motion-fast) var(--easing);
  pointer-events: none;
}
.kw-table tbody tr:hover, .data-table tbody tr:hover {
  background: var(--bg-hover);
  /* NB: no transform here either — would briefly establish a stacking
   * context and break the keyword-rank table's sticky first column on hover. */
}
.kw-table tbody tr:hover > td:first-child::before,
.data-table tbody tr:hover > td:first-child::before { transform: scaleY(1); }

/* Force the keyword-rank table's first column to behave like a normal cell.
 * The sticky+stacking-context combination has caused repeated rendering
 * bugs (KEYWORD column appearing empty / shifted under SOURCE header).
 * The trade-off: when the table is scrolled horizontally, the keyword text
 * scrolls out of view with it. We can revisit sticky after a future redesign. */
.master-kw thead th:first-child,
.master-kw tbody td:first-child {
  position: static !important;
  left: auto !important;
  z-index: auto !important;
  min-width: 280px;
  max-width: 360px;
  box-shadow: none !important;
  /* Restore the accent stripe via border-left since box-shadow is off */
}
.master-kw tbody tr.is-pushed td:first-child,
.master-kw tbody tr.pushed-primary td:first-child {
  border-left: 3px solid var(--accent);
}
.master-kw tbody tr.pushed-secondary td:first-child {
  border-left: 3px solid var(--muted-strong);
}
.master-kw tbody tr.pushed-negative td:first-child {
  border-left: 3px solid var(--fail);
}
/* Make sure the first cell content actually paints — guard against any
 * inherited visibility/opacity rules from neighboring panel CSS. */
.master-kw tbody td:first-child .kw-row-pick,
.master-kw tbody td:first-child .kw-text,
.master-kw tbody td:first-child .kw-rationale,
.master-kw tbody td:first-child .kw-targets {
  visibility: visible !important;
  opacity: 1 !important;
}
.master-kw tbody td:first-child .kw-row-pick {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
/* old row-level hover rule lived here — superseded by the
 * td:first-child::before rule above. Kept this comment in case of grep. */

/* ----------  collection cards (products page)  ---------- */
.collection-card {
  position: relative;
  overflow: hidden;
}
.collection-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--lift-shadow);
  border-color: var(--accent-soft-border);
}
.collection-thumb {
  transition: transform var(--motion-slow) var(--easing);
}
.collection-card:hover .collection-thumb {
  transform: scale(1.06);
}

/* ----------  product / campaign detail tabs  ---------- */
.product-tab, .product-tab-link {
  position: relative;
}
.product-tab::after, .product-tab-link::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -1px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width var(--motion-med) var(--easing),
              left   var(--motion-med) var(--easing);
}
.product-tab:hover::after, .product-tab-link:hover::after {
  width: 100%; left: 0;
}

/* ----------  chat panel  ---------- */
.chat-msg {
  animation: msg-in var(--motion-slow) var(--easing) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-scope-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent-soft-border);
}

/* ----------  details / summary  ---------- */
details > summary { cursor: pointer; }
details > summary:hover {
  color: var(--accent);
}
details[open] > summary {
  color: var(--accent);
}
.kw-actions-menu[open] > summary {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
}

/* ----------  page intro (reveal-on-load)  ---------- */
.app-main > * {
  animation: reveal-up var(--motion-slow) var(--easing) both;
}
/* Snappier stagger — total reveal cascade ≤ 220ms */
.app-main > *:nth-child(1) { animation-delay: 0ms; }
.app-main > *:nth-child(2) { animation-delay: 20ms; }
.app-main > *:nth-child(3) { animation-delay: 40ms; }
.app-main > *:nth-child(4) { animation-delay: 60ms; }
.app-main > *:nth-child(5) { animation-delay: 80ms; }
.app-main > *:nth-child(6) { animation-delay: 100ms; }
.app-main > *:nth-child(7) { animation-delay: 120ms; }
.app-main > *:nth-child(8) { animation-delay: 140ms; }
.app-main > *:nth-child(9) { animation-delay: 160ms; }
.app-main > *:nth-child(n+10) { animation-delay: 180ms; }
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ----------  flash messages  ---------- */
.flash, .auth-error {
  animation: flash-in var(--motion-slow) var(--easing) both;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------  scrollbar (webkit/blink)  ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--bg);
  transition: background var(--motion-fast) var(--easing);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ----------  focus-visible accessibility ring  ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----------  on-page "alive" hint: links get a soft underline grow ---------- */
.muted-link {
  position: relative;
  display: inline-block;
}
.muted-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--motion-med) var(--easing);
}
.muted-link:hover::after { transform: scaleX(1); }

/* ----------  the pending-copy banner gets a moving accent stripe ---------- */
.panel .auth-error[style*="rgba(255,200,90"] {
  position: relative;
  overflow: hidden;
}
.panel .auth-error[style*="rgba(255,200,90"]::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 200%; height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(251, 191, 36, 0.6),
    transparent
  );
  animation: stripe-sweep 3s linear infinite;
}
@keyframes stripe-sweep {
  to { transform: translateX(50%); }
}

/* ============================================================================
 * Growth dashboard — KPI tiles, line chart, donut, mover sparklines.
 * ============================================================================ */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
.kpi {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateX(-100%);
  transition: transform var(--motion-slow) var(--easing);
}
.kpi:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft-border);
  box-shadow: var(--lift-shadow);
}
.kpi:hover::after { transform: translateX(0); }
.kpi.is-active {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}
.kpi.is-active::after { transform: translateX(0); }
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi-value {
  /* Bigger, heavier — KPIs are the headline number on the page. */
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 6px 0 8px;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.kpi-foot {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.delta-up   { background: rgba(16, 185, 129, 0.14); color: var(--ok);   border-color: rgba(16,185,129,0.30); }
.delta-down { background: rgba(239, 68, 68, 0.12); color: var(--fail); border-color: rgba(239,68,68,0.28); }
.delta-flat { background: var(--bg-hover); color: var(--muted); border-color: var(--border); }

/* Empty-state KPI tile (campaigns dashboard before Google Ads is wired). */
.kpi-empty {
  background: var(--bg-input);
  cursor: default;
}
.kpi-empty:hover { transform: none; box-shadow: none; border-color: var(--border); }
.kpi-empty .kpi-label { color: var(--muted); }
.kpi-value-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 24px;
  font-weight: 600;
}
.kpi-value-empty svg { opacity: 0.65; }
.kpi-empty .kpi-foot { display: none; }

/* "Google Ads not connected" CTA banner above the KPI row. */
.kpi-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.conn-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.conn-status-off {
  background: rgba(245, 158, 11, 0.12);
  color: var(--wait);
  border-color: rgba(245, 158, 11, 0.30);
}
.conn-status-on  {
  background: rgba(16, 185, 129, 0.12);
  color: var(--ok);
  border-color: rgba(16, 185, 129, 0.30);
}
.kpi-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.kpi-cta-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-cta-body strong { color: var(--text-strong); }
.kpi-cta .btn-primary { flex-shrink: 0; }

/* Period selector segmented buttons */
.period-form .seg-group {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--motion-fast) var(--easing);
}
.seg-btn:hover { color: var(--text); background: var(--bg-hover); }
.seg-btn.is-active {
  color: var(--text-strong);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft-border);
}

/* Channel chip-bar */
.chip-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;  /* keep "Show ignored too" on one line in grid cells */
  width: max-content;
  justify-self: start;
  transition: all var(--motion-fast) var(--easing);
}
.chip:hover { transform: translateY(-1px); border-color: var(--accent-soft-border); }
.chip input { margin: 0; }
.chip input:checked + .chip-dot { transform: scale(1.2); }

/* "chip" used as a clickable filter toggle (anchor); .chip-on = active. */
a.chip {
  text-decoration: none;
  color: var(--text);
}
a.chip.chip-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.chip-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  transition: transform var(--motion-fast) var(--easing);
}

/* Chart panel */
.chart-panel { padding: 18px 20px 8px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}
.chart-yaxis, .chart-xaxis {
  font-size: 10px;
  fill: var(--muted);
  font-family: inherit;
}
.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 10px rgba(124, 156, 255, 0.18));
  animation: draw-in 900ms var(--easing) both;
}
.chart-area {
  opacity: 0;
  animation: fade-in 600ms var(--easing) 300ms forwards;
}
.chart-last {
  animation: ping 1.8s ease-out infinite;
  transform-origin: center;
}
@keyframes draw-in {
  from { stroke-dasharray: 1200; stroke-dashoffset: 1200; }
  to   { stroke-dasharray: 1200; stroke-dashoffset: 0; }
}
@keyframes fade-in { to { opacity: 1; } }
@keyframes ping {
  0%   { r: 4; opacity: 1; }
  60%  { r: 9; opacity: 0; }
  100% { r: 4; opacity: 0; }
}
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 4px 6px;
  font-size: 12px;
}
.legend-item {
  display: inline-flex; gap: 8px; align-items: center;
  transition: transform var(--motion-fast) var(--easing);
}
.legend-item:hover { transform: translateY(-1px); }
.legend-swatch {
  width: 12px; height: 4px; border-radius: 2px; display: inline-block;
}

/* Donut */
.dash-two { grid-template-columns: minmax(280px, 360px) 1fr; gap: 14px; }
@media (max-width: 900px) { .dash-two { grid-template-columns: 1fr; } }
.donut-panel { display: flex; flex-direction: column; }
.donut-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}
.donut-svg circle { transition: stroke-width var(--motion-fast) var(--easing); }
.donut-svg:hover circle { stroke-width: 26; }
.donut-center {
  font-size: 14px;
  font-weight: 600;
  fill: var(--text-strong);
}
.donut-sub {
  font-size: 9px;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.donut-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.legend-label { color: var(--text); }
.legend-value { color: var(--muted-strong); font-variant-numeric: tabular-nums; }

/* Top movers sparklines */
.mover-table td { vertical-align: middle; }
.mover-table .num { font-variant-numeric: tabular-nums; }
.sparkline {
  display: block;
}
.sparkline path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.sparkline circle {
  fill: var(--accent);
}

/* ----- dashboard chart: pill filters + tail caption ----- */
.channel-filter {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.channel-pill {
  --pill-color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--motion-fast) var(--easing);
}
.channel-pill .channel-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pill-color);
  display: inline-block;
}
.channel-pill:hover { color: var(--text); border-color: var(--border-strong); }
.channel-pill.is-on {
  background: color-mix(in srgb, var(--pill-color) 12%, var(--panel));
  border-color: var(--pill-color);
  color: var(--text);
}
.channel-pill.is-on .channel-dot {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pill-color) 25%, transparent);
}

.chart-tail {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding: 10px 4px 6px;
  font-size: 12px;
  border-top: 1px dashed var(--border);
  margin-top: 6px;
}
.tail-item { display: inline-flex; align-items: baseline; gap: 6px; }
.tail-label { color: var(--muted); }
.tail-value { color: var(--text-strong); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ----- "Channel scope" details disclosure (was a raw debug <pre>) ----- */
.scope-details {
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.scope-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
  user-select: none;
}
.scope-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform var(--motion-fast) var(--easing);
}
.scope-details[open] > summary::before { transform: rotate(90deg); }
.scope-details > summary:hover { color: var(--accent); }
.scope-pre {
  margin: 10px 0 0;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: var(--bg-input);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  color: var(--muted-strong);
  max-height: 220px;
  overflow: auto;
}

/* "Why did sales move" cards — active stand out, inactive recede. */
.src-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.src-card {
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: 10px;
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
}
.src-card.src-on {
  background: var(--panel);
  border-color: var(--accent-soft-border);
}
.src-card.src-on:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
/* Inactive integrations recede — dashed border + grayed text so the active
 * cards (SEO & organic, Google Ads) stand out. */
.src-card.src-off {
  background: transparent;
  border: 1px dashed var(--border-strong);
  opacity: 0.62;
  cursor: default;
}
.src-card.src-off:hover { transform: none; border-color: var(--border-strong); }
.src-card.src-off .src-title { color: var(--muted); font-weight: 500; }
.src-card.src-off .src-desc  { color: var(--muted); }
.src-card.src-off::after {
  content: "Coming soon";
  position: absolute;
  top: 8px; right: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.src-title { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.src-desc { color: var(--muted-strong); font-size: 12px; margin-bottom: 8px; }

/* Collection card thumb + placeholder + SEO chip */
.collection-thumb { position: relative; }

/* Modern placeholder: deterministic gradient driven by --hue + collection
 * name centered in soft white. Replaces the giant single-letter style. */
.collection-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 14px;
  text-align: center;
  background: linear-gradient(
    135deg,
    hsl(var(--hue, 220), 75%, 64%) 0%,
    hsl(calc(var(--hue, 220) + 25), 80%, 52%) 100%
  );
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  border-radius: inherit;
}
.collection-thumb-placeholder .placeholder-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* SEO status chip — now a clearly labeled pill ("SEO: complete" /
 * "SEO: incomplete") instead of a cryptic ✓ / ✗ icon. */
.seo-chip {
  position: absolute;
  top: 8px; right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform var(--motion-fast) var(--easing);
}
.seo-chip-ok   {
  background: rgba(16, 185, 129, 0.18);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}
.seo-chip-warn {
  background: rgba(245, 158, 11, 0.20);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.4);
}
[data-theme="dark"] .seo-chip-ok   { color: var(--ok); }
[data-theme="dark"] .seo-chip-warn { color: var(--wait); }
.collection-card:hover .seo-chip { transform: scale(1.04); }

/* OOS list — ignored rows fade back so the active OOS items pop. */
.data-table tbody tr.is-ignored { opacity: 0.55; }
.data-table tbody tr.is-ignored:hover { opacity: 0.85; }

/* OOS table layout — explicit column widths via <colgroup>, horizontal
 * scroll if the viewport is too narrow, headers don't wrap. */
.oos-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.oos-table {
  width: 100%;
  min-width: 1180px;  /* room for Product (~400px) + new SKU (130px) column */
  table-layout: fixed;
  border-collapse: collapse;
}
.oos-table th, .oos-table td {
  padding: 10px 12px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.oos-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.oos-table td { font-size: 13px; border-bottom: 1px solid var(--border); }
.oos-table tbody tr:last-child td { border-bottom: none; }
.oos-table td.num, .oos-table th.num { text-align: right; }
/* Product cell: don't truncate, but wrap softly. Keep the bottom border
 * clean by limiting to 2 lines max via -webkit-line-clamp where supported. */
.oos-table td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

/* View-options dropdown — absolute-positioned dropdowns kept getting trapped
 * in parent stacking contexts (panels with transform/overflow). Switch to
 * inline expansion: when details is open, the form renders BELOW the button
 * in normal flow, pushing the rest of the page down. Reliable in every
 * browser, no z-index gymnastics. */
.view-options[open] {
  display: block;
  background: var(--panel);
  border: 1px solid var(--accent-soft-border);
  border-radius: 10px;
  padding: 0;
}
.view-options-form {
  position: static !important;
  top: auto !important;
  left: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  border: none !important;
  margin-top: 8px;
}

/* AI collection suggestions */
.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.suggestion-card {
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: 12px;
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  transition: transform var(--motion-med) var(--easing),
              border-color var(--motion-fast) var(--easing);
}
.suggestion-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--motion-slow) var(--easing);
}
.suggestion-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft-border);
  box-shadow: var(--lift-shadow);
}
.suggestion-card:hover::before { transform: scaleX(1); }
.suggestion-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.suggestion-title {
  font-weight: 600;
  color: var(--text-strong);
}
.suggestion-handle {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.suggestion-score {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.score-high { background: rgba(74, 222, 128, 0.18); color: var(--ok); }
.score-mid  { background: rgba(251, 191, 36, 0.18); color: var(--wait); }
.score-low  { background: var(--bg-hover); color: var(--muted); }
.suggestion-rationale {
  color: var(--muted-strong);
  font-size: 12px;
  margin: 8px 0 0;
}

/* Growth alerts list */
.alert-list, .rise-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-input);
  transition: transform var(--motion-fast) var(--easing),
              background var(--motion-fast) var(--easing);
}
.alert-row:hover {
  transform: translateX(2px);
  background: var(--bg-hover);
}
.alert-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 6px;
  border-radius: 6px;
  text-align: center;
}
.alert-badge-top_3      { background: rgba(74, 222, 128, 0.18); color: var(--ok); }
.alert-badge-top_10     { background: rgba(124, 156, 255, 0.18); color: var(--accent); }
.alert-badge-improved   { background: rgba(74, 222, 128, 0.12); color: var(--ok); }
.alert-badge-new_keyword{ background: rgba(244, 162, 97, 0.18); color: #f4a261; }
.alert-badge-regressed  { background: rgba(248, 113, 113, 0.14); color: var(--fail); }
.alert-keyword {
  font-weight: 500;
  color: var(--text);
}
.alert-product {
  font-size: 11px;
  display: block;
}
.alert-pos {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.alert-pos strong { color: var(--text-strong); }

.rise-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-input);
  transition: transform var(--motion-fast) var(--easing),
              background var(--motion-fast) var(--easing);
}
.rise-row:hover {
  transform: translateX(2px);
  background: var(--bg-hover);
}
.rise-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  background: rgba(74, 222, 128, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Channel-scope reminder pill — appears next to per-product sales numbers
 * to remind the user the figures only count Online Store + Shop app. */
.channel-scope-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: help;
  transition: transform var(--motion-fast) var(--easing);
}
.channel-scope-pill:hover { transform: translateY(-1px); }

/* Bulk-bar inline-action buttons (Select all / Clear).
 * Styled to feel like real buttons — not text links. Bigger hit area,
 * subtle elevation, hover-into-accent state. */
.bulk-bar .bulk-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  cursor: pointer;
  margin-left: 8px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition:
    background-color var(--motion-fast) var(--easing),
    border-color var(--motion-fast) var(--easing),
    color var(--motion-fast) var(--easing),
    box-shadow var(--motion-med) var(--easing),
    transform var(--motion-fast) var(--easing);
}
.bulk-bar .bulk-action:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px var(--accent-soft);
}
/* Override the dashed-tint .bulk-bar from style.css with a clean solid look. */
.bulk-bar {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Bulk-bar inline-action buttons (Select all / Clear).
 * Styled to feel like real buttons — matched in height to the primary
 * action sitting on the right so the whole bar reads as one row. */
.bulk-bar .bulk-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;        /* matches btn-primary: 11px padding + 14px text + 2px border */
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  cursor: pointer;
  margin-left: 8px;
  text-decoration: none;
  transition:
    background-color var(--motion-fast) var(--easing),
    border-color var(--motion-fast) var(--easing),
    color var(--motion-fast) var(--easing),
    box-shadow var(--motion-med) var(--easing),
    transform var(--motion-fast) var(--easing);
}
.bulk-bar .bulk-action:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px var(--accent-soft);
}
.bulk-bar .bulk-action:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Keep the bar's label group cleanly inline-aligned with its inner buttons. */
.bulk-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================================
 * Products list table — column alignment + status badges
 * Locks down column widths and alignment so headers/data always line up.
 * ============================================================================ */
.products-table {
  width: 100%;
  table-layout: auto;            /* let title col grow, others fixed via min-width */
  border-collapse: collapse;
}
.products-table th,
.products-table td {
  vertical-align: middle;
  white-space: nowrap;           /* no rogue wrapping; titles override below */
  padding: 10px 12px;
}
.products-table th {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

/* Right-align numeric columns BOTH header and body so PRICE / SOLD / etc.
 * are visually aligned. text-align: right on the th's <a> too. */
.products-table th.num,
.products-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.products-table th.num a { display: inline-block; text-align: right; }

/* Title cell — allow soft wrapping for long product names. */
.products-table td:has(a.row-link) { white-space: normal; min-width: 280px; }

/* Stock-days badges: enforced single row using flex+nowrap. */
.stock-days-cell { min-width: 200px; }
.stock-days-badges {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.stock-days-badges .tag {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 7px;
}
.tag.tag-in  { color: var(--ok);   border-color: rgba(74,222,128,0.3); background: rgba(74,222,128,0.08); }
.tag.tag-out { color: var(--fail); border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.08); }

/* Explicit min-widths so each numeric column gets enough room and never
 * gets squeezed by a wider neighbor. */
.products-table .thumb-col { width: 56px; min-width: 56px; }
.products-table th.num,
.products-table td.num { min-width: 96px; }
/* status column gets a comfortable width for the longest label ("ARCHIVED") */
.products-table th:last-child,
.products-table td:last-child { min-width: 100px; }

/* Status column: badge stays inline-block in its own cell, never floats. */
.products-table .product-status {
  display: inline-block;
  white-space: nowrap;
  position: static !important;   /* defeat the grid-card absolute positioning */
}

/* Bulk-assign checkbox overlaid on a product card (grid view). */
.product-card { position: relative; }
.product-card-pick {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 4;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform var(--motion-fast) var(--easing),
              border-color var(--motion-fast) var(--easing);
}
.product-card-pick:hover {
  transform: scale(1.06);
  border-color: var(--accent);
}
.product-card-pick input { margin: 0; cursor: pointer; }

/* Copyable invite-URL row in the users table */
.invite-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  max-width: 460px;
}
.invite-url-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
}
.invite-url-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.copy-invite-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 12px;
  transition: all var(--motion-fast) var(--easing);
}
.copy-invite-btn.copied {
  background: rgba(74, 222, 128, 0.14) !important;
  border-color: var(--ok) !important;
  color: var(--ok) !important;
}

/* Per-product ownership pills (visible on the All Products list) */
.ownership-strip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.assign-pill, .progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.assign-on  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-border); }
.assign-off { background: var(--bg-input);    color: var(--muted);  border-color: var(--border); }
.progress-done { background: rgba(74, 222, 128, 0.14); color: var(--ok);   border-color: rgba(74, 222, 128, 0.3); }
.progress-some { background: rgba(251, 191, 36, 0.14); color: var(--wait); border-color: rgba(251, 191, 36, 0.3); }
.progress-none { background: var(--bg-input);          color: var(--muted); border-color: var(--border); }

/* Per-product assignee row on the Tasks sub-tab */
.assignee-row {
  display: flex;
  align-items: center;
  margin: 14px 0 6px;
}

/* SEO/Ads worker task checklist */
.task-panel .panel-head { align-items: center; }
.task-progress { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.task-progress-bar {
  width: 160px; height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}
.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 999px;
  transition: width var(--motion-slow) var(--easing);
}
.task-table tr.is-done { opacity: 0.78; }
.task-table tr.is-done td:nth-child(2) strong {
  text-decoration: line-through;
  color: var(--muted);
}
.task-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--motion-fast) var(--easing);
}
.task-check-off:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: scale(1.06);
}
.task-check-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-text);
}
.task-check-on:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: var(--fail);
  color: var(--fail);
}

/* ----------  reduced-motion: respect user preference  ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .app-body::before { display: none; }
}
