:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e1ec;
  --accent: #1769aa;
  --accent-strong: #0f4f88;
  --good: #13795b;
  --bad: #bd3131;
  --warn: #a86408;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 56px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 750; color: var(--text); }

nav { display: flex; align-items: center; gap: 14px; }
nav form { margin: 0; }

h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 34px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.hero p, .muted { color: var(--muted); }

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

button, .button, .small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 650;
  cursor: pointer;
}

.small, .small-button { min-height: 32px; padding: 0 10px; font-size: 13px; }
.ghost { background: transparent; color: var(--muted); min-height: 32px; padding: 0 8px; }
.danger { background: var(--bad); }

section { margin-top: 24px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

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

.metric, .panel, .card, .empty, .notice, .login-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric { padding: 18px; }
.metric span { display: block; color: var(--muted); margin-bottom: 8px; }
.metric strong { font-size: 26px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 18px; }
.panel h2 { margin-bottom: 14px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 4px; }

.health-cell {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.health-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e8eef6;
  overflow: hidden;
}

.health-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.health-fill.excellent { background: linear-gradient(90deg, #157f5b 0%, #1f9d71 100%); }
.health-fill.good { background: linear-gradient(90deg, #1e6fbe 0%, #2f89de 100%); }
.health-fill.medium { background: linear-gradient(90deg, #d48b1f 0%, #e8aa42 100%); }
.health-fill.high { background: linear-gradient(90deg, #d9730d 0%, #f0a33e 100%); }
.health-fill.critical { background: linear-gradient(90deg, #c73636 0%, #df5a5a 100%); }
.health-fill.unknown { background: linear-gradient(90deg, #98a2b3 0%, #b8c0cc 100%); }

.health-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.health-meta strong {
  font-size: 14px;
}

.health-meta small {
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card { padding: 16px; }
.card p { color: var(--muted); }
.card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--muted); }

.todo-list {
  display: grid;
  gap: 12px;
}

.todo-item {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.todo-priority {
  display: grid;
  gap: 8px;
}

.todo-priority strong {
  font-size: 15px;
}

.todo-copy {
  min-width: 0;
}

.todo-copy p {
  margin: 6px 0 0;
  color: var(--muted);
}

.todo-action {
  color: var(--text) !important;
  font-weight: 650;
}

.todo-cta {
  display: flex;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8eef6;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.pill.critical, .pill.p1 { background: #ffe5e5; color: #9b1c1c; }
.pill.high, .pill.p2 { background: #fff0d9; color: #8a4b00; }
.pill.medium, .pill.p3 { background: #eaf2ff; color: #194f90; }
.pill.low { background: #e5f6ef; color: #146447; }
.pill.metric-good { background: #e5f6ef; color: #146447; }
.pill.metric-medium { background: #fff0d9; color: #8a4b00; }
.pill.metric-bad { background: #ffe5e5; color: #9b1c1c; }
.pill.metric-neutral { background: #eef2f7; color: #667085; }

.good { color: var(--good); font-weight: 700; }
.bad, .danger-text { color: var(--bad); font-weight: 700; }

.mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.mini-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.mini-list li small {
  margin-left: 8px;
  color: var(--muted);
}

.sparkline {
  height: 56px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  align-items: end;
  padding: 10px 2px 2px;
  border-radius: 8px;
  background: #f2f5fa;
  border: 1px solid var(--line);
  overflow: hidden;
}

.spark-bar {
  display: block;
  width: 100%;
  min-height: 2px;
  border-radius: 2px;
  background: #9bb3d6;
}

.spark-bar.up { background: #66b49b; }
.spark-bar.down { background: #d67a7a; }

.timeline {
  margin-top: 12px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  align-items: center;
  height: 10px;
}

.timeline-day {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #d9e1ec;
}

.timeline-day.oldest {
  background: var(--accent);
}

dl { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 8px 14px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 650; }

.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 650; }
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
  border: 0;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: white;
  font: inherit;
  color: var(--text);
}

.notice, .empty { padding: 16px; color: var(--muted); }
.notice.danger { border-color: #ffd1d1; color: var(--bad); background: #fff5f5; }

.login-page { display: grid; min-height: 100vh; place-items: center; }
.login-box { width: min(420px, calc(100% - 32px)); padding: 24px; }
.login-box h1 { font-size: 28px; margin-bottom: 10px; }
.login-box p { color: var(--muted); }

code {
  background: #eef2f7;
  border-radius: 5px;
  padding: 2px 5px;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .topbar, .hero { flex-direction: column; align-items: stretch; }
  nav { flex-wrap: wrap; }
  .metrics, .split { grid-template-columns: 1fr; }
  .todo-item { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
}
