:root {
  --bg: #080d18;
  --panel: rgba(16, 24, 42, 0.88);
  --panel-solid: #10182a;
  --panel-2: #151f35;
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.27);
  --text: #e8edf7;
  --muted: #8f9bb0;
  --faint: #657189;
  --mint: #63e6be;
  --mint-dim: rgba(99, 230, 190, 0.12);
  --blue: #7cc4ff;
  --blue-dim: rgba(124, 196, 255, 0.12);
  --violet: #b7a1ff;
  --violet-dim: rgba(183, 161, 255, 0.12);
  --amber: #f7c970;
  --amber-dim: rgba(247, 201, 112, 0.13);
  --pink: #ff91b8;
  --pink-dim: rgba(255, 145, 184, 0.12);
  --red: #ff8585;
  --red-dim: rgba(255, 133, 133, 0.13);
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(70, 124, 255, 0.14), transparent 34%),
    linear-gradient(180deg, #090f1d 0%, #080d18 72%, #070b14 100%);
  overflow-x: hidden;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 460px;
  height: 460px;
  border-radius: 999px;
  filter: blur(100px);
  opacity: 0.1;
  pointer-events: none;
}
.ambient-one { background: #4c8dff; top: -180px; right: -120px; }
.ambient-two { background: #43d8ae; bottom: -280px; left: -220px; }

.shell {
  position: relative;
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 46px 0 30px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
  margin-bottom: 26px;
}

.eyebrow, .section-kicker {
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 9px; }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 15px var(--mint);
}

h1 { margin: 11px 0 5px; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1; letter-spacing: -0.045em; }
h1 span { color: var(--mint); font-weight: 520; }
.lead { margin: 0; color: var(--muted); font-size: 0.98rem; }

.source-pill {
  display: grid;
  gap: 3px;
  min-width: 175px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 19, 34, 0.64);
  text-align: right;
}
.source-pill span { color: var(--faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.09em; }
.source-pill strong { font-size: 0.84rem; color: #b6c3d8; }

.query-card, .results-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(18, 28, 48, 0.94), rgba(12, 19, 34, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.query-card { padding: 24px; }
.query-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 15px; }
h2 { margin: 0; font-size: 1.1rem; letter-spacing: -0.018em; }
.query-head p { margin: 5px 0 0; color: var(--muted); font-size: 0.81rem; }

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 4px 0;
  font-size: 0.78rem;
  font-weight: 680;
  cursor: pointer;
}
.text-button:hover { color: #a2d6ff; }

textarea {
  display: block;
  width: 100%;
  min-height: 146px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  outline: none;
  padding: 15px 17px;
  color: #dbe8f7;
  background: rgba(5, 10, 20, 0.7);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea::placeholder { color: #4f5b70; }
textarea:focus, input:focus, select:focus {
  border-color: rgba(99, 230, 190, 0.56);
  box-shadow: 0 0 0 3px rgba(99, 230, 190, 0.08);
}
textarea.invalid { border-color: rgba(255, 133, 133, 0.6); }

.input-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 15px;
  color: var(--faint);
  font-size: 0.75rem;
}
.input-error { display: block; color: var(--red); margin-top: 4px; }
.button-row { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.primary-button, .secondary-button, .export-button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 0.8rem;
  font-weight: 740;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.primary-button { min-width: 145px; background: var(--mint); color: #062218; }
.primary-button:hover { background: #82edcd; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.7; transform: none; }
.secondary-button { background: transparent; color: #9aa8be; border-color: var(--border-strong); }
.secondary-button:hover { background: rgba(148, 163, 184, 0.07); color: var(--text); }
.button-spinner { display: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(6,34,24,.3); border-top-color: #062218; animation: spin .7s linear infinite; }
.primary-button.loading .button-label { display: none; }
.primary-button.loading .button-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.results-section { margin-top: 22px; padding: 24px; }
.results-top { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-kicker { margin: 0 0 7px; font-size: 0.65rem; }

.summary-strip { display: flex; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: rgba(7, 13, 25, 0.45); }
.summary-strip div { display: flex; align-items: baseline; gap: 7px; min-width: 112px; padding: 10px 13px; border-left: 1px solid var(--border); }
.summary-strip div:first-child { border-left: 0; }
.summary-strip strong { font-variant-numeric: tabular-nums; font-size: 0.98rem; }
.summary-strip span { color: var(--faint); font-size: 0.68rem; }

.progress-wrap { padding: 12px 14px; margin-bottom: 15px; border: 1px solid rgba(124,196,255,.16); border-radius: 11px; background: var(--blue-dim); }
.progress-copy { display: flex; justify-content: space-between; color: #a9bdd4; font-size: .73rem; margin-bottom: 8px; }
.progress-track { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(124,196,255,.13); }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--blue); box-shadow: 0 0 12px rgba(124,196,255,.55); transition: width 180ms ease; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto auto; align-items: center; gap: 9px; margin-bottom: 13px; }
.search-control { position: relative; }
.search-control svg { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: #68778e; stroke-width: 1.8; stroke-linecap: round; }
.search-control input, .select-control select {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 9px; outline: none; color: #bac5d5; background: rgba(7, 13, 25, 0.62); font-size: .76rem;
}
.search-control input { padding: 0 12px 0 36px; }
.search-control input::placeholder { color: #617087; }
.select-control select { padding: 0 30px 0 11px; cursor: pointer; }
.export-button { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; color: #b8c4d6; border-color: var(--border-strong); background: rgba(148,163,184,.06); }
.export-button:hover:not(:disabled) { color: var(--text); background: rgba(148,163,184,.11); }
.export-button:disabled { opacity: .4; cursor: not-allowed; }
.export-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.table-frame { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: rgba(7, 12, 23, .56); }
table { width: 100%; min-width: 1160px; border-collapse: collapse; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 1; padding: 0; color: #7e8ba1; background: #111a2c; border-bottom: 1px solid var(--border-strong); text-align: left; font-size: .65rem; text-transform: uppercase; letter-spacing: .075em; }
th:nth-child(1) { width: 15%; }
th:nth-child(2) { width: 10%; }
th:nth-child(3) { width: 22%; }
th:nth-child(4) { width: 8%; }
th:nth-child(5) { width: 15%; }
th:nth-child(6) { width: 14%; }
th:nth-child(7) { width: 16%; }
th button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 13px; border: 0; background: transparent; color: inherit; text-align: inherit; text-transform: inherit; letter-spacing: inherit; font-size: inherit; cursor: pointer; }
th button:hover { color: #c3ccda; }
th span { color: #46536a; font-size: .72rem; }
th[aria-sort="ascending"] span::before { content: "↑"; }
th[aria-sort="descending"] span::before { content: "↓"; }
th[aria-sort]:not([aria-sort="none"]) span { font-size: 0; color: var(--mint); }
th[aria-sort]:not([aria-sort="none"]) span::before { font-size: .74rem; }

td { padding: 12px 13px; border-bottom: 1px solid rgba(148,163,184,.09); color: #bdc7d6; font-size: .75rem; vertical-align: middle; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 100ms ease; }
tbody tr:hover { background: rgba(124,196,255,.035); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .73rem; color: #dbe5f2; font-variant-numeric: tabular-nums; }
.ip-cell { display: flex; flex-direction: column; gap: 4px; }
.ip-meta { color: #59677d; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .63rem; }
.operator { color: #d2d9e4; }
.muted-cell { color: #5f6d82; }
.error-text { display: block; margin-top: 3px; color: #d98888; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .64rem; line-height: 1.35; }

.badge { display: inline-flex; align-items: center; max-width: 100%; padding: 5px 8px; border-radius: 999px; border: 1px solid transparent; font-size: .64rem; font-weight: 720; white-space: nowrap; }
.badge-hosting { color: var(--violet); background: var(--violet-dim); border-color: rgba(183,161,255,.15); }
.badge-mobile { color: var(--pink); background: var(--pink-dim); border-color: rgba(255,145,184,.15); }
.badge-isp { color: var(--blue); background: var(--blue-dim); border-color: rgba(124,196,255,.15); }
.badge-other { color: var(--mint); background: var(--mint-dim); border-color: rgba(99,230,190,.14); }
.badge-special { color: var(--amber); background: var(--amber-dim); border-color: rgba(247,201,112,.17); }
.badge-error { color: var(--red); background: var(--red-dim); border-color: rgba(255,133,133,.17); }
.badge-loading { color: #8fa0b6; background: rgba(143,160,182,.08); border-color: rgba(143,160,182,.12); }
.badge-threat-hit { color: var(--red); background: var(--red-dim); border-color: rgba(255,133,133,.2); }
.badge-threat-clear { color: var(--mint); background: var(--mint-dim); border-color: rgba(99,230,190,.16); }
.badge-threat-neutral { color: #8fa0b6; background: rgba(143,160,182,.08); border-color: rgba(143,160,182,.12); }
.badge-loading::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.1s ease-in-out infinite; }
.threat-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.threat-detail { color: #657189; font-size: .61rem; line-height: 1.35; }
@keyframes pulse { 50% { opacity: .25; } }

.empty-state { padding: 38px 20px; color: var(--faint); text-align: center; font-size: .8rem; }
.table-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; color: #56647a; font-size: .66rem; }

footer { display: flex; justify-content: space-between; gap: 28px; padding: 19px 2px 0; color: #4d5a70; font-size: .66rem; }
footer a { color: #75879f; text-decoration: none; }
footer a:hover { color: var(--blue); }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; transform: translateY(18px); opacity: 0; pointer-events: none; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: #172136; color: #dbe4f1; box-shadow: 0 16px 50px rgba(0,0,0,.35); font-size: .75rem; transition: opacity 160ms ease, transform 160ms ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .toolbar { grid-template-columns: 1fr 1fr 1fr; }
  .search-control { grid-column: 1 / -1; }
  .results-top { align-items: start; flex-direction: column; }
  .summary-strip { width: 100%; }
  .summary-strip div { flex: 1; min-width: 0; }
}

@media (max-width: 660px) {
  .shell { width: min(100% - 24px, 1480px); padding-top: 26px; }
  .masthead { align-items: start; }
  .source-pill { display: none; }
  .query-card, .results-section { padding: 17px; border-radius: 15px; }
  .query-head { flex-direction: column; gap: 6px; }
  textarea { min-height: 175px; font-size: .8rem; }
  .input-foot { align-items: stretch; flex-direction: column; }
  .button-row { justify-content: flex-end; }
  .summary-strip { display: grid; grid-template-columns: 1fr 1fr; }
  .summary-strip div { border-left: 0; border-top: 1px solid var(--border); }
  .summary-strip div:nth-child(-n+2) { border-top: 0; }
  .summary-strip div:nth-child(even) { border-left: 1px solid var(--border); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .select-control { min-width: 0; }
  .export-button { grid-column: 1 / -1; }
  .table-foot, footer { flex-direction: column; gap: 6px; }
  footer { line-height: 1.5; }
}
