:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c222b;
  --line: #2a323d;
  --text: #d7dee8;
  --muted: #8b95a5;
  --accent: #4fb6ff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--bad); min-height: 0; margin: 8px 0 0; white-space: pre-wrap; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: min(380px, 100%);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }

/* ---------- chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.chip {
  font-family: var(--mono); font-size: 11px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; color: var(--muted);
  max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  position: sticky; top: 68px;
  max-height: calc(100vh - 88px);
  overflow: auto;
}
@media (max-width: 900px) { .panel { position: static; max-height: none; } }

h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.history-title { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
input, textarea, select {
  width: 100%; margin-top: 5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit;
}
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.inline { display: flex; align-items: center; gap: 8px; }
label.inline input { width: auto; margin: 0; }

button, .button {
  background: var(--accent); color: #06121d; border: 0;
  border-radius: 8px; padding: 9px 14px;
  font: 600 13px/1 system-ui, sans-serif; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
button.ghost.danger { color: var(--bad); border-color: #4a2b2b; }
button.small { padding: 4px 9px; font-size: 11px; }

/* ---------- history ---------- */
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history li {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; cursor: pointer; background: var(--panel-2);
}
.history li:hover { border-color: var(--accent); }
.history li.active { border-color: var(--accent); background: #1b2836; }
.history .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.history .targets { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .meta { font-size: 11px; color: var(--muted); }

.badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 999px; border: 1px solid;
  white-space: nowrap;
}
.badge.queued { color: var(--muted); border-color: var(--line); }
.badge.running { color: var(--accent); border-color: #24506e; }
.badge.done { color: var(--ok); border-color: #1e4b28; }
.badge.failed { color: var(--bad); border-color: #4a2b2b; }
.badge.cancelled { color: var(--warn); border-color: #4d3c15; }

/* ---------- detail ---------- */
.content { min-width: 0; }
.empty { color: var(--muted); padding: 60px 20px; text-align: center; }
#detail {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px;
}
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-head h2 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 18px; font-family: var(--mono); margin-bottom: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

.cmd {
  display: block; margin: 14px 0;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px;
  overflow-x: auto; white-space: pre;
}

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; min-width: 92px;
}
.stat b { display: block; font-size: 18px; font-family: var(--mono); }
.stat span { font-size: 11px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  background: transparent; color: var(--muted); border: 0;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 8px 12px; font-weight: 500;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- results ---------- */
.host {
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 12px; overflow: hidden;
}
.host > summary {
  cursor: pointer; padding: 11px 14px; background: var(--panel-2);
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
}
.host > summary::-webkit-details-marker { display: none; }
.host .addr { font-family: var(--mono); font-weight: 600; }
.host .names { color: var(--muted); font-size: 12px; }
.host .count { margin-left: auto; font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 14px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td.port, td.proto { font-family: var(--mono); }
.state-open { color: var(--ok); }
.state-closed { color: var(--muted); }
.state-filtered { color: var(--warn); }
.scriptout {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: pre-wrap; margin: 4px 0 0; padding-left: 10px;
  border-left: 2px solid var(--line);
}
.os { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- console ---------- */
.console {
  background: #05080c; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin-top: 10px;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.console .cmdline { color: var(--accent); }
.console .err { color: var(--bad); }
