:root {
  --bg: #0f1218;
  --panel: #171b23;
  --panel-2: #1e2430;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --accent: #5b8cff;
  --green: #3fbf7f;
  --yellow: #e5b84b;
  --orange: #e8834a;
  --red: #e5534b;
  --gray: #6b7385;
  --purple: #a07de0;
  --radius: 10px;
  font-family: Inter, 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); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 360px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.error { color: var(--red); margin: 0; }

input, select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 12px; }

header.top { display: flex; align-items: center; gap: 18px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
nav.tabs { display: flex; gap: 4px; }
nav.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
nav.tabs button.active { background: var(--panel-2); color: var(--text); }
.spacer { flex: 1; }
.live { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.live.on .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(63,191,127,.2); }

main { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }
section.view { display: none; }
section.view.active { display: block; }

.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 700; }
.kpi .label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.two-col { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }

.stage { display: grid; grid-template-columns: 210px 1fr 230px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.stage:last-child { border-bottom: 0; }
.stage .name { font-weight: 600; }
.stage .note { color: var(--muted); font-size: 12px; grid-column: 2 / 4; margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width .5s; }
.stage.done .bar > div { background: var(--green); }
.stage.failed .bar > div, .stage.stopped .bar > div { background: var(--red); }
.stage .meta { font-size: 12px; color: var(--muted); text-align: right; }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); margin-left: 6px; font-weight: 500; }
.status-pill.running { background: rgba(91,140,255,.18); color: var(--accent); }
.status-pill.done { background: rgba(63,191,127,.15); color: var(--green); }
.status-pill.failed, .status-pill.stopped { background: rgba(229,83,75,.15); color: var(--red); }
.status-pill.paused, .status-pill.interrupted { background: rgba(229,184,75,.15); color: var(--yellow); }

.log { height: 360px; overflow-y: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #0b0e13; border-radius: 8px; padding: 10px; border: 1px solid var(--border); }
.log div { padding: 2px 0; white-space: pre-wrap; word-break: break-word; }
.log .warn { color: var(--yellow); }
.log .error { color: var(--red); }
.log .ts { color: var(--gray); margin-right: 8px; }
.log .stg { color: var(--accent); margin-right: 6px; }

.tierbar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.tierbar div { display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #0b0e13; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c); vertical-align: -1px; }

.tier { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; color: #0b0e13; }
.tier.strong { background: var(--green); }
.tier.weak { background: var(--yellow); }
.tier.publisher_only { background: var(--orange); }
.tier.broken { background: var(--red); }
.tier.invisible { background: var(--gray); color: #fff; }
.tier.unconfirmed { background: var(--purple); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
tbody tr:hover { background: var(--panel-2); cursor: pointer; }
td.mono { white-space: nowrap; }
td.url { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.chip { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); color: var(--muted); margin: 1px 2px 1px 0; }
.chip.good { color: var(--green); }
.chip.bad { color: var(--red); }
.chip.warn { color: var(--yellow); }

.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(760px, 96vw); background: var(--panel); border-left: 1px solid var(--border); z-index: 20; overflow-y: auto; transform: translateX(100%); transition: transform .2s; padding: 22px; }
.drawer.open { transform: none; box-shadow: -20px 0 50px rgba(0,0,0,.4); }
.drawer h2 { margin: 0 0 4px; font-size: 18px; }
.drawer .close { position: absolute; right: 16px; top: 14px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13px; margin: 12px 0; }
.kv div:nth-child(odd) { color: var(--muted); }
.breakdown { display: grid; gap: 6px; }
.breakdown .row { display: grid; grid-template-columns: 160px 1fr 50px; gap: 10px; align-items: center; font-size: 12px; }
.link-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.link-card .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-card .url { word-break: break-all; }
.verdict { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--border); }
.verdict.confirmed, .verdict.confirmed_title { background: rgba(63,191,127,.2); color: var(--green); }
.verdict.likely, .verdict.blocked_likely { background: rgba(91,140,255,.18); color: var(--accent); }
.verdict.weak, .verdict.publisher_root, .verdict.listing, .verdict.blocked { background: rgba(229,184,75,.15); color: var(--yellow); }
.verdict.mismatch, .verdict.broken, .verdict.unreachable, .verdict.parked { background: rgba(229,83,75,.15); color: var(--red); }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 15; display: none; }
.backdrop.open { display: block; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px; z-index: 30; display: none; }

/* info tooltips */
.tip-i { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted);
  font: italic 700 10px/1 Georgia, "Times New Roman", serif; text-transform: none; letter-spacing: 0; cursor: help; vertical-align: 1px; user-select: none; flex: none; }
.tip-i:hover, .tip-i:focus-visible, .tip-i.tip-on { border-color: var(--accent); color: var(--accent); background: rgba(91,140,255,.12); outline: none; }
.tip-i:focus-visible { box-shadow: 0 0 0 2px rgba(91,140,255,.45); }
[data-tip]:not(.tip-i) { cursor: help; }
.legend .tip-i::before { content: none; }
.controls .tip-i { margin-left: -4px; }
#j-table th, #coverage th { white-space: nowrap; }
.tip { position: fixed; z-index: 100; max-width: 340px; padding: 9px 12px; border-radius: 8px; background: #252c3a; border: 1px solid #3a4459; color: var(--text);
  font: 400 12.5px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; text-transform: none; letter-spacing: 0; white-space: pre-line; text-align: left;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); pointer-events: none; opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }
.tip b { color: #fff; }
.method h4 { margin: 16px 0 4px; font-size: 14px; }
.method p, .method li { color: #cdd3de; }
.method ol, .method ul { padding-left: 22px; margin: 6px 0; }
.method td, .method th { font-size: 13px; }
details.cols { position: relative; }
details.cols summary { list-style: none; }
details.cols summary::-webkit-details-marker { display: none; }
details.cols > div { position: absolute; right: 0; top: 38px; z-index: 12; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: grid; gap: 4px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.scope-row { margin-bottom: 10px; }
table.mini td, table.mini th { padding: 4px 8px; font-size: 12px; }
#np-table td { font-size: 13px; }
