:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d24;
  --text-muted: #6b7280;
  --accent: #2f5bea;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --yellow: #b45309;
  --yellow-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --gray: #6b7280;
  --gray-bg: #f3f4f6;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --border: #2a2e37;
    --text: #e7e9ee;
    --text-muted: #9099a8;
    --accent: #6d8cff;
    --green: #34d399;
    --green-bg: #0d2a1e;
    --yellow: #fbbf24;
    --yellow-bg: #2a2211;
    --red: #f87171;
    --red-bg: #2a1414;
    --gray: #9099a8;
    --gray-bg: #23262e;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

nav.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
}
nav.sidebar h1 {
  font-size: 15px;
  font-weight: 700;
  padding: 0 20px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
nav.sidebar .group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}
nav.sidebar a {
  display: block;
  padding: 8px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
nav.sidebar a:hover { background: var(--gray-bg); }
nav.sidebar a.active { border-left-color: var(--accent); background: var(--gray-bg); font-weight: 600; }
nav.sidebar a .unavailable-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray); margin-right: 6px;
}

main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1100px;
  overflow-x: auto;
}
main h2 { margin-top: 0; font-size: 20px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: -8px; margin-bottom: 20px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.panel h3 { margin: 0 0 12px; font-size: 14px; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.tile {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel);
}
.tile .status-badge { margin-bottom: 8px; }
.tile .tile-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tile .tile-reason { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.tile .tile-meta { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 20px;
}
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.yellow { color: var(--yellow); background: var(--yellow-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.gray, .badge.unknown { color: var(--gray); background: var(--gray-bg); }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv-grid dt { color: var(--text-muted); }
.kv-grid dd { margin: 0; }

.note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--gray-bg);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  line-height: 1.5;
}
.note.warn { background: var(--yellow-bg); color: var(--yellow); }

.unavailable-box {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.unavailable-box strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 15px; }

.freshness { font-size: 11px; color: var(--text-muted); margin-bottom: 16px; }
.freshness code { font-family: var(--mono); }

input, button {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}
button {
  cursor: pointer;
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
}
button:hover { opacity: 0.9; }
button.secondary { background: var(--gray-bg); color: var(--text); }

.loading, .error-box { color: var(--text-muted); font-size: 13px; padding: 20px 0; }
.error-box { color: var(--red); }

code.inline { font-family: var(--mono); font-size: 12px; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }

.timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline-list li {
  padding: 8px 0 8px 20px;
  border-left: 2px solid var(--border);
  position: relative;
  font-size: 13px;
}
.timeline-list li::before {
  content: "";
  position: absolute;
  left: -5px; top: 12px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-list .event-type { font-weight: 600; }
.timeline-list .event-meta { color: var(--text-muted); font-size: 11px; }
