/* ==========================================================================
   Customer Intelligence Platform — design tokens + components
   ========================================================================== */

:root {
  /* --- surfaces --- */
  --bg: #0a0d14;
  --bg-alt: #0d1119;
  --surface: #121826;
  --surface-2: #161d2c;
  --surface-hover: #1a2233;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* --- text --- */
  --text-1: #eef1f7;
  --text-2: #aab3c5;
  --text-3: #6b7488;

  /* --- brand / accents --- */
  --violet: #8b5cf6;
  --violet-soft: rgba(139, 92, 246, 0.14);
  --indigo: #6366f1;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);

  /* --- type --- */
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* --- spacing scale --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* --- motion --- */
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-in-out: cubic-bezier(.65,0,.35,1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 0 1px var(--border), 0 20px 60px -20px rgba(0,0,0,.6);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100dvh; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--violet); color: #fff; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--violet); color: #fff; padding: 10px 16px;
  border-radius: 0 0 8px 0; z-index: 999;
}
.skip-link:focus { left: 0; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code, pre { font-family: var(--font-mono); }
button { font: inherit; }

h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}

/* ============ reveal-on-scroll ============ */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--reveal-delay, 0) * 70ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal-delay="1"] { --reveal-delay: 1; }
[data-reveal-delay="2"] { --reveal-delay: 2; }
[data-reveal-delay="3"] { --reveal-delay: 3; }
[data-reveal-delay="4"] { --reveal-delay: 4; }

/* ============ Navbar ============ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10, 13, 20, 0.6);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base);
}
.navbar.is-scrolled { border-bottom-color: var(--border); background: rgba(10, 13, 20, 0.86); }
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 var(--space-5);
  height: 68px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  color: #0a0d14; font-size: 13px; font-weight: 700;
}
.brand-text em { font-style: normal; color: var(--text-2); font-weight: 500; }

.nav-links { display: flex; align-items: center; gap: var(--space-5); }
.nav-links a:not(.nav-cta) {
  font-size: 14px; color: var(--text-2); position: relative; padding: 6px 0;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1.5px;
  background: var(--violet); transition: right var(--dur-base) var(--ease-out);
}
.nav-links a:not(.nav-cta):hover { color: var(--text-1); }
.nav-links a:not(.nav-cta):hover::after { right: 0; }

.nav-cta {
  font-size: 13.5px; font-weight: 600; padding: 8px 16px; border-radius: 100px;
  background: var(--text-1); color: #0a0d14;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.nav-cta:hover { transform: translateY(-1px); opacity: .9; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; background: none; border: none; cursor: pointer;
}
.nav-toggle span { width: 20px; height: 1.5px; background: var(--text-1); margin: 0 auto; transition: transform var(--dur-fast), opacity var(--dur-fast); }

.nav-progress {
  position: absolute; bottom: -1px; left: 0; height: 2px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  width: 0%;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 100px; font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast);
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--text-1); color: #0a0d14; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px rgba(255,255,255,.25); }
.btn-primary svg { transition: transform var(--dur-fast) var(--ease-out); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-ghost { background: transparent; color: var(--text-1); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-outline { background: var(--surface); color: var(--text-1); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* ============ Hero ============ */
.hero {
  position: relative; min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: calc(68px + var(--space-8)) var(--space-5) var(--space-8);
  overflow: hidden;
}
.hero-blobs { position: absolute; inset: 0; z-index: -1; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; will-change: transform; }
.blob-a { width: 480px; height: 480px; top: -120px; left: -100px; background: var(--violet); animation: drift-a 22s ease-in-out infinite; }
.blob-b { width: 420px; height: 420px; bottom: -140px; right: -80px; background: var(--cyan); animation: drift-b 26s ease-in-out infinite; }
.blob-c { width: 320px; height: 320px; top: 40%; left: 60%; background: var(--rose); opacity: .18; animation: drift-a 30s ease-in-out infinite reverse; }
@keyframes drift-a { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(60px,40px) scale(1.1); } }
@keyframes drift-b { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-50px,-30px) scale(1.08); } }

.hero-inner { max-width: 880px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 100px;
  padding: 7px 14px; margin: 0 0 var(--space-5);
}
.dot-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); position: relative; }
.dot-pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--emerald);
  animation: pulse-ring 1.8s ease-out infinite;
}
@keyframes pulse-ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

.hero-title {
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  line-height: 1.05;
  margin-bottom: var(--space-5);
}
.grad-text {
  background: linear-gradient(100deg, var(--violet) 0%, var(--indigo) 45%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--text-2); max-width: 700px;
  margin: 0 auto var(--space-6);
}
.hero-sub strong { color: var(--text-1); font-weight: 600; }

.hero-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.stat-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 18px; min-width: 118px;
  transition: border-color var(--dur-base), transform var(--dur-base);
}
.stat-chip:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-num {
  display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }

.scroll-cue {
  position: absolute; bottom: var(--space-6); left: 50%; transform: translateX(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: 8px;
  animation: bob 2.2s ease-in-out infinite;
}
.scroll-cue-dot { animation: cue-dot 2.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,8px); } }
@keyframes cue-dot { 0%,100% { opacity: 1; transform: translateY(0); } 50% { opacity: .3; transform: translateY(10px); } }

/* ============ Sections (generic) ============ */
.section { position: relative; padding: var(--space-9) 0; }
.section-alt { background: linear-gradient(180deg, transparent, var(--bg-alt) 8%, var(--bg-alt) 92%, transparent); }

.section-label {
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--violet); margin: 0 0 var(--space-3);
}
.label-violet { color: var(--violet); }
.label-rose { color: var(--rose); }
.label-emerald { color: var(--emerald); }

.section-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: var(--space-4); }
.section-sub { font-size: 1.05rem; color: var(--text-2); max-width: 680px; margin: 0 0 var(--space-7); }
.section-sub code { background: var(--surface); border: 1px solid var(--border); padding: 2px 7px; border-radius: 5px; font-size: .88em; color: var(--cyan); }

.grad-violet { background: linear-gradient(100deg, var(--violet), #c4b5fd); -webkit-background-clip: text; background-clip: text; }
.grad-rose { background: linear-gradient(100deg, var(--rose), #fca5a5); -webkit-background-clip: text; background-clip: text; }
.grad-emerald { background: linear-gradient(100deg, var(--emerald), #6ee7b7); -webkit-background-clip: text; background-clip: text; }

/* ============ Problem cards ============ */
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.problem-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-6); transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base), background var(--dur-base);
}
.problem-card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--surface-2); }
.problem-icon { width: 52px; height: 52px; border-radius: var(--radius-md); display: grid; place-items: center; margin-bottom: var(--space-4); }
.icon-violet { background: var(--violet-soft); color: var(--violet); }
.icon-rose { background: var(--rose-soft); color: var(--rose); }
.icon-emerald { background: var(--emerald-soft); color: var(--emerald); }
.problem-tag { display: block; font-size: 12px; color: var(--text-3); margin-bottom: var(--space-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.problem-card h3 { font-size: 1.25rem; margin-bottom: var(--space-3); }
.problem-card p { color: var(--text-2); font-size: .95rem; margin: 0 0 var(--space-4); }
.problem-method { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--text-1); background: var(--surface-2); border: 1px solid var(--border); padding: 5px 11px; border-radius: 100px; }

/* ============ Pipeline flow ============ */
.flow { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); margin-bottom: var(--space-6); overflow-x: auto; }
.flow-row { display: flex; align-items: stretch; gap: var(--space-3); min-width: 900px; }
.flow-node {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4); position: relative; min-width: 140px;
  transition: border-color var(--dur-base), transform var(--dur-base);
}
.flow-node:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.flow-node-index { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.flow-node h4 { font-size: .95rem; margin: 6px 0 4px; }
.flow-node p { font-size: 12.5px; color: var(--text-2); margin: 0; line-height: 1.45; }
.flow-meta { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--cyan); font-family: var(--font-mono); }
.node-data { border-top: 2px solid var(--text-3); }
.node-feature { border-top: 2px solid var(--indigo); }
.node-model { border-top: 2px solid var(--violet); }
.node-output { border-top: 2px solid var(--emerald); }
.flow-split { flex: 1.4; display: flex; flex-direction: column; gap: var(--space-2); min-width: 180px; }
.flow-arrow { align-self: center; width: 28px; height: 2px; background: var(--border-strong); position: relative; flex-shrink: 0; }
.flow-arrow::after {
  content: ""; position: absolute; right: -1px; top: 50%; transform: translateY(-50%);
  border: 4px solid transparent; border-left-color: var(--border-strong);
}

.callout {
  display: flex; gap: var(--space-4); background: var(--amber-soft); border: 1px solid rgba(251,191,36,.25);
  border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-6);
}
.callout-icon { color: var(--amber); flex-shrink: 0; }
.callout-body h4 { font-size: 1.05rem; margin-bottom: var(--space-2); }
.callout-body p { color: var(--text-2); font-size: .95rem; margin: 0 0 var(--space-3); }
.callout-code {
  background: #0a0d14; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4); font-size: 12.5px; color: var(--text-2); overflow-x: auto; margin: 0;
}

.stack-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.stack-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 6px 14px; font-size: 13px; color: var(--text-2); }

/* ============ Model sections ============ */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: center; margin-bottom: var(--space-7); }
.model-grid.reverse .model-visual { order: -1; }
@media (min-width: 861px) { .model-grid.reverse .model-visual { order: 0; } }

.formula-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5); margin: var(--space-4) 0; font-size: .92rem; color: var(--text-2);
}
.formula-card b { color: var(--text-1); }
.formula-line + .formula-line { margin-top: 6px; }
.formula-math { font-family: var(--font-mono); font-size: 1rem; color: var(--cyan); text-align: center; padding: var(--space-4); }

.note { font-size: .9rem; color: var(--text-3); border-left: 2px solid var(--border-strong); padding-left: var(--space-4); margin: var(--space-4) 0; }

.chart-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-5) 0 0; }
.chart-tab {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  padding: 8px 14px; border-radius: 100px; font-size: 13px; cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.chart-tab:hover { color: var(--text-1); border-color: var(--border-strong); }
.chart-tab.is-active { background: var(--text-1); color: #0a0d14; border-color: var(--text-1); font-weight: 600; }

.chart-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); box-shadow: var(--shadow-glow);
}
.chart-panel img { border-radius: var(--radius-sm); width: 100%; height: auto; }

.metric-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin: var(--space-5) 0; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); }
.metric-num { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.metric-label { font-size: 12px; color: var(--text-3); }

/* live data blocks */
.segment-live { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); }
.live-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-5); }
.live-head h3 { font-size: 1.1rem; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }

.segment-cards, .risk-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.seg-card {
  border-radius: var(--radius-md); padding: var(--space-4); border: 1px solid var(--border);
  background: var(--surface-2); position: relative; overflow: hidden;
}
.seg-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--violet)); }
.seg-card .seg-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.seg-card .seg-count { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.seg-card .seg-pct { font-size: 12px; color: var(--text-3); }

.chart-box { position: relative; }

/* ============ Priority ============ */
.priority-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--space-6); align-items: start; }
.priority-tiers { display: flex; flex-direction: column; gap: var(--space-3); }
.priority-tiers.tiers-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .priority-tiers.tiers-grid { grid-template-columns: 1fr; } }
.tier-channel { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.tier-channel svg { vertical-align: -2px; margin-right: 3px; }
.tier-clickable { cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast), background var(--dur-fast); }
.tier-clickable:hover { border-color: var(--border-strong); background: var(--surface-hover); transform: translateY(-1px); }
.tier-clickable:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.tier-clickable.is-active-filter { border-color: var(--accent, var(--violet)); background: var(--surface-2); box-shadow: 0 0 0 1px var(--accent, var(--violet)) inset; }
.tier {
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4);
  background: var(--surface); display: flex; align-items: center; gap: var(--space-4);
  border-left: 3px solid var(--accent, var(--violet));
}
.tier-rank { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); width: 22px; flex-shrink: 0; }
.tier-body { flex: 1; }
.tier-title { font-size: .92rem; font-weight: 600; margin-bottom: 3px; }
.tier-desc { font-size: 12.5px; color: var(--text-3); }
.tier-count { text-align: right; flex-shrink: 0; }
.tier-count b { display: block; font-family: var(--font-display); font-size: 1.3rem; }
.tier-count span { font-size: 11px; color: var(--text-3); }

/* ============ Upload your data ============ */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin-bottom: var(--space-5); }
.upload-drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5); cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base);
}
.upload-drop:hover, .upload-drop:focus-visible { border-color: var(--violet); background: var(--surface-2); outline: none; }
.upload-drop.is-dragover { border-color: var(--cyan); background: var(--cyan-soft); }
.upload-drop.has-file { border-style: solid; border-color: var(--emerald); }
.upload-icon { color: var(--text-3); margin-bottom: 4px; }
.upload-drop h4 { font-size: 1rem; margin: 0; }
.upload-drop p { font-size: 12.5px; color: var(--text-3); margin: 0; }
.upload-drop p code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; color: var(--cyan); }
.upload-filename { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.upload-drop.has-file .upload-filename { color: var(--emerald); }
.upload-sample { font-size: 12px; color: var(--violet); margin-top: 6px; text-decoration: underline; text-underline-offset: 2px; }

.upload-actions { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.upload-status { font-size: 13.5px; color: var(--text-3); }
.upload-status.is-error { color: var(--rose); }
.upload-status.is-success { color: var(--emerald); }

.upload-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.upload-summary .stat-chip { min-width: 0; }

/* ============ Explorer / table ============ */
.explorer-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.field {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px; height: 44px;
}
.field-search { flex: 1; min-width: 200px; color: var(--text-3); }
.field input { background: none; border: none; outline: none; color: var(--text-1); font-size: 14px; width: 100%; height: 100%; }
.field-select {
  height: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 13.5px; padding: 0 12px; cursor: pointer;
}
.field-select:focus, .field input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }

.explorer-count { font-size: 13px; color: var(--text-3); margin: 0 0 var(--space-3); }
.explorer-count span { color: var(--text-1); font-weight: 600; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; min-width: 880px; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 14px 16px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.data-table tbody tr { transition: background var(--dur-fast); }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table td:first-child { color: var(--text-1); font-family: var(--font-mono); }
.data-table td:nth-child(4) { font-variant-numeric: tabular-nums; color: var(--text-1); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px; font-size: 12px; font-weight: 600; }
.badge-vip { background: var(--violet-soft); color: #c4b5fd; }
.badge-loyal { background: var(--cyan-soft); color: #67e8f9; }
.badge-occasional { background: var(--amber-soft); color: #fcd34d; }
.badge-atrisk { background: var(--rose-soft); color: #fda4af; }
.risk-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.risk-dot { width: 7px; height: 7px; border-radius: 50%; }
.risk-low .risk-dot { background: var(--emerald); }
.risk-mid .risk-dot { background: var(--amber); }
.risk-high .risk-dot { background: var(--rose); }

.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-5); flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 13.5px;
  transition: all var(--dur-fast) var(--ease-out);
}
.page-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-1); }
.page-btn.is-active { background: var(--text-1); color: #0a0d14; border-color: var(--text-1); font-weight: 600; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }


/* ============ Footer ============ */
.footer { border-top: 1px solid var(--border); padding: var(--space-8) 0 var(--space-5); background: var(--bg-alt); }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--space-7); margin-bottom: var(--space-7); }
.footer-brand p { color: var(--text-3); font-size: 13.5px; margin-top: var(--space-3); max-width: 320px; }
.footer-links h5 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: var(--space-3); }
.footer-links a, .footer-links span { display: block; color: var(--text-2); font-size: 13.5px; margin-bottom: 10px; }
.footer-links a:hover { color: var(--text-1); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: var(--space-5); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; gap: var(--space-3); }
.back-to-top {
  width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: all var(--dur-fast) var(--ease-out);
}
.back-to-top:hover { color: var(--text-1); border-color: var(--border-strong); transform: translateY(-2px); }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed; top: 68px; left: 0; right: 0; bottom: 0;
    background: var(--bg); border-top: 1px solid var(--border);
    flex-direction: column; align-items: stretch; padding: var(--space-5);
    transform: translateX(100%); transition: transform var(--dur-base) var(--ease-out);
    overflow-y: auto;
  }
  .nav-links.is-open { transform: translateX(0); }
  .nav-links a { padding: 14px 4px; border-bottom: 1px solid var(--border); font-size: 16px; }
  .nav-cta { text-align: center; margin-top: var(--space-3); }

  .problem-grid { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .model-grid.reverse .model-visual { order: 0; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .segment-cards, .risk-cards { grid-template-columns: 1fr 1fr; }
  .priority-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { padding: 0 var(--space-4); }
  .hero { padding-top: calc(68px + var(--space-6)); }
  .hero-stats { gap: var(--space-2); }
  .stat-chip { min-width: 100px; padding: 10px 14px; }
  .segment-cards, .risk-cards { grid-template-columns: 1fr; }
  .flow-split { flex-direction: row; }
  .explorer-toolbar { flex-direction: column; align-items: stretch; }
  .field-select { width: 100%; }
  .metric-row { grid-template-columns: 1fr; }
  .section { padding: var(--space-7) 0; }
}

/* touch affordance */
@media (hover: none) {
  .problem-card:hover, .flow-node:hover, .stat-chip:hover { transform: none; }
}
