:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-alt: #0d1b2b;
  --panel: rgba(10, 18, 31, 0.82);
  --panel-strong: rgba(13, 27, 43, 0.95);
  --text: #edf4ff;
  --muted: #a6b7d0;
  --line: rgba(163, 182, 213, 0.22);
  --accent: #67d1ff;
  --accent-strong: #33b9f3;
  --done: #3ad29f;
  --progress: #ffb84d;
  --waiting: #8fa8d8;
  --blocked: #ff6b8a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --max: 1320px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(103, 209, 255, 0.18), transparent 24%),
    radial-gradient(circle at 80% 0%, rgba(58, 210, 159, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg), var(--bg-alt));
}

body {
  padding: 24px;
}

.app-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 20px;
  padding: 28px;
}

.next-task {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(7, 17, 31, 0.62);
  border: 1px solid rgba(103, 209, 255, 0.24);
}

.next-task-header {
  margin-bottom: 0;
}

.next-task-priority {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(255, 184, 77, 0.16);
  color: #ffd899;
}

.next-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.next-task-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(13, 27, 43, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.next-task-description {
  grid-column: span 2;
}

.project-health {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(7, 17, 31, 0.45);
  border: 1px solid rgba(103, 209, 255, 0.18);
}

.project-health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.project-health-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(13, 27, 43, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.health-badge {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.health-badge.healthy {
  background: rgba(58, 210, 159, 0.16);
  color: #b9ffe5;
}

.health-badge.warning {
  background: rgba(255, 184, 77, 0.16);
  color: #ffd899;
}

.health-badge.error {
  background: rgba(255, 107, 138, 0.16);
  color: #ffc1cf;
}

.hero-copy h1,
.section-header h2 {
  margin: 0;
  line-height: 1.05;
}

.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  max-width: 14ch;
}

.section-header h2 {
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

.lead,
.section-note,
.metric-note,
.module-meta,
.module-tests,
.node-meta {
  color: var(--muted);
}

.lead {
  margin: 16px 0 0;
  max-width: 70ch;
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-metrics {
  display: grid;
  gap: 14px;
  align-content: start;
}

.hero-metrics > div,
.module-card,
.flow-node {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.hero-metrics > div {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-label,
.module-kicker,
.node-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 700;
}

#latest-commit,
#current-phase {
  font-size: 1.35rem;
}

.metric-note {
  font-size: 0.95rem;
}

.panel-grid,
.flow-panel,
.legend-panel {
  padding: 24px;
}

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

.section-header.compact {
  margin-bottom: 12px;
}

.section-note {
  margin: 0;
  max-width: 52ch;
  font-size: 0.96rem;
  line-height: 1.5;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.module-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.module-head,
.node-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.module-title,
.node-title {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill.done { background: rgba(58, 210, 159, 0.16); color: #b9ffe5; }
.status-pill.progress { background: rgba(255, 184, 77, 0.16); color: #ffd899; }
.status-pill.waiting { background: rgba(143, 168, 216, 0.16); color: #d3def7; }
.status-pill.blocked { background: rgba(255, 107, 138, 0.16); color: #ffc1cf; }

.module-meta,
.node-meta {
  margin: 0;
  line-height: 1.55;
}

.module-tests {
  margin: 0;
  font-size: 0.96rem;
}

.module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.flow-canvas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 12px;
  align-items: start;
}

.flow-node {
  padding: 16px;
  position: relative;
}

.flow-node::after {
  content: "↓";
  display: block;
  text-align: center;
  color: var(--accent);
  font-size: 1.4rem;
  margin-top: 10px;
  opacity: 0.9;
}

.flow-node:last-of-type::after {
  display: none;
}

.flow-node.branch::after {
  content: "↘";
}

.node-links {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.node-links li {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.dot.done { background: var(--done); }
.dot.in-progress { background: var(--progress); }
.dot.waiting { background: var(--waiting); }
.dot.blocked { background: var(--blocked); }

@media (max-width: 920px) {
  body {
    padding: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .panel-grid,
  .flow-panel,
  .legend-panel,
  .hero {
    padding: 18px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}
