:root {
  color-scheme: dark;
  --bg: #101315;
  --panel: #171c1f;
  --panel-2: #1f272b;
  --line: #2d3940;
  --text: #edf4f7;
  --muted: #a7b4bb;
  --faint: #6f7f87;
  --green: #49d19a;
  --green-soft: rgba(73, 209, 154, 0.14);
  --amber: #f3b75f;
  --amber-soft: rgba(243, 183, 95, 0.16);
  --red: #ef6b73;
  --red-soft: rgba(239, 107, 115, 0.16);
  --cyan: #5ac8d8;
  --cyan-soft: rgba(90, 200, 216, 0.14);
  --violet: #b896ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--cyan);
}

a:visited {
  color: var(--violet);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.boot {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.boot.error {
  color: var(--red);
}

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #13181b;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(90, 200, 216, 0.4);
  background: var(--cyan-soft);
  color: var(--cyan);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.workspace,
.source-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
}

.workspace {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.workspace strong {
  color: var(--text);
}

nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
}

.nav-item:hover,
.nav-item[data-active="true"] {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.source-card {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.source-card strong,
.source-card span {
  display: block;
}

.source-card span {
  color: var(--faint);
  font-size: 12px;
}

.dot,
.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-top: 5px;
  flex: 0 0 auto;
}

.dot.ok,
.state-dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.dot.warn,
.state-dot.degraded,
.state-dot.unknown {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.state-dot.down {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.status-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: lowercase;
}

.status-chip .state-dot {
  margin-top: 0;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 17, 15, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar p,
.topbar h1 {
  margin: 0;
}

.topbar p {
  color: var(--muted);
  font-size: 12px;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 720;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.live-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 12px;
  white-space: nowrap;
}

.search {
  width: min(360px, 36vw);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  min-height: 44px;
  padding: 0 10px;
}

.search input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
}

.icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button,
.text-button,
.chip,
.primary {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  min-height: 44px;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  flex: 0 0 44px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 0 10px;
}

.chip,
.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #051113;
  font-weight: 700;
}

.warning {
  margin: 18px 28px 0;
  border: 1px solid rgba(243, 183, 95, 0.32);
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  padding: 10px 12px;
}

.content {
  padding: 24px 28px 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 18px;
}

.hero h2 {
  max-width: 940px;
  margin: 8px 0 10px;
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.08;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.hero-metrics {
  display: grid;
  gap: 10px;
}

.hero-metric,
.stat-card,
.panel,
.service-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.hero-metric {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 86px;
  padding: 14px;
}

.hero-metric span,
.stat-card span,
.stat-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.hero-metric strong {
  font-size: 30px;
  overflow-wrap: anywhere;
}

.hero-metric.ok strong {
  color: var(--green);
}

.hero-metric.warn strong {
  color: var(--amber);
}

.hero-metric.danger strong {
  color: var(--red);
}

.current-board {
  border: 1px solid var(--line);
  background: #141a1d;
  border-radius: 8px;
  margin-bottom: 18px;
  overflow: hidden;
}

.current-board[data-state="danger"] {
  border-color: rgba(239, 107, 115, 0.42);
}

.current-board[data-state="warn"] {
  border-color: rgba(243, 183, 95, 0.36);
}

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

.current-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.current-summary {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.current-summary span {
  min-width: 92px;
  border: 1px solid var(--line);
  background: #101517;
  border-radius: 6px;
  padding: 8px 10px;
}

.current-summary strong,
.current-summary em {
  display: block;
}

.current-summary strong {
  font-size: 22px;
}

.current-summary em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.module-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  border-bottom: 1px solid var(--line);
}

.module-tile {
  min-height: 98px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.module-tile:hover {
  background: var(--panel-2);
}

.module-tile[data-state="degraded"],
.module-tile[data-state="down"] {
  background: var(--red-soft);
}

.module-tile strong,
.module-tile em {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-tile strong {
  font-size: 14px;
}

.module-tile em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.affected-stack {
  display: grid;
}

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

.affected-head span {
  color: var(--muted);
  font-size: 12px;
}

.affected-list {
  display: grid;
}

.affected-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.1fr) minmax(220px, 1.1fr) 28px;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.affected-row:hover {
  background: var(--panel-2);
}

.affected-row > span {
  min-width: 0;
}

.affected-row em,
.affected-row small,
.affected-row strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.affected-row em {
  color: var(--faint);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.affected-row strong {
  margin-top: 3px;
  font-size: 13px;
}

.affected-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.affected-action {
  color: var(--muted);
  justify-self: end;
}

.current-clear {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.current-clear strong {
  color: var(--green);
}

.current-clear span {
  color: var(--muted);
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 116px;
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.stat-card strong {
  font-size: 36px;
}

.panel-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
}

.panel {
  overflow: hidden;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.service-list {
  display: grid;
}

.service-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.service-row:hover {
  background: var(--panel-2);
}

.service-row strong,
.service-row em {
  display: block;
}

.service-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-top: 3px;
}

.service-row b {
  color: var(--cyan);
}

.month-bars {
  padding: 14px;
  display: grid;
  gap: 13px;
}

.month-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
}

.month-row span,
.month-row b {
  color: var(--muted);
  font-size: 12px;
}

.month-row div {
  height: 10px;
  background: #0d1113;
  border-radius: 999px;
  overflow: hidden;
}

.month-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-count {
  color: var(--muted);
  margin-left: auto;
  font-size: 13px;
}

.select,
.toggle,
.range {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.select span,
.range span {
  color: var(--muted);
  font-size: 12px;
}

select {
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  min-height: 44px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
  flex: 0 0 auto;
}

input[type="range"] {
  min-height: 44px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.service-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.service-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-top > .score {
  margin-left: auto;
  color: var(--cyan);
  font-weight: 800;
}

.service-card p {
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mini-stats div {
  background: #111719;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.mini-stats span,
.mini-stats strong {
  display: block;
}

.mini-stats span {
  color: var(--faint);
  font-size: 11px;
}

.mini-stats strong {
  margin-top: 4px;
}

.table {
  overflow: auto;
}

.table-head,
.table-row {
  display: grid;
  gap: 12px;
  min-width: 980px;
  align-items: center;
}

.components-table .table-head,
.components-table .table-row {
  grid-template-columns: 54px 2fr 1fr 1.7fr 120px 70px;
}

.episodes-table .table-head,
.episodes-table .table-row {
  grid-template-columns: 110px 150px 2fr 1.6fr 90px 60px;
}

.taxonomy-table .table-head,
.taxonomy-table .table-row {
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.1fr) 88px minmax(260px, 1.4fr);
}

.table-head {
  min-height: 42px;
  padding: 0 14px;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.table-row {
  min-height: 58px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.table-row strong,
.table-row em {
  display: block;
}

.table-row strong {
  font-size: 13px;
}

.table-row em {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
}

.bh {
  color: var(--amber);
}

.taxonomy-stack {
  display: grid;
  gap: 18px;
}

.correction-body,
.unmapped-body,
.source-body,
.empty-state {
  padding: 14px;
}

.correction-body {
  display: grid;
  gap: 8px;
}

.correction-body strong {
  color: var(--cyan);
  font-size: 18px;
}

.correction-body p,
.unmapped-body p,
.source-body p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.unmapped-body {
  display: grid;
  gap: 14px;
}

.example-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.example-list div {
  min-width: 0;
  border: 1px solid var(--line);
  background: #141310;
  border-radius: 6px;
  padding: 10px;
}

.example-list strong,
.example-list span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.example-list strong {
  font-size: 13px;
}

.example-list span {
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
}

.needle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 5px 2px 0;
  border: 1px solid rgba(90, 200, 216, 0.28);
  background: var(--cyan-soft);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  padding: 0 8px;
  overflow-wrap: anywhere;
}

.muted-text {
  color: var(--faint);
  font-style: normal;
}

.empty-state {
  display: grid;
  gap: 6px;
}

.empty-state strong {
  color: var(--text);
}

.empty-state span {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.source-body {
  display: grid;
  gap: 12px;
}

.source-body dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.source-body dl div {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.source-body dt {
  color: var(--muted);
}

.source-body dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-links {
  display: grid;
  gap: 8px;
}

.source-links a {
  display: grid;
  gap: 4px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  text-decoration: none;
}

.source-links a:hover {
  background: var(--panel-2);
}

.source-links span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.evidence-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
  margin-bottom: 18px;
}

.report {
  padding: 14px;
}

.report dl {
  margin: 0 0 14px;
  display: grid;
  gap: 10px;
}

.report div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.report dt {
  color: var(--muted);
}

.report dd {
  margin: 0;
  text-align: right;
}

.wedge-list {
  display: grid;
}

.wedge-list div {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.wedge-list strong,
.wedge-list span {
  display: block;
}

.wedge-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 5px;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .brand div:last-child,
  .workspace span,
  .source-card div,
  .nav-item span:not(.icon) {
    display: none;
  }

  .sidebar {
    align-items: center;
  }

  .nav-item {
    width: 44px;
    justify-content: center;
  }

  .hero,
  .panel-grid.two,
  .evidence-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .service-grid,
  .example-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .brand {
    flex: 1 0 100%;
    padding: 0;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: 1 1 auto;
    gap: 6px;
    min-width: 0;
    overflow: visible;
  }

  .brand div:last-child,
  .nav-item span:not(.icon) {
    display: block;
  }

  .nav-item .icon {
    display: inline-grid;
  }

  .nav-item {
    width: auto;
    min-width: 0;
    justify-content: center;
    padding: 0 8px;
    font-size: 13px;
  }

  .source-card,
  .workspace {
    display: none;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .top-actions,
  .search {
    width: 100%;
  }

  .top-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .live-pill {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
  }

  .content {
    padding: 16px;
  }

  .hero h2 {
    font-size: 34px;
  }

  .current-head {
    align-items: stretch;
    flex-direction: column;
  }

  .current-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .current-summary span {
    min-width: 0;
  }

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

  .module-tile {
    min-height: 72px;
    border-right: 0;
  }

  .affected-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .affected-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .affected-action {
    display: none;
  }

  .stats-grid,
  .service-grid,
  .mini-stats,
  .example-list {
    grid-template-columns: 1fr;
  }

  .table {
    overflow: visible;
  }

  .table-head {
    display: none;
  }

  .table-row,
  .components-table .table-row,
  .episodes-table .table-row,
  .taxonomy-table .table-row {
    min-width: 0;
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .table-row > span {
    display: grid;
    grid-template-columns: minmax(86px, 0.36fr) minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    min-width: 0;
  }

  .table-row > span::before {
    content: attr(data-label);
    color: var(--faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .table-row strong,
  .table-row em {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .source-body dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
