:root {
  --bg: #0b0d10;
  --panel: #13171c;
  --line: #222932;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #f5b83d;
  --ok: #4cc38a;
  --warn: #f5b83d;
  --bad: #ef6461;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; color: var(--text); }

header, main, footer { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: 0.01em; }
.logo {
  width: 22px; height: 22px;
  background: var(--accent);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
}

nav { display: flex; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }

section { margin-bottom: 22px; }

.label { margin: 0 0 6px; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 0.88rem; }
.hidden { display: none; }

.model {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.model h2 { margin: 0; font-size: 1.5rem; }

.state {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.state.serving { color: var(--ok); border-color: var(--ok); }
.state.loading { color: var(--warn); border-color: var(--warn); }
.state.idle, .state.offline { color: var(--bad); border-color: var(--bad); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.cards article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.big { margin: 0; font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.big small { font-size: 0.9rem; font-weight: 400; color: var(--muted); }

.chart {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.chart-head .muted { margin: 0; }
#spark { width: 100%; height: 120px; display: block; margin-top: 8px; }
#spark .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
#spark .area { fill: var(--accent); opacity: 0.12; }

.table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:last-child td { border-bottom: none; }
td.id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.role-head { color: var(--accent); font-weight: 600; }
.engine-ready { color: var(--ok); }
.engine-failed { color: var(--bad); }

.explain {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.explain div { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.explain h3 { margin: 0 0 6px; font-size: 1rem; }
.explain p { margin: 0; color: var(--muted); font-size: 0.92rem; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 30px;
  font-size: 0.85rem;
}

@media (max-width: 560px) {
  .model { flex-direction: column; align-items: flex-start; }
  .big { font-size: 1.6rem; }
}
