/*
 * Novara GTM — design system
 * Self-hosted type (IBM Plex Sans + Plex Mono), a considered cool-neutral
 * palette with a single deliberate accent, and flat-bordered (not
 * shadow-heavy) surfaces — the Linear/Notion/Stripe register rather than
 * a stock admin-template look. Layered on top of Bootstrap 5's grid and
 * utility classes; every visual decision below overrides or replaces
 * Bootstrap's own component styling.
 */

@font-face {
  font-family: 'Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/plexsans-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/plexmono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/plexmono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/plexmono-600.woff2') format('woff2');
}

:root {
  /* Surfaces */
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-hover: #f7f8fa;
  --surface-sunken: #f1f2f5;

  /* Borders */
  --border: #e4e7eb;
  --border-strong: #d3d8df;

  /* Ink */
  --ink: #14181d;
  --ink-secondary: #5b6572;
  --ink-tertiary: #939ba6;
  --ink-disabled: #c7ccd3;

  /* Accent (brand — teal, deliberately distinct from indigo/purple defaults) */
  --accent: #0e7c6b;
  --accent-strong: #095b4e;
  --accent-soft: #e3f2ee;
  --accent-ink: #06463c;
  --focus-ring: rgba(14, 124, 107, 0.35);

  /* Semantic — separate hues from the accent, never reused for brand */
  --success: #1b8354;
  --success-soft: #e5f5ec;
  --warning: #a5680a;
  --warning-soft: #fcf2de;
  --danger: #c13a2e;
  --danger-soft: #fbeae7;
  --info: #2a5db0;
  --info-soft: #e9f0fb;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(20, 24, 29, 0.05);
  --shadow-sm: 0 2px 6px rgba(20, 24, 29, 0.06), 0 1px 2px rgba(20, 24, 29, 0.04);
  --shadow-md: 0 12px 28px rgba(20, 24, 29, 0.10), 0 2px 6px rgba(20, 24, 29, 0.05);
  --shadow-lg: 0 20px 48px rgba(20, 24, 29, 0.14), 0 4px 12px rgba(20, 24, 29, 0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* AI accent — a second, deliberately distinct hue used ONLY to mark AI-generated
     content (reasoning, recommendations, variant analysis) so it reads apart from
     the teal brand/action colour without adding visual noise. */
  --ai-accent: #5b5fc7;
  --ai-accent-soft: #eef0fc;
  --ai-accent-ink: #363a94;
  --ai-grad: linear-gradient(135deg, #8184f0 0%, #5b5fc7 55%, #4338ca 100%);

  /* Brand gradient — a richer expression of the teal accent for primary actions,
     hero surfaces, avatars, and the active-nav treatment. */
  --brand-grad: linear-gradient(135deg, #12a88c 0%, #0e7c6b 55%, #0a5a63 100%);
  --brand-grad-hover: linear-gradient(135deg, #14bd9d 0%, #0e8c78 55%, #0a5a63 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(18, 168, 140, 0.12), rgba(10, 90, 99, 0.06));

  /* Module palette — one distinct hue per workflow stage (ICP, Clay, Apollo,
     Enrichment, Planner, Emails, Performance) so the campaign stepper and related
     module accents read as vivid and alive rather than a single monochrome brand
     colour repeated everywhere. Purely additive — the semantic/brand tokens above
     are unchanged and still carry all status/action meaning. */
  --m-icp: #2563eb;      --m-icp-soft: #e8f0fe;
  --m-clay: #7c3aed;     --m-clay-soft: #f2ecfd;
  --m-apollo: #ea580c;   --m-apollo-soft: #fdece0;
  --m-enrich: #db2777;   --m-enrich-soft: #fce7f1;
  --m-planner: #4f46e5;  --m-planner-soft: #ece9fc;
  --m-emails: #0891b2;   --m-emails-soft: #e1f4f7;
  --m-perf: #16a34a;     --m-perf-soft: #e6f7ec;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

::selection { background: var(--accent-soft); color: var(--accent-ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-tertiary); }

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.011em; color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); }

.mono { font-family: 'Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace; font-feature-settings: 'tnum' 1; }

.icon { width: 17px; height: 17px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 28px; height: 28px; }

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

.text-secondary { color: var(--ink-secondary) !important; }
.text-tertiary { color: var(--ink-tertiary) !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =====================================================================
   Auth shell (login / forgot-password / reset-password)
   ===================================================================== */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(14, 124, 107, 0.06), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(14, 124, 107, 0.05), transparent 45%),
    var(--canvas);
}
.auth-card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  animation: auth-rise 420ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes auth-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }

.auth-brand, .brand {
  display: flex;
  align-items: center;
  color: var(--ink);
}
.auth-brand { margin-bottom: 28px; }
.brand-divider { margin: 0 8px; font-weight: 300; color: var(--border-strong); font-size: 16px; }
.brand-suffix {
  font-family: 'Plex Mono', monospace;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  text-transform: uppercase;
}
.brand-logo { height: 22px; width: auto; display: block; }

.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-subtitle { color: var(--ink-secondary); font-size: 13px; margin-bottom: 22px; }

/* =====================================================================
   App shell
   ===================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--canvas);
  background-image: radial-gradient(rgba(14, 124, 107, 0.07) 1px, transparent 1px);
  background-size: 20px 20px;
}

.app-sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(20, 24, 29, 0.02), 4px 0 16px rgba(20, 24, 29, 0.03);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-sidebar .brand { position: relative; padding: 6px 8px 20px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.app-sidebar .brand::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--brand-grad); border-radius: 2px 2px 0 0; }

.nav-group { margin-bottom: 4px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label {
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  padding: 0 10px 6px;
}

.app-sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  border-left: 2.5px solid transparent;
  transition: background 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out;
}
.app-sidebar a.nav-link .icon { color: var(--ink-tertiary); transition: color 120ms ease-out; }
.app-sidebar a.nav-link:hover { background: var(--surface-hover); color: var(--ink); }
.app-sidebar a.nav-link:hover .icon { color: var(--ink-secondary); }
.app-sidebar a.nav-link.active { background: linear-gradient(90deg, var(--accent-soft) 0%, rgba(14, 124, 107, 0.03) 100%); color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(14, 124, 107, 0.06); }
.app-sidebar a.nav-link.active .icon { color: var(--accent); }
.app-sidebar a.nav-link.disabled { color: var(--ink-disabled); cursor: default; pointer-events: none; }
.app-sidebar a.nav-link.disabled .icon { color: var(--ink-disabled); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 120ms ease-out;
}
.sidebar-user:hover { background: var(--surface-hover); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--brand-grad);
  color: #fff;
  font-family: 'Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border), 0 2px 6px rgba(10, 90, 99, 0.3);
}
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }

.sidebar-user-meta { min-width: 0; flex: 1; }
.sidebar-user-name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-family: 'Plex Mono', monospace; font-size: 10px; color: var(--ink-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  height: 58px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-topbar > a.icon-btn { margin-left: auto; }

.topbar-context {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-context .sep { color: var(--ink-disabled); }
.topbar-context .current { color: var(--ink); }

.topbar-search { position: relative; max-width: 340px; width: 100%; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-tertiary); pointer-events: none; }
.topbar-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 33px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 120ms, background 120ms;
}
.topbar-search input::placeholder { color: var(--ink-tertiary); }
.topbar-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 120ms, border-color 120ms;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border); color: var(--ink); }

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: 'Plex Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--surface);
}

.app-content { padding: 30px 28px 60px; max-width: 1180px; width: 100%; margin: 0 auto; animation: content-fade 220ms ease-out; }
@keyframes content-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .app-content { animation: none; } }

.page-title { font-size: 22px; margin-bottom: 5px; letter-spacing: -0.014em; }

/* Small gradient icon chip used beside the page title on list/admin pages
   (Clients, Users, Activity, Settings) so each secondary page reads as
   distinct and considered rather than a bare heading. */
.page-head-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 4px 10px rgba(10, 90, 99, 0.3);
}
.page-head-icon .icon { width: 19px; height: 19px; }
.page-head-icon.ph-campaigns { background: linear-gradient(135deg, #4f83e0, var(--info)); box-shadow: 0 4px 10px rgba(42, 93, 176, 0.32); }
.page-head-icon.ph-users { background: linear-gradient(135deg, #7c76e8, var(--m-planner)); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.32); }
.page-head-icon.ph-activity { background: linear-gradient(135deg, #29b6cf, var(--m-emails)); box-shadow: 0 4px 10px rgba(8, 145, 178, 0.32); }
.page-head-icon.ph-settings { background: var(--brand-grad); }

.panel-head .panel-count { font-family: 'Plex Mono', monospace; font-size: 11px; font-weight: 500; color: var(--ink-tertiary); text-transform: none; letter-spacing: 0; }
.status-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.sidebar-toggle { display: none; flex-shrink: 0; }
.sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  .sidebar-toggle { display: inline-flex; }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 200ms ease-out;
    box-shadow: var(--shadow-md);
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 29, 0.4);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease-out;
  }
  body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }

  .app-topbar { padding: 0 14px; gap: 10px; }
  .topbar-search { max-width: none; flex: 1; min-width: 0; }
  .topbar-context { display: none; }

  .app-content { padding: 20px 16px 48px; }

  /* Page headers use Bootstrap's d-flex justify-content-between for title + action button;
     wrap them instead of forcing the button to collide with the title on narrow screens. */
  .app-content > .d-flex.justify-content-between { flex-wrap: wrap; row-gap: 10px; }
}

/* =====================================================================
   Page hero (dashboard welcome banner) — gradient surface + subtle dot
   pattern, used sparingly (dashboard only) as the "wow" first impression.
   ===================================================================== */

.page-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--brand-grad);
  padding: 26px 28px 24px;
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.page-hero-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(120deg, black, transparent 72%);
  mask-image: linear-gradient(120deg, black, transparent 72%);
  pointer-events: none;
}
.page-hero-content { position: relative; z-index: 1; }
.page-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.14);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.page-hero-title { font-size: 25px; color: #fff; margin-bottom: 5px; letter-spacing: -0.015em; }
.page-hero-sub { color: rgba(255, 255, 255, 0.84); font-size: 13px; }

@media (max-width: 860px) {
  .page-hero { padding: 20px 18px; }
  .page-hero-title { font-size: 20px; }
}

/* =====================================================================
   Buttons
   ===================================================================== */

.btn { font-family: inherit; font-weight: 600; font-size: 13px; border-radius: var(--radius-sm); padding: 7px 14px; transition: background 120ms, border-color 120ms, box-shadow 120ms, transform 120ms; border: 1px solid transparent; }
.btn:active { transform: translateY(1px); }
.btn-sm { font-size: 12.5px; padding: 5px 11px; }

.btn-brand, .btn-primary {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(10, 90, 99, 0.3), 0 1px 2px rgba(9, 91, 78, 0.25);
}
.btn-brand:hover, .btn-primary:hover { background: var(--brand-grad-hover); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(10, 90, 99, 0.38); transform: translateY(-1px); }
.btn-brand:focus-visible, .btn-primary:focus-visible { box-shadow: 0 0 0 3px var(--focus-ring); }
.btn-brand:disabled, .btn-brand.disabled { background: var(--ink-disabled); border-color: var(--ink-disabled); box-shadow: none; transform: none; }

.btn-hero {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.36);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  backdrop-filter: blur(3px);
  transition: background 120ms, border-color 120ms;
}
.btn-hero:hover { background: rgba(255, 255, 255, 0.27); border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.btn-hero .icon { margin-right: 4px; vertical-align: -3px; }

.btn-outline-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-secondary);
}
.btn-outline-secondary:hover { background: var(--surface-hover); border-color: var(--ink-tertiary); color: var(--ink); }

.btn-outline-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.btn-link { font-weight: 500; padding: 4px 2px; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }

.btn .icon { vertical-align: -3px; margin-right: 4px; }

/* =====================================================================
   Panels / cards
   ===================================================================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.panel-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-body { padding: 16px 18px; }
.panel-body.py-2 { padding-top: 8px; padding-bottom: 8px; }
.panel-body.py-3 { padding-top: 16px; padding-bottom: 16px; }
/* Scoped to the Dashboard only (never a global .panel change) — a tighter rhythm
   so the whole GTM picture fits with noticeably less scrolling. */
.panel-compact .panel-head { padding: 10px 16px; }
.panel-compact .panel-body { padding: 12px 16px; }
.panel-compact .panel-body.py-3 { padding-top: 12px; padding-bottom: 12px; }
.page-hero-compact { padding: 18px 24px; }
.page-hero-compact .page-hero-title { font-size: 21px; }
.panel-body.py-4 { padding-top: 28px; padding-bottom: 28px; }

.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 160ms ease-out, transform 160ms ease-out, border-color 160ms ease-out;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-grad); }
.kpi-card.kpi-info::before { background: linear-gradient(135deg, #4f83e0, var(--info)); }
.kpi-card.kpi-ai::before { background: var(--ai-grad); }
.kpi-card.kpi-success::before { background: linear-gradient(135deg, #34c37a, var(--success)); }
.kpi-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-2px); }
.kpi-card .kpi-label { font-size: 12px; color: var(--ink-secondary); font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.kpi-card .kpi-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: #fff; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(10, 90, 99, 0.3);
}
.kpi-card .kpi-icon .icon { width: 15px; height: 15px; }
.kpi-card.kpi-info .kpi-icon { background: linear-gradient(135deg, #4f83e0, var(--info)); box-shadow: 0 3px 8px rgba(42, 93, 176, 0.32); }
.kpi-card.kpi-ai .kpi-icon { background: var(--ai-grad); box-shadow: 0 3px 8px rgba(91, 95, 199, 0.32); }
.kpi-card.kpi-success .kpi-icon { background: linear-gradient(135deg, #34c37a, var(--success)); box-shadow: 0 3px 8px rgba(27, 131, 84, 0.32); }
.kpi-card .n { font-family: 'Plex Mono', monospace; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.015em; color: var(--ink); line-height: 1; }
.kpi-card .l { font-size: 12px; color: var(--ink-secondary); margin-top: 6px; }

/* =====================================================================
   Metric cards (Performance — Open/Reply/Positive/Meetings/Closed/Bounce)
   ===================================================================== */

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.metric-card {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
}
.metric-card .metric-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-tertiary); margin-bottom: 4px; }
.metric-card .metric-value { font-family: 'Plex Mono', monospace; font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* =====================================================================
   Recommendation cards — left border tinted by severity, reusing the
   existing semantic tokens (no new colours).
   ===================================================================== */

.rec-card { border-left: 3px solid var(--border-strong); padding-left: 13px; }
.rec-card.rec-high { border-left-color: var(--danger); }
.rec-card.rec-medium { border-left-color: var(--warning); }
.rec-card.rec-low { border-left-color: var(--ink-tertiary); }

.winner-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
}

/* =====================================================================
   Status pills / badges
   ===================================================================== */

.status-pill {
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-pill.active { background: var(--success-soft); color: var(--success); }
.status-pill.inactive { background: var(--surface-sunken); color: var(--ink-tertiary); }
.status-pill.warn { background: var(--warning-soft); color: var(--warning); }
.status-pill.danger { background: var(--danger-soft); color: var(--danger); }
.status-pill.info { background: var(--info-soft); color: var(--info); }

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--ai-grad);
  color: #fff;
  box-shadow: 0 2px 6px rgba(91, 95, 199, 0.35);
}
.ai-badge .icon { width: 11px; height: 11px; color: #fff; }

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-secondary);
  margin: 2px;
}

/* =====================================================================
   Email A/B/C variant tabs + inter-step delay divider
   ===================================================================== */

.variant-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.variant-tab {
  font-family: 'Plex Mono', monospace;
  font-size: 12.5px;
  font-weight: 700;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
}
.variant-tab:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.variant-tab.active { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 3px 8px rgba(10, 90, 99, 0.35); }
.variant-tab.stopped { opacity: 0.45; text-decoration: line-through; }
.variant-tab-add {
  font-family: 'Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--ink-tertiary);
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.variant-tab-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.step-delay-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 11.5px;
  color: var(--ink-tertiary);
}
.step-delay-divider::before, .step-delay-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.step-delay-divider input { width: 48px; text-align: center; }

/* =====================================================================
   Tables
   ===================================================================== */

.table { font-size: 13px; margin-bottom: 0; color: var(--ink); }
.table > thead > tr > th {
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  border-bottom: 1px solid var(--border);
  padding: 0 10px 12px;
  white-space: nowrap;
}
.table > tbody > tr > td { padding: 14px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: none; }
.table > tbody > tr.row-hover, .table > tbody > tr[onclick] { transition: background 100ms ease-out; cursor: pointer; }
.table > tbody > tr.row-hover:hover, .table > tbody > tr[onclick]:hover { background: var(--surface-hover); }
.table-sm > tbody > tr > td, .table-sm > thead > tr > th { padding: 9px 10px; }
.table-responsive { border-radius: var(--radius); }

/* =====================================================================
   Team table (Users) — Person / Email / Role / Status / Action
   ===================================================================== */

.table-team .person-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.table-team .person-email-mobile {
  font-size: 11px;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.table-team .email-cell {
  font-size: 12px;
  color: var(--ink-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.table-team select.form-select-sm {
  font-size: 11.5px;
  min-width: 108px;
  width: auto;
}
.table-team .action-cell .btn { min-width: 92px; }

/* Shared row/edge conventions for dense admin tables (Team, Activity Log). */
.table-team tbody tr,
.table-activity tbody tr { transition: background 100ms ease-out; }
.table-team tbody tr:hover,
.table-activity tbody tr:hover { background: var(--surface-hover); }
.table-team .cell-lead,
.table-activity .cell-lead { padding-left: 18px; }
.table-team .cell-trail,
.table-activity .cell-trail { padding-right: 18px; }

@media (max-width: 640px) {
  .table-team .cell-lead,
  .table-activity .cell-lead { padding-left: 12px; }
  .table-team .cell-trail,
  .table-activity .cell-trail { padding-right: 12px; }
  .table-team .action-cell .btn { min-width: 0; padding: 5px 9px; }
}

/* =====================================================================
   Activity log — When / User / Action / Entity / Description / IP
   ===================================================================== */

.table-activity .desc-cell { color: var(--ink-secondary); }

.action-chip {
  display: inline-flex;
  align-items: center;
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-sunken);
  color: var(--ink-secondary);
}
.action-chip.tone-ai { background: var(--ai-accent-soft); color: var(--ai-accent-ink); }
.action-chip.tone-success { background: var(--success-soft); color: var(--success); }
.action-chip.tone-info { background: var(--info-soft); color: var(--info); }
.action-chip.tone-warn { background: var(--warning-soft); color: var(--warning); }
.action-chip.tone-danger { background: var(--danger-soft); color: var(--danger); }

/* =====================================================================
   Forms
   ===================================================================== */

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 5px;
  display: inline-block;
}
.form-control, .form-select {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  transition: border-color 120ms, box-shadow 120ms;
}
.form-control::placeholder { color: var(--ink-tertiary); }
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.form-control-sm, .form-select-sm { font-size: 12.5px; padding: 6px 9px; }
textarea.form-control { line-height: 1.5; }
.form-control:disabled, .form-control[readonly] { background: var(--surface-sunken); color: var(--ink-tertiary); }

input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
/* Bootstrap paints its own checked-state background/border (not native accent-color
   rendering) — override those explicitly so radios/checkboxes match the brand accent. */
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.form-help { font-size: 11.5px; color: var(--ink-tertiary); margin-top: 5px; line-height: 1.5; }

.field-error { font-size: 11.5px; color: var(--danger); margin-top: 5px; font-weight: 500; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 3px rgba(193, 58, 46, 0.16); }

/* =====================================================================
   Workflow stepper (campaign) + tab bar (client)
   ===================================================================== */

.workflow-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 14px 4px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.workflow-stepper .step {
  --step-c: var(--accent);
  --step-soft: var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-tertiary);
  white-space: nowrap;
  position: relative;
  transition: color 120ms;
}
/* One distinct hue per workflow stage (module palette), so progress through the
   campaign reads as vivid rather than a single accent colour repeated ten times. */
.workflow-stepper .step:nth-child(2) { --step-c: var(--m-icp); --step-soft: var(--m-icp-soft); }
.workflow-stepper .step:nth-child(3) { --step-c: var(--m-clay); --step-soft: var(--m-clay-soft); }
.workflow-stepper .step:nth-child(4) { --step-c: var(--m-apollo); --step-soft: var(--m-apollo-soft); }
.workflow-stepper .step:nth-child(5) { --step-c: var(--m-enrich); --step-soft: var(--m-enrich-soft); }
.workflow-stepper .step:nth-child(6) { --step-c: var(--m-planner); --step-soft: var(--m-planner-soft); }
.workflow-stepper .step:nth-child(7) { --step-c: var(--m-emails); --step-soft: var(--m-emails-soft); }
.workflow-stepper .step:nth-child(10) { --step-c: var(--m-perf); --step-soft: var(--m-perf-soft); }
.workflow-stepper .step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 1px;
  background: var(--border-strong);
}
.workflow-stepper a.step:hover { color: var(--ink); }
.workflow-stepper .step .step-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plex Mono', monospace; font-size: 10px; font-weight: 700;
  color: var(--ink-tertiary); flex-shrink: 0;
  background: var(--surface);
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
}
.workflow-stepper .step.done .step-dot { background: var(--step-soft); border-color: var(--step-c); color: var(--step-c); }
.workflow-stepper .step.done .step-dot .icon { width: 11px; height: 11px; color: var(--step-c); }
.workflow-stepper .step.current { color: var(--step-c); font-weight: 700; }
.workflow-stepper .step.current .step-dot { background: var(--step-c); border-color: var(--step-c); color: #fff; box-shadow: 0 0 0 4px var(--step-soft); }
.workflow-stepper .step.disabled { color: var(--ink-disabled); cursor: default; }
.workflow-stepper .step.disabled .step-dot { color: var(--ink-disabled); border-color: var(--border); }

.tab-bar { display: flex; gap: 2px; margin-bottom: 26px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-bar a {
  --tab-c: var(--accent);
  padding: 10px 4px;
  margin-right: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms;
}
/* Client sub-navigation (Overview/Discovery/Website Analysis/Business
   Intelligence/Campaigns) — one hue per tab, mirroring the workflow-stepper
   treatment so this page reads with the same visual energy. */
.tab-bar a:nth-child(2) { --tab-c: var(--m-apollo); }
.tab-bar a:nth-child(3) { --tab-c: var(--m-icp); }
.tab-bar a:nth-child(4) { --tab-c: var(--m-clay); }
.tab-bar a:nth-child(5) { --tab-c: var(--m-perf); }
.tab-bar a:hover { color: var(--ink); }
.tab-bar a.active { color: var(--tab-c); border-color: var(--tab-c); }

.btn-outline-secondary.active {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
}
.btn-outline-secondary.active:hover { background: var(--brand-grad-hover); color: #fff; }

/* Selectable "card" wrapper for radio/checkbox options (Settings) — turns a
   bare Bootstrap form-check list into a considered set of pickable cards. */
.option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color 120ms, background 120ms;
}
.option-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.option-card:has(.form-check-input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* Bootstrap's .form-check floats the input with a negative margin, assuming
   block layout — neutralise that so it behaves as a normal flex item here. */
.option-card.form-check { padding-left: 14px; }
.option-card.form-check .form-check-input { float: none; margin-left: 0; margin-top: 0; }

.progress-track { height: 6px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--brand-grad); transition: width 200ms ease; }

/* =====================================================================
   Empty states
   ===================================================================== */

.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--ink-secondary);
}
.empty-state .icon-lg {
  color: var(--ink-tertiary);
  margin-bottom: 16px;
  width: 44px; height: 44px;
  padding: 10px;
  border-radius: 999px;
  background: var(--surface-sunken);
}
.empty-state h4 { font-size: 14.5px; color: var(--ink); margin-bottom: 5px; }
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto; line-height: 1.6; }
.empty-state .btn { margin-top: 16px; }

/* =====================================================================
   AI loading / skeleton
   ===================================================================== */

.ai-loading {
  text-align: center;
  padding: 44px 24px;
}
.ai-loading .ai-spark { color: var(--accent); margin-bottom: 10px; animation: spark-pulse 1.6s ease-in-out infinite; }
@keyframes spark-pulse { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }
.ai-loading .ai-label { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.ai-loading .ai-sub { font-size: 12.5px; color: var(--ink-secondary); }

.skeleton {
  background: linear-gradient(100deg, var(--surface-sunken) 30%, #e9ebef 50%, var(--surface-sunken) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; background: var(--surface-sunken); } }
.skeleton-line { height: 11px; margin-bottom: 8px; }

.pipeline-step { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.pipeline-step:last-child { border-bottom: none; }
.pipeline-step-icon { flex: 0 0 auto; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.pipeline-step-icon.completed { color: var(--success); }
.pipeline-step-icon.processing, .pipeline-step-icon.pending { color: var(--accent); animation: spark-pulse 1.6s ease-in-out infinite; }
.pipeline-step-icon.failed { color: var(--danger); }
.pipeline-step-icon.upcoming { color: var(--border-strong); }
.pipeline-step-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.pipeline-step.upcoming .pipeline-step-label { color: var(--ink-secondary); font-weight: 400; }
.pipeline-step-error { font-size: 12px; color: var(--danger); margin-top: 3px; }
.pipeline-step-retry { margin-top: 6px; }
.skeleton-line:last-child { margin-bottom: 0; width: 70%; }

.campaign-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 12.5px; }
.campaign-crumb-label { color: var(--ink-tertiary); }
.campaign-crumb-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-secondary); text-decoration: none; font-weight: 500; }
.campaign-crumb-link:hover { color: var(--accent-strong); text-decoration: underline; }
.campaign-crumb-back { color: var(--accent-strong); }
.campaign-crumb-sep { width: 13px; height: 13px; color: var(--ink-disabled); flex-shrink: 0; }
.campaign-crumb-current { color: var(--ink); font-weight: 600; }
.campaign-crumb-toggle { display: inline-flex; align-items: center; gap: 3px; background: none; border: none; padding: 2px 4px; margin: -2px -4px; border-radius: var(--radius-sm); cursor: pointer; }
.campaign-crumb-toggle:hover { background: var(--surface-hover); }
.campaign-crumb-toggle .icon { width: 12px; height: 12px; color: var(--ink-tertiary); }
.campaign-crumb-switcher .dropdown-menu { font-size: 13px; min-width: 220px; max-height: 320px; overflow-y: auto; }
.campaign-crumb-switcher .dropdown-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }

/* =====================================================================
   Alerts / flash
   ===================================================================== */

.alert { border-radius: var(--radius-sm); border: 1px solid transparent; padding: 10px 14px; font-size: 13px; display: flex; align-items: flex-start; gap: 9px; }
.alert .icon { flex-shrink: 0; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(193, 58, 46, 0.18); }
.alert-brand { background: var(--accent-soft); color: var(--accent-ink); border-color: rgba(14, 124, 107, 0.18); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(42, 93, 176, 0.18); }

/* =====================================================================
   AI reasoning panel
   ===================================================================== */

.reasoning-panel { background: linear-gradient(165deg, var(--accent-soft) 0%, #eaf7f3 55%, var(--surface) 100%); border: 1px solid rgba(14, 124, 107, 0.18); border-radius: var(--radius); }
.reasoning-panel .panel-head { background: transparent; border-bottom: 1px solid rgba(14, 124, 107, 0.18); color: var(--accent-ink); }
.reasoning-panel .panel-body { color: var(--accent-ink); font-size: 12.5px; line-height: 1.65; }

.reasoning-panel .why-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(14, 124, 107, 0.18); font-size: 12.5px; line-height: 1.6; }
.reasoning-panel .why-block strong { color: var(--accent-ink); }

/* =====================================================================
   Concept explainer ("What is this?" educational disclosure)
   ===================================================================== */

.concept-explainer {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  padding: 2px 14px;
}
.concept-explainer summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 9px 0;
  list-style: none;
}
.concept-explainer summary::-webkit-details-marker { display: none; }
.concept-explainer summary::before { content: '?'; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-right: 7px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; font-weight: 700; }
.concept-explainer[open] summary { color: var(--ink); border-bottom: 1px solid var(--border); }
.concept-explainer p { padding: 10px 0 12px 22px; font-size: 12.5px; line-height: 1.6; color: var(--ink-secondary); margin: 0; }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: linear-gradient(120deg, var(--accent-soft) 0%, var(--surface) 45%);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.callout strong { color: var(--ink); }

/* =====================================================================
   GTM Intelligence Dashboard — funnel, trend chart, campaign comparison,
   AI insights, needs-attention. All built on real aggregated data (see
   DashboardRepository/OptimisationHistoryRepository/JobRepository); no new
   colours — reuses the existing brand/module/semantic token set.
   ===================================================================== */

.funnel { display: flex; flex-direction: column; gap: 9px; }
.funnel-conversion { font-size: 10.5px; color: var(--ink-tertiary); margin-bottom: 4px; padding-left: 92px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-label { width: 80px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-secondary); }
.funnel-bar-track { flex: 1; height: 18px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 999px; background: var(--brand-grad); transition: width 300ms ease; }
.funnel-value { width: 64px; flex-shrink: 0; text-align: right; font-family: 'Plex Mono', monospace; font-size: 13px; font-weight: 600; color: var(--ink); }

@media (max-width: 640px) {
  .funnel-label { width: 62px; font-size: 11.5px; }
  .funnel-value { width: 50px; font-size: 12px; }
  .funnel-conversion { padding-left: 74px; }
}

.trend-legend-row { display: flex; gap: 16px; margin-bottom: 10px; }
.trend-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-secondary); }
.trend-swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.trend-swatch-open { background: var(--info); }
.trend-swatch-reply { background: var(--m-perf); }
.trend-chart { width: 100%; height: auto; display: block; }
.trend-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.trend-line-open { stroke: var(--info); }
.trend-line-reply { stroke: var(--m-perf); }
.trend-dot { stroke: var(--surface); stroke-width: 1.5; }
.trend-dot-open { fill: var(--info); }
.trend-dot-reply { fill: var(--m-perf); }
.trend-dot:hover { r: 5; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease-out;
}
.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: var(--surface-hover); }
.rank-row.is-top { background: var(--success-soft); }
.rank-number {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plex Mono', monospace; font-size: 11px; font-weight: 700;
  background: var(--surface-sunken); color: var(--ink-tertiary);
}
.rank-row.is-top .rank-number { background: var(--success); color: #fff; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.rank-bar-track { height: 5px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.rank-bar { height: 100%; border-radius: 999px; background: var(--brand-grad); }
.rank-stats { display: flex; gap: 16px; flex-shrink: 0; }
.rank-stats span { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.rank-stats strong { font-family: 'Plex Mono', monospace; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank-stats small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-tertiary); margin-top: 1px; }

@media (max-width: 640px) {
  .rank-row { padding: 10px 12px; gap: 8px; }
  .rank-stats { gap: 10px; }
  .rank-stats span { min-width: 34px; }
}

.insight-card {
  border-left: 3px solid var(--border-strong);
  background: var(--ai-accent-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 13px;
  height: 100%;
}
.insight-card.rec-high { border-left-color: var(--danger); }
.insight-card.rec-medium { border-left-color: var(--warning); }
.insight-card.rec-low { border-left-color: var(--ink-tertiary); }
.insight-why { font-size: 11.5px; color: var(--ai-accent-ink); line-height: 1.5; }

.attention-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.attention-item:last-child { border-bottom: none; }
.attention-item .icon { flex-shrink: 0; margin-top: 2px; }
.attention-danger .icon, .attention-high .icon { color: var(--danger); }
.attention-medium .icon { color: var(--warning); }
.attention-low .icon { color: var(--ink-tertiary); }
.attention-body { min-width: 0; }
.attention-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.attention-title a { color: var(--accent-strong); }
.attention-meta { font-size: 11.5px; color: var(--ink-tertiary); margin-top: 2px; }
.attention-meta a { color: var(--ink-tertiary); text-decoration: underline; }
