:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d2433; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1f4fd8; --accent-ink: #fff; --good: #137a3f; --bad: #b42318; --warn: #b54708;
  --warn-bg: #fff7ed; --tag: #eef2ff; --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.warn { color: var(--warn); }
.count { display: inline-block; min-width: 24px; padding: 1px 8px; border-radius: 99px; background: var(--line); font-size: 13px; text-align: center; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--tag); color: var(--accent); font-size: 12px; font-weight: 700; }

.top { display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: #111827; color: #fff; flex-wrap: wrap; }
.top .brand { color: #fff; font-weight: 700; }
.top nav a { color: #cbd5e1; margin-right: 14px; }
.top nav a.on { color: #fff; font-weight: 600; }
.top .search { margin-left: auto; }
.top .search input { width: 240px; padding: 6px 10px; border-radius: 6px; border: 0; }
.top .user { display: flex; gap: 8px; align-items: center; color: #cbd5e1; }
.top .link { background: none; border: 0; color: #93c5fd; cursor: pointer; padding: 0; }

main { max-width: 1400px; margin: 0 auto; padding: 20px 22px 60px; }
.head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.head p { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.empty { color: var(--muted); }
.card.error, .error { color: var(--bad); }
.flash { background: var(--warn-bg); border: 1px solid #fed7aa; color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }

.group-head { display: flex; justify-content: space-between; align-items: center; }
.level { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f3f4f6; color: var(--muted); }
.level-3 { background: #ecfdf3; color: var(--good); }
.level-2 { background: #eff6ff; color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num { text-align: right; white-space: nowrap; }
td.wide { width: 50%; }
tr.row-warn td { background: var(--warn-bg); }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proposal { color: var(--accent); font-size: 13px; margin-top: 3px; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions .sep { flex: 1; }
.actions .note { width: 280px; }
button { font: inherit; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button:hover { border-color: #c7cdd6; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.ghost { background: none; }
input, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
form.inline { display: inline-flex; gap: 8px; }
label { display: block; margin: 10px 0; }
label input { display: block; width: 100%; margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
label.check input { width: auto; margin-top: 3px; }

.login { max-width: 380px; margin: 60px auto; }
.login button { width: 100%; margin-top: 6px; }

pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; line-height: 1.45; max-height: 70vh; white-space: pre-wrap; }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.waiting { display: flex; gap: 10px; align-items: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.confirm { border-color: #fecaca; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 18px; }
.stats div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; min-width: 150px; }
.stats b { display: block; font-size: 22px; }
.stats span { color: var(--muted); font-size: 12px; }
.stats .bad b { color: var(--bad); }
details { margin-top: 12px; }
