:root {
  --bg: #0b0f1a;
  --bg-2: #111827;
  --card: #151d2e;
  --card-2: #1a2338;
  --border: #243147;
  --text: #e6edf7;
  --muted: #93a4bd;
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --kafka: #e8532e;
  --spark: #e6a023;
  --radius: 14px;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ── Hero ─────────────────────────── */
.hero {
  position: relative;
  padding: 64px 0 48px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 300px at 20% 0%, rgba(79,140,255,.16), transparent 60%),
    radial-gradient(700px 300px at 80% 10%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(500px 200px at 50% 100%, rgba(232,83,46,.08), transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; }
.badge-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); background: var(--card);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.18); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

h1 {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.08;
  margin-bottom: 14px;
}
.accent { color: var(--accent-2); }
.subtitle { color: var(--muted); font-size: 16px; max-width: 720px; margin-bottom: 32px; }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-num { font-size: 30px; font-weight: 800; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat-label code { font-size: 11.5px; }

/* ── Cards ────────────────────────── */
main { padding: 40px 0 60px; display: flex; flex-direction: column; gap: 26px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card h2 { font-size: 21px; font-weight: 700; margin-bottom: 16px; letter-spacing: -.01em; }
.card h3 { font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* ── Pipeline diagram ─────────────── */
.pipeline {
  display: flex; align-items: stretch; gap: 10px;
  flex-wrap: wrap; margin: 18px 0 28px;
}
.node {
  flex: 1 1 130px;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 12px; text-align: center;
  min-width: 140px;
}
.node.kafka-node { border-color: rgba(232,83,46,.55); background: rgba(232,83,46,.07); }
.node-icon { font-size: 26px; margin-bottom: 6px; }
.node-title { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.node-title code { font-size: 11px; color: var(--accent-2); }
.node-sub { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.node-sub .mono, .node-sub code { font-size: 10.5px; }
.arrow { align-self: center; color: var(--muted); font-size: 20px; flex: 0 0 auto; }

/* ── Tables ───────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.data-table thead th {
  background: var(--card-2); text-align: left;
  padding: 11px 14px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(79,140,255,.05); }
.data-table code { font-size: 12px; }

/* alert level chips */
.lvl { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--mono); }
.lvl-0 { background: rgba(52,211,153,.14); color: var(--green); border: 1px solid rgba(52,211,153,.35); }
.lvl-1 { background: rgba(251,191,36,.14); color: var(--amber); border: 1px solid rgba(251,191,36,.35); }
.lvl-2 { background: rgba(248,113,113,.14); color: var(--red); border: 1px solid rgba(248,113,113,.4); }

/* ── Exercise map ─────────────────── */
.exercise-map table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.exercise-map th {
  text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); background: var(--card-2);
}
.exercise-map td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.exercise-map code { background: rgba(79,140,255,.12); padding: 2px 6px; border-radius: 6px; font-size: 12px; color: var(--accent-2); }
.pill.ok { color: var(--green); font-weight: 700; font-size: 12.5px; }

/* ── Misc ─────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.sub-card { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.code-block {
  background: #0d1424; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; font-family: var(--mono); font-size: 13px;
  color: #a5f3fc; overflow-x: auto; white-space: pre-wrap;
}
.code-block.small { font-size: 12px; color: #cbd5e1; }
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #0d1424; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; font-family: var(--mono); font-size: 14px;
}
.topic-item .tag { font-size: 11px; color: var(--kafka); border: 1px solid rgba(232,83,46,.4); border-radius: 6px; padding: 2px 8px; font-family: 'Inter', sans-serif; font-weight: 600; }

.alert-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
@media (max-width: 700px) { .alert-rules { grid-template-columns: 1fr; } }
.rule { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.rule-title { font-weight: 700; margin-bottom: 10px; font-size: 14px; }
.rule-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); margin-bottom: 7px; }

footer { margin-top: 30px; padding: 22px 0 34px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }
footer a { color: var(--accent-2); text-decoration: none; }

/* highlight row when alert present */
tr.alert-row td { background: rgba(248,113,113,.05); }
