:root {
  --ink: #132a2a;
  --muted: #647473;
  --line: #d9e2df;
  --paper: #f7f9f8;
  --white: #ffffff;
  --teal: #087f75;
  --teal-dark: #075e58;
  --mint: #dff3ed;
  --coral: #e86452;
  --amber: #fff3d4;
  --error: #b42318;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

.topbar { height: 68px; padding: 0 max(24px, calc((100vw - 1280px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 6px; }
.brand-mark svg { width: 21px; }
.brand strong { display: block; font-size: 19px; line-height: 1.1; }
.brand small { font: 500 9px var(--mono); letter-spacing: 1.8px; color: var(--muted); }
.top-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #1aae8a; box-shadow: 0 0 0 4px #dff5ee; }

.query-band { color: white; background-color: #0b4847; background-image: linear-gradient(115deg, rgba(6, 59, 59, .96), rgba(9, 91, 83, .91)), repeating-linear-gradient(90deg, transparent 0 47px, rgba(255,255,255,.08) 48px 49px), repeating-linear-gradient(0deg, transparent 0 47px, rgba(255,255,255,.08) 48px 49px); border-bottom: 4px solid var(--coral); }
.query-inner { max-width: 1040px; min-height: 310px; margin: 0 auto; padding: 42px 24px 34px; }
.eyebrow { margin-bottom: 10px; color: #90d8cc; font: 500 11px var(--mono); letter-spacing: 1.5px; }
h1 { max-width: 720px; margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.2; letter-spacing: 0; }
.intro { margin: 12px 0 24px; color: #c9e1dd; font-size: 15px; }
.mode-switch { display: inline-flex; height: 38px; margin-bottom: 12px; padding: 3px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.14); border-radius: 6px; }
.mode { min-width: 128px; border: 0; color: #bad7d3; background: transparent; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; border-radius: 3px; }
.mode svg { width: 16px; }
.mode.active { color: var(--teal-dark); background: white; font-weight: 600; }
.search-form { height: 58px; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; background: white; border: 1px solid transparent; box-shadow: 0 12px 28px rgba(0,25,24,.2); border-radius: 6px; overflow: hidden; }
.search-form:focus-within { border-color: #62d1c3; box-shadow: 0 0 0 3px rgba(98,209,195,.22), 0 12px 28px rgba(0,25,24,.2); }
.search-icon { margin-left: 18px; color: var(--teal); width: 20px; }
.search-form input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font: 500 16px var(--mono); }
.search-form button { height: 100%; padding: 0 25px; border: 0; background: var(--coral); color: white; display: flex; align-items: center; gap: 9px; font-weight: 600; cursor: pointer; }
.search-form button:hover { background: #cf4f3f; }
.search-form button svg { width: 18px; }
.search-foot { display: flex; justify-content: space-between; margin-top: 9px; color: #a9cbc6; font-size: 11px; }

.workspace { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.history-panel, .results-panel { background: var(--white); border: 1px solid var(--line); }
.history-panel { position: sticky; top: 18px; }
.section-title { min-height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.section-title small { color: var(--muted); font-weight: 400; font-size: 11px; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button svg { width: 15px; }
.history-list { min-height: 100px; padding: 8px; }
.history-item { width: 100%; padding: 10px; border: 0; border-bottom: 1px solid #edf1ef; background: white; text-align: left; cursor: pointer; }
.history-item:hover { background: #f1f8f6; }
.history-item strong { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font: 500 12px var(--mono); }
.history-item span { color: var(--muted); font-size: 10px; }
.privacy-note { padding: 13px; display: flex; gap: 8px; color: var(--muted); background: #f3f7f5; font-size: 10px; }
.privacy-note svg { width: 15px; flex: none; color: var(--teal); }
.results-panel { min-height: 420px; }
.welcome-state, .loading-state { min-height: 418px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.radar { width: 74px; height: 74px; margin-bottom: 16px; display: grid; place-items: center; color: var(--teal); background: var(--mint); border: 1px solid #b8ddd4; border-radius: 50%; }
.radar svg { width: 36px; height: 36px; }
.welcome-state h2 { margin: 0 0 6px; font-size: 19px; }
.welcome-state p, .loading-state span { margin: 0; color: var(--muted); font-size: 13px; }
.spinner { width: 42px; height: 42px; margin-bottom: 18px; border: 3px solid var(--mint); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { margin: 28px; padding: 16px; color: var(--error); background: #fff1ef; border-left: 3px solid var(--coral); font-size: 14px; }
.result-heading { min-height: 90px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.result-heading h2 { display: inline; margin: 0 0 0 9px; font: 600 19px var(--mono); overflow-wrap: anywhere; }
.result-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.kind-badge { padding: 3px 7px; color: var(--teal-dark); background: var(--mint); font: 600 10px var(--mono); border-radius: 3px; }
.export-button { min-width: 116px; height: 38px; padding: 0 13px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--teal-dark); border: 1px solid #93c9c0; text-decoration: none; font-size: 12px; font-weight: 600; }
.export-button svg { width: 15px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.metric { min-height: 88px; padding: 17px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { font: 600 28px var(--mono); }
.metric.accent { background: #f0f8f5; }
.metric.accent strong { color: var(--teal); }
.warnings { padding: 0 20px; }
.warning { margin: 14px 0; padding: 10px 12px; display: flex; gap: 8px; color: #765718; background: var(--amber); border-left: 3px solid #e4b547; font-size: 11px; }
.warning svg { width: 15px; flex: none; }
.data-section, .source-section { margin: 18px 20px; border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 14px; color: var(--muted); background: #f3f6f5; text-align: left; font-weight: 500; }
td { padding: 12px 14px; border-top: 1px solid #e9eeec; }
td:first-child { color: var(--teal-dark); font-family: var(--mono); overflow-wrap: anywhere; }
.type-chip { padding: 2px 6px; background: #edf3f1; font: 600 10px var(--mono); border-radius: 3px; }
.empty-row { padding: 28px; color: var(--muted); text-align: center; font-size: 12px; }
.domain-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.domain-item { min-width: 0; padding: 11px 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #edf1ef; font: 12px var(--mono); }
.domain-item:nth-child(odd) { border-right: 1px solid #edf1ef; }
.domain-item svg { width: 14px; flex: none; color: var(--teal); }
.domain-item span { overflow: hidden; text-overflow: ellipsis; }
.source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; gap: 10px; }
.source-item { min-width: 0; padding: 11px; background: #f5f8f7; border-left: 3px solid var(--line); }
.source-item.ok { border-color: #23a887; }
.source-item.limited, .source-item.error { border-color: var(--coral); }
.source-item strong { display: block; font-size: 11px; }
.source-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.intelligence-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.intel-card { min-width: 0; padding: 13px; background: #f5f8f7; border-left: 3px solid var(--line); }
.intel-card.ok { border-color: #23a887; }
.intel-card.error { border-color: var(--coral); }
.intel-heading { display: flex; align-items: center; gap: 7px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.intel-heading svg { width: 16px; color: var(--teal); }
.intel-heading strong { font-size: 12px; }
.intel-heading span { margin-left: auto; color: var(--muted); font-size: 10px; }
.intel-card dl { margin: 8px 0 0; }
.intel-card dl div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 5px 0; font-size: 11px; }
.intel-card dt { color: var(--muted); }
.intel-card dd { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.graph { min-height: 150px; padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; background-color: #f5f8f7; background-image: radial-gradient(#bfd8d3 1px, transparent 1px); background-size: 16px 16px; }
.graph-node { max-width: 220px; padding: 9px 12px; display: flex; align-items: center; gap: 7px; color: var(--teal-dark); background: white; border: 1px solid #aad3ca; box-shadow: 0 3px 8px rgba(14, 70, 66, .08); font: 11px var(--mono); animation: node-in .35s both; animation-delay: calc(var(--node-index) * 45ms); }
.graph-node svg { width: 15px; flex: none; }
.graph-node.domain { border-color: var(--coral); color: #a94738; }
.graph-node.asn { border-color: #c7a653; color: #765718; }
@keyframes node-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 16px; }
  .top-status { display: none; }
  .query-inner { min-height: 330px; padding: 32px 16px 26px; }
  h1 { font-size: 29px; }
  .intro { font-size: 13px; }
  .mode-switch { width: 100%; }
  .mode { min-width: 0; flex: 1; }
  .search-form { height: auto; grid-template-columns: 44px 1fr; overflow: visible; background: transparent; box-shadow: none; border: 0; gap: 0; }
  .search-icon { z-index: 1; grid-row: 1; grid-column: 1; margin-left: 15px; }
  .search-form input { height: 54px; grid-row: 1; grid-column: 1 / 3; padding: 0 12px 0 44px; background: white; border-radius: 5px; font-size: 14px; }
  .search-form button { height: 48px; margin-top: 9px; grid-column: 1 / 3; justify-content: center; border-radius: 5px; }
  .search-foot span:last-child { display: none; }
  .workspace { padding: 16px 12px 40px; display: flex; flex-direction: column-reverse; }
  .history-panel, .results-panel { width: 100%; }
  .history-panel { position: static; }
  .result-heading { align-items: flex-start; }
  .export-button { min-width: 40px; width: 40px; padding: 0; }
  .export-button { font-size: 0; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 75px; padding: 13px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric.accent { grid-column: 1 / 3; border-top: 1px solid var(--line); }
  .metric strong { font-size: 23px; }
  .data-section, .source-section { margin: 14px 10px; }
  .domain-list, .source-list, .intelligence-list { grid-template-columns: 1fr; }
  .domain-item:nth-child(odd) { border-right: 0; }
  th, td { padding: 10px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}