:root {
  --bg: #070b14;
  --bg-soft: #0c1222;
  --panel: rgba(18, 25, 54, 0.82);
  --panel-solid: #121936;
  --panel2: #0e1530;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #eef2ff;
  --muted: #94a3b8;
  --accent: #0d9488;
  --accent2: #5eead4;
  --accent-blue: #60a5fa;
  --accent-purple: #a78bfa;
  --orange: #fb923c;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --glow: 0 0 0 1px rgba(94, 234, 212, 0.08), 0 20px 60px rgba(13, 148, 136, 0.12);
  font-size: 15px;
}

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

html, body { min-height: 100%; }

body {
  background:
    radial-gradient(circle at 10% 0%, rgba(13, 148, 136, 0.18), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(96, 165, 250, 0.14), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(167, 139, 250, 0.1), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

body.dashboard-body { display: block; }

.dashboard-frame {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.dashboard-banners {
  width: 100%;
  flex: 0 0 auto;
}

.dashboard-banners .demo-session-banner {
  width: 100%;
}

.demo-session-banner.banner-success {
  background: linear-gradient(90deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-bottom: 1px solid #6ee7b7;
  box-shadow: none;
}

.demo-session-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.95), rgba(249, 128, 18, 0.92));
  color: #1c1917;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(249, 128, 18, 0.25);
}

.demo-session-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
}

.demo-session-pulse { animation: demo-pulse 1.2s ease-in-out infinite; }

@keyframes demo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#demo-countdown {
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.12);
  padding: 2px 10px;
  border-radius: 999px;
}

.demo-session-hint {
  font-weight: 500;
  opacity: 0.85;
  font-size: 12px;
}

@media (max-width: 640px) {
  .demo-session-hint { display: none; }
  .demo-session-inner { font-size: 12px; }
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; width: 100%; flex: 1; min-height: 0; }

aside {
  width: 270px;
  min-height: 100vh;
  background: rgba(8, 12, 24, 0.88);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #042f2e;
  box-shadow: var(--glow);
}

.logo h1 { font-size: 16px; line-height: 1.15; font-weight: 700; }
.logo small { color: var(--muted); font-weight: 500; font-size: 11px; display: block; margin-top: 2px; }

.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0 10px 8px;
  font-weight: 700;
}

nav button,
nav .nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  margin: 3px 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: 0.18s ease;
}

nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}

nav .nav-link.active {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.22), rgba(13, 148, 136, 0.04));
  color: var(--text);
  border-color: rgba(94, 234, 212, 0.18);
  box-shadow: inset 3px 0 0 var(--accent2);
}

nav .ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

nav .nav-link.active .ico { background: rgba(94, 234, 212, 0.14); }

.mode-chip {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  font-size: 12px;
  color: var(--muted);
}

.mode-chip b { display: block; font-size: 13px; margin-bottom: 4px; }
.mode-chip.demo b { color: var(--warn); }
.mode-chip.live b { color: var(--ok); }

main {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1280px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  padding: 0;
  font-size: 13px;
}

.search-box input:focus { outline: none; }

.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

header.page {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

header.page h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

header.page p { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 620px; }

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.demo {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.28);
}

.badge.live {
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 24px 26px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(13, 148, 136, 0.24), rgba(96, 165, 250, 0.12)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(94, 234, 212, 0.16);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.22), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.hero h3 {
  font-size: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero p { color: #cbd5e1; font-size: 14px; line-height: 1.55; max-width: 620px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.hero-side {
  display: grid;
  gap: 10px;
  align-content: center;
}

.hero-stat {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(7, 11, 20, 0.35);
  border: 1px solid var(--line);
}

.hero-stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-stat .value { font-size: 22px; font-weight: 800; margin-top: 4px; color: var(--accent2); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: 1.1fr 0.9fr; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .kpis, .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid, .cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  aside { width: 100%; min-height: auto; position: static; }
  main { padding: 18px 16px 28px; }
  .kpis, .cols-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.card.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

.card h3, .section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.kpi {
  position: relative;
  overflow: hidden;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 14px;
}

.kpi-icon.teal { background: rgba(13, 148, 136, 0.18); }
.kpi-icon.blue { background: rgba(96, 165, 250, 0.18); }
.kpi-icon.purple { background: rgba(167, 139, 250, 0.18); }
.kpi-icon.orange { background: rgba(251, 146, 60, 0.18); }

.kpi .val { font-size: 32px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.kpi .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kpi .hint { color: #64748b; font-size: 12px; margin-top: 8px; }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.quick-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s ease;
}

.quick-btn:hover {
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(13, 148, 136, 0.12);
  transform: translateY(-1px);
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.example-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  transition: 0.18s ease;
}

.example-card:hover {
  border-color: rgba(94, 234, 212, 0.24);
  transform: translateY(-2px);
}

.example-card .tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 10px;
}

.example-card h4 { font-size: 16px; margin-bottom: 8px; }
.example-card p { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border-radius: 12px; }

.progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill.ok { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.pill.off { background: rgba(248, 113, 113, 0.14); color: var(--err); }
.pill.warn { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.pill.info { background: rgba(96, 165, 250, 0.14); color: var(--accent-blue); }

.chart-box { position: relative; height: 300px; }

.activity-list { display: grid; gap: 10px; }
.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.activity-item strong { display: block; font-size: 13px; margin-bottom: 3px; }
.activity-item span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.activity-item time { margin-left: auto; color: #64748b; font-size: 11px; white-space: nowrap; }

.course-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.course-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.course-card .code {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--accent2);
  margin-bottom: 8px;
}

.course-card h4 { font-size: 15px; line-height: 1.35; margin-bottom: 10px; min-height: 40px; }
.course-card .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }

input, select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  width: 100%;
}

input:focus, select:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.35);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), #0891b2);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.24);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 12px;
}

.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }

.msg { margin-top: 12px; font-size: 13px; padding: 12px 14px; border-radius: 12px; }
.msg.ok { background: rgba(52, 211, 153, 0.12); color: var(--ok); border: 1px solid rgba(52, 211, 153, 0.18); }
.msg.err { background: rgba(248, 113, 113, 0.12); color: var(--err); border: 1px solid rgba(248, 113, 113, 0.18); }

.loading, .empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 28px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 15px; }

.htmx-indicator {
  display: none;
  color: var(--accent2);
  font-size: 13px;
  margin-bottom: 12px;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: block; }

.skeleton {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), var(--accent-blue));
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #042f2e;
  margin-right: 8px;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-input {
  max-width: 280px;
}

.tip-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(96, 165, 250, 0.08);
  color: #bfdbfe;
  font-size: 13px;
  line-height: 1.5;
}

.tip-box code {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #dbeafe;
}

.hero-analytics {
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(13, 148, 136, 0.22)),
    rgba(255, 255, 255, 0.03);
  border-color: rgba(251, 146, 60, 0.22);
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.stack-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: "JetBrains Mono", monospace;
}

.insight-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
}

.insight-pill {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(94, 234, 212, 0.22);
  color: #99f6e4;
}

.prediction-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.prediction-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.prediction-card .value {
  font-size: 36px;
  font-weight: 800;
  margin: 8px 0;
  letter-spacing: -0.03em;
}

.prediction-card p { font-size: 12px; color: var(--muted); line-height: 1.45; }
.prediction-card.optimistic .value { color: var(--ok); }
.prediction-card.baseline .value { color: var(--accent-blue); }
.prediction-card.pessimistic .value { color: var(--err); }

.heatmap-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(70px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.heatmap-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  padding: 8px;
}

.heatmap-label {
  font-size: 12px;
  color: #cbd5e1;
  padding: 10px 8px;
  display: flex;
  align-items: center;
}

.heatmap-cell {
  --intensity: 50;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #042f2e;
  background: color-mix(in srgb, #5eead4 calc(var(--intensity) * 1%), #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
