:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --line: #e4e4e0;
  --accent: #2f6fdb;
  --ai: #2f6fdb;
  --wait: #d9a21b;
  --bad: #c2410c;
  --good: #15803d;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --panel: #1d2024;
    --text: #e6e6e3;
    --muted: #9aa0a8;
    --line: #2e3238;
    --accent: #6ea0ff;
    --ai: #6ea0ff;
    --wait: #e2b440;
    --bad: #f08a5d;
    --good: #4ade80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.bar nav { display: flex; gap: 16px; }
.bar a { color: var(--muted); text-decoration: none; }
.bar a.active { color: var(--text); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 12px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

h1 { font-size: 18px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 24px 0 8px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

input, select, button {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}

button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; }
tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.muted { color: var(--muted); }
.bad { color: var(--bad); }
.good { color: var(--good); }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.meter { position: relative; height: 8px; min-width: 120px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter span { position: absolute; inset: 0 auto 0 0; background: var(--good); }

.timeline { position: relative; height: 28px; background: var(--bg); border-radius: 4px; }
.timeline .seg { position: absolute; top: 4px; bottom: 4px; border-radius: 2px; background: var(--ai); }
.timeline .seg.wait { background: var(--wait); }
.timeline .seg.anomaly { outline: 2px solid var(--bad); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { background: var(--bg); padding: 12px; border-radius: 6px; overflow-x: auto; }
.secret { word-break: break-all; padding: 12px; border: 1px dashed var(--accent); border-radius: 6px; }

@media (max-width: 640px) {
  .bar { padding: 12px 16px; gap: 12px; }
  .who { margin-left: 0; width: 100%; }
}
