/* Lead Discovery — dashboard design system v2
   Forked from automations/ai-news-draft (v1). Refinements based on Refero/Lazyweb research:
   - Linear "calmer interface" warm palette + dimmed sidebar
   - Unkey/Mintlify monochrome-with-one-accent KPI tiles
   - Three-layer KPI (value + delta + ghost sparkline)
   - Source-color taxonomy (Pipedrive/Lemlist/Wolfscale/Supernormal)
   - Master-detail drawer + kanban triage + timeline patterns

   Token order: surface → text → border → brand → status → source → spacing → type → radius → shadow → motion → layout. */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Surface — warmer than v1 (Linear refresh) */
  --bg-canvas: #f8fafc;       /* slate-50 — cooler; warm beige read badly (2026-06-11 UI QA) */
  --bg-surface: #ffffff;
  --bg-sidebar: #f4f6f9;      /* sidebar dimmer than content area */
  --bg-subtle: #f5f6f8;
  --bg-hover: #eef0f3;
  --bg-input: #ffffff;
  --bg-codeblock: #0f172a;
  --bg-codeblock-text: #e2e8f0;

  /* Text — deeper ink for crisper hierarchy on white (Mintlify) */
  --text-primary: #0a0f1f;
  --text-secondary: #475569;
  --text-muted: #64748b;      /* was #94a3b8 — failed readability on canvas (2026-06-11 UI QA) */
  --text-on-accent: #ffffff;

  /* Border */
  --border-subtle: #eef0f3;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Brand — indigo */
  --accent-50: #eef2ff;
  --accent-100: #e0e7ff;
  --accent-300: #a5b4fc;      /* NEW — page-header hinge gradient mid stop */
  --accent-500: #6366f1;
  --accent-600: #4f46e5;
  --accent-700: #4338ca;
  --accent-ring: rgba(99,102,241,0.25);

  /* Status */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-700: #047857;
  --warn-50: #fffbeb;
  --warn-500: #f59e0b;
  --warn-700: #b45309;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-700: #b91c1c;
  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info-700: #1d4ed8;
  --neutral-50: #f9fafb;
  --neutral-200: #e5e7eb;
  --neutral-500: #6b7280;
  --neutral-700: #374151;

  /* Source-color taxonomy — same colour for the same source EVERYWHERE
     (cards, kanban dots, timeline pips, channel badges). Avoid using these for any other meaning. */
  --src-pipedrive: #2563eb;       /* blue */
  --src-pipedrive-50: #eff6ff;
  --src-lemlist: #16a34a;          /* green */
  --src-lemlist-50: #ecfdf5;
  --src-wolfscale: #ea580c;        /* orange */
  --src-wolfscale-50: #fff7ed;
  --src-supernormal: #9333ea;      /* purple */
  --src-supernormal-50: #faf5ff;
  --src-pulse: #0d9488;            /* teal */
  --src-pulse-50: #f0fdfa;
  --src-icp: #6366f1;              /* indigo (matches accent) */
  --src-icp-50: #eef2ff;
  --src-competitor: #db2777;       /* pink */
  --src-competitor-50: #fdf2f8;
  --src-inbound: #16a34a;          /* same green as Lemlist (high-intent inbound) */
  --src-newsletter: #f59e0b;       /* amber */
  --src-existing: #0ea5e9;         /* sky — repeat-revenue loyalty */
  --src-ai: #6b7280;               /* neutral grey — AI-generated content */

  /* Spacing */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;  --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;  --space-12: 48px;

  /* Type — Linear-style display family for headings, fall back to system */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-display: 'Inter Display', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --text-xs: 11px; --text-sm: 12px; --text-base: 13px; --text-md: 14px;
  --text-lg: 16px; --text-xl: 20px; --text-2xl: 28px; --text-3xl: 36px;
  --tracking-tight: -0.01em;
  --tracking-display: -0.022em;

  /* Radius */
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px;
  --radius-xl: 16px; --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 4px 8px rgba(15,23,42,0.06), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 24px rgba(15,23,42,0.08), 0 4px 8px rgba(15,23,42,0.05);
  --shadow-focus: 0 0 0 3px var(--accent-ring);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration-base: 180ms;
  --duration-slow: 280ms;

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
}

/* ── Base resets ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-600); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--accent-700); }

code, pre { font-family: var(--font-mono); font-size: 0.92em; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
p { margin: 0; }

button { font-family: inherit; }

::selection { background: var(--accent-100); color: var(--accent-700); }

/* Focus rings (visible on keyboard nav only) */
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* ── App shell layout ────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--duration-base) var(--ease-out);
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* Sidebar — dimmed relative to content (Linear refresh) */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--topbar-h);
  flex-shrink: 0;
}
.sidebar__logo {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: var(--text-md);
  flex-shrink: 0;
  /* Default treatment for the legacy "L" monogram: indigo gradient. */
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  box-shadow: var(--shadow-sm);
}
/* When the logo is an <img> (SEJ brand mark), render flat — square, no background. */
img.sidebar__logo {
  width: 30px;
  height: 30px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}
.sidebar__title {
  font-size: var(--text-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.app-shell.is-collapsed .sidebar__title { opacity: 0; pointer-events: none; }

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.sidebar__group { display: flex; flex-direction: column; gap: 2px; }
.sidebar__group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.app-shell.is-collapsed .sidebar__group-label { opacity: 0; height: 0; margin: 0; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.sidebar__link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar__link.is-active {
  /* Active link is BRIGHTER than its (dimmed) sidebar container — feels like an inset card. */
  background: var(--bg-surface);
  color: var(--accent-700);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.sidebar__link.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--accent-500);
  border-radius: var(--radius-full);
  animation: scale-in-y var(--duration-base) var(--ease-spring);
}
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.sidebar__details {
  display: block;
}
.sidebar__details > summary {
  list-style: none;
  cursor: pointer;
}
.sidebar__details > summary::-webkit-details-marker { display: none; }
.sidebar__link--summary {
  width: 100%;
}
.sidebar__chevron {
  margin-inline-start: auto;
  color: var(--text-muted);
  display: inline-flex;
  transition: transform var(--duration-fast) var(--ease-out);
}
.sidebar__chevron svg {
  width: 14px;
  height: 14px;
}
.sidebar__details[open] .sidebar__chevron { transform: rotate(90deg); }
.sidebar__submenu {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 30px;
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-default);
}
.sidebar__sublink {
  display: block;
  padding: 5px var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__sublink:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar__sublink.is-active {
  background: var(--bg-surface);
  color: var(--accent-700);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.app-shell.is-collapsed .sidebar__label { opacity: 0; pointer-events: none; }
.app-shell.is-collapsed .sidebar__link { justify-content: center; }
.app-shell.is-collapsed .sidebar__group-trail { display: none; }
.app-shell.is-collapsed .sidebar__submenu,
.app-shell.is-collapsed .sidebar__chevron { display: none; }

.sidebar__footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar__collapse {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-2);
  margin-left: auto;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.sidebar__collapse:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar__collapse svg { width: 16px; height: 16px; transition: transform var(--duration-base) var(--ease-out); }
.app-shell.is-collapsed .sidebar__collapse svg { transform: rotate(180deg); }

/* Topbar */
.topbar {
  grid-area: topbar;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(1.4);
}
.topbar__search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.topbar__search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  font-size: var(--text-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  transition: border-color var(--duration-fast), background var(--duration-fast), box-shadow var(--duration-fast);
}
.topbar__search input:focus { background: var(--bg-surface); border-color: var(--accent-500); box-shadow: var(--shadow-focus); outline: none; }
.topbar__search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }

.topbar__status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.topbar__status:hover { background: var(--bg-hover); }
.topbar__status .dot {
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--success-500);
  position: relative;
}
.topbar__status .dot::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: pulse-dot 1.6s ease-in-out infinite;
  opacity: 0.55;
}
.topbar__status.is-paused .dot { background: var(--warn-500); }
.topbar__status.is-paused .dot::after { animation: none; }
.topbar__status.is-error .dot { background: var(--error-500); }

.topbar__actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.topbar__user {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Main */
.main {
  grid-area: main;
  padding: var(--space-6) var(--space-6) var(--space-12);
  max-width: 1320px;
  width: 100%;
}
.main > * { animation: fade-in var(--duration-slow) var(--ease-out) both; }
.main > *:nth-child(1) { animation-delay: 0ms; }
.main > *:nth-child(2) { animation-delay: 40ms; }
.main > *:nth-child(3) { animation-delay: 80ms; }
.main > *:nth-child(4) { animation-delay: 120ms; }
.main > *:nth-child(5) { animation-delay: 160ms; }
.main > *:nth-child(n+6) { animation-delay: 180ms; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  position: relative;
  padding-bottom: var(--space-4);
}
.page-header::after {
  /* Indigo "section hinge" gradient — Linear-style soft divider that fades right. */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
    var(--accent-500) 0%,
    var(--accent-300) 18%,
    var(--border-default) 32%,
    var(--border-default) 100%);
  opacity: 0.7;
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  margin-bottom: var(--space-1);
}
.page-meta {
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.page-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2);
  max-width: 80ch;
  line-height: 1.55;
}
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.dashboard-tour-start {
  flex-shrink: 0;
}

.dashboard-tour-card {
  position: fixed;
  z-index: 80;
  width: min(360px, calc(100vw - 32px));
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.dashboard-tour-card[hidden],
.dashboard-tour-spotlight[hidden] {
  display: none;
}
.dashboard-tour-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.dashboard-tour-card__eyebrow {
  color: var(--accent-700);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dashboard-tour-card__title {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: var(--text-md);
  font-weight: 700;
}
.dashboard-tour-card__close {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  width: auto;
  height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 700;
}
.dashboard-tour-card__close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.dashboard-tour-card__close svg {
  width: 14px;
  height: 14px;
}
.dashboard-tour-card__body {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.dashboard-tour-card__footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.dashboard-tour-card__progress {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  margin-right: auto;
}
.dashboard-tour-spotlight {
  position: fixed;
  z-index: 79;
  border: 2px solid var(--accent-500);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.18), var(--shadow-focus);
  pointer-events: none;
  transition: top var(--duration-base) var(--ease-out), left var(--duration-base) var(--ease-out),
    width var(--duration-base) var(--ease-out), height var(--duration-base) var(--ease-out);
}
.is-dashboard-tour-target {
  position: relative;
  z-index: 1;
}

/* System Map / operator guide */
.system-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.system-map-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.system-map-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.system-map-card__title {
  font-size: var(--text-lg);
  letter-spacing: 0;
}
.system-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.system-map-table th {
  width: 112px;
  padding: 7px 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: top;
}
.system-map-table td {
  padding: 7px 0 7px var(--space-3);
  color: var(--text-secondary);
  vertical-align: top;
}
.operator-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}
.operator-guide-grid h2 {
  margin-bottom: var(--space-2);
  font-size: var(--text-md);
  letter-spacing: 0;
}
.operator-guide-grid ul {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--text-secondary);
}
.operator-guide-grid li + li {
  margin-top: var(--space-2);
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: border-color var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}
.card--quiet { background: var(--bg-subtle); }
.card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.card__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}
.card__meta { font-size: var(--text-sm); color: var(--text-muted); }
.card__body { color: var(--text-secondary); }
.card--empty {
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-8) var(--space-4);
  font-size: var(--text-base);
}

/* ── KPI grid ────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
  transition: border-color var(--duration-base), box-shadow var(--duration-base), transform var(--duration-base);
}
/* Anchor-as-tile when the KPI is clickable */
a.kpi { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.kpi:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

/* Subtle left accent strip (replaces the v1 corner-gradient hover overlay).
   Always present at low opacity for status variants; lifts on hover for the default. */
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 2px;
  border-radius: var(--radius-full);
  background: var(--accent-500);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}
.kpi:hover::before { opacity: 0.7; }
.kpi--success::before { background: var(--success-500); opacity: 0.55; }
.kpi--warn::before    { background: var(--warn-500);    opacity: 0.55; }
.kpi--error::before   { background: var(--error-500);   opacity: 0.55; }
.kpi--info::before    { background: var(--info-500);    opacity: 0.55; }
.kpi--accent::before  { background: var(--accent-500);  opacity: 0.55; }

.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}
.kpi__value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: var(--tracking-display);
  font-variant-numeric: tabular-nums;
}

/* Trend delta — three-layer KPI pattern (Power BI / Unkey) */
.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.kpi__delta--up   { color: var(--success-700); }
.kpi__delta--down { color: var(--error-700); }
.kpi__delta--flat { color: var(--text-muted); }
.kpi__delta-period { color: var(--text-muted); font-weight: 500; margin-left: 4px; }

/* Ghost sparkline — tucks bottom-right of tile, low-opacity, doesn't fight the value */
.kpi__spark {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  width: 96px;
  height: 28px;
  color: var(--accent-500);
  opacity: 0.5;
  pointer-events: none;
}
.kpi--success .kpi__spark { color: var(--success-500); }
.kpi--warn    .kpi__spark { color: var(--warn-500); }
.kpi--error   .kpi__spark { color: var(--error-500); }

.kpi__trend {  /* legacy alias kept for back-compat with overview.py */
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kpi__trend--up { color: var(--success-700); }
.kpi__trend--down { color: var(--error-700); }
.kpi--success .kpi__value { color: var(--success-700); }
.kpi--warn    .kpi__value { color: var(--warn-700); }
.kpi--error   .kpi__value { color: var(--error-700); }
.kpi--info    .kpi__value { color: var(--info-700); }
.kpi--accent  .kpi__value { color: var(--accent-700); }
.kpi__icon {
  position: absolute;
  top: var(--space-4); right: var(--space-4);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.kpi__icon svg { width: 16px; height: 16px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), background var(--duration-fast), border-color var(--duration-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:focus-visible { box-shadow: var(--shadow-focus), var(--shadow-md); outline: none; }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary { background: var(--accent-600); color: var(--text-on-accent); border-color: var(--accent-600); }
.btn--primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn--ghost { background: transparent; border-color: var(--border-default); color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn--success { background: var(--success-500); color: #fff; border-color: var(--success-500); }
.btn--success:hover { background: var(--success-700); border-color: var(--success-700); }
.btn--danger { background: var(--error-500); color: #fff; border-color: var(--error-500); }
.btn--danger:hover { background: var(--error-700); border-color: var(--error-700); }
.btn--link {
  background: transparent;
  border: none;
  color: var(--accent-600);
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
}
.btn--link:hover { transform: none; box-shadow: none; color: var(--accent-700); }
.btn--sm { padding: 4px 10px; font-size: var(--text-sm); }
.btn--xs { padding: 2px 8px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn--error { background: var(--error-50); color: var(--error-700); border-color: var(--error-200, #fecaca); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

/* ── Inputs ──────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: var(--shadow-focus);
}
.textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}
.form-grid__full { grid-column: 1 / -1; }
.input--xs, .select--xs {
  min-height: 28px;
  padding: 3px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}
.inventory-anomaly-detail {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.inventory-anomaly-actions {
  display: grid;
  gap: 6px;
  min-width: 320px;
}
.inventory-inline-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.2fr) auto;
  gap: 6px;
  align-items: center;
}
.inventory-inline-form + .inventory-inline-form {
  grid-template-columns: minmax(140px, 1fr) minmax(70px, 0.5fr) auto;
}
.inventory-inline-form [data-action-status] {
  grid-column: 1 / -1;
}
.inventory-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 150px;
}
.inventory-proposal-details {
  position: relative;
  min-width: 148px;
}
.inventory-proposal-details summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}
.inventory-proposal-details summary::-webkit-details-marker {
  display: none;
}
.inventory-proposal-card {
  display: none;
  width: min(360px, 72vw);
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid rgba(245,158,11,0.28);
  border-radius: var(--radius-md);
  background: var(--warn-50);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  white-space: normal;
}
.inventory-proposal-details[open] .inventory-proposal-card,
.inventory-proposal-details:hover .inventory-proposal-card,
.inventory-proposal-details:focus-within .inventory-proposal-card {
  display: block;
}
.inventory-proposal-card strong {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--warn-700);
}
.inventory-proposal-card ul {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.inventory-proposal-card li {
  display: grid;
  gap: 2px;
}
.inventory-proposal-card li span {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}
.inventory-proposal-card li small,
.inventory-proposal-more {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.inventory-tabs {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin: calc(-1 * var(--space-2)) 0 var(--space-5);
}
.inventory-tabs--secondary {
  margin-top: 0;
}
.inventory-tab {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}
.inventory-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.inventory-tab.is-active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
}
.inventory-filter-bar {
  /* Flex, not a fixed 8-column grid: the bars no longer have the same number of
     controls (Product Types shows 2 and reveals 4 more behind Custom; the
     calendar shows 3), and the rigid track list stranded the Reset button on a
     row of its own. Baseline-align on the controls so labels sit level. */
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: flex-end;
  margin: calc(-1 * var(--space-2)) 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.inventory-filter-bar > .btn,
.inventory-filter-bar > a.btn {
  flex: 0 0 auto;
}
.inventory-filter-bar label,
.inventory-filter-field,
.inventory-filter-bar__summary {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 168px;
}
.inventory-filter-bar__summary { flex: 1 1 220px; }
.inventory-filter-bar label span,
.inventory-filter-field > span,
.inventory-filter-bar__summary span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: uppercase;
}
.inventory-filter-bar__summary strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.inventory-calendar-controls {
  grid-template-columns: minmax(190px, 1fr) minmax(150px, 0.45fr) minmax(220px, 1fr) auto auto;
}
.inventory-product-filters {
  grid-template-columns: minmax(220px, 1.15fr) minmax(260px, 1.25fr) minmax(130px, 0.7fr) minmax(150px, 0.75fr) minmax(128px, 0.65fr) minmax(128px, 0.65fr) auto auto;
}
.inventory-multiselect {
  position: relative;
  min-width: 0;
}
.inventory-multiselect summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-xs);
  line-height: 1.35;
  list-style: none;
}
.inventory-multiselect summary::-webkit-details-marker {
  display: none;
}
/* The design system adds `details > summary::before { content: "›" }` for
   generic disclosures. This control draws its own chevron in ::after, so the
   inherited one became a third flex item and, with space-between, sat at the
   far left while pushing the label to the centre. */
.inventory-multiselect summary::before {
  content: none;
}
.inventory-multiselect summary::marker {
  content: "";
  font-size: 0;
}
.inventory-multiselect summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: var(--text-muted);
  transform: rotate(45deg);
  transform-origin: 50% 50%;
}
.inventory-multiselect[open] summary::after {
  transform: rotate(-135deg);
}
.inventory-multiselect[open] summary {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.12);
}
.inventory-multiselect__options {
  display: grid;
  width: 100%;
  min-width: 0;
  max-height: 260px;
  margin-top: 4px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  scrollbar-gutter: stable;
}
.inventory-multiselect__options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.inventory-multiselect__options label:hover {
  background: var(--bg-subtle);
}
.inventory-multiselect__options input {
  flex: 0 0 auto;
}
.inventory-multiselect__options span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-sku {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
}
.inventory-sku code {
  user-select: all;
}
.inventory-sku-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}
.inventory-sku-copy svg {
  width: 14px;
  height: 14px;
}
.inventory-sku-copy:hover {
  border-color: var(--accent-500);
  color: var(--accent-600);
  background: var(--accent-50);
}
.inventory-sku-copy.is-copied {
  min-width: 58px;
  color: var(--success-700);
  border-color: rgba(16,185,129,0.25);
  background: var(--success-50);
}
.inventory-calendar-scroll {
  overflow-x: auto;
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
}
.inventory-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(142px, 1fr));
  min-width: 994px;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--border-default);
}
.inventory-calendar__weekday {
  padding: 8px var(--space-2);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}
.inventory-calendar__day {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 146px;
  min-width: 0;
  padding: var(--space-2);
  background: var(--bg-surface);
}
.inventory-calendar__day.is-outside {
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.inventory-calendar__day.has-sales {
  box-shadow: inset 3px 0 0 var(--info-500);
}
.inventory-calendar__date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
  margin-bottom: 6px;
}
.inventory-calendar__date strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.inventory-calendar__date span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inventory-calendar__events {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}
.inventory-calendar-event {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--info-50);
  color: inherit;
  text-decoration: none;
}
.inventory-calendar-event:hover {
  border-color: var(--info-500);
  background: #fff;
}
.inventory-calendar-event.is-available {
  border-color: rgba(16, 185, 129, 0.24);
  background: #ecfdf5;
}
.inventory-calendar-event.is-internal,
.inventory-calendar-event.is-excluded,
.inventory-calendar-event.is-non-revenue {
  border-color: rgba(245, 158, 11, 0.3);
  background: #fffbeb;
}
.inventory-calendar-event.is-expired-available {
  border-color: rgba(239, 68, 68, 0.28);
  background: #fef2f2;
}
.inventory-calendar-event strong,
.inventory-calendar-event span,
.inventory-calendar-event small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-calendar-event strong {
  color: var(--info-700);
  font-size: var(--text-xs);
}
.inventory-calendar-event span {
  color: var(--text-primary);
  font-size: var(--text-xs);
}
.inventory-calendar-event small {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.inventory-calendar__more {
  justify-self: start;
  color: var(--accent-700);
  font-size: var(--text-xs);
  font-weight: 700;
}
.inventory-calendar__add {
  align-self: end;
  justify-self: stretch;
  margin-top: 6px;
  padding: 5px 7px;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 700;
}
.inventory-calendar__add:hover,
.inventory-calendar__add:focus-visible {
  border-color: var(--accent-500);
  color: var(--accent-700);
  outline: none;
}
.inventory-calendar-table td:nth-child(2) {
  min-width: 190px;
}
.inventory-calendar-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.inventory-calendar-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
}
.inventory-calendar-dialog__form {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
}
.inventory-calendar-dialog__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.inventory-calendar-dialog__head h2 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: 1.25;
}
.inventory-calendar-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.inventory-value-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  container-type: inline-size;
}
.inventory-value-strip--compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.inventory-value {
  display: grid;
  min-height: 104px;
  align-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-block-start-width: 3px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.inventory-value--success { border-block-start-color: var(--success-500); }
.inventory-value--warn { border-block-start-color: var(--warn-500); }
.inventory-value--error { border-block-start-color: var(--error-500); }
.inventory-value--info { border-block-start-color: var(--info-500); }
.inventory-value span,
.inventory-value small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.inventory-value small {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.inventory-value strong {
  color: var(--text-primary);
  font-size: var(--text-2xl);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
a.inventory-value,
a.inventory-value-bar {
  color: inherit;
  text-decoration: none;
}
a.inventory-value:hover,
a.inventory-value-bar:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.inventory-health {
  /* Verdict on top, actions beneath. It was a two-column grid, but the left
     column holds a pill and one sentence against a four-row action list, so
     whatever the alignment there was a column of dead space beside it. */
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: clip;
}
.inventory-health::before {
  content: "";
  position: absolute;
  inset-block: var(--space-4);
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--radius-full);
  background: var(--success-500);
}
.inventory-health--warn::before { background: var(--warn-500); }
.inventory-health--error::before { background: var(--error-500); }
.inventory-health__main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.inventory-health__main .pill {
  justify-self: start;
}
.inventory-health__main h2 {
  font-size: var(--text-xl);
  letter-spacing: 0;
}
.inventory-health__main p {
  color: var(--text-secondary);
  max-width: 68ch;
}
.inventory-health__items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-2);
}
.inventory-health__item {
  display: grid;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: inherit;
  background: var(--bg-subtle);
}
.inventory-health__item:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.inventory-health__item strong {
  color: var(--text-primary);
}
.inventory-health__item span {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.inventory-mix__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2);
}
.inventory-mix__facts div {
  display: grid;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.inventory-mix__facts span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inventory-mix__facts strong {
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}
.inventory-value-bars {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  align-content: start;
}
.inventory-value-bars__head {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: uppercase;
}
.inventory-value-bar {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.inventory-value-bar__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}
.inventory-value-bar__row span {
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}
.inventory-value-bar__row strong {
  color: var(--text-primary);
  flex: 0 0 auto;
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}
.inventory-value-bar__row strong span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}
.inventory-value-bar__track {
  height: 9px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--neutral-200);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
.inventory-value-bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.inventory-value-bar__fill--available { background: var(--success-500); }
.inventory-value-bar__fill--sold { background: var(--info-500); }
.inventory-value-bar__fill--expired_available { background: var(--error-500); }
.inventory-value-bar__fill--expired_sold { background: var(--neutral-500); }
.inventory-value-bar__fill--expiring { background: var(--warn-500); }
.inventory-value-bar__fill--blocked { background: var(--warn-500); }
.inventory-value-bar small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3;
}
.status-stack {
  display: flex;
  width: 100%;
  min-width: 150px;
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--neutral-200);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
.status-stack__seg {
  display: block;
  min-width: 2px;
}
.status-stack__seg--available { background: var(--success-500); }
.status-stack__seg--sold { background: var(--info-500); }
.status-stack__seg--expired_available { background: var(--error-500); }
.status-stack__seg--expired_sold { background: var(--neutral-500); }
.status-stack__seg--blocked { background: var(--warn-500); }
.status-stack__seg--empty { background: var(--neutral-200); }
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--space-3);
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.status-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.status-legend__swatch {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--neutral-500);
}
.status-legend__swatch--available { background: var(--success-500); }
.status-legend__swatch--sold { background: var(--info-500); }
.status-legend__swatch--expired_available { background: var(--error-500); }
.status-legend__swatch--expired_sold { background: var(--neutral-500); }
.status-legend__swatch--blocked { background: var(--warn-500); }
.inventory-table td:nth-child(3) {
  min-width: 190px;
}
.table tbody tr.table-row-link {
  cursor: pointer;
}
.table tbody tr.table-row-link:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: -2px;
}
.inventory-metric-cell {
  min-width: 132px;
  vertical-align: top;
}
.inventory-metric-cell strong {
  display: block;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}
.inventory-metric-cell span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inventory-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.7fr);
  gap: var(--space-5);
}
.inventory-detail-main {
  display: grid;
  align-content: start;
  gap: var(--space-3);
}
.inventory-detail-main__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.inventory-insights {
  display: grid;
  gap: var(--space-4);
}
.inventory-insights__summary {
  color: var(--text-primary);
  font-size: var(--text-md);
  line-height: 1.6;
}
.inventory-insights__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}
.inventory-insight-col {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.inventory-insight-col h4 {
  font-size: var(--text-sm);
  letter-spacing: 0;
}
.inventory-insight-col ul,
.inventory-quarter-notes {
  margin: 0;
  padding-left: 18px;
}
.inventory-insight-col li,
.inventory-quarter-notes li {
  margin-bottom: 5px;
}
.inventory-chat-status {
  min-height: 24px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.inventory-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.24);
}
.inventory-chat-backdrop[hidden],
.inventory-chat-drawer[hidden] {
  display: none !important;
}
.inventory-chat-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(760px, calc(100vw - 24px));
  max-width: 100vw;
  background: var(--bg-surface);
  border-inline-start: 1px solid var(--border-default);
  box-shadow: -20px 0 48px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 160ms ease;
  pointer-events: none;
}
.inventory-chat-drawer.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.inventory-chat-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.inventory-chat-drawer__head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.inventory-chat-drawer__body {
  display: grid;
  grid-template-columns: minmax(170px, 0.34fr) minmax(0, 1fr);
  min-height: 0;
}
.inventory-chat-history {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border-inline-end: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}
.inventory-chat-history__list {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 0;
  overflow-y: auto;
}
.inventory-chat-history__empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.inventory-chat-history__item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.inventory-chat-history__item strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.inventory-chat-history__item span {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.inventory-chat-history__item:hover,
.inventory-chat-history__item.is-active {
  border-color: var(--border-default);
  background: var(--bg-surface);
}
.inventory-chat-conversation {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}
.inventory-chat-messages {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-height: 0;
  padding: var(--space-4);
  overflow-y: auto;
  background: var(--bg-canvas);
}
.inventory-chat-empty {
  align-self: center;
  justify-self: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.inventory-chat-message {
  display: grid;
  gap: var(--space-2);
  max-width: min(580px, 92%);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.inventory-chat-message--user {
  justify-self: end;
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
}
.inventory-chat-message--assistant {
  justify-self: start;
}
.inventory-chat-results {
  display: grid;
  gap: 6px;
  padding-top: var(--space-1);
}
.inventory-chat-results div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) minmax(54px, auto) auto;
  gap: var(--space-2);
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
}
.inventory-chat-results span,
.inventory-chat-results em {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-style: normal;
}
.inventory-chat-results strong {
  min-width: 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.inventory-chat-results b {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inventory-chat-form {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.inventory-chat-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.inventory-manual-entry {
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.inventory-manual-entry summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-sm);
}
.inventory-manual-entry form {
  margin-top: var(--space-3);
}
.table-wrap {
  overflow-x: auto;
  scrollbar-gutter: stable;
}

/* ── Pills (replaces badge) ──────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--neutral-50);
  color: var(--neutral-700);
  border: 1px solid var(--neutral-200);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.pill--success { background: var(--success-50); color: var(--success-700); border-color: rgba(16,185,129,0.25); }
.pill--warn    { background: var(--warn-50);    color: var(--warn-700);    border-color: rgba(245,158,11,0.25); }
.pill--error   { background: var(--error-50);   color: var(--error-700);   border-color: rgba(239,68,68,0.25); }
.pill--info    { background: var(--info-50);    color: var(--info-700);    border-color: rgba(59,130,246,0.25); }
.pill--accent  { background: var(--accent-50);  color: var(--accent-700);  border-color: rgba(99,102,241,0.25); }
.pill--neutral { background: var(--neutral-50); color: var(--neutral-700); border-color: var(--neutral-200); }

.pill--solid.pill--success { background: var(--success-500); color: #fff; border-color: transparent; }
.pill--solid.pill--warn    { background: var(--warn-500);    color: #fff; border-color: transparent; }
.pill--solid.pill--error   { background: var(--error-500);   color: #fff; border-color: transparent; }
.pill--solid.pill--info    { background: var(--info-500);    color: #fff; border-color: transparent; }
.pill--solid.pill--accent  { background: var(--accent-500);  color: #fff; border-color: transparent; }
.pill--solid.pill--neutral { background: var(--neutral-500); color: #fff; border-color: transparent; }

.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-600);
  color: #fff;
  border-radius: var(--radius-full);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  animation: pop-in var(--duration-base) var(--ease-spring);
}

/* ── Chips (filter chips) ────────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
  user-select: none;
}
.chip:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.chip:active { transform: translateY(0.5px); }
.chip.is-selected {
  background: var(--accent-600);
  color: #fff;
  border-color: var(--accent-600);
  box-shadow: var(--shadow-sm);
}
.chip.is-selected:hover { background: var(--accent-700); color: #fff; }
.chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  margin-left: 2px;
}
.chip.is-selected .chip__count { background: rgba(255,255,255,0.25); color: #fff; }

/* ── Tables ──────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
.table th {
  text-align: left;
  padding: 10px var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td {
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}
.table--hoverable tbody tr:hover { background: var(--bg-subtle); }
.table tbody tr.row--success { box-shadow: inset 3px 0 0 var(--success-500); }
.table tbody tr.row--warn    { box-shadow: inset 3px 0 0 var(--warn-500); }
.table tbody tr.row--error   { box-shadow: inset 3px 0 0 var(--error-500); }
.table tbody tr.row--info    { box-shadow: inset 3px 0 0 var(--info-500); }
.table tbody tr.row--neutral { box-shadow: inset 3px 0 0 var(--neutral-500); }

.table-meta { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.table-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-base);
}

.url-cell {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* ── Codeblock / inline code ─────────────────────────────────── */
.codeblock {
  background: var(--bg-codeblock);
  color: var(--bg-codeblock-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  position: relative;
}
.codeblock--light {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.codeblock-actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-bottom: var(--space-2); }

code.inline {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* ── Toast / flash messages ──────────────────────────────────── */
.toast, .flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--accent-500);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
  color: var(--text-secondary);
  animation: slide-in-top var(--duration-slow) var(--ease-out);
}
.flash--success { border-left-color: var(--success-500); background: var(--success-50); color: var(--success-700); }
.flash--warn    { border-left-color: var(--warn-500);    background: var(--warn-50);    color: var(--warn-700); }
.flash--error   { border-left-color: var(--error-500);   background: var(--error-50);   color: var(--error-700); }
.flash--info    { border-left-color: var(--info-500);    background: var(--info-50);    color: var(--info-700); }

/* ── Section / kanban ────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.kanban__column {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}
.kanban__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.kanban__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kanban__body {
  padding: var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}
.kanban__empty { color: var(--text-muted); font-size: var(--text-sm); text-align: center; padding: var(--space-6) 0; }

/* Column-state tint — header tinted so the stage of work is scannable across columns */
.kanban__column--info    .kanban__header { background: var(--info-50);    border-bottom-color: var(--info-100, #bfdbfe); }
.kanban__column--info    .kanban__title  { color: var(--info-700); }
.kanban__column--success .kanban__header { background: var(--success-50); border-bottom-color: var(--success-100, #bbf7d0); }
.kanban__column--success .kanban__title  { color: var(--success-700); }
.kanban__column--warn    .kanban__header { background: var(--warn-50);    border-bottom-color: var(--warn-100, #fde68a); }
.kanban__column--warn    .kanban__title  { color: var(--warn-700); }
.kanban__column--neutral .kanban__header { background: var(--bg-subtle); }
.kanban__column--neutral .kanban__title  { color: var(--text-muted); }

@media (max-width: 1100px) { .kanban { grid-template-columns: 1fr; } .kanban__column { max-height: none; } }

/* ── Tile grid (Authors) ─────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}
.tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--duration-base), box-shadow var(--duration-base), transform var(--duration-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tile__name { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tile__meta { font-size: var(--text-xs); color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; font-family: var(--font-mono); }
.tile__footer { display: flex; gap: var(--space-2); align-items: center; margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}
.tabs__tab {
  padding: 10px var(--space-4);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  text-decoration: none;
  white-space: nowrap;
}
.tabs__tab:hover { color: var(--text-primary); }
.tabs__tab.is-active {
  color: var(--accent-700);
  border-bottom-color: var(--accent-500);
  font-weight: 600;
}

/* ── Misc helpers ────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: var(--space-2); }
.spacer { flex: 1; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.bulk-outreach-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.bulk-outreach-form__textarea {
  min-height: 220px;
  resize: vertical;
  width: 100%;
}

.pipedrive-restore-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.pipedrive-restore-flash {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.pipedrive-restore-flash--error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #991b1b;
}

.pipedrive-restore-flash--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.pipedrive-restore-filters label,
.pipedrive-restore-form label {
  display: grid;
  gap: 6px;
}

.pipedrive-restore-filters label span,
.pipedrive-restore-form label span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pipedrive-restore-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.pipedrive-restore-diff pre,
.pipedrive-restore-form pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.pipedrive-restore-form fieldset {
  border: 0;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.pipedrive-restore-form legend {
  font-weight: 700;
  margin-bottom: 4px;
}

.pipedrive-restore-safe-note {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px;
}

@media (max-width: 1100px) {
  .pipedrive-restore-filters,
  .pipedrive-restore-detail {
    grid-template-columns: 1fr;
  }
}

.hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-4) 0; }

/* details/summary */
details > summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 6px 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--duration-fast);
}
details > summary:hover { color: var(--text-primary); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "›";
  display: inline-block;
  transition: transform var(--duration-base) var(--ease-out);
  font-weight: 600;
  font-size: var(--text-md);
}
details[open] > summary::before { transform: rotate(90deg); }
details[open] > *:not(summary) { animation: fade-in var(--duration-base) var(--ease-out); }

/* Live status flash on row update */
.row-flash { animation: flash-green 1100ms var(--ease-out); }

/* ── Auth pages (login/verify) ───────────────────────────────── */
.auth-canvas {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background:
    radial-gradient(circle at 1px 1px, rgba(99,102,241,0.08) 1px, transparent 0),
    linear-gradient(135deg, var(--bg-canvas) 0%, var(--accent-50) 100%);
  background-size: 24px 24px, auto;
}
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: rise-in var(--duration-slow) var(--ease-out);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.auth-brand__logo {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: var(--text-md);
  box-shadow: var(--shadow-md);
}
/* Same as sidebar — when it's the actual brand mark, drop the gradient and stay square. */
img.auth-brand__logo {
  width: 64px;
  height: 64px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}
.auth-brand__title { font-size: var(--text-lg); font-weight: 600; }
.auth-card h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
  text-align: center;
  letter-spacing: -0.02em;
}
.auth-card .auth-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-6);
}
.auth-card .auth-error {
  background: var(--error-50);
  color: var(--error-700);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-card .input { padding: 12px 14px; font-size: var(--text-md); }
.auth-card .btn--primary { padding: 12px 20px; font-size: var(--text-md); justify-content: center; width: 100%; }

.code-input {
  font-family: var(--font-mono);
  font-size: 28px;
  text-align: center;
  letter-spacing: 12px;
  padding: 16px 12px 16px 24px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  width: 100%;
  font-weight: 700;
  color: var(--text-primary);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.code-input:focus { outline: none; border-color: var(--accent-500); box-shadow: var(--shadow-focus); }

.auth-footer {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.auth-footer a { color: var(--text-muted); text-decoration: underline; }
.auth-footer a:hover { color: var(--text-primary); }

/* ── Severity-coloured log rows ───────────────────────────────── */
.log-row { font-family: var(--font-mono); font-size: var(--text-sm); }
.log-row td { padding: 6px var(--space-3); }
.log-row--debug { box-shadow: inset 3px 0 0 var(--neutral-500); }
.log-row--info  { box-shadow: inset 3px 0 0 var(--info-500); }
.log-row--warn  { box-shadow: inset 3px 0 0 var(--warn-500); background: rgba(245,158,11,0.04); }
.log-row--error { box-shadow: inset 3px 0 0 var(--error-500); background: rgba(239,68,68,0.05); }
.log-row--fatal { box-shadow: inset 3px 0 0 var(--error-700); background: rgba(127,29,29,0.07); }

/* Automation logs */
.automation-log-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  align-items: end;
}
.automation-log-filters label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}
.automation-log-filters label span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.automation-log-filters__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.automation-log-table td {
  vertical-align: top;
}
.automation-log-action {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-weight: 700;
}
.automation-log-summary {
  max-width: 62ch;
  color: var(--text-secondary);
  line-height: 1.45;
}
.automation-log-detail {
  margin-top: 6px;
}
.automation-log-detail summary {
  color: var(--accent-700);
  font-size: var(--text-xs);
  font-weight: 700;
}
.automation-log-detail pre {
  max-width: 62ch;
  max-height: 220px;
  margin: 6px 0 0;
  padding: var(--space-2);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.automation-log-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.progress {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-2);
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-500), var(--accent-700));
  border-radius: inherit;
  transition: width var(--duration-slow) var(--ease-out);
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty-state__icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  display: grid; place-items: center;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
}
.empty-state__icon svg { width: 28px; height: 28px; }
.empty-state__title { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state__body { font-size: var(--text-base); color: var(--text-secondary); max-width: 420px; margin: 0 auto; }

/* ── Profile chips (style profile vocab) ─────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-50);
  color: var(--accent-700);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  margin: 2px 2px 2px 0;
  transition: background var(--duration-fast);
}
.tag:hover { background: var(--accent-100); }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── Author style list (table-row accordion) ─────────────────── */
.style-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}
.style-list__head, .style-row__summary {
  display: grid;
  grid-template-columns: 24px minmax(180px, 1.4fr) minmax(110px, 1fr) 70px minmax(120px, 1fr) 100px 70px 130px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.style-list__head {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.style-row { border-bottom: 1px solid var(--border-subtle); }
.style-row:last-child { border-bottom: none; }
.style-row > summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--text-base);
  user-select: none;
  transition: background var(--duration-fast) var(--ease-out);
}
.style-row > summary::-webkit-details-marker,
.style-row > summary::marker { display: none; }
.style-row:hover > summary { background: var(--bg-subtle); }
.style-row[open] > summary {
  background: var(--accent-50);
  border-bottom: 1px solid var(--border-default);
}

/* Override the global details::before chevron for style rows */
.style-row > summary::before { content: none; }
.style-row__chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out), color var(--duration-fast);
}
.style-row__chev svg { width: 14px; height: 14px; }
.style-row[open] .style-row__chev {
  transform: rotate(90deg);
  color: var(--accent-600);
}
.style-row__name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-row__cell {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-row__body {
  padding: var(--space-5) var(--space-6);
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-default);
  animation: fade-in var(--duration-base) var(--ease-out);
}
.style-row[open] + .style-row .style-row__body { /* prevents double border in stacked open rows */ }

@media (max-width: 1100px) {
  .style-list__head { display: none; }
  .style-row__summary {
    grid-template-columns: 24px 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "chev name status"
      "chev meta meta";
    gap: var(--space-1) var(--space-3);
  }
  .style-row__chev { grid-area: chev; }
  .style-row__name { grid-area: name; }
  .style-row__summary > .style-row__cell:nth-child(3),
  .style-row__summary > .style-row__cell:nth-child(4),
  .style-row__summary > .style-row__cell:nth-child(5),
  .style-row__summary > .style-row__cell:nth-child(6),
  .style-row__summary > .style-row__cell:nth-child(7) {
    grid-area: meta;
    display: inline-flex;
    margin-right: var(--space-2);
  }
  .style-row__summary > .style-row__cell:last-child { grid-area: status; }
}

/* ── Definition list ──────────────────────────────────────────── */
.dl {
  display: grid;
  grid-template-columns: minmax(80px, max-content) 1fr;
  gap: 4px var(--space-3);
  font-size: var(--text-sm);
  min-width: 0;
}
.dl dt { color: var(--text-muted); font-weight: 500; padding: 4px 0; white-space: nowrap; }
.dl dd { margin: 0; padding: 4px 0; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.dl code.inline { word-break: keep-all; overflow-wrap: anywhere; }

/* When the dl is inside a narrow container (kanban column), stack labels above values */
.kanban .dl, .signal-card .dl {
  grid-template-columns: 1fr;
  gap: 0;
}
.kanban .dl dt, .signal-card .dl dt { padding-bottom: 0; font-size: var(--text-xs); }
.kanban .dl dd, .signal-card .dl dd { padding-top: 2px; padding-bottom: var(--space-2); }

/* Feedback signal: bot-verdict / human-signal grid auto-collapses to 1col when narrow */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}
.signal-grid > div { min-width: 0; }

/* ════════════════════════════════════════════════════════════════
   v2 component additions (Refero/Lazyweb research synthesis)
   ════════════════════════════════════════════════════════════════ */

/* ── Hero stat (Mercury pattern: huge value + sparkline + delta) ─ */
.hero-stat {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 1fr;
  gap: var(--space-6);
  align-items: end;
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--accent-50) 140%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}
.hero-stat__label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600; }
.hero-stat__value { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text-primary); margin-top: var(--space-2); }
.hero-stat__delta { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--space-3);
  font-size: var(--text-sm); font-weight: 600; }
.hero-stat__delta--up { color: var(--success-700); }
.hero-stat__delta--down { color: var(--error-700); }
.hero-stat__compare { font-size: var(--text-xs); color: var(--text-muted); margin-left: var(--space-2); font-weight: 400; }
.hero-stat__spark { width: 100%; height: 56px; }
.hero-stat__spark-path { fill: none; stroke: var(--accent-600); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hero-stat__spark-area { fill: var(--accent-100); opacity: 0.55; stroke: none; }

/* ── Segmented toggle (Mercury "money in / money out" pattern) ──── */
.seg {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.seg__btn {
  padding: 4px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  text-decoration: none;
}
.seg__btn:hover { color: var(--text-primary); }
.seg__btn.is-active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ── Keyboard hint chip (kbd) ───────────────────────────────────── */
.kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: 500;
}

/* ── Command palette overlay (Linear / Raycast Cmd+K) ────────────── */
.cmdk { position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding-top: 12vh;
  backdrop-filter: blur(4px); }
.cmdk.is-open { display: flex; animation: fade-in var(--duration-base) var(--ease-out); }
.cmdk__panel { width: min(640px, 92vw); max-height: 70vh; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; }
.cmdk__input { padding: var(--space-4) var(--space-5); border: none; border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-lg); outline: none; }
.cmdk__list { overflow-y: auto; padding: var(--space-2); }
.cmdk__group-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); padding: var(--space-2) var(--space-3); }
.cmdk__item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm); cursor: pointer; }
.cmdk__item:hover, .cmdk__item.is-selected { background: var(--bg-hover); }
.cmdk__item-meta { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); }

/* ── Right-rail detail panel / drawer (Linear issue detail) ─────── */
.detail-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw);
  background: var(--bg-surface); border-left: 1px solid var(--border-default); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform var(--duration-base) var(--ease-out);
  z-index: 90; display: flex; flex-direction: column; }
.detail-panel.is-open { transform: translateX(0); }
.detail-panel__head { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.detail-panel__body { flex: 1; overflow-y: auto; padding: var(--space-5); }
.detail-panel__composer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border-default);
  background: var(--bg-subtle); display: flex; gap: var(--space-2); align-items: center; }

/* ── Source-color pip (used in timeline + lists + tags) ─────────── */
.src-pip {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.src-pip--pipedrive  { background: var(--src-pipedrive); }
.src-pip--lemlist    { background: var(--src-lemlist); }
.src-pip--wolfscale  { background: var(--src-wolfscale); }
.src-pip--supernormal { background: var(--src-supernormal); }
.src-pip--pulse      { background: var(--src-pulse); }
.src-pip--icp        { background: var(--src-icp); }
.src-pip--competitor { background: var(--src-competitor); }
.src-pip--inbound    { background: var(--src-inbound); }
.src-pip--newsletter { background: var(--src-newsletter); }
.src-pip--existing   { background: var(--src-existing); }

.src-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600;
  background: var(--bg-subtle); border: 1px solid var(--border-default); color: var(--text-secondary);
}
.src-pill--pipedrive  { background: var(--src-pipedrive-50);  color: var(--src-pipedrive);  border-color: rgba(37,99,235,0.18); }
.src-pill--lemlist    { background: var(--src-lemlist-50);    color: var(--src-lemlist);    border-color: rgba(22,163,74,0.18); }
.src-pill--wolfscale  { background: var(--src-wolfscale-50);  color: var(--src-wolfscale);  border-color: rgba(234,88,12,0.18); }
.src-pill--supernormal{ background: var(--src-supernormal-50);color: var(--src-supernormal);border-color: rgba(147,51,234,0.18); }
.src-pill--pulse      { background: var(--src-pulse-50);      color: var(--src-pulse);      border-color: rgba(13,148,136,0.18); }
.src-pill--icp        { background: var(--src-icp-50);        color: var(--src-icp);        border-color: rgba(99,102,241,0.18); }
.src-pill--competitor { background: var(--src-competitor-50); color: var(--src-competitor); border-color: rgba(219,39,119,0.18); }

/* ── Cross-source timeline (deal detail / org detail) ───────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline__row { display: grid; grid-template-columns: 90px 18px 1fr; gap: var(--space-3);
  padding: var(--space-2) 0; align-items: start; }
.timeline__date { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline__rail { position: relative; display: flex; justify-content: center; }
.timeline__rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: var(--border-default); transform: translateX(-50%); }
.timeline__rail .src-pip { margin-top: 5px; box-shadow: 0 0 0 3px var(--bg-surface); position: relative; z-index: 1; }
.timeline__row:first-child .timeline__rail::before { top: 8px; }
.timeline__row:last-child .timeline__rail::before { bottom: calc(100% - 8px); }
.timeline__body { font-size: var(--text-sm); color: var(--text-primary); padding: 1px 0 var(--space-1); }
.timeline__title { font-weight: 500; }
.timeline__meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* ── Today / temporal section header (Asana pattern) ────────────── */
.today-section { margin-bottom: var(--space-6); }
.today-section__head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); }
.today-section__title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600;
  color: var(--text-primary); letter-spacing: var(--tracking-tight); }
.today-section__count { font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.today-section__action { margin-left: auto; }

/* ── Recents row (Notion "Jump back in") ────────────────────────── */
.recents-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-5); }
.recent-tile { padding: var(--space-3) var(--space-4); background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  transition: border-color var(--duration-fast), transform var(--duration-fast); text-decoration: none; color: inherit; }
.recent-tile:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.recent-tile__title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-tile__meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

/* ── Bulk action bar (sits above kanban / list when items selected) ─ */
.bulk-bar { display: flex; gap: var(--space-2); align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-50); border: 1px solid var(--accent-100);
  border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.bulk-bar__count { font-size: var(--text-sm); font-weight: 600; color: var(--accent-700); }
.bulk-bar__spacer { flex: 1; }

/* ── Kanban card (with source-color top stripe) ─────────────────── */
.kanban-card { background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 14px var(--space-3) var(--space-3);
  display: flex; flex-direction: column; gap: 6px; cursor: pointer; position: relative;
  flex: 0 0 auto;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast); }
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kanban-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--text-muted); }
.kanban-card--pipedrive::before  { background: var(--src-pipedrive); }
.kanban-card--lemlist::before    { background: var(--src-lemlist); }
.kanban-card--wolfscale::before  { background: var(--src-wolfscale); }
.kanban-card--supernormal::before{ background: var(--src-supernormal); }
.kanban-card--pulse::before      { background: var(--src-pulse); }
.kanban-card__title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.kanban-card__meta { font-size: var(--text-xs); color: var(--text-muted); display: flex; gap: var(--space-2); flex-wrap: wrap; }
.kanban-card__excerpt { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  word-break: break-word; }
.kanban-card__actions { display: flex; gap: 4px; margin-top: var(--space-1); }
.kanban-card.is-selected { border-color: var(--accent-500); box-shadow: 0 0 0 1px var(--accent-500); }

/* ── Reply row / triage list row ────────────────────────────────── */
.reply-list { display: flex; flex-direction: column; }
.reply-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle);
  align-items: start; transition: background var(--duration-fast); }
.reply-row:hover { background: var(--bg-subtle); }
.reply-row__src { padding-top: 5px; }
.reply-row__main { min-width: 0; }
.reply-row__title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.reply-row__excerpt { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.reply-row__context { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.reply-row__time { font-size: var(--text-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 4px; }

/* ── Next-move callout (deal-detail "highlight what to do next") ─ */
.next-move { background: linear-gradient(135deg, var(--accent-50), var(--bg-surface));
  border: 1px solid var(--accent-100); border-radius: var(--radius-md); padding: var(--space-4);
  display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.next-move__icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--radius-md); background: var(--bg-surface); color: var(--accent-600); }
.next-move__icon svg { width: 18px; height: 18px; }
.next-move__main { flex: 1; min-width: 0; }
.next-move__label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  color: var(--accent-700); letter-spacing: 0.06em; }
.next-move__title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-top: 2px; }

/* ── Diff card (Robinhood "before / after" pattern) ─────────────── */
.diff-card { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-4);
  align-items: center; padding: var(--space-4); background: var(--bg-subtle);
  border-radius: var(--radius-md); font-size: var(--text-sm); }
.diff-card__before { color: var(--text-muted); text-decoration: line-through; }
.diff-card__after { color: var(--success-700); font-weight: 600; }
.diff-card__arrow { color: var(--text-muted); }

/* ── Table refinements (tabular-nums + zebra + sticky shadow) ───── */
.table { font-variant-numeric: tabular-nums; }
.table th.r, .table td.r { text-align: right; }
.table th.col--num, .table td.cell--num,
.table th.col--money, .table td.cell--money,
.table th.col--date, .table td.cell--date { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table--zebra tbody tr:nth-child(even) td { background: rgba(15, 23, 42, 0.012); }
.table--compact td { padding: 6px var(--space-3); }
.table--compact th { padding: 8px var(--space-3); }

/* ── Empty-state v2 (illustration + dot grid + CTA) ─────────────── */
.empty-state__art {
  width: 88px; height: 88px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 30% 30%, var(--accent-50), transparent 60%),
    var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: grid; place-items: center;
  position: relative;
}
.empty-state__art::after {
  content: ""; position: absolute; inset: 12px;
  background-image: radial-gradient(circle at 1px 1px, rgba(15,23,42,0.06) 1px, transparent 0);
  background-size: 8px 8px; border-radius: var(--radius-md); opacity: 0.55; pointer-events: none;
}
.empty-state__art svg { width: 32px; height: 32px; color: var(--accent-600); position: relative; z-index: 1; }
.empty-state__cta { display: inline-flex; gap: var(--space-2); margin-top: var(--space-2); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes pulse-dot { 0%,100% { transform: scale(1); opacity: 0.55; } 50% { transform: scale(2.2); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-top { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes flash-green { 0% { background: var(--success-50); } 100% { background: transparent; } }
@keyframes scale-in-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.is-shimmering {
  background-image: linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.12) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar { display: none; }
  .main { padding: var(--space-4); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 var(--space-4); }
  .topbar__search { display: none; }
  .inventory-health,
  .inventory-detail-grid {
    grid-template-columns: 1fr;
  }
  .inventory-filter-bar {
    grid-template-columns: 1fr;
  }
  .inventory-chat-drawer {
    width: 100vw;
  }
  .inventory-chat-drawer__body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .inventory-chat-history {
    max-height: 170px;
    border-inline-end: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .inventory-chat-results div {
    grid-template-columns: 74px minmax(0, 1fr) auto;
  }
  .inventory-chat-results em {
    display: none;
  }
  .inventory-inline-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}
.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-left: 25%;
}

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

/* ─── Brief paper (intake_preview, meeting_preview, future briefings) ───
   Moved from inline `<style>` in meeting_preview.py so intake_preview.py
   actually inherits the classes (it referenced them but they only existed
   on the meeting page before). */

.brief-paper {
  max-width: 780px;
  margin: 24px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 36px 48px;
  box-shadow: var(--shadow-sm);
}
.brief-paper--wide { max-width: 1100px; }   /* intake_preview wants more horizontal room */

.brief-eyebrow {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.brief-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.2;
  letter-spacing: var(--tracking-display);
}
.brief-header__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.brief-actions { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }
.brief-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.brief-meta--quiet {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.brief-chip {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.brief-recording {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-50);
  border: 1px solid var(--accent-100, var(--accent-200));
  border-radius: var(--radius-md);
}
.brief-recording a {
  color: var(--accent-700);
  font-weight: 600;
  text-decoration: none;
  font-size: var(--text-sm);
}
.brief-recording a:hover { text-decoration: underline; }

.brief-body { margin-top: 28px; }
.brief-section {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.brief-section:last-child { border-bottom: none; }
.brief-section__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.brief-prose {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}
.brief-list { margin: 0; padding-left: 22px; }
.brief-list li {
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.brief-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}
.brief-footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

/* Note: a `.brief-header--sticky` modifier existed briefly but conflicted with
   the topbar (also `position: sticky; top: 0; z-index: 10`) — the brief header
   ended up hidden behind it. Re-adding it needs `top: <topbar height>` AND a
   z-index that respects the topbar. Removed for now. */

/* Print: hide app shell, expand brief paper to full page, force-expand any
   `<details>` so the printed copy isn't missing collapsed sections. */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .brief-actions { display: none !important; }
  .main { padding: 0 !important; margin: 0 !important; }
  .brief-paper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 24px 32px !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .brief-recording {
    background: transparent !important;
    border: 1px solid #cbd5e1 !important;
  }
  .brief-section { page-break-inside: avoid; }
  /* Expand all <details> on paper — the SKIPS table and the keywords/tech
     reveal would otherwise be lost when the printed page renders them closed. */
  details > * { display: block !important; }
  details summary { display: none !important; }
}

/* ─── Profile card (Rox-inspired contact panel) ───
   Avatar + name + title at top of a card. Used by intake_preview's Contact
   section. */
.profile-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.profile-card__avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-100);
  color: var(--accent-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  text-transform: uppercase;
}
.profile-card__avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-card__body { flex: 1; min-width: 0; }
.profile-card__name {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 2px 0;
  line-height: 1.3;
}
.profile-card__title {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  line-height: 1.35;
}

/* ─── Attr row (Rox-style icon + label + value) ───
   Compact key-value display. Used inside any card section. */
.attr-list { margin: 8px 0 0 0; padding: 0; list-style: none; }
.attr-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  padding: 3px 0;
}
.attr-row__icon {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.attr-row__label {
  width: 84px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.attr-row__value {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  word-wrap: break-word;
}
.attr-row__value a { color: var(--accent-700); text-decoration: none; }
.attr-row__value a:hover { text-decoration: underline; }

/* Dense enrichment field matrix: gathered value + provenance + current CRM +
   write verdict. Used by /console/intake/{lead_id}. */
.profile-field-group {
  margin: 14px 0 18px 0;
}
.profile-field-group h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-fields th {
  width: 190px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: normal;
}
.profile-fields td,
.profile-fields th {
  vertical-align: top;
}
.field-source,
.field-confidence,
.field-note {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  background: var(--bg-subtle);
}
.field-confidence {
  color: var(--accent-700);
  background: var(--accent-50);
}
.field-note {
  display: block;
  border-radius: var(--radius-sm);
  white-space: normal;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.review-grid--top {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
}
.feedback-form {
  display: grid;
  gap: 8px;
}
.feedback-form__label {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.feedback-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-surface);
}
.feedback-form textarea:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
}
.feedback-form__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.feedback-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.feedback-item {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.feedback-item__meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-bottom: 4px;
}

/* Two-column grid for the contact + meeting row on intake_preview. */
.intake-two-col {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 16px;
  margin-bottom: 22px;
}
@media (max-width: 1180px) {
  .inventory-filter-bar,
  .inventory-calendar-controls,
  .inventory-product-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .intake-two-col { grid-template-columns: 1fr; }
  .review-grid--top { grid-template-columns: minmax(0, 1fr); }
  .settings-form-actions { padding-left: 0; }
}

/* ─── Brief markdown (parsed Claude output) ───
   Typography for the rendered meeting brief: h3 section headers with
   underline rule, h4 sub-headers, paragraphs, bullet lists, bold/em. */
.brief-md {
  font-size: var(--text-base);
  line-height: 1.62;
  color: var(--text-primary);
}
.brief-md h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin: 22px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.brief-md h3:first-child { margin-top: 0; }
.brief-md h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 6px 0;
}
.brief-md p { margin: 0 0 10px 0; }
.brief-md ul { margin: 0 0 12px 0; padding-left: 22px; }
.brief-md li { margin-bottom: 4px; line-height: 1.55; }
.brief-md strong { font-weight: 600; color: var(--text-primary); }
.brief-md em { font-style: italic; color: var(--text-secondary); }
.brief-md a { color: var(--accent-700); text-decoration: none; }
.brief-md a:hover { text-decoration: underline; }

/* ─── Pipedrive-diff SKIPs collapse ───
   Used on intake_preview to hide skipped/already-set fields behind a toggle. */
.diff-skips {
  margin-top: 10px;
  font-size: 12px;
}
.diff-skips summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 0;
  user-select: none;
}
.diff-skips summary:hover { color: var(--text-primary); }
.diff-skips[open] summary { color: var(--text-primary); }
.diff-skips table { margin-top: 6px; opacity: 0.75; }

/* ─── Write/skip pill colors for the diff table ───
   The .table th/td defaults are already styled; these are inline pills shown
   in the leftmost column of each FieldWrite row. */
.diff-write { color: var(--accent-success-700, #15803d); }
.diff-skip  { color: var(--text-muted); }

/* Contextual report feedback */
body[data-report-feedback-enabled="false"] .report-feedback-control { display: none; }
.report-feedback-host { min-width: 0; }
.report-feedback-host--kpi {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.report-feedback-host--kpi > .kpi { flex: 1; }
.report-feedback-control {
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}
.card > .report-feedback-control { margin: 0 16px 12px; }
.report-feedback-host > .report-feedback-control {
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 10px 10px;
  background: var(--surface, #fff);
  margin: -1px 10px 0;
  padding: 0 10px;
}
.report-feedback-control summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.report-feedback-control summary::-webkit-details-marker { display: none; }
.report-feedback-control summary::before { content: "+"; margin-right: 5px; }
.report-feedback-control[open] summary::before { content: "−"; }
.report-feedback-control summary:hover { color: var(--text-primary); }
.report-feedback-control summary:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--accent-600, #2563eb);
  outline-offset: 2px;
}
.report-feedback-form {
  display: grid;
  gap: 8px;
  padding: 4px 0 12px;
}
.report-feedback-form__label { display: grid; gap: 6px; line-height: 1.45; }
.report-feedback-form textarea {
  width: 100%;
  min-height: 84px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--border-default, #cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  padding: 9px 10px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
}
.report-feedback-form textarea:focus-visible {
  outline: 2px solid var(--accent-600, #2563eb);
  outline-offset: 1px;
}
.report-feedback-form textarea:user-invalid { border-color: #b91c1c; }
.report-feedback-form textarea[aria-invalid="false"]:user-invalid {
  border-color: var(--border-default, #cbd5e1);
}
.report-feedback-form__validation { display: none; color: #991b1b; }
.report-feedback-form textarea:user-invalid + .report-feedback-form__validation,
.report-feedback-form:has(textarea:user-invalid) .report-feedback-form__validation { display: block; }
.report-feedback-form:has(textarea[aria-invalid="false"]) .report-feedback-form__validation { display: none; }
.report-feedback-form__actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.report-feedback-form__status { min-height: 18px; color: var(--text-muted); }
.report-feedback-form__status.is-success { color: #166534; }
.report-feedback-form__status.is-error { color: #991b1b; }

/* Admin feedback review queue */
.feedback-review__filters {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) repeat(2, minmax(190px, 1fr)) auto auto;
  align-items: end;
  gap: 10px;
}
.feedback-review__filters label,
.feedback-review__status label { display: grid; gap: 5px; font-size: var(--text-xs); font-weight: 600; }
.feedback-review__filters input,
.feedback-review__filters select,
.feedback-review__status select {
  min-height: 38px;
  border: 1px solid var(--border-default, #cbd5e1);
  border-radius: 8px;
  background: #fff;
  padding: 7px 9px;
}
.feedback-review { display: grid; gap: 12px; }
.feedback-review__item {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
}
.feedback-review__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text-muted); font-size: var(--text-xs); }
.feedback-review__text { margin: 12px 0; white-space: pre-wrap; color: var(--text-primary); line-height: 1.55; }
.feedback-review__context { margin: 8px 0; color: var(--text-muted); font-size: var(--text-xs); }
.feedback-review__context div { margin-top: 7px; padding: 9px; border-radius: 7px; background: var(--surface-muted, #f8fafc); white-space: pre-wrap; }
.feedback-review__status { display: flex; align-items: end; gap: 8px; margin-top: 10px; }

@media (max-width: 900px) {
  .feedback-review__filters { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
  .report-feedback-control summary,
  .report-feedback-form button { min-height: 48px; }
}

/* Custom-range pair: participates in the filter bar's own layout when shown,
   so revealing it does not add a nested box. */
.inventory-filter-custom { display: contents; }
.inventory-filter-custom[hidden] { display: none; }

/* ══════════════════════════════════════════════════════════════
   Sidebar sub-links — one entry per product type under Products.
   ══════════════════════════════════════════════════════════════ */
.sidebar__sublinks {
  display: flex;
  flex-direction: column;
  margin: 2px 0 6px 0;
  padding-left: 30px;
  border-left: 1px solid var(--border-default);
  margin-left: 15px;
}
.sidebar__sublink {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__sublink:hover { color: var(--text-primary); background: var(--bg-hover); }
.sidebar__sublink.is-active { color: var(--accent-700); font-weight: 600; }
.sidebar.is-collapsed .sidebar__sublinks { display: none; }

/* ══════════════════════════════════════════════════════════════
   Inventory workspace only — scoped by the body attribute so the
   other console workspaces keep the shared treatment.

   Two things were wrong. The sections did not read as separate
   because the canvas (#f8fafc) and the card surface (#ffffff) are
   two per cent apart, and every card carried a 1px border *and* a
   soft shadow, so neither edge nor elevation resolved. And the KPI
   tiles used a rounded 2px accent rail down their left edge, which
   duplicated information the value colour already carries.
   ══════════════════════════════════════════════════════════════ */
body[data-report-page^="/console/inventory"] {
  /* A real step down, so white surfaces separate from the ground. */
  --bg-canvas: #eceff4;
}

/* Edge, not elevation: one of the two, never both. */
body[data-report-page^="/console/inventory"] .kpi,
body[data-report-page^="/console/inventory"] .card,
body[data-report-page^="/console/inventory"] .inventory-health,
body[data-report-page^="/console/inventory"] .inventory-filter-bar,
body[data-report-page^="/console/inventory"] .inventory-value-strip {
  box-shadow: none;
  border-color: var(--border-strong);
}

/* The accent rail is the single most recognisable generated-UI tell, and here
   it is redundant: .kpi--error .kpi__value is already red. */
body[data-report-page^="/console/inventory"] .kpi::before,
body[data-report-page^="/console/inventory"] .inventory-health::before {
  content: none;
}
body[data-report-page^="/console/inventory"] .inventory-health {
  padding-inline-start: var(--space-5);
}

/* Tight within a group, generous between groups. */
body[data-report-page^="/console/inventory"] .kpi-grid,
body[data-report-page^="/console/inventory"] .inventory-value-strip {
  margin-bottom: var(--space-6);
}
body[data-report-page^="/console/inventory"] .inventory-filter-bar {
  margin-bottom: var(--space-6);
}
body[data-report-page^="/console/inventory"] .card + .card {
  margin-top: var(--space-6);
}

/* The queue's type column: a readable label, not a machine identifier. */
.inventory-anomaly-kind {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* The value strip carried a 3px coloured top edge on a rounded card — the same
   accent-rail tell as the KPI rails, rotated. The status moves onto the number
   itself, matching how .kpi--error .kpi__value already works, so the signal
   survives and the decoration goes. */
body[data-report-page^="/console/inventory"] .inventory-value {
  border-block-start-width: 1px;
  border-block-start-color: var(--border-strong);
}
body[data-report-page^="/console/inventory"] .inventory-value--success strong { color: var(--success-700); }
body[data-report-page^="/console/inventory"] .inventory-value--warn strong { color: var(--warn-700); }
body[data-report-page^="/console/inventory"] .inventory-value--error strong { color: var(--error-700); }
body[data-report-page^="/console/inventory"] .inventory-value--info strong { color: var(--info-700); }

/* A SKU is one token — breaking "101-09" across two lines makes it unreadable
   and unclickable next to its copy button. */
.inventory-table .inventory-sku {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) { white-space: nowrap; width: 1%; }

/* Give the product name room rather than letting it wrap every row. */
.inventory-table th:first-child,
.inventory-table td:first-child { min-width: 190px; }

/* Feedback opens as a dialog on inventory pages. The control is a <details>
   that expands in place, which is fine on a wide card but breaks a 190px KPI
   tile — the form overflowed the tile and covered the value it was about.
   Pure CSS so the no-JS fallback still works: the summary stays the trigger. */
body[data-report-page^="/console/inventory"] .report-feedback-control[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 60;
}
body[data-report-page^="/console/inventory"] .report-feedback-control[open] .report-feedback-form {
  position: fixed;
  z-index: 61;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
body[data-report-page^="/console/inventory"] .report-feedback-control[open] .report-feedback-form textarea {
  width: 100%;
  min-height: 120px;
}

/* Quarter notes are reference detail behind a disclosure now. */
.inventory-quarter-notes > summary {
  font-weight: 600;
  color: var(--text-secondary);
}

