:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.1);
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --purple: #4f46e5;
  --green: #18a86b;
  --yellow: #c58a13;
  --red: #d13d54;
  --dark: #172554;
  --dark-2: #1e3a8a;
  --gradient: linear-gradient(135deg, #2563eb, #4f46e5);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Inter", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-heading); line-height: 1.12; letter-spacing: 0; }
p { margin: 0; color: var(--muted); line-height: 1.65; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.demo-shell { min-height: 100vh; }
.demo-nav {
  width: min(1120px, 92%);
  margin: 20px auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.demo-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 900; }
.demo-brand img { width: 132px; height: 34px; object-fit: contain; object-position: left center; }
.demo-links { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-links a, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.pill.sim { color: #1e3a8a; border-color: #bfdbfe; background: #eff6ff; }

.container, .page { width: min(1120px, 92%); margin: 0 auto; }
.hero { padding: 28px 0 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 36px;
  align-items: center;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(115deg, #ffffff 0%, #f8fafc 58%, #eff6ff 100%);
  box-shadow: var(--shadow);
}
.eyebrow { margin-bottom: 16px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.hero h1 { max-width: 780px; font-size: clamp(38px, 5vw, 64px); font-weight: 700; }
.hero p { max-width: 700px; margin-top: 22px; font-size: 18px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
  background: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button.secondary { color: var(--ink); background: #f8fafc; border: 1px solid var(--line); }
.button.danger { background: #b91c1c; color: #fff; }
.button.small { min-height: 34px; padding: 8px 12px; font-size: 13px; }

.section { padding: 22px 0; }
.section.dark { margin-top: 20px; padding: 30px 0; background: transparent; color: var(--ink); }
.section.dark h2, .section.dark h3 { color: var(--ink); }
.section.dark p { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-head h2 { font-size: clamp(26px, 4vw, 40px); }

.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.dashboard { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.pad { padding: 18px; }
.card.dark-card { background: #fff; border-color: var(--line); color: var(--ink); }
.card h3 { margin-bottom: 10px; font-size: 20px; }
.card p, .card li { color: var(--muted); font-size: 14px; line-height: 1.55; }
.dark-card p, .dark-card li { color: var(--muted); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.card-head h3 { margin: 0; font-size: 17px; }
.card-body { padding: 16px; }

.launcher-card { display: flex; flex-direction: column; min-height: 230px; }
.launcher-card .button { margin-top: auto; align-self: flex-start; }

.phone {
  border: 1px solid #bfdbfe;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(30, 64, 175, 0.08);
}
.phone-top, .market-row, .health-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.phone-top { color: #334155; font-size: 13px; font-weight: 800; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(24,168,107,0.14); }
.phone h2 { margin: 22px 0 12px; color: var(--ink); font-size: 30px; }
.market-card { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.market-card p { color: #475569; }
.market-row { margin-top: 10px; color: #475569; }
.market-row strong { color: var(--ink); font-size: 24px; }
.shake-zone {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 140px;
  margin-top: 18px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: #dbeafe;
  color: #0f172a;
  text-align: center;
}
.shake-zone strong { display: block; color: #0f172a; font: 700 25px/1.08 var(--font-heading); }
.shake-zone span { display: block; margin-top: 8px; color: #475569; font-size: 13px; }
.flow-result {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 18px;
  border: 2px solid #93c5fd;
  border-radius: 14px;
  background: #dbeafe;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(30, 64, 175, 0.12);
}
.flow-result strong {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.12;
}
.flow-result span {
  color: #334155;
  font-size: 15px;
  line-height: 1.45;
}
.flow-result-button {
  justify-self: start;
  margin-top: 4px;
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.72);
}
.flow-result.is-active {
  border-color: #2563eb;
  background: #dbeafe;
}
.flow-result.is-success {
  border-color: #16a34a;
  background: #dcfce7;
}
.flow-result.is-warning {
  border-color: #f59e0b;
  background: #fef3c7;
}
.flow-result.is-error {
  border-color: #e11d48;
  background: #ffe4e6;
}
.flow-result.is-success strong { color: #166534; }
.flow-result.is-warning strong { color: #92400e; }
.flow-result.is-error strong { color: #9f1239; }
.state-pill { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; }
.health-list { display: grid; gap: 10px; margin-top: 16px; }
.health-row { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8fafc; color: #475569; font-size: 13px; }
.health-row strong { color: #166534; }

.timeline { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.timeline li { padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.timeline strong { display: block; color: var(--ink); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 14, 0.65);
}
.modal.active { display: grid; }
.modal-card { width: min(430px, 100%); padding: 26px; text-align: center; }
.face-id {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  margin: 4px auto 20px;
  border: 2px solid var(--blue);
  border-radius: 28px;
  color: var(--blue);
  font: 900 42px/1 var(--font-heading);
}

.agent-panel { display: grid; gap: 12px; }
.chat-log { min-height: 170px; max-height: 280px; overflow: auto; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8fafc; }
.chat-msg { padding: 10px 12px; border-radius: var(--radius-sm); background: #fff; color: var(--ink); font-size: 14px; line-height: 1.5; }
.chat-msg.user { background: #1d4ed8; color: #fff; }
.agent-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.agent-form textarea { min-height: 44px; max-height: 120px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-soft); }
.kpi span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.kpi strong { display: block; margin-top: 6px; font-size: 23px; font-weight: 800; line-height: 1.1; }

.state-overview {
  display: grid;
  gap: 12px;
}

.state-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: #eff6ff;
}

.state-summary strong { color: #1e3a8a; }

.state-rail {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
  counter-reset: step;
}

.state-node {
  position: relative;
  flex: 0 0 78px;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.state-node.active { border-color: #1d4ed8; background: #eff6ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #1d4ed8; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
.table th { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
pre { max-height: 420px; overflow: auto; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #0f172a; color: #dce8ff; font-size: 12px; line-height: 1.5; }

.bar { height: 10px; overflow: hidden; border-radius: 999px; background: #e7ebf4; }
.bar span { display: block; height: 100%; border-radius: inherit; background: #1d4ed8; }
.feed { display: grid; gap: 10px; }
.feed-item { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.feed-item strong { display: block; margin-bottom: 4px; }

.dashboard-page {
  width: min(1120px, 92%);
  margin: 20px auto 48px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(115deg, #ffffff 0%, #f8fafc 60%);
  box-shadow: var(--shadow);
}

.dashboard-hero h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 44px);
}

.dashboard-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
  min-width: min(360px, 100%);
}

.dashboard-result {
  width: 100%;
  max-width: 360px;
  margin-top: 0;
}

.metric-bars {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: grid;
  gap: 7px;
}

.metric-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.metric-row-head strong {
  color: var(--ink);
}

@media (max-width: 1050px) {
  .hero-grid, .grid.cards, .grid.two { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid.dashboard { grid-template-columns: 1fr; }
  .grid.dashboard > * { grid-column: auto !important; }
  .dashboard-hero { align-items: stretch; flex-direction: column; }
  .dashboard-actions { justify-items: stretch; min-width: 0; }
  .dashboard-result { max-width: none; }
}
@media (max-width: 680px) {
  .demo-nav { align-items: flex-start; flex-direction: column; }
  .demo-links { width: 100%; }
  .demo-links a, .pill { font-size: 12px; }
  .hero { padding-top: 46px; }
  .hero h1 { font-size: 42px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .agent-form { grid-template-columns: 1fr; }
}
