:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent2: #f0883e;
  --ok: #3fb950;
  --error: #f85149;
  --fatal: #d73a49;
  --warn: #d29922;
  --info: #58a6ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 700; }
code { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--accent); font-family: ui-monospace, Consolas, monospace; }

/* ---- nav ---- */
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.nav .brand { font-weight: 700; font-size: 16px; color: var(--text); margin-right: 6px; }
.nav .brand span { color: var(--accent2); }
.nav a.link { color: var(--muted); padding: 5px 10px; border-radius: 6px; font-size: 13px; }
.nav a.link.active { color: #fff; background: var(--accent2); }
.nav a.link:hover:not(.active) { color: var(--text); background: var(--bg3); }
.nav .spacer { flex: 1; }
.nav .who { color: var(--muted); font-size: 12px; }
.nav button.link { color: var(--muted); background: none; border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.nav button.link:hover { color: var(--text); border-color: var(--accent); }
.nav button.link.active { color: #fff; background: var(--accent2); border-color: var(--accent2); }
.nav .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.nav .dot.on { background: var(--ok); box-shadow: 0 0 6px #3fb95088; }

/* ---- progress ---- */
#progressWrap { position: fixed; top: 0; left: 0; right: 0; height: 12px; z-index: 999; opacity: 0; transition: opacity .3s ease; pointer-events: none; background: rgba(13,17,23,.35); }
#progressBar { position: absolute; top: 0; left: 0; bottom: 0; width: 0%; background: var(--accent2); box-shadow: 0 0 8px #f0883e88; transition: width .25s ease; }
#progressPct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; font-family: ui-monospace, Consolas, monospace; }

/* ---- layout ---- */
.wrap { padding: 20px; max-width: 1400px; margin: 0 auto; }
.wrap.wrap-wide { max-width: 2200px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.card .label small { font-size: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 3px; }
.card.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.card.clickable:hover { border-color: var(--accent2); background: #1f2630; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card .value.err { color: var(--error); }
.card .value.ok { color: var(--ok); }
.card .value.warn { color: var(--warn); }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--bg2); border-radius: 10px; }
.table-wrap { overflow-x: auto; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th { text-align: center; vertical-align: middle; color: var(--muted); font-weight: 600; padding: 9px 11px; border-bottom: 1px solid var(--border); background: var(--bg2); position: relative; }
.col-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; touch-action: none; }
.col-resizer::after { content: ''; position: absolute; top: 22%; bottom: 22%; left: 3px; width: 1px; background: var(--border); }
.col-resizer:hover::after, .col-resizer.active::after { background: var(--accent); width: 2px; }
body.col-resizing { cursor: col-resize; user-select: none; }
td { padding: 9px 11px; border-bottom: 1px solid var(--bg3); vertical-align: top; }
tr:last-child td { border-bottom: none; }
thead tr:first-child th:first-child { border-top-left-radius: 10px; }
thead tr:first-child th:last-child { border-top-right-radius: 10px; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
tr:hover td { background: var(--bg3); }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #1f2630; box-shadow: inset 0 1px 0 var(--accent2), inset 0 -1px 0 var(--accent2); }
tr.rowlink:hover td:first-child { box-shadow: inset 1px 0 0 var(--accent2), inset 0 1px 0 var(--accent2), inset 0 -1px 0 var(--accent2); }
tr.rowlink:hover td:last-child { box-shadow: inset -1px 0 0 var(--accent2), inset 0 1px 0 var(--accent2), inset 0 -1px 0 var(--accent2); }
td.time { white-space: nowrap; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
td.num { color: var(--muted); font-variant-numeric: tabular-nums; width: 48px; text-align: center; }
td.actions { white-space: nowrap; text-align: center; }
.btn-group { display: inline-flex; gap: 10px; align-items: center; }
.btn-group > * + * { position: relative; }
.btn-group > * + *::before { content: ''; position: absolute; left: -5px; top: 15%; bottom: 15%; width: 1px; background: var(--border); }
td.user { text-align: center; }
td.status { text-align: center; }
td.center { text-align: center; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.BLOCKED { background: #f8514922; color: var(--error); border: 1px solid #f8514955; }
.badge.SUCCESS { background: #3fb95022; color: var(--ok); border: 1px solid #3fb95055; }
.badge.UNKNOWN { background: #8b949e22; color: var(--muted); border: 1px solid #8b949e55; }
.badge.PARTIAL { background: #d2992222; color: var(--warn); border: 1px solid #d2992255; }
td.providers { white-space: normal; text-align: left; }
td.providers .badge { margin: 1px 2px; }
.blocked { color: var(--error); font-weight: 600; }
.success { color: var(--ok); font-weight: 600; }

/* ---- forms / toolbar ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar .push-right { margin-left: auto; }
input, select, textarea { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; font-family: inherit; }
select { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-color: var(--bg3); color: var(--text); padding-right: 30px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path fill='%238b949e' d='M0 0l5 6 5-6z'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: none; }
button:focus, button:focus-visible { outline: none; box-shadow: none; }
select:-moz-focusring, button:-moz-focusring, input:-moz-focusring, textarea:-moz-focusring { outline: none; }
select option { background-color: #0d1117; color: var(--text); }
select option:checked, select option:hover { background-color: var(--accent); color: #fff; }
select.active-filter { border: 1px solid var(--accent); background-color: rgba(47, 129, 247, .18); color: #fff; }
textarea { width: 100%; min-height: 120px; resize: vertical; font-family: ui-monospace, Consolas, monospace; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.btn { background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn.secondary { background: var(--bg3); border-color: var(--border); color: var(--text); }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: #238636; border-color: #238636; color: #fff; }
.btn.icon { padding: 5px 8px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.btn.active:disabled { opacity: 1; }
.btn.accent { background: var(--accent2); border-color: var(--accent2); }
.btn.danger { background: #f8514922; border-color: #f8514955; color: var(--error); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* ---- probe pills ---- */
.probe { display: inline-block; padding: 8px 14px; margin: 0 6px 8px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg3); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.probe:hover { border-color: var(--accent); color: var(--text); }
.probe.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---- entry / result card ---- */
.entry { padding: 12px 14px; margin: 8px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); font-size: 13px; }
.entry:hover { background: var(--bg3); }
.entry:last-child { margin-bottom: 0; }
.entry .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.entry .meta .dom { color: var(--text); font-weight: 600; }
.entry .msg { color: var(--text); }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 10px; overflow: auto; }
.modal-bg.show { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; width: 560px; max-width: 100%; padding: 20px; }
.modal h3 { margin: 0 0 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---- login ---- */
.login-box { max-width: 360px; margin: 8vh auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 26px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box .brand span { color: var(--accent2); }
.login-box p.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.login-box .btn { width: 100%; margin-top: 6px; }
.err { color: var(--error); font-size: 13px; min-height: 16px; margin-top: 8px; }

/* ---- misc ---- */
small, .muted { color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pager button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.bar { margin-top: 12px; height: 18px; background: var(--bg3); border-radius: 9px; overflow: hidden; display: none; border: 1px solid var(--border); }
.bar .fill { height: 100%; background: var(--accent2); width: 0%; transition: width .3s; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px; display: none; z-index: 60; color: var(--text); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 22px; transition: .2s; cursor: pointer; }
.switch .slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #238636; }
.switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }
