/* ============================================
   IP RESEARCH TOOL — Spreadsheet
   ============================================ */

/* Override smooth scroll and dotted bg */
html:has(.research-page-header) {
  scroll-behavior: auto;
}

body:has(.research-page-header) {
  background-image: none;
}

/* ---- Page header (fixed, single line) ---- */
.research-page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.research-page-header .container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.research-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.research-header-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.research-logo {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.research-logo span {
  color: var(--accent);
}

.research-logo-sep {
  margin: 0 8px;
  color: var(--border);
  font-size: 0.9rem;
}

.research-logo-page {   /* the page's h1, kept inline in the header's wordmark row */
  display: inline;
  margin: 0;
  line-height: inherit;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));   /* the accent, dark enough for small text */
  letter-spacing: 0.03em;
}

.research-header-right {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.research-header-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.research-header-link:hover {
  color: var(--text-primary);
}

/* Theme toggle button */
.research-header-theme {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  padding: 0;
}

.research-header-theme:hover {
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--text-primary) 30%, transparent);
}

.research-header-theme .research-theme-sun { display: none; }
.research-header-theme .research-theme-moon { display: block; }

html[data-theme="dark"] .research-header-theme .research-theme-sun { display: block; }
html[data-theme="dark"] .research-header-theme .research-theme-moon { display: none; }

.research-page-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.research-page-title {
  font-family: var(--font-sans);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.1;
}

.research-page-desc {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.5;
}

/* ---- Input bar (fixed below header) ---- */
.research-input-section {
  position: fixed;
  top: var(--research-header-h, 49px);   /* the header's 48px and its line; the script re-measures once it runs, this keeps the bar in place while the page loads */
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) 0;
}

#research-header-spacer { height: var(--research-fixed-total, 108px); }   /* room under the fixed header and input bar before the script measures them (2026-10-12: the tabs were sliding under the header while the page loaded) */

.research-input-section .container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Search bar */
.research-search-bar {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  transition: border-color var(--duration-fast);
}

.research-search-bar:focus-within {
  border-color: var(--text-primary);
}

.research-search-bar.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

.research-search-icon {
  flex-shrink: 0;
  margin-left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.research-search-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
}

.research-search-input::placeholder {
  color: var(--text-muted);
}

/* Clear button + shortcut hint */
.input-clear-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  flex-shrink: 0;
}

.input-clear-btn:hover {
  color: var(--text-primary);
}

.input-clear-btn.visible {
  display: block;
}

.input-shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  flex-shrink: 0;
  opacity: 0.5;
}

.input-shortcut-hint.hidden {
  display: none;
}

.research-attach-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  transition: color var(--duration-fast);
}

.research-attach-btn:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.research-send-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--duration-fast);
}

.research-send-btn:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

/* ---- Sheet toolbar ---- */
.sheet-toolbar {
  display: flex;
  flex-wrap: wrap;               /* when the row runs out of room, the counts move to a second line */
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-md);
  row-gap: 8px;
}

.sheet-actions {
  display: flex;
  gap: 1px;
}

.sheet-action-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast);
}

.sheet-action-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.sheet-action-btn + .sheet-action-btn {
  border-left: none;
}

.sheet-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  white-space: nowrap;
}

/* the share control: shown once there are rows; a snapshot link with a workspace, an address list without one */
.sheet-share {
  display: inline-flex;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.sheet-share[hidden] {
  display: none;
}

.sheet-share:hover {
  color: var(--accent);
}

.sheet-summary {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.sheet-storage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.storage-size {
  opacity: 0.7;
}

.storage-clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: all 0.1s;
}

.storage-clear-btn:hover {
  border-color: #dc2626;
  color: #dc2626;
}

/* ---- View toggles ---- */
.view-toggles {
  display: flex;
  gap: 0;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;                /* the tabs keep their size; the counts give way instead */
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
}

.view-toggle svg {
  flex-shrink: 0;
}

.view-toggle + .view-toggle {
  border-left: none;
}

.view-toggle:hover {
  color: var(--text-primary);
}

.view-toggle.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.view-toggle.active + .view-toggle {
  border-left-color: var(--text-primary);
}

/* the counts the script puts beside the views are not shown in this switcher (a pill switcher with counts was tried on 2026-10-07 and reverted at his ask on 2026-10-08) */
.view-count {
  display: none;
}

/* ---- Summary view ---- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.summary-card {
  background: var(--bg-primary);
  padding: 16px 20px;
}

.summary-card-title {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.summary-stat-big {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.summary-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.summary-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.summary-bar-label {
  width: 80px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.summary-bar-track {
  flex: 1;
  height: 10px;
  background: color-mix(in srgb, var(--border) 50%, transparent);
}

.summary-bar-fill {
  height: 100%;
  background: var(--text-primary);
  opacity: 0.3;
}

.summary-bar-count {
  width: 28px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.65rem;
  flex-shrink: 0;
}

.summary-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 30%, transparent);
}

.summary-list-item:last-child { border-bottom: none; }

.summary-clickable {
  cursor: pointer;
  transition: background 0.1s;
}

.summary-clickable:hover {
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

.summary-list-val {
  color: var(--text-primary);
  font-weight: 500;
}

.summary-list-count {
  color: var(--text-muted);
  font-size: 0.6rem;
}

/* ---- Inline progress bar ---- */
.research-progress-inline {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.research-progress-inline.active {
  display: flex;
}

.research-progress-track {
  flex: 1;
  height: 2px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.research-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--text-primary);
  transition: width 0.3s ease;
}

.research-progress-text {
  color: var(--text-muted);
  white-space: nowrap;
}

.research-progress-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 4px;
  line-height: 1;
}

.research-progress-cancel:hover {
  color: var(--text-primary);
}

/* ---- Queue (legacy compat) ---- */
.research-queue .container,
.research-analytics .container,
.research-results .container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.research-queue {
  padding: var(--space-lg) 0 var(--space-lg);
  display: none;
}

.research-queue.active {
  display: block;
}

.research-queue-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-bottom: var(--space-lg);
}

.research-queue-progress {
  flex: 1;
  height: 3px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.research-queue-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--text-primary);
  transition: width 0.3s ease;
}

.research-queue-text {
  color: var(--text-muted);
  white-space: nowrap;
}

.research-queue-cancel {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}

.research-queue-cancel:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* ---- Analytics + Map Panel ---- */
.research-analytics {
  padding: 0 0 var(--space-3xl);
  display: none;
}

.research-analytics.active {
  display: block;
}

.research-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.research-analytics-cell {
  background: var(--bg-primary);
  padding: var(--space-lg);
}

.research-analytics-cell-map {
  grid-row: 1 / 3;
  grid-column: 2;
  padding: 0;
  position: relative;
  min-height: 320px;
}

.research-analytics-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* Bar charts */
.research-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.research-bar-label {
  width: 90px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.research-bar-track {
  flex: 1;
  height: 14px;
  background: color-mix(in srgb, var(--border) 40%, transparent);
  position: relative;
}

.research-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--text-primary);
  opacity: 0.2;
  transition: width 0.4s ease;
}

.research-bar-count {
  width: 28px;
  text-align: right;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Signal summary chips */
.research-signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.research-signal-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.research-signal-chip-label {
  color: var(--text-muted);
}

.research-signal-chip-val {
  font-weight: 500;
  color: var(--text-primary);
}

.research-signal-chip-val.flagged {
  color: var(--accent, #2563eb);
}

.research-signal-chip-val.threat {
  color: #dc2626;
}

/* ---- Networks view ---- */
.networks-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.networks-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.net-asn-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.net-asn-link:hover { text-decoration: underline; }

.net-count { font-weight: 600; color: var(--text-primary); }

.net-countries { font-size: 0.7rem; color: var(--text-muted); }

.net-bar {
  display: inline-block;
  height: 3px;
  background: color-mix(in srgb, var(--accent) 50%, transparent);
  margin-left: 6px;
  vertical-align: middle;
}

.net-threat-count { color: #dc2626; font-weight: 500; }

.net-clickable { cursor: pointer; }
.net-clickable:hover { color: var(--accent); }

.net-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-md) 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.net-page-info {
  color: var(--text-muted);
  margin-right: auto;
}

.net-page-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}

.net-page-btn:hover:not(:disabled) {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.net-page-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.net-page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.view-hidden { display: none !important; }

/* ---- Dot-matrix map view ---- */
.dotmap-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  border: 1px solid var(--border);
  min-height: 420px;
  background: var(--bg-primary);
  position: relative;
}

@media (max-width: 900px) {
  .dotmap-layout {
    grid-template-columns: 1fr;
  }
}

.dotmap-canvas-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

#dotmap-canvas {
  width: 100%;
  height: 420px;
  display: block;
  background: var(--bg-primary);
}

/* MapLibre chrome — hover card, zoom buttons, attribution — in the page's own tones */
.dotmap-tooltip .maplibregl-popup-content {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.45;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  background: var(--bg-primary);
  color: var(--text-primary);
}
.dotmap-tooltip .maplibregl-popup-content span { color: var(--text-muted) !important; }
.dotmap-tooltip .maplibregl-popup-tip { display: none; }

#dotmap-canvas .maplibregl-ctrl-group {
  background: var(--bg-primary);
  border-radius: 0;
  box-shadow: none;
  border: 1px solid var(--border);
}
#dotmap-canvas .maplibregl-ctrl-group button { width: 28px; height: 28px; border-radius: 0; }
#dotmap-canvas .maplibregl-ctrl-group button + button { border-top: 1px solid var(--border); }
#dotmap-canvas .maplibregl-ctrl-group button:hover { background: var(--bg-secondary); }

#dotmap-canvas .maplibregl-ctrl-attrib {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: color-mix(in srgb, var(--bg-primary) 75%, transparent);
  color: var(--text-muted);
}
#dotmap-canvas .maplibregl-ctrl-attrib a { color: var(--text-secondary); }

/* Dark themes: the control glyphs are drawn dark by MapLibre, so invert them there */
[data-theme="dark"] #dotmap-canvas .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
[data-theme="dark"] #dotmap-canvas .maplibregl-ctrl-attrib-button{
  filter: invert(0.8);
}

.dotmap-legend {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border);
}

.dotmap-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dotmap-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dotmap-table-wrap {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: 420px;
  background: var(--bg-primary);
}

.dotmap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.dotmap-table th {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 400;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.dotmap-pct-col {
  text-align: right !important;
}

.dotmap-table td {
  padding: 6px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--text-secondary);
}

.dotmap-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  padding-right: 8px;
}

.dotmap-table td:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
}

.dotmap-table tbody tr:hover td {
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

/* Legacy — keep for compat */
/* ---- Filter / Search Bar ---- */
.research-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.research-search {
  flex: 1;
  min-width: 200px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.5rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  outline: none;
}

.research-search:focus {
  border-color: var(--text-primary);
}

.research-search::placeholder {
  color: var(--text-muted);
}

.research-filter-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.7rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.research-filter-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.research-filter-btn.active {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 5%, transparent);
}

/* ---- History Panel ---- */
.research-history-wrap {
  position: relative;
}

.research-history-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.research-history-panel.open {
  display: block;
}

.research-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
}

.research-history-item:hover {
  background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}

.research-history-ip {
  color: var(--text-primary);
  font-weight: 500;
}

.research-history-meta {
  color: var(--text-muted);
  font-size: 0.6rem;
}

/* ---- Results / Spreadsheet ---- */
.research-results {
  padding: var(--space-xl) 0 var(--space-5xl);
  min-height: calc(100vh - var(--research-fixed-total, 108px));
}

.research-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.research-results-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.research-results-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.research-export-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.8rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}

.research-export-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

/* ---- Table filter bar ---- */
.table-filter-bar {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  margin-bottom: 8px;
}

.table-filter-icon {
  flex-shrink: 0;
  margin-left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.table-filter-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 7px 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
}

.table-filter-input::placeholder {
  color: var(--text-muted);
}

.filter-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 8px;
  flex-shrink: 0;
  line-height: 1;
}

.filter-clear-btn.visible {
  display: flex;
}

.filter-clear-btn:hover {
  color: var(--text-primary);
}

.table-filter-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-right: 10px;
  flex-shrink: 0;
}

.table-filter-count:empty {
  display: none;
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chips:empty {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 4px 2px 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text-primary);
  white-space: nowrap;
}

.filter-chip-key {
  color: var(--accent);
  font-weight: 500;
}

.filter-chip-val {
  color: var(--text-secondary);
}

.filter-chip-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 2px;
  line-height: 1;
}

.filter-chip-x:hover {
  color: var(--text-primary);
}

/* Filter dropdown autocomplete */
.table-filter-bar {
  position: relative;
}

.filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-top: none;
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

.filter-dropdown.open {
  display: block;
}

.filter-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}

.filter-dropdown-item:hover,
.filter-dropdown-item.active {
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
  color: var(--text-primary);
}

.filter-dropdown-key {
  color: var(--accent);
  font-weight: 500;
}

.filter-dropdown-hint {
  color: var(--text-muted);
  font-size: 0.6rem;
}

/* ---- Clean mono table ---- */
.research-table-wrap {
  overflow-x: auto;
}

/* Custom scrollbar */
.research-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.research-table-wrap::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--border) 30%, transparent);
}

.research-table-wrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 30%, transparent);
}

.research-table-wrap::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-muted) 50%, transparent);
}

.research-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.research-table th {
  text-align: left;
  padding: 6px 12px;
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.research-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.research-table th.sortable:hover {
  color: var(--text-primary);
}

.research-table th.sorted {
  color: var(--text-primary);
}

.research-table th .sort-arrow {
  margin-left: 4px;
  opacity: 0.5;
  font-size: 0.5rem;
}

.research-table th.sorted .sort-arrow {
  opacity: 1;
}

.research-table td {
  padding: 6px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 30%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.3;
}

.research-table td:last-child {
  border-right: none;
}

.research-table th {
  border-right: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
}

.research-table th:last-child {
  border-right: none;
}

.research-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.research-table tbody tr:hover td {
  background: color-mix(in srgb, var(--text-primary) 2%, transparent);
}

.research-table tbody tr.active-row td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-bottom-color: color-mix(in srgb, var(--accent) 15%, transparent);
}

.research-table tr.hidden-row {
  display: none;
}

/* New row animation */
.research-table tbody tr.new-row {
  animation: researchRowFade 1.2s ease-out;
}

@keyframes researchRowFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Flash existing row on re-lookup */
.research-table tbody tr.flash-row {
  animation: rowFlash 1.5s ease-out;
}

@keyframes rowFlash {
  0%   { background: color-mix(in srgb, var(--accent) 25%, transparent); }
  100% { background: transparent; }
}

/* Date section headers */
.research-date-header td {
  padding: 0.5rem 20px;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-secondary) 60%, transparent);
  border-top: 1px solid var(--border);
  cursor: default !important;
}

.research-date-header.today td {
  color: var(--accent, #2563eb);
}

/* Empty state */
.empty-state-cell {
  text-align: center;
  padding: 60px 20px !important;
  border-bottom: none !important;
  border-right: none !important;
}

.empty-state-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
  opacity: 0.4;
}

.empty-state-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Cell styles */
/* Star / favorite */
.col-star {
  width: 28px;
  text-align: center;
  padding-left: 8px !important;
  padding-right: 0 !important;
}

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--border);
  line-height: 1;
  padding: 0;
  transition: color 0.1s;
}

.fav-btn:hover {
  color: #f59e0b;
}

.fav-btn.starred {
  color: #f59e0b;
}

.favorites-empty {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.col-num {
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 28px;
  text-align: center;
}

.cell-ip {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.ip-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  padding: 0 0 0 8px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}

tr:hover .ip-copy-btn {
  opacity: 0.6;
}

.ip-copy-btn:hover {
  opacity: 1 !important;
  color: var(--accent);
}

.ip-copy-btn.copied {
  opacity: 1 !important;
  color: #16a34a;
}

.cell-country {
  text-transform: uppercase;
  font-size: 0.8rem;
}

.cell-city,
.cell-org,
.cell-op {
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-asn {
  color: var(--text-primary);
  font-size: 0.8rem;
}

.cell-type {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.cell-vpn {
  font-size: 0.8rem;
}

.cell-notes {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  min-width: 120px;
  white-space: normal;
  max-width: 200px;
  outline: none;
  cursor: text;
}

.cell-notes:focus {
  color: var(--text-primary);
  font-style: normal;
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

/* Badges */
.cell-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 1px 7px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-clean {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-threat {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
}

.badge-tor {
  color: #dc2626;
  background: transparent;
  border-color: rgba(220, 38, 38, 0.4);
}

.badge-vpn-yes {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 1px 7px;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.badge-vpn-no {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.research-tag.user-tag {
  color: var(--text-secondary);
  border-color: var(--text-secondary);
}

.research-tag.diff {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border-color: #f59e0b;
  color: #b45309;
}

/* Star button */
.research-star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}

.research-star:hover {
  opacity: 0.8;
}

.research-star.starred {
  color: #f59e0b;
  opacity: 1;
}

/* Notes indicator */
.research-note-indicator {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  margin-left: 4px;
  vertical-align: middle;
}

/* External links dropdown */
.research-ext {
  position: relative;
  display: inline-block;
}

.research-ext-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 1;
}

.research-ext-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.research-ext-panel {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 2px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  z-index: 20;
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.research-ext-panel.open {
  display: block;
}

.research-ext-link {
  display: block;
  padding: 0.45rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.research-ext-link:hover {
  background: color-mix(in srgb, var(--text-primary) 3%, transparent);
  color: var(--text-primary);
}

/* Row error state */
.research-table tr.error td {
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Detail / notes row ---- */
.research-detail-row td {
  padding: 0.8rem;
  background: color-mix(in srgb, var(--bg-secondary) 30%, transparent);
  white-space: normal;
  cursor: default !important;
}

.research-detail-inner {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}

.research-detail-notes {
  flex: 1;
}

.research-detail-notes textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 48px;
}

.research-detail-notes textarea:focus {
  border-color: var(--text-primary);
}

.research-detail-tags {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.research-detail-tag-input {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.4rem;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  width: 80px;
}

.research-tag-remove {
  cursor: pointer;
  margin-left: 2px;
  opacity: 0.5;
}

.research-tag-remove:hover {
  opacity: 1;
}

/* ---- Table footer / pagination ---- */
.research-table-footer {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.research-table-footer.active {
  display: flex;
}

.research-pagination {
  display: flex;
  gap: 4px;
  align-items: center;
}

.research-pagination button {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.3rem 0.6rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}

.research-pagination button:hover:not(:disabled) {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.research-pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.research-pagination .page-info {
  padding: 0 var(--space-sm);
  color: var(--text-muted);
}

/* ---- Tooltip Popover ---- */
.research-tooltip {
  position: fixed;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 2000;
  max-width: 340px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.research-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.research-tooltip-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  word-break: break-word;
  line-height: 1.4;
}

.research-tooltip-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-size: 0.65rem;
}

.research-tooltip-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.research-tooltip-value {
  color: var(--text-primary);
  word-break: break-word;
}

/* ---- JSON Detail Modal ---- */
.research-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.research-modal-overlay.open {
  display: flex;
}

.research-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  max-width: 800px;
  max-height: 80vh;
  width: 90%;
  display: flex;
  flex-direction: column;
}

.research-modal-header {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
}

.research-modal-header h3 {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.research-modal-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.research-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.research-modal-close:hover {
  color: var(--text-primary);
}

.research-modal-body {
  padding: 1rem;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.research-modal-body .modal-ext-links {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.research-modal-body .modal-ext-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.65rem;
  transition: all 0.15s;
}

.research-modal-body .modal-ext-links a:hover {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

.research-modal-body .modal-notes-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.research-modal-body .modal-notes-section label {
  display: block;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.research-modal-body .modal-notes-section textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  outline: none;
  resize: vertical;
  min-height: 60px;
}

.research-modal-body .modal-notes-section textarea:focus {
  border-color: var(--text-primary);
}

.research-modal-body .modal-tags-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

.research-modal-body .modal-json {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.research-modal-body .modal-json label {
  display: block;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.research-modal-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.65rem;
  line-height: 1.5;
  background: color-mix(in srgb, var(--bg-secondary) 30%, transparent);
  padding: 0.8rem;
  border: 1px solid var(--border);
  color: var(--text-primary);
  max-height: 300px;
  overflow: auto;
}

/* ---- Changes section in modal ---- */
.research-modal-body .modal-changes {
  margin-bottom: 1rem;
}

.research-modal-body .change-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0.5rem 0.6rem;
  border-left: 2px solid #f59e0b;
  background: color-mix(in srgb, #f59e0b 5%, transparent);
  margin-bottom: 0.4rem;
}

.research-modal-body .change-path {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.research-modal-body .change-values {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
}

.research-modal-body .change-old {
  color: #ef4444;
  text-decoration: line-through;
}

.research-modal-body .change-new {
  color: #22c55e;
}

/* Toast */
.research-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-dark, #1a1a1a);
  color: var(--text-on-dark, #fff);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  z-index: 2000;
  animation: toastFade 2s ease-in-out;
  pointer-events: none;
}

@keyframes toastFade {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .research-hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .research-input-grid {
    flex-direction: column;
  }

  .research-analytics-grid {
    grid-template-columns: 1fr;
  }

  .research-analytics-cell-map {
    grid-row: auto;
    grid-column: auto;
    min-height: 250px;
  }

  .research-stats {
    gap: var(--space-lg);
  }

  .research-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .research-search {
    min-width: 0;
  }
}

/* ---- Detail Drawer ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.06);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
}

.drawer-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.drawer-nav-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.drawer-title {
  flex: 1;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
  min-width: 0;
  cursor: pointer;
}

.drawer-title::after {
  content: 'COPY';
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.drawer-title:hover::after {
  opacity: 1;
}

.drawer-title:hover {
  color: var(--text-secondary);
}

.drawer-title.copied::after {
  content: 'COPIED';
  opacity: 1;
  color: var(--text-primary);
}

.drawer-title.copied {
  color: var(--text-primary);
}

.drawer-refetch-inline {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.drawer-refetch-inline:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.drawer-refetch-inline.loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* drawer-close is hidden, close via overlay or Esc */

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Drawer sections */
.drawer-section {
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.drawer-section-title {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.drawer-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.drawer-label {
  color: var(--text-muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}

.drawer-value {
  color: var(--text-primary);
  word-break: break-word;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  transition: color 0.15s;
}

.drawer-value:hover,
.drawer-value:hover > span {
  color: var(--text-muted);
}

.drawer-value a {
  color: var(--accent);
  text-decoration: none;
}

.drawer-value a:hover {
  text-decoration: underline;
}

.drawer-copy {
  opacity: 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 4px;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}

.drawer-value:hover .drawer-copy {
  opacity: 1;
}

.drawer-copy:hover {
  color: var(--text-primary);
}

.drawer-copy.copied {
  opacity: 1;
  color: var(--text-primary);
}

/* Threat flags row */
.drawer-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Scores row */
.drawer-scores {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.drawer-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.drawer-score-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
}

.drawer-score-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* JSON block */
.drawer-json {
  margin: 0;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: color-mix(in srgb, var(--bg-secondary) 40%, transparent);
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
}

/* External links in drawer */
.drawer-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.drawer-link {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.1s;
}

.drawer-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   API KEY, LOCKED ATTRIBUTES, COLUMN TOGGLE
   Without a key the tool looks addresses up through keyless ipdata.free, which returns
   location and network. The other columns stay in place and show how to get them.
   ============================================ */

/* ---- The key control in the header ---- */
.research-key {
  position: relative;
}

.research-key-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--duration-fast);
}

.research-key-btn:hover,
.research-key-btn[aria-expanded="true"] {
  color: var(--text-primary);
}

.research-key-btn:focus-visible,
.research-key-save:focus-visible,
.research-key-remove:focus-visible,
.research-notice-action:focus-visible,
.cell-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.research-key-btn.has-problem {
  color: #dc2626;
}

.research-key-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.research-key-panel[hidden] {
  display: none;
}

.research-key-title {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.research-key-row {
  display: flex;
  gap: 6px;
}

.research-key-input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  background: transparent;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  outline: none;
  -webkit-text-security: disc;   /* masked like a password, without inviting a password manager to save it */
  transition: border-color var(--duration-fast);
}

.research-key-input:placeholder-shown {
  -webkit-text-security: none;
}

.research-key-input:focus {
  border-color: var(--text-primary);
}

.research-key-input::placeholder {
  color: var(--text-muted);
}

.research-key-save {
  padding: 0 12px;
  background: var(--text-primary);
  border: 1px solid var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--bg-primary);
  cursor: pointer;
}

.research-key-save:disabled {
  opacity: 0.6;
  cursor: default;
}

.research-key-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-muted);
  cursor: pointer;
}

.research-key-remember input {
  accent-color: var(--text-primary);
  margin: 0;
}

.research-key-msg {
  margin-top: 8px;
  color: var(--text-secondary);
}

.research-key-msg:empty {
  display: none;
}

.research-key-msg.is-error {
  color: #dc2626;
}

.research-key-msg.is-ok {
  color: #16a34a;
}

.research-key-note {
  margin-top: 8px;
  color: var(--text-muted);
}

.research-key-wait {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-secondary);
}

.research-key-wait[hidden] {
  display: none;
}

.research-key-run,
.research-key-share-btn {
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  cursor: pointer;
}

.research-key-share-btn:disabled {
  color: var(--text-muted);
  text-decoration: none;
  cursor: default;
}

.research-key-shares {
  margin-top: 10px;
  color: var(--text-secondary);
}

.research-key-shares[hidden] {
  display: none;
}

.research-key-shares-title {
  color: var(--text-muted);
  margin-bottom: 2px;
}

.research-key-share {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
}

.research-key-share a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

.research-key-share a:hover {
  color: var(--accent);
}

/* a shared snapshot: one line above the table, the same voice as the notice */
.research-shared {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: var(--space-md);
  padding-left: 10px;
  border-left: 2px solid var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.research-shared[hidden] {
  display: none;
}

.research-shared-link {
  flex-shrink: 0;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.research-key-warn {
  color: #dc2626;
}

.research-key-foot-left {
  display: flex;
  gap: 14px;
}

.research-key-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.research-key-remove {
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.research-key-remove:hover {
  color: #dc2626;
}

.research-key-plans {
  margin-left: auto;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
  text-decoration: none;
}

.research-key-plans:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* On a phone the header has no room for the label: the key becomes an icon, and its panel spans the screen */
@media (max-width: 560px) {
  .research-key-btn {
    justify-content: center;
    width: 28px;
    padding: 0;
  }

  .research-key-btn span {
    display: none;
  }

  .research-key-panel {
    position: fixed;
    top: 56px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
  }
}

/* ---- One line under the toolbar for things the visitor has to act on ---- */
.research-notice {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: var(--space-md);
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.research-notice[hidden] {
  display: none;
}

.research-notice.is-error {
  border-left-color: #dc2626;
}

.research-notice-action {
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  cursor: pointer;
}

.research-notice-action[hidden] {
  display: none;
}

.research-notice-close {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0 2px;
  background: none;
  border: none;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.research-notice-close:hover {
  color: var(--text-primary);
}

/* ---- A cell whose value the lookup did not include: the way to get it ---- */
.cell-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));   /* the accent, dark enough for small text */
  cursor: pointer;
}

.cell-cta svg {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
}

.cell-cta:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.research-table td .cell-none,
.cell-none {
  color: var(--text-muted);
}

/* A column nobody in the table has data for carries a lock in its header */
.research-table th.is-locked::after {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 5px;
  vertical-align: -1px;
  background: currentColor;
  opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='1'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='1'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Every column but Notes has a set width, so when columns are hidden the room they leave goes to
   Notes at the end, not to whichever column has the longest text (the owner's, as a rule) */
#research-table th:nth-child(3) { width: 9.5rem; }    /* IP */
#research-table th:nth-child(4) { width: 5rem; }      /* country */
#research-table th:nth-child(5) { width: 8rem; }      /* city */
#research-table th:nth-child(6) { width: 13rem; }     /* registered owner */
#research-table th:nth-child(7) { width: 12rem; }     /* operator */
#research-table th:nth-child(8) { width: 6.5rem; }    /* ASN */
#research-table th:nth-child(9) { width: 5.5rem; }    /* type */
#research-table th:nth-child(10) { width: 6rem; }     /* threat */
#research-table th:nth-child(11) { width: 4rem; }     /* VPN */
#research-table .cell-notes { max-width: none; }

/* ...and can be hidden with the toggle beside the filter */
.research-table.hide-op th[data-col="op"],
.research-table.hide-op td.cell-op,
.research-table.hide-type th[data-col="type"],
.research-table.hide-type td.cell-type,
.research-table.hide-threat th[data-col="threat"],
.research-table.hide-threat td.cell-threat,
.research-table.hide-vpn th[data-col="vpn"],
.research-table.hide-vpn td.cell-vpn {
  display: none;
}

/* ---- The filter and the column toggle share a row ---- */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.table-controls .table-filter-bar {
  flex: 1 1 320px;
  min-width: 0;
  margin-bottom: 0;
}

.col-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast);
}

.col-toggle[hidden] {
  display: none;
}

.col-toggle:hover {
  color: var(--text-primary);
}

.col-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.col-toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 14px;
  border: 1px solid var(--border);
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.col-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  transition: transform var(--duration-fast), background var(--duration-fast);
}

.col-toggle input:checked + .col-toggle-switch {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.col-toggle input:checked + .col-toggle-switch::after {
  transform: translateX(12px);
  background: var(--bg-primary);
}

.col-toggle input:focus-visible + .col-toggle-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- The same message in the drawer, the summary cards and the owners view ---- */
.drawer-locked,
.locked-note {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.drawer-locked {
  margin-top: 8px;
}

.drawer-value .cell-cta {
  cursor: pointer;
}

.net-locked-row td {
  padding: 20px 12px;
  cursor: default;
}

.empty-state-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.empty-state-sub .cell-cta {
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
}

/* ---- The Blocklists view (2026-10-08): the rows asked of nine DNS blocklists, live ---- */
.dnsbl-status { margin: 0 0 .75rem; font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); }
.dnsbl-chip { display: inline-flex; align-items: baseline; gap: .35rem; margin: 0 .3rem .3rem 0; padding: .18rem .45rem; border-radius: 4px; background: color-mix(in srgb, #e5484d 10%, transparent); color: #c03a3e; font-family: var(--font-mono); font-size: .7rem; white-space: nowrap; }
.dnsbl-chip small { font-size: .58rem; color: var(--text-muted); }
.dnsbl-clear, .dnsbl-wait, .dnsbl-n { font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); }
.dnsbl-wait { font-style: italic; }
.dnsbl-note { margin: .9rem 0 0; font-family: var(--font-mono); font-size: .68rem; line-height: 1.5; color: var(--text-muted); }

.drawer-close { display: none; margin-left: 6px; }   /* on a wide screen the overlay closes the drawer; on a phone, where the drawer fills the screen, this button does */

/* ---- Phones (2026-10-15): the view bar scrolls sideways within itself instead of widening the page,
   the empty state sits in view inside the wide table, the drawer takes the whole width ---- */
@media (max-width: 767px) {
  .view-toggles { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: calc(-1 * var(--container-padding)); margin-right: calc(-1 * var(--container-padding)); padding-left: var(--container-padding); padding-right: var(--container-padding); }
  .view-toggles::-webkit-scrollbar { display: none; }
  .view-toggle { flex: 0 0 auto; }
  .research-table tr.empty-state .empty-state-inner { position: sticky; left: 0; width: calc(100vw - 2 * var(--container-padding) - 40px); }
  .research-table tr.empty-state td { white-space: normal; }
  .empty-state-text, .empty-state-sub { text-align: center; }
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-close { display: flex; }
}
