
/* ==========================================================================
   Abuse Radar design system
   Tokens -> primitives -> components -> layout -> responsive.
   ========================================================================== */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #060a0f;
  --surface: #0d141d;
  --surface-2: #121b26;
  --surface-3: #18232f;
  --line: rgba(148, 176, 205, .14);
  --line-strong: rgba(148, 176, 205, .26);

  /* Ink */
  --text: #e9eff6;
  --text-2: #adbccb;
  --text-3: #7d8fa1;

  /* Brand */
  --accent: #4fd1c5;
  --accent-dim: #2c9d95;
  --accent-ink: #04191c;
  --gold: #d7a64a;

  /* Status (always paired with a text label, never colour alone) */
  --sev-critical: #ff6b6b;
  --sev-high: #ff9f5a;
  --sev-medium: #ddb050;
  --sev-low: #8fa3b6;
  --ok: #3fbf9f;
  --warn: #ddb050;
  --danger: #ff6b6b;

  /* Categorical series - fixed order, never cycled */
  --cat-ssh: #7087d5;
  --cat-mail: #05a388;
  --cat-leak: #b68028;
  --cat-other: #b570af;

  /* Spacing scale (4px base) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .34);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1360px;
  --maxw-wide: 1760px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.55 var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 15% -8%, rgba(79, 209, 197, .07), transparent 62%),
    radial-gradient(900px 460px at 88% -4%, rgba(215, 166, 74, .06), transparent 58%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: #fff; letter-spacing: -.01em; margin: 0; font-weight: 700; }
h1 { font-size: 20px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.25; }
h3 { font-size: 15px; line-height: 1.3; }
p  { margin: 0; color: var(--text-2); }
a  { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #7ce7dc; }
code, .mono { font-family: var(--mono); font-size: .92em; }

/* Accessibility -------------------------------------------------------- */
.skip-link {
  position: absolute; left: var(--s3); top: -60px; z-index: 100;
  padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  transition: top .15s ease;
}
.skip-link:focus { top: var(--s3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* A <table> ignores width:1px and lays out at min-content, so it must be
   wrapped rather than carry this class itself; clip-path contains anything
   that still overflows. */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.visually-hidden table { position: absolute; }
/* Captions stay in the table's flow but are not painted. */
.visually-hidden-caption {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Layout --------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s6); }
/* Data-dense pages use the viewport instead of the reading-width cap, while
   keeping comfortable gutters. min() keeps it fluid rather than stepped. */
.wrap-wide { max-width: min(var(--maxw-wide), 100% - 2 * var(--s6)); }
main.wrap { padding-top: var(--s6); padding-bottom: var(--s8); }
.stack > * + * { margin-top: var(--s6); }

/* Header --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8, 13, 19, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex; align-items: center; gap: var(--s5);
  min-height: 62px; padding-top: var(--s2); padding-bottom: var(--s2);
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; flex: 0 0 auto; }
.brand:hover { color: inherit; }
.mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--gold));
  color: var(--accent-ink); font-weight: 900; font-size: 14px; letter-spacing: -.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 15px; font-weight: 750; }
.brand-text span { color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

.site-nav { display: flex; align-items: center; gap: var(--s1); margin-left: auto; flex-wrap: wrap; }
.site-nav a, .site-nav button {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 8px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 650;
  border: 1px solid transparent; background: transparent; cursor: pointer; font-family: inherit;
}
.site-nav a:hover, .site-nav button:hover { color: #fff; background: var(--surface-2); }
.site-nav a[aria-current="page"] {
  color: #fff; background: var(--surface-2); border-color: var(--line-strong);
}
.nav-toggle { display: none; }

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: 650 13.5px/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.btn:hover { background: var(--surface-3); border-color: rgba(79, 209, 197, .5); color: #fff; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-primary {
  background: linear-gradient(180deg, #5ee1d6, #33bbb0);
  border-color: #5ee1d6; color: var(--accent-ink); font-weight: 750;
}
.btn-primary:hover { background: linear-gradient(180deg, #6ee9de, #3ac6ba); color: var(--accent-ink); }
.btn-sm { min-height: 32px; padding: 0 var(--s3); font-size: 12.5px; }
.btn-ghost { background: transparent; }

/* Forms ---------------------------------------------------------------- */
label { display: block; }
.field-label {
  display: block; margin-bottom: 6px;
  color: var(--text-2); font-size: 11.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
}
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #0a1119; color: var(--text); font: 400 14px/1.4 var(--sans);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent-dim); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--danger); }
textarea { min-height: 130px; padding: 11px; resize: vertical; line-height: 1.5; }
select {
  appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%237d8fa1' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 11px;
}
.field-hint { margin-top: 5px; color: var(--text-3); font-size: 12.5px; }
.field-error { margin-top: 5px; color: #ff9d9d; font-size: 12.5px; font-weight: 600; }

/* Cards / panels ------------------------------------------------------- */
.card {
  min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.card-pad { padding: var(--s5); }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4);
}
.card-head p { font-size: 13px; }
.section-title { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.section-title .count { color: var(--text-3); font-size: 13px; font-weight: 600; }

/* Stat tiles ----------------------------------------------------------- */
.stat-row {
  min-width: 0;
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.stat {
  position: relative; overflow: hidden; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(215, 166, 74, .8));
}
.stat .stat-label {
  display: block; color: var(--text-3); font-size: 11.5px;
  font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.stat .stat-value {
  display: block; margin-top: 7px; color: #fff;
  font-size: 27px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums;
}
.stat .stat-sub { display: block; margin-top: 5px; color: var(--text-3); font-size: 12.5px; }
.stat.is-alert::before { background: linear-gradient(90deg, var(--sev-high), var(--sev-critical)); }

/* Chips / badges ------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text-2);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip-critical { color: #ffb0b0; background: rgba(255, 107, 107, .14); border-color: rgba(255, 107, 107, .42); }
.chip-high     { color: #ffc79c; background: rgba(255, 159, 90, .13); border-color: rgba(255, 159, 90, .40); }
.chip-medium   { color: #f3d38a; background: rgba(221, 176, 80, .13); border-color: rgba(221, 176, 80, .40); }
.chip-low      { color: #c3d2e0; background: rgba(143, 163, 182, .14); border-color: rgba(143, 163, 182, .36); }
.chip-ok       { color: #7fe6d3; background: rgba(63, 191, 159, .13); border-color: rgba(63, 191, 159, .38); }
.chip-warn     { color: #f3d38a; background: rgba(221, 176, 80, .13); border-color: rgba(221, 176, 80, .40); }
.chip-muted    { color: var(--text-3); }
.chip-unlisted { color: #9fe8d9; background: rgba(63, 191, 159, .10); border-color: rgba(63, 191, 159, .30); }

/* Copyable IP ---------------------------------------------------------- */
.ip-cell { display: inline-flex; align-items: center; gap: 5px; }
.ip-value {
  font-family: var(--mono); font-size: 13.5px; font-weight: 650; color: #fff;
  text-decoration: none; border-bottom: 1px solid rgba(79, 209, 197, .45); padding-bottom: 1px;
}
.ip-value:hover { color: var(--accent); border-bottom-color: var(--accent); }
.copy-btn {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  color: var(--text-3); cursor: pointer; flex: 0 0 auto;
}
.copy-btn:hover { color: var(--accent); background: var(--surface-3); border-color: var(--line); }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn.is-done { color: var(--ok); }

/* Tables --------------------------------------------------------------- */
/* The scroll container must be the element that also carries the rounded
   clip.  Previously .table-wrap had overflow:hidden, so content wider than
   the wrapper was cut off instead of scrolling inside .table-scroll. */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: inherit;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  overscroll-behavior-x: contain;
}
.table-scroll::-webkit-scrollbar { height: 9px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: var(--radius-pill);
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data { table-layout: auto; }
table.data th, table.data td {
  padding: 11px var(--s3); text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { padding-left: var(--s4); }
table.data th:last-child, table.data td:last-child { padding-right: var(--s4); }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: #0a1017; color: var(--text-2);
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(79, 209, 197, .045); }
table.data td.wrap-cell { white-space: normal; min-width: 168px; max-width: 260px; }
/* The timezone hint must not contribute to the column's intrinsic width:
   it is supplementary, and the exact UTC value lives in each cell's title. */
table.data th .tz {
  position: absolute; margin-top: 13px; color: var(--text-3);
  font-size: 9.5px; letter-spacing: .06em; font-weight: 600; pointer-events: none;
}
table.data th { position: sticky; }
table.data th.has-tz { padding-bottom: 18px; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }
.col-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.col-sort:hover { color: #fff; }
.col-sort .arrow { opacity: .35; font-size: 9px; }
.col-sort[aria-sort] .arrow, .col-sort.is-active .arrow { opacity: 1; color: var(--accent); }
.time-cell { display: block; line-height: 1.3; min-width: 108px; }
.time-cell .exact { color: var(--text); font-variant-numeric: tabular-nums; }
.time-cell .ago {
  display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px;
  max-width: 118px; overflow: hidden; text-overflow: ellipsis;
}
.net-cell { display: block; line-height: 1.3; max-width: 200px; white-space: normal; }
.net-cell .place { color: var(--text); font-weight: 600; }
.net-cell .org {
  display: block; color: var(--text-3); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
table.data td:has(.net-cell) { white-space: normal; }

/* Empty / loading / error states --------------------------------------- */
.state {
  display: grid; place-items: center; gap: var(--s3);
  padding: var(--s8) var(--s5); text-align: center; color: var(--text-3);
}
.state h3 { color: var(--text-2); font-size: 15px; }
.state p { font-size: 13.5px; max-width: 44ch; }
.state .state-icon {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text-3);
}
.skeleton {
  border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.notice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4); border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2);
}
.notice strong { color: #fff; }
.notice-ok { border-color: rgba(63, 191, 159, .4); background: rgba(63, 191, 159, .08); }
.notice-error { border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .07); }

/* Pagination ----------------------------------------------------------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; margin-top: var(--s4);
  color: var(--text-3); font-size: 13px;
}
.pager-controls { display: flex; align-items: center; gap: var(--s2); }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart-figure { margin: 0; }
.chart-caption { margin-top: var(--s3); color: var(--text-3); font-size: 12.5px; }

/* Category mix: one 100% stacked bar + direct-labelled legend */
.mix-bar {
  display: flex; gap: 2px; height: 13px; margin-bottom: var(--s4);
  border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-3);
}
.mix-seg { height: 100%; min-width: 3px; }
.mix-seg:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.mix-seg:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.mix-legend { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.mix-item {
  padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); border-left: 3px solid var(--c, var(--accent));
}
.mix-item .mix-name {
  display: block; color: var(--text-2); font-size: 11.5px;
  font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.mix-item .mix-value {
  display: block; margin-top: 5px; color: #fff; font-size: 20px;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.mix-item .mix-share { display: block; margin-top: 2px; color: var(--text-3); font-size: 12px; }

/* Activity bars: single series, one hue, 4px rounded data ends */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 122px; }
.bar-col {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  justify-content: flex-end; height: 100%; position: relative; cursor: default;
}
.bar-fill {
  width: 100%; min-height: 2px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  transition: filter .12s ease;
}
.bar-col:hover .bar-fill { filter: brightness(1.25); }
.bar-col.is-empty .bar-fill { background: var(--surface-3); }
.bar-axis {
  display: flex; justify-content: space-between; margin-top: var(--s2);
  color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums;
}

/* Ranked bar rows: countries, networks */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.rank-row {
  position: relative; display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: var(--s3); padding: 8px 11px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.rank-row .track {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%);
  background: linear-gradient(90deg, rgba(79, 209, 197, .16), rgba(79, 209, 197, .04));
  border-right: 1px solid rgba(79, 209, 197, .3);
}
.rank-row > * { position: relative; }
.rank-name { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; }
.rank-name .primary {
  color: #fff; font-weight: 650; font-size: 13.5px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The link, not just its wrapper, must be the truncating box - otherwise the
   inline anchor still reports (and can lay out at) its full text width. */
.rank-name .primary a {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-name .secondary { color: var(--text-3); font-size: 11.5px; font-family: var(--mono); flex: 0 0 auto; }
.rank-value { color: var(--text); font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* World map ------------------------------------------------------------ */
.map-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(230px, .6fr); gap: var(--s4); align-items: start; }
.world-map {
  position: relative; width: 100%; aspect-ratio: 2 / 1;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(148, 176, 205, .05) 34px 35px),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(148, 176, 205, .05) 46px 47px),
    url("/world-map.svg") center / contain no-repeat,
    #08111a;
}
.map-flows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.map-route {
  fill: none; stroke: rgba(79, 209, 197, .62); stroke-width: .26; stroke-linecap: round;
  /* Dash period is scaled per route so short paths still show several dashes
     instead of one, or none at an unlucky animation offset. */
  stroke-dasharray: var(--dash, .7 2.4); opacity: .85;
  animation: routeflow 3.4s linear infinite; animation-delay: var(--delay, 0s);
}
@keyframes routeflow { to { stroke-dashoffset: var(--flow, -15.5); } }

.map-node {
  position: absolute; width: var(--s, 10px); height: var(--s, 10px);
  margin: calc(var(--s, 10px) / -2) 0 0 calc(var(--s, 10px) / -2);
  border-radius: 50%; background: var(--gold); border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 3px rgba(8, 17, 26, .75), 0 0 0 5px rgba(215, 166, 74, .16);
  z-index: 3; cursor: help;
}
.map-node:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* The hub is a square rotated 45 degrees, so it is distinguishable from the
   round source markers by shape as well as colour. */
.map-hub {
  position: absolute; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  background: var(--accent); border: 2px solid #eafffb; border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px rgba(8, 17, 26, .8), 0 0 0 6px rgba(79, 209, 197, .18);
  z-index: 4; cursor: help;
}
.map-hub::after {
  content: ""; position: absolute; inset: -9px; border-radius: 4px;
  border: 1px solid rgba(79, 209, 197, .35); animation: ping 2.6s ease-out infinite;
}
.map-hub:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }

.map-legend {
  position: absolute; left: 10px; bottom: 10px; z-index: 5;
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: 5px 9px; border-radius: var(--radius-sm);
  background: rgba(6, 12, 18, .82); border: 1px solid var(--line);
  color: var(--text-2); font-size: 10.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { flex: 0 0 auto; }
.map-legend .key-source {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); border: 1px solid rgba(255, 255, 255, .8);
}
.map-legend .key-hub {
  width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg);
  background: var(--accent); border: 1px solid #eafffb;
}
.map-legend .key-route {
  width: 14px; height: 0; border-top: 2px dotted rgba(79, 209, 197, .85);
}
.map-note {
  position: absolute; right: 10px; bottom: 10px; z-index: 5; max-width: 46%;
  padding: 4px 8px; border-radius: var(--radius-sm);
  background: rgba(6, 12, 18, .82); border: 1px solid var(--line);
  color: var(--text-3); font-size: 10.5px;
}
.map-empty { display: grid; place-items: center; height: 100%; color: var(--text-3); font-size: 13.5px; }

/* Attack source matrix -------------------------------------------------- */
.matrix { position: relative; min-width: 0; margin-top: var(--s4); }
.matrix-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.matrix-row {
  display: grid; grid-template-columns: minmax(96px, 172px) minmax(0, 1fr) auto;
  align-items: center; gap: var(--s3); min-width: 0; border-radius: 5px;
  padding: 3px 4px; margin: 0 -4px; cursor: default;
}
.matrix-row:hover, .matrix-row:focus-visible { background: rgba(148, 176, 205, .07); outline: none; }
.matrix-row:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.matrix-label { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.matrix-country {
  color: var(--text); font-size: 12.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.matrix-label em {
  flex: 0 0 auto; color: var(--text-3); font-style: normal;
  font-size: 10.5px; font-family: var(--mono);
}
.matrix-track {
  display: flex; gap: 2px; height: 12px; min-width: 3px;
  border-radius: 3px; overflow: hidden; background: var(--surface-3);
}
.matrix-seg { min-width: 2px; height: 100%; }
.matrix-total {
  color: var(--text); font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}
.matrix-legend {
  display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3);
  color: var(--text-2); font-size: 10.5px;
}
.matrix-legend span { display: inline-flex; align-items: center; gap: 5px; }
.matrix-legend i { width: 9px; height: 3px; border-radius: 2px; background: var(--c); flex: 0 0 auto; }
.matrix-state {
  display: grid; place-items: center; gap: 5px; min-height: 92px;
  color: var(--text-3); font-size: 12.5px; text-align: center;
}
.matrix-tip {
  position: absolute; z-index: 7; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%); transition: opacity .1s ease;
  padding: 8px 10px; border-radius: var(--radius-sm); min-width: 178px;
  background: rgba(6, 12, 18, .97); border: 1px solid var(--line-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5); font-size: 11.5px; color: var(--text);
}
.matrix-tip.is-visible { opacity: 1; }
.matrix-tip b { display: block; color: #fff; margin-bottom: 4px; font-size: 11.5px; }
.matrix-tip .row { display: flex; gap: var(--s3); justify-content: space-between; white-space: nowrap; }
.matrix-tip .row em { font-style: normal; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.matrix-tip .row i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.matrix-tip .row strong { font-variant-numeric: tabular-nums; }
.matrix-tip .sep { display: block; margin: 5px 0; border-top: 1px solid var(--line); }
.matrix-tip .asn { display: block; color: var(--text-3); font-size: 10.5px; white-space: normal; }

/* Cards in this row size to their content instead of stretching to the
   tallest sibling, which is what left the Attack mix card ~294px blank. */
.grid-2-fit { align-items: start; }

/* Threat activity timeline --------------------------------------------- */
.map-col { display: grid; gap: var(--s4); align-content: start; min-width: 0; }

.activity {
  min-width: 0; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.activity-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3);
}
.activity-head h3 { font-size: 14px; }
.activity-sub { margin-top: 3px; color: var(--text-3); font-size: 11.5px; }

.range-tabs {
  display: inline-flex; gap: 2px; padding: 2px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.range-tabs button {
  min-height: 26px; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-3); cursor: pointer;
  font: 700 11.5px/1 var(--sans); letter-spacing: .04em;
}
.range-tabs button:hover { color: var(--text); background: var(--surface-3); }
.range-tabs button[aria-selected="true"] {
  background: var(--surface-3); color: #fff; box-shadow: inset 0 0 0 1px var(--line-strong);
}

.activity-kpis {
  display: grid; gap: var(--s2); margin-bottom: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.activity-kpi {
  min-width: 0; padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  border-left: 3px solid var(--c, var(--line-strong));
}
.activity-kpi .k {
  display: block; color: var(--text-3); font-size: 9.5px;
  font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-kpi .v {
  display: block; margin-top: 3px; color: #fff; font-size: 17px;
  font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums;
}

.activity-plot { position: relative; min-width: 0; }
.activity-plot svg { display: block; max-width: 100%; height: auto; }
.act-grid { stroke: var(--line); stroke-width: .5; }
.act-bar { fill: var(--cat-mail); }
.act-bar-hit { fill: transparent; }
.activity-plot .act-col:hover .act-bar { fill: #0abfa0; }
.activity-plot .act-col:hover .act-bar-hit { fill: rgba(148, 176, 205, .07); }
.act-line { fill: none; stroke: var(--cat-leak); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.act-area { fill: var(--cat-leak); opacity: .1; }
.act-axis { fill: var(--text-3); font-size: 9px; font-family: var(--sans); }
.act-ymax { fill: var(--text-3); font-size: 9px; font-family: var(--sans); }

.activity-legend {
  display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s2);
  color: var(--text-2); font-size: 11px;
}
.activity-legend span { display: inline-flex; align-items: center; gap: 6px; }
.activity-legend i { width: 10px; height: 3px; border-radius: 2px; background: var(--c); }
.activity-legend i.dot-mark { width: 8px; height: 8px; border-radius: 50%; }

.activity-tip {
  position: absolute; z-index: 6; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%); transition: opacity .1s ease;
  padding: 7px 9px; border-radius: var(--radius-sm); white-space: nowrap;
  background: rgba(6, 12, 18, .96); border: 1px solid var(--line-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5); font-size: 11.5px; color: var(--text);
}
.activity-tip.is-visible { opacity: 1; }
.activity-tip b { display: block; color: #fff; margin-bottom: 3px; font-size: 11px; }
.activity-tip .row { display: flex; gap: var(--s3); justify-content: space-between; }
.activity-tip .row em { font-style: normal; color: var(--text-3); }
.activity-tip .row strong { font-variant-numeric: tabular-nums; }

.activity-note { margin-top: var(--s2); color: var(--text-3); font-size: 10.5px; }
.activity-state {
  display: grid; place-items: center; gap: 6px; min-height: 150px;
  color: var(--text-3); font-size: 12.5px; text-align: center;
}
.activity.is-busy .activity-plot { opacity: .45; transition: opacity .12s ease; }

/* Collector health ----------------------------------------------------- */
.collector-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.collector-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.collector-row .name { display: block; color: #fff; font-size: 13px; font-weight: 650; }
.collector-row .meta { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.state-pill {
  flex: 0 0 auto; min-width: 56px; text-align: center;
  padding: 3px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; border: 1px solid var(--line-strong);
  background: var(--surface-3); color: var(--text-2);
}
.state-live,
.state-reporting,
.state-healthy { color: #7fe6d3; background: rgba(63, 191, 159, .14); border-color: rgba(63, 191, 159, .4); }
.state-idle { color: var(--text-2); background: var(--surface-3); }
/* Awaiting heartbeat rollout: informative, not a fault. */
.state-unmonitored { color: var(--text-2); background: var(--surface-3); border-style: dashed; }
/* Overdue is the only actionable state: silent beyond this sensor's own pattern. */
.state-overdue { color: #ffc79c; background: rgba(255, 159, 90, .14); border-color: rgba(255, 159, 90, .42); }
.state-pending { color: var(--text-3); }
/* Retired is deliberate, not a fault - muted rather than red. */
.state-retired { color: var(--text-3); background: var(--surface-3); border-style: dashed; }
.state-off { color: #ffb0b0; background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .35); }
.collector-row .meta { line-height: 1.5; }
.collector-row .meta br { content: ''; }
.health-note {
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 10.5px; line-height: 1.45;
}

/* ==========================================================================
   Page furniture
   ========================================================================== */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: var(--s6); align-items: start; }
.hero h1, .hero h2 { font-size: 27px; line-height: 1.15; max-width: 20ch; }
.hero .lede { margin-top: var(--s3); font-size: 14.5px; max-width: 62ch; }

.search-card { padding: var(--s5); }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: end; }
.search-form .field { grid-column: 1 / 2; }
.search-form input { min-height: 44px; font-family: var(--mono); font-size: 15px; }
.search-result { grid-column: 1 / -1; margin-top: var(--s3); }
.result-card { padding: var(--s4); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.result-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.result-head .result-ip { font-family: var(--mono); font-size: 16px; font-weight: 700; color: #fff; }
.result-grid { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin-top: var(--s3); }
.result-grid div { padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.result-grid dt, .result-grid .k {
  display: block; color: var(--text-3); font-size: 10.5px;
  font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.result-grid dd, .result-grid .v { display: block; margin: 4px 0 0; color: #fff; font-size: 13.5px; overflow-wrap: anywhere; }
.result-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

/* IP detail page ------------------------------------------------------- */
.ip-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5); align-items: start; padding: var(--s6); }
.ip-hero .ip-title { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.ip-hero h1 { font-family: var(--mono); font-size: 26px; letter-spacing: -.02em; }
.ip-hero .ip-sub { margin-top: var(--s2); font-size: 14px; }
.risk-gauge { display: grid; gap: var(--s2); min-width: 210px; }
.risk-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.risk-fill { height: 100%; width: var(--w, 0%); border-radius: var(--radius-pill); background: var(--sev-low); }
.risk-fill.sev-critical { background: var(--sev-critical); }
.risk-fill.sev-high { background: var(--sev-high); }
.risk-fill.sev-medium { background: var(--sev-medium); }
.risk-meta { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; }
.risk-meta strong { color: #fff; font-variant-numeric: tabular-nums; }
.score-parts { display: grid; gap: 4px; margin-top: var(--s2); }
.score-part { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); font-size: 12px; color: var(--text-3); }
.score-part b { color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }

.kv-grid { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kv {
  padding: var(--s3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); min-height: 66px;
}
.kv dt, .kv .k {
  color: var(--text-3); font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
}
.kv dd, .kv .v { margin: 5px 0 0; color: #fff; font-size: 13.5px; overflow-wrap: anywhere; }
.kv .v small { display: block; margin-top: 2px; color: var(--text-3); font-size: 11.5px; font-weight: 400; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.timeline li {
  position: relative; padding: var(--s3) var(--s3) var(--s3) var(--s6);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.timeline li::before {
  content: ""; position: absolute; left: 14px; top: 18px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.timeline .t-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.timeline .t-head strong { color: #fff; font-size: 13.5px; }
.timeline .t-meta { margin-top: 5px; color: var(--text-3); font-size: 12px; }

/* Filter bar ----------------------------------------------------------- */
/* auto-fit lets the toolbar reflow to as many columns as genuinely fit,
   instead of a fixed 6-column template that eventually overflows. */
.filter-bar {
  display: grid; gap: var(--s3); align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding: var(--s4); border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.filter-bar > .field-search { grid-column: span 2; min-width: 0; }
.filter-bar > * { min-width: 0; }
.filter-actions {
  display: flex; gap: var(--s2); align-items: end; justify-content: flex-end;
  grid-column: 1 / -1;
}
.filter-actions .btn { min-width: 84px; }
@media (min-width: 1100px) {
  .filter-actions { grid-column: span 2; justify-content: flex-start; }
}
.active-filters { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.filter-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
  border-radius: var(--radius-pill); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; text-decoration: none;
}
.filter-tag:hover { color: #fff; border-color: rgba(255, 107, 107, .5); }

/* Blocklists ----------------------------------------------------------- */
.list-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.list-card {
  display: block; padding: var(--s4); text-decoration: none; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.list-card:hover { border-color: rgba(79, 209, 197, .55); color: var(--text); }
.list-card .list-name { display: block; color: #fff; font-size: 17px; font-weight: 700; }
.list-card .list-desc { display: block; margin-top: 4px; color: var(--text-3); font-size: 13px; }
.list-card .list-meta {
  display: flex; gap: var(--s3); margin-top: var(--s3);
  color: var(--text-2); font-size: 12px; font-weight: 650;
}
.list-card .list-meta b { color: #fff; font-variant-numeric: tabular-nums; }

/* Prose / docs --------------------------------------------------------- */
.prose { max-width: 74ch; overflow-wrap: break-word; }
.prose code, .card p code, td code, .field-hint code { overflow-wrap: anywhere; }
.card p, .card h2, .card h3 { overflow-wrap: break-word; }
.prose p + p { margin-top: var(--s3); }
.prose ul, .prose ol { margin: var(--s3) 0; padding-left: var(--s5); color: var(--text-2); }
.prose li + li { margin-top: 6px; }
.code-block {
  margin: 0; padding: var(--s4); overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #070d14; color: #cfe9e5; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
}
.endpoint {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  margin-bottom: var(--s2); font-family: var(--mono); font-size: 13px;
}
.method {
  padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: rgba(63, 191, 159, .15); color: #7fe6d3; border: 1px solid rgba(63, 191, 159, .4);
}
.method-post { background: rgba(221, 176, 80, .14); color: #f3d38a; border-color: rgba(221, 176, 80, .4); }
.grid-2 {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}
.grid-2 > * { min-width: 0; }
/* Two-up only when each column can actually hold its table; otherwise the
   cards stack and each gets the full width instead of a cramped scroller. */
.grid-2-tables {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(min(840px, 100%), 1fr));
}
.grid-2-tables > * { min-width: 0; }
.grid-2-tables .net-cell { max-width: 168px; }
.grid-2-tables table.data td.wrap-cell { min-width: 140px; max-width: 200px; }

/* Modal ---------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; padding: var(--s5);
  background: rgba(3, 7, 11, .74); backdrop-filter: blur(6px);
}
.modal.is-open { display: flex; }
.modal-panel {
  width: min(660px, 100%); max-height: min(82vh, 780px); overflow: auto;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.modal-head {
  position: sticky; top: 0; display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s4); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); background: #0a1017;
}
.modal-head h2 { font-family: var(--mono); font-size: 18px; }
.modal-head p { margin-top: 3px; font-size: 13px; }
.modal-close { width: 34px; height: 34px; min-height: 0; padding: 0; font-size: 20px; line-height: 1; }
.modal-body { padding: var(--s5); }

/* Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: var(--s8); background: rgba(8, 13, 19, .5); }
.footer-inner {
  display: flex; gap: var(--s5); flex-wrap: wrap; justify-content: space-between;
  padding-top: var(--s6); padding-bottom: var(--s6); color: var(--text-3); font-size: 13px;
}
.footer-links { display: flex; gap: var(--s4); flex-wrap: wrap; }
.footer-links a { color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* Toast ---------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(12px);
  z-index: 80; padding: 9px var(--s4); border-radius: var(--radius-pill);
  background: var(--surface-3); border: 1px solid var(--line-strong); color: #fff;
  font-size: 13px; font-weight: 650; opacity: 0; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1400px) {
  .wrap-wide { padding-left: var(--s5); padding-right: var(--s5); }
  .wrap-wide table.data th, .wrap-wide table.data td { padding-left: 10px; padding-right: 10px; }
  .wrap-wide table.data th:first-child, .wrap-wide table.data td:first-child { padding-left: var(--s3); }
  .wrap-wide table.data th:last-child, .wrap-wide table.data td:last-child { padding-right: var(--s3); }
  .wrap-wide .net-cell { max-width: 176px; }
  .wrap-wide table.data td.wrap-cell { min-width: 150px; }
}

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .wrap { padding-left: var(--s4); padding-right: var(--s4); }
  .ip-hero { grid-template-columns: 1fr; }
  .hero h1, .hero h2 { font-size: 24px; }
}

@media (max-width: 780px) {
  .nav-toggle {
    display: inline-flex; margin-left: auto; align-items: center; gap: var(--s2);
    min-height: 38px; padding: 0 var(--s3); border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--surface-2);
    color: var(--text); font: 650 13px/1 var(--sans); cursor: pointer;
  }
  .site-nav {
    display: none; width: 100%; margin: 0; padding-bottom: var(--s3);
    flex-direction: column; align-items: stretch; gap: 2px;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a, .site-nav button { width: 100%; justify-content: flex-start; min-height: 42px; }
  .header-inner { flex-wrap: wrap; }

  /* Tables collapse into readable cards */
  .table-wrap { border: 0; background: transparent; }
  /* Card mode still keeps a scroller: it must never be the page that scrolls. */
  .table-scroll { overflow-x: auto; }
  table.data { font-size: 14px; }
  table.data thead { display: none; }
  table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tbody tr {
    margin-bottom: var(--s3); padding: var(--s3) var(--s4);
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface-2);
  }
  table.data tbody tr:hover { background: var(--surface-2); }
  table.data td {
    display: grid; grid-template-columns: minmax(80px, 34%) minmax(0, 1fr); gap: var(--s3);
    align-items: baseline; padding: 7px 0; white-space: normal; text-align: left;
    overflow-wrap: anywhere;
  }
  table.data td > * { min-width: 0; }
  table.data td::before {
    content: attr(data-label); color: var(--text-3); font-size: 10.5px;
    font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  }
  table.data td.num { text-align: left; }
  table.data td:last-child { border-bottom: 0; padding-bottom: 0; }
  table.data td:first-child { padding-top: 0; }
  .net-cell { max-width: none; }
  .hide-sm { display: none; }
  .pager { flex-direction: column; align-items: stretch; gap: var(--s3); }
  .pager-controls { justify-content: space-between; }
  .pager-controls .btn { flex: 1 1 0; }
}

@media (max-width: 700px) {
  .matrix-row { grid-template-columns: minmax(72px, 96px) minmax(0, 1fr) auto; gap: var(--s2); }
  .matrix-country { font-size: 12px; }
  .matrix-legend { gap: var(--s2); font-size: 10px; }
  .activity-head { flex-direction: column; align-items: stretch; }
  .range-tabs { align-self: flex-start; }
  .activity-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Two short lines beat an ellipsised label. */
  .activity-kpi .k { white-space: normal; min-height: 2em; }
}

@media (max-width: 560px) {
  .wrap { padding-left: var(--s3); padding-right: var(--s3); }
  main.wrap { padding-top: var(--s4); }
  .card-pad { padding: var(--s4); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .stat-value { font-size: 22px; }
  .hero h1, .hero h2 { font-size: 21px; }
  .ip-hero { padding: var(--s4); }
  .ip-hero h1 { font-size: 20px; }
  .search-form { grid-template-columns: 1fr; }
  .search-form .btn { width: 100%; }
  .filter-bar { grid-template-columns: 1fr; padding: var(--s3); }
  .filter-bar > .field-search { grid-column: span 1; }
  .mix-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bars { height: 96px; }
  .modal { padding: 0; }
  .modal-panel { max-height: 100vh; height: 100%; border-radius: 0; width: 100%; }
  .footer-inner { flex-direction: column; gap: var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(190, 214, 235, .34); --line-strong: rgba(190, 214, 235, .5); --text-3: #93a5b6; }
}

@media print {
  .site-header, .site-footer, .filter-bar, .pager, .modal, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
}
