:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #66717d;
  --line: #dce3ea;
  --soft-line: #edf1f5;
  --healthy: #16885f;
  --healthy-bg: #e7f6ef;
  --degraded: #a86500;
  --degraded-bg: #fff2dc;
  --failed: #ba2838;
  --failed-bg: #ffe8eb;
  --unknown: #5964a2;
  --unknown-bg: #eef0ff;
  --accent: #1463c2;
  --accent-dark: #0f4e98;
  --cyan-bg: #eaf7fb;
  --rose-bg: #fff0f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: linear-gradient(90deg, #ffffff 0%, #f8fbff 68%, #eef7fb 100%);
  border-bottom: 1px solid #cbd9e6;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.header-note,
.section-note,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.header-note {
  margin-top: 5px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  border-color: #aab6c2;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.hidden {
  display: none !important;
}

.layout {
  width: min(1120px, calc(100% - 28px));
  margin: 18px auto 40px;
}

.overview,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border-left: 6px solid var(--healthy);
  background: linear-gradient(90deg, var(--healthy-bg), #ffffff 42%);
}

.overview.degraded {
  border-left-color: var(--degraded);
  background: linear-gradient(90deg, var(--degraded-bg), #ffffff 42%);
}

.overview.failed {
  border-left-color: var(--failed);
  background: linear-gradient(90deg, var(--failed-bg), #ffffff 42%);
}

.overview.unknown {
  border-left-color: var(--unknown);
  background: linear-gradient(90deg, var(--unknown-bg), #ffffff 42%);
}

.readiness-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.readiness-strip article {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.readiness-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.readiness-strip strong {
  font-size: 18px;
  line-height: 1;
}

.safe-text {
  color: var(--healthy);
}

.review-text {
  color: var(--degraded);
}

.danger-text {
  color: var(--failed);
}

.muted-text {
  color: var(--muted);
}

.overview-message {
  margin-top: 8px;
  color: #34414d;
  font-size: 14px;
  line-height: 1.45;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-height: 82px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  align-content: space-between;
  background: #ffffff;
}

.metric.healthy {
  background: var(--healthy-bg);
}

.metric.degraded {
  background: var(--degraded-bg);
}

.metric.failed {
  background: var(--failed-bg);
}

.metric.unknown {
  background: var(--unknown-bg);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.metric.healthy strong {
  color: var(--healthy);
}

.metric.degraded strong {
  color: var(--degraded);
}

.metric.failed strong {
  color: var(--failed);
}

.metric.unknown strong {
  color: var(--unknown);
}

.panel {
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.count-pill {
  min-width: 34px;
  border-radius: 999px;
  background: var(--degraded-bg);
  color: var(--degraded);
  padding: 5px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.incident-list {
  display: grid;
  gap: 8px;
}

.incident {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 5px solid var(--degraded);
  border-radius: 8px;
  padding: 12px;
  background: var(--degraded-bg);
}

.incident:has(.badge.failed),
.overview.failed + .priority-panel .incident {
  background: var(--failed-bg);
  border-left-color: var(--failed);
}

.incident p {
  margin: 4px 0;
  color: #34414d;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.incident small {
  color: var(--muted);
  font-size: 12px;
}

.project-coverage {
  display: grid;
  gap: 8px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-left: 5px solid var(--healthy);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.project-card.healthy {
  background: var(--healthy-bg);
}

.project-card.degraded {
  border-left-color: var(--degraded);
  background: var(--degraded-bg);
}

.project-card.failed {
  border-left-color: var(--failed);
  background: var(--failed-bg);
}

.project-card.unknown {
  border-left-color: var(--unknown);
  background: var(--unknown-bg);
}

.project-card.new {
  border-left-color: var(--accent);
  background: var(--cyan-bg);
}

.project-card.excluded {
  border-left-color: #8d98a5;
  background: #eef1f4;
  opacity: 0.76;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-column: 1 / -1;
  gap: 10px;
}

.project-title {
  display: grid;
  gap: 3px;
}

.project-title strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.project-title span,
.project-meta,
.project-signal {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.project-meta {
  grid-column: 1 / -1;
  color: #34414d;
}

.project-signal {
  grid-column: 1 / -1;
  color: var(--ink);
}

.project-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.badge.healthy {
  background: var(--healthy-bg);
  color: var(--healthy);
}

.badge.degraded {
  background: var(--degraded-bg);
  color: var(--degraded);
}

.badge.failed {
  background: var(--failed-bg);
  color: var(--failed);
}

.badge.unknown {
  background: var(--unknown-bg);
  color: var(--unknown);
}

.badge.new {
  background: var(--cyan-bg);
  color: var(--accent);
}

.badge.excluded {
  background: #eef1f4;
  color: #66717d;
}

.disclosure {
  padding: 0;
  overflow: hidden;
}

.disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  cursor: pointer;
  font-weight: 850;
}

.disclosure summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.disclosure[open] summary {
  border-bottom: 1px solid var(--line);
}

.system-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
}

.system-flow div {
  display: grid;
  gap: 5px;
  align-content: start;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.system-flow span,
.kind {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.system-flow strong {
  font-size: 14px;
}

.system-flow small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
}

.target-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 138px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  background: #fbfcfd;
}

.target-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.message {
  color: #34414d;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.sparkline {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  align-items: end;
  gap: 3px;
  height: 28px;
}

.bar {
  min-height: 7px;
  border-radius: 3px 3px 0 0;
  background: #b7c1cb;
}

.bar.healthy {
  background: var(--healthy);
}

.bar.degraded {
  background: var(--degraded);
}

.bar.failed {
  background: var(--failed);
}

.bar.unknown {
  background: var(--unknown);
}

.table-wrap {
  overflow-x: auto;
  padding: 8px 16px 16px;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td.status {
  font-weight: 850;
  text-transform: uppercase;
}

td.status.healthy {
  color: var(--healthy);
}

td.status.degraded {
  color: var(--degraded);
}

td.status.failed {
  color: var(--failed);
}

td.status.unknown {
  color: var(--unknown);
}

.empty {
  color: var(--muted);
  padding: 12px 0;
  font-size: 14px;
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 99, 194, 0.12), rgba(22, 136, 95, 0.1)),
    var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 390px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 22px;
  box-shadow: 0 20px 48px rgba(23, 33, 43, 0.12);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  background: #fbfcfd;
}

.auth-form input:focus {
  outline: 3px solid rgba(20, 99, 194, 0.16);
  border-color: var(--accent);
  background: #ffffff;
}

.auth-error {
  min-height: 18px;
  color: var(--failed);
  font-size: 13px;
  line-height: 1.35;
}

.auth-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 860px) {
  .overview {
    grid-template-columns: 1fr;
  }

  .system-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    display: grid;
    align-items: start;
  }

  .actions {
    width: 100%;
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 130px;
  }

  .layout {
    width: min(100% - 20px, 1120px);
    margin-top: 10px;
  }

  .status-strip,
  .system-flow,
  .readiness-strip {
    grid-template-columns: 1fr 1fr;
  }

  .incident {
    grid-template-columns: 1fr;
  }

  .incident button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  .status-strip,
  .system-flow,
  .readiness-strip {
    grid-template-columns: 1fr;
  }
}
