:root {
  --ink: #0d1117;
  --muted: #5b6672;
  --line: #e3e8ee;
  --accent: #0b6bcb;
  --accent-dark: #0956a3;
  --bg: #ffffff;
  --soft: #f6f8fb;
  --code: #0d1117;
  --ok: #1a7f37;
  --warn: #9a6700;
  --error: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 20px 72px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); }
.top nav { display: flex; gap: 18px; font-size: 14px; font-weight: 600; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--ink); text-decoration: none; }

/* hero */
.hero { margin: 44px 0 30px; }
.badge {
  display: inline-flex; gap: 6px; align-items: center; margin: 0 0 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 4px 11px;
}
h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 14px; }
h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 18px; color: var(--muted); max-width: 64ch; margin: 0; }

/* app panel */
.panel {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  box-shadow: 0 24px 60px -48px rgba(13, 17, 23, 0.5); margin: 30px 0 40px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 16px; }
.pill {
  font-size: 12px; font-weight: 600; color: var(--accent); background: #eef5ff;
  border-radius: 999px; padding: 4px 10px;
}

.controls {
  display: grid; gap: 14px; align-items: end;
  grid-template-columns: minmax(140px, 1.1fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(80px, 0.45fr) minmax(180px, 1.05fr) auto;
}
@media (max-width: 780px) { .controls { grid-template-columns: 1fr 1fr; } .controls .primary { grid-column: 1 / -1; } }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field.grow { flex: 1; }
select, input[type="number"], input[type="password"], input[type="text"], input[type="search"], input[type="email"] {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0;
}
select:focus, input:focus, textarea:focus { outline: 2px solid #b9d6f6; outline-offset: 1px; border-color: var(--accent); }

.checks { border: 0; padding: 0; margin: 0; }
.checks legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.checks label { display: flex; align-items: center; gap: 7px; font-weight: 400; color: var(--ink); font-size: 14px; }
.checks input { accent-color: var(--accent); }

button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 16px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
button.ghost { background: #fff; border-color: var(--accent); color: var(--accent); }
button.ghost:hover:not(:disabled) { background: #eef5ff; }
button.link { border: 0; background: none; color: var(--muted); padding: 6px 2px; text-decoration: underline; }
button:disabled { background: #fff; color: var(--muted); border-color: var(--line); cursor: default; }

.keybar { display: flex; gap: 12px; align-items: end; margin-top: 16px; flex-wrap: wrap; }

.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 20px; }
.hint[data-tone="ok"] { color: var(--ok); }
.hint[data-tone="warn"] { color: var(--warn); }
.hint[data-tone="error"] { color: var(--error); }

.output-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 8px; }
.output-head h3 { font-size: 15px; margin: 0; letter-spacing: -0.01em; }
.row { display: flex; gap: 8px; }

textarea.box {
  width: 100%; min-height: 280px; resize: vertical; padding: 14px;
  font: 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink);
  white-space: pre; overflow: auto;
}

/* results: a table the client can read and sort, not a wall of tabs */
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
/* `display` beats the hidden attribute, so state it explicitly. */
.summary[hidden], .chip[hidden] { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink); background: var(--soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.chip-email { border-color: #bfe0c8; background: #f1f9f3; color: var(--ok); font-weight: 500; }
.empty {
  margin: 0; padding: 40px 18px; text-align: center; font-size: 14px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 12px; background: var(--soft);
}
.table-wrap {
  max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg);
}
.results { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.results .col-n { width: 25%; }
.results .col-ci { width: 15%; }
.results .col-c { width: 16%; }
.results .col-p { width: 9%; }
.results .col-e { width: 20%; }
.results .col-w { width: 15%; }
.results th.index { width: 38px; }
.results thead th {
  position: sticky; top: 0; z-index: 1; background: var(--soft); text-align: left;
  padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.results thead th button {
  all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer;
  padding: 9px 12px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.results thead th button:hover { color: var(--accent); background: #eef3f9; }
.results thead th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.results thead th button[data-dir="asc"]::after { content: " \2191"; color: var(--accent); }
.results thead th button[data-dir="desc"]::after { content: " \2193"; color: var(--accent); }
.results td {
  padding: 8px 12px; border-bottom: 1px solid #f0f3f7; vertical-align: top;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.results tbody tr:nth-child(even) { background: #fafbfd; }
.results tbody tr:hover { background: #f2f7fd; }
.results tbody tr:last-child td { border-bottom: 0; }
.results td.index {
  color: var(--muted); font-variant-numeric: tabular-nums; width: 1%;
  text-align: right; padding-right: 8px;
}
.results thead th.index { padding: 9px 12px 9px 0; text-align: right; font-size: 11px; color: var(--muted); }
.results td.nil { color: #b6bfc9; }
.results td .sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.results td.name { max-width: 220px; }
.results td.name, .results td.city { white-space: normal; }
.results td.city { max-width: 110px; }
/* An address the client cannot read is useless, so email wraps; a long host name
   is truncated with the full URL on hover (and in full in the CSV). */
.results td.email { white-space: normal; overflow-wrap: anywhere; font-size: 12.5px; }
.results td.website { font-size: 12.5px; }
.results td.category { max-width: 120px; }
.results a { color: var(--accent); text-decoration: none; }
.results a:hover { text-decoration: underline; }

/* notes + footer */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.note { border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.note h3 { margin: 0 0 6px; font-size: 15px; }
.note p { margin: 0; font-size: 14px; }

.free-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); max-width: 62ch; }

/* ad slots: empty by default, filled by the network when one is configured */
.ad {
  border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px;
  background: var(--soft); margin: 0 0 22px; min-height: 64px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.ad-wide { min-height: 76px; }
.ad-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.ad-house { margin: 0; font-size: 13px; color: var(--muted); }
.ad-house strong { color: var(--ink); }
.ad ins { display: block; width: 100%; }

.muted { color: var(--muted); }
.foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
