:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --text: #0f1f33;
  --muted: #5a6980;
  --primary: #2563eb;
  --accent: #7c3aed;
  --ok: #0e9f6e;
  --bad: #d03853;
  --line: #dbe5f2;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 0 0, #eef4ff, var(--bg));
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  padding: 0.75rem;
  z-index: 50;
}

.skip-link:focus { left: 1rem; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.side-rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0e2444, #162f56);
  color: #ecf2ff;
  padding: 1.2rem;
  display: grid;
  align-content: start;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block h1 {
  margin: 0.3rem 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #9ec1ff;
  font-size: 0.75rem;
}

.subtle {
  margin: 0;
  color: #c7d8f6;
  font-size: 0.9rem;
}

.goal-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.goal-card span { color: #c2d6ff; font-size: 0.8rem; }
.goal-card strong { font-size: 1rem; line-height: 1.3; }

.control-stack {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: grid;
  gap: 0.7rem;
}

.control-stack h2 {
  margin: 0;
  font-size: 0.95rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: #d4e3ff;
  font-weight: 600;
}

select {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(10, 24, 47, 0.6);
  color: #fff;
  padding: 0.6rem;
}

.workspace {
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

.hero-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 8px 28px rgba(15, 31, 51, 0.06);
}

.hero-panel h2,
.panel h2 {
  margin: 0.3rem 0 0.5rem;
}

.hero-panel > p,
.panel > p { color: var(--muted); }

.hero-chip-grid,
.engagement-kpi-grid {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
  border: 1px solid #d9e4f3;
  border-radius: 12px;
  padding: 0.85rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.kpi-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi-value {
  margin-top: 0.35rem;
  font-size: 1.45rem;
  font-weight: 700;
}

.kpi-delta {
  margin-top: 0.3rem;
  font-size: 0.84rem;
  color: #49607f;
}

.up { color: var(--ok); }
.down { color: var(--bad); }

.grid-two {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.journey-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.journey-item {
  border: 1px solid #dce6f4;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfdff;
}

.journey-item p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.journey-item strong { display: block; margin-top: 0.3rem; font-size: 1.1rem; }

.journey-meter { margin-top: 0.55rem; height: 8px; border-radius: 20px; background: #e8effb; overflow: hidden; }
.journey-meter span { display:block; height:100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.conversion-summary { display:grid; gap:0.7rem; margin-top:0.7rem; }

.conversion-item {
  border: 1px solid #dce6f4;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfdff;
}

.conversion-item h3 { margin: 0 0 0.4rem; font-size: 0.94rem; }
.conversion-item p { margin: 0.2rem 0; color: var(--muted); font-size: 0.86rem; }

.detail-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.detail-grid article {
  border: 1px solid #dce6f4;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfdff;
}

.action-list {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.trend-insight {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #d6e2f4;
  color: #2f4a70;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ana-chatbot {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
}

.ana-toggle {
  border: none;
  border-radius: 999px;
  background: linear-gradient(120deg, #2563eb, #7c3aed);
  color: #fff;
  padding: 0.72rem 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3);
}

.ana-panel {
  margin-top: 0.65rem;
  width: min(360px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(10, 24, 47, 0.2);
  overflow: hidden;
}

.ana-header { padding: 0.85rem 1rem; border-bottom: 1px solid #e4ebf7; background: #f7faff; }
.ana-header h2 { margin: 0; font-size: 1rem; }
.ana-header p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.84rem; }

.ana-messages { max-height: 320px; overflow: auto; padding: 0.9rem; display: grid; gap: 0.55rem; }
.ana-bubble { max-width: 92%; border-radius: 12px; padding: 0.58rem 0.7rem; line-height: 1.35; font-size: 0.9rem; }
.ana-bubble.user { justify-self: end; background: #2563eb; color: #fff; }
.ana-bubble.bot { justify-self: start; background: #eff5ff; color: #1b3457; }
.ana-bubble.thinking { justify-self: start; background: #f2f6fd; color: #355171; font-style: italic; }

.ana-input-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; border-top: 1px solid #e4ebf7; padding: 0.8rem; }
.ana-input-row input { border: 1px solid #c9d8ef; border-radius: 8px; padding: 0.55rem; }
.ana-input-row button { border: none; border-radius: 8px; background: #2563eb; color: #fff; padding: 0.5rem 0.8rem; font-weight: 600; cursor: pointer; }

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }
}
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }
}