:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2430; --muted: #667085; --line: #e3e6eb;
  --accent: #2f6fde; --accent-soft: #e8f0fd; --ok: #1f8a4c; --ok-soft: #e3f5ea;
  --warn: #b25e00; --warn-soft: #fff1dc; --bad: #c4302b; --bad-soft: #fde8e7;
  --hl: #fff3b0; --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 3px 9px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.small, a.btn.small { padding: 1px 6px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
a.btn {
  display: inline-block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1px 6px; font-size: 12px; background: var(--panel); white-space: nowrap;
}
a.btn:hover { border-color: var(--accent); text-decoration: none; }
select, input[type=text], input[type=search], input[type=number], textarea {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 6px; background: #fff;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

header.top {
  display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: #1d2430; color: #fff;
  position: sticky; top: 0; z-index: 20;
}
header.top h1 { font-size: 16px; margin: 0; font-weight: 600; }
header.top nav a { color: #c9d6ee; margin-right: 12px; }
header.top nav a.active { color: #fff; font-weight: 600; border-bottom: 2px solid #7fa7f0; }
header.top .spacer { flex: 1; }
header.top .stats { color: #c9d6ee; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.badge {
  display: inline-block; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 17px;
  background: #eef0f3; color: #3b4452; margin: 1px 2px 1px 0; white-space: nowrap; cursor: default;
}
.badge.out { background: var(--accent-soft); color: #1b4fa8; cursor: pointer; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.lvl { background: #f1ecfb; color: #5b3aa8; }
.hl { background: var(--hl) !important; box-shadow: inset 3px 0 0 #e0b400; }

table.grid { border-collapse: collapse; width: 100%; background: var(--panel); }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
table.grid th { position: sticky; top: 0; background: #f0f2f5; font-weight: 600; z-index: 1; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--accent); }
table.grid tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 6px 10px; }
.tabs button.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.toolbar label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 1px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
details > summary { cursor: pointer; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; font-size: 11px; background: #fff; }

.viewer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(48vw, 820px); background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -6px 0 20px rgba(0,0,0,.08); z-index: 30;
  display: flex; flex-direction: column;
}
.viewer[hidden] { display: none; }
.viewer .vhead { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.viewer .vhead .vtitle { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer iframe { flex: 1; border: 0; width: 100%; background: #fff; }
.bar { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
