/* ============================================================
   Easy Intel (IP Stalker) — Threatbear Design System
   Token values mirror the design system verbatim:
     _ds/.../tokens/{colors,typography,spacing}.css
   Dark-first, warm espresso "ink" surfaces, single ember accent,
   fixed severity ramp. Sharp industrial radii.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&family=Saira+Condensed:wght@600;700;800&family=Permanent+Marker&display=swap');

:root {
    color-scheme: dark;

    /* ---- Families ---- */
    --font-display: 'Saira Condensed', 'Arial Narrow', sans-serif;
    --font-sans:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
    --font-wordmark: 'Permanent Marker', 'Saira Condensed', cursive;

    /* ---- Weights ---- */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    /* ---- Type scale ---- */
    --text-2xs: 11px;
    --text-xs:  12px;
    --text-sm:  13px;
    --text-base:15px;
    --text-md:  17px;
    --text-lg:  20px;
    --text-xl:  24px;
    --text-2xl: 30px;
    --text-3xl: 38px;
    --text-4xl: 50px;
    --text-5xl: 66px;

    --tracking-wide:  0.04em;
    --tracking-wider: 0.08em;
    --tracking-caps:  0.14em;

    /* ---- Ember (signature accent) ---- */
    --ember-300: #EDA684;
    --ember-400: #E9885E;
    --ember-500: #E2673B;
    --ember-600: #C9542C;

    /* ---- Ink (warm espresso surfaces) ---- */
    --ink-950: #100C0A;
    --ink-900: #15110E;
    --ink-800: #1D1814;
    --ink-700: #26201B;
    --ink-600: #332B24;

    /* ---- Sand (warm neutrals) ---- */
    --sand-50:  #F7F3ED;
    --sand-300: #C4B9A9;
    --sand-400: #A0947F;
    --sand-500: #7C7161;

    /* ---- Severity / status — never recolour ---- */
    --sev-critical: #D23B3B;
    --sev-high:     #E2673B;
    --sev-medium:   #E0A32E;
    --sev-low:      #4A7FB5;
    --sev-info:     #6E7F8C;

    --status-success: #3E8E7E;
    --status-warning: #E0A32E;
    --status-danger:  #D23B3B;

    /* ---- Semantic aliases ---- */
    --surface-base:   var(--ink-950);
    --surface-raised: var(--ink-900);
    --surface-card:   var(--ink-800);
    --surface-inset:  var(--ink-700);
    --surface-hover:  var(--ink-600);

    --text-primary:   var(--sand-50);
    --text-secondary: var(--sand-300);
    --text-muted:     var(--sand-500);
    --text-accent:    var(--ember-500);
    --text-on-accent: var(--ink-950);

    --border-subtle:  rgba(247,243,237,0.08);
    --border-default: rgba(247,243,237,0.14);
    --border-strong:  rgba(247,243,237,0.26);

    --accent:       var(--ember-500);
    --accent-hover: var(--ember-400);
    --accent-press: var(--ember-600);
    --accent-soft:  rgba(226,103,59,0.14);
    --focus-ring:   rgba(226,103,59,0.55);

    /* ---- Radii — sharp/industrial ---- */
    --radius-xs:   2px;
    --radius-sm:   3px;
    --radius-md:   5px;
    --radius-pill: 999px;

    /* ---- Shadows ---- */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.45);
    --shadow-lg: 0 18px 44px rgba(0,0,0,0.55);
    --shadow-focus: 0 0 0 3px var(--focus-ring);

    /* ---- Controls ---- */
    --control-h-sm: 30px;
    --control-h-md: 38px;
    --control-h-lg: 46px;

    /* ---- Motion ---- */
    --dur-fast: 120ms;
    --dur-base: 180ms;
    --dur-slow: 280ms;
    --ease-standard: cubic-bezier(0.2, 0, 0.1, 1);
    --transition-control: background-color var(--dur-fast) var(--ease-standard),
                          border-color var(--dur-fast) var(--ease-standard),
                          color var(--dur-fast) var(--ease-standard),
                          box-shadow var(--dur-fast) var(--ease-standard);
}

@media (prefers-reduced-motion: reduce) {
    :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    background: var(--surface-base);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 40px 24px 80px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    line-height: 1.05;
    letter-spacing: 0.005em;
    text-transform: uppercase;
}

a { color: var(--text-accent); text-decoration: none; transition: color var(--dur-fast) var(--ease-standard); }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

::selection { background: var(--accent-soft); color: var(--text-primary); }

/* A slim line across the top of every page, outside the body's padding. */
.coffee-strip {
    margin: -40px -24px 32px;
    padding: 8px 24px;
    text-align: center;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
}

.coffee-strip a { color: var(--text-secondary); }
.coffee-strip a:hover { color: var(--accent); text-decoration: none; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ============================================================
   Header — compact brand bar: Threatbear mark + product name
   ============================================================ */
header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark-link {
    display: inline-flex;
    align-items: center;
}

.brand-mark-link:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

.brand-mark {
    height: 18px;
    width: auto;
    display: block;
    opacity: 0.92;
    transition: opacity var(--dur-fast) var(--ease-standard);
}

.brand-mark-link:hover .brand-mark,
.brand-mark-link:focus-visible .brand-mark { opacity: 1; }

.brand-divider {
    width: 1px;
    height: 20px;
    background: var(--border-default);
    display: block;
}

.wordmark-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* Wordmark: hand-drawn marker. Its lowercase are small caps, so the
   mixed-case "Easy Intel" reads as a tag; no uppercase transform. */
.logo-text {
    font-family: var(--font-wordmark);
    font-size: 26px;
    font-weight: var(--fw-regular);
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: var(--text-primary);
    transition: color var(--dur-fast) var(--ease-standard);
}

.wordmark-link:hover .logo-text,
.wordmark-link:focus-visible .logo-text { color: var(--accent); }

.wordmark-link:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}


/* Methodology link and Get Feeds, at the right of the header */
.header-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-link {
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-link:hover { color: var(--accent); }
.header-link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* Button, variant=secondary size=sm */

.get-feeds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--control-h-sm);
    padding: 0 12px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-control);
}

.get-feeds-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.get-feeds-btn:active { background: var(--accent-soft); }
.get-feeds-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ============================================================
   Alerts — DS Alert: hairline box with 3px severity left rule
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--sev-info);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.alert[hidden] { display: none; }
.alert strong { color: var(--text-primary); font-weight: var(--fw-semibold); }

.alert-warning { border-left-color: var(--status-warning); }
.alert-warning strong { color: #E6B54E; }
.alert-error   { border-left-color: var(--status-danger); }
.alert-error strong { color: #E56A6A; }
.alert-success { border-left-color: var(--status-success); }
.alert-success strong { color: #5FB8A6; }

/* ============================================================
   Search box — one line, centred, until a paste brings in a list
   ============================================================ */
.search-section {
    width: 100%;
    max-width: 680px;
    margin: clamp(24px, 9vh, 96px) auto 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-title {
    margin-bottom: 8px;
    text-align: center;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--fw-bold);
    line-height: 1.05;
    letter-spacing: 0.005em;
    text-transform: uppercase;
}

.search-section form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: var(--transition-control);
}

.search-field:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

#bulk-input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    background: transparent;
    border: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 22px;
}

#bulk-input::placeholder { color: var(--text-muted); }

.search-notice {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.search-undo {
    padding: 0;
    background: none;
    border: 0;
    color: var(--text-accent);
    font: inherit;
    font-weight: var(--fw-semibold);
    cursor: pointer;
}

.search-undo:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
.search-undo:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.search-count {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.search-count--over { color: var(--status-warning); }

.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* After a lookup: the full width of the results under it, without the
   heading and help; showing its summary, one line without the list tools. */
.search-section--compact { max-width: none; margin-top: 16px; }
.search-section--compact .search-title,
.search-section--compact .search-help,
.search-section--summary .search-notice,
.search-section--summary .search-toolbar { display: none; }
.search-section--summary .search-field { align-items: center; }

.search-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: text;
}
.search-summary__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.search-summary::after { content: '▾'; margin-left: auto; color: var(--text-muted); font-family: var(--font-sans); }
.search-summary:hover { color: var(--text-primary); }
.search-summary:focus-visible { outline: none; }
.search-summary[hidden],
#bulk-input[hidden] { display: none; }

/* These set display, which would otherwise override the hidden attribute. */
.search-notice[hidden],
.search-toolbar[hidden],
.btn[hidden] { display: none; }

.search-help {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--sand-400);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Button, variant=primary size=md */
#bulk-lookup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 8px;
    /* Wide enough for "Lookup 50 IPs", so the box doesn't move as the count changes */
    min-width: 9.5em;
    height: var(--control-h-md);
    padding: 0 18px;
    background: var(--accent);
    color: var(--text-on-accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-control);
}

#bulk-lookup-btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

#bulk-lookup-btn:active:not(:disabled) { background: var(--accent-press); border-color: var(--accent-press); }

#bulk-lookup-btn:disabled { opacity: 0.45; cursor: not-allowed; }

#bulk-lookup-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(16,12,10,0.28);
    border-top-color: var(--text-on-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Results — query bar, decision filters, triage table
   ============================================================ */
.results-card {
    padding: 20px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.results-card > * + * { margin-top: 12px; }

/* The checked IPs on one line, with Edit and Re-run */
/* Button, size=sm: secondary (outline) and primary (ember) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: var(--control-h-sm);
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-control);
}

.btn--secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border-strong); }
.btn--secondary:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); color: var(--text-on-accent); border: 1px solid var(--accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.query-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    letter-spacing: var(--tracking-wide);
    color: var(--text-muted);
}

.heading-spinner {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1;
    flex: none;
    display: inline-block;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.heading-spinner:empty { display: none; }
.heading-spinner.spinning { color: var(--text-secondary); }
.heading-spinner.done     { color: var(--status-success); }
.heading-spinner.fade-out { opacity: 0; }

.results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.decision-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* One tone per verdict, shared by the filter badges, the verdict labels,
   the row rails and the deep-dive cells. */
.count-badge--malicious,
.decision--malicious,
.result-row--malicious { --state: var(--sev-critical); }
.count-badge--suspicious,
.decision--suspicious,
.result-row--suspicious { --state: var(--sev-low); }
.count-badge--ignored,
.decision--ignored,
.result-row--ignored { --state: var(--sev-info); }
.count-badge--no_recent_intel,
.decision--no_recent_intel,
.result-row--no_recent_intel { --state: var(--status-success); }
.count-badge--failed,
.decision--failed,
.result-row--failed { --state: var(--text-muted); }
.count-badge--neighbourhood { --state: var(--sev-high); }

/* Neighbourhood risk 1-5: green through to critical red */
.neighbourhood--1 { --risk: var(--status-success); }
.neighbourhood--2 { --risk: #7E9A5E; }
.neighbourhood--3 { --risk: var(--sev-medium); }
.neighbourhood--4 { --risk: var(--sev-high); }
.neighbourhood--5 { --risk: var(--sev-critical); }

/* Badge, pill + tonal; a toggle that filters the table to its decision */
.count-badge {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-wide);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    color: var(--state);
    background: color-mix(in srgb, var(--state) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--state) 32%, transparent);
    cursor: pointer;
    transition: var(--transition-control);
}

.count-badge:hover:not(:disabled) { border-color: var(--state); }
.count-badge[aria-pressed="true"] {
    background: color-mix(in srgb, var(--state) 30%, transparent);
    border-color: var(--state);
}
.count-badge:disabled { opacity: 0.45; cursor: default; }
.count-badge:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.results-filter {
    flex: 0 1 260px;
    min-width: 160px;
    height: var(--control-h-sm);
    padding: 0 10px;
    background: var(--surface-inset);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    transition: var(--transition-control);
}

.results-filter::placeholder { color: var(--text-muted); }
.results-filter:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }

.results-shown {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

/* Table: one grid row per IP. An open row grows in place: each cell shows
   more about its own column, so every detail sits under its header. */
.result-row {
    display: grid;
    grid-template-columns: 136px 164px 100px 96px minmax(0, 1.4fr) 84px 72px 128px minmax(0, 1.2fr) 14px;
    gap: 12px;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.result-row--head {
    padding-block: 8px;
    background: var(--surface-inset);
    border-bottom: none;
    border-radius: var(--radius-sm);
}

.result-row--head span {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--text-muted);
    white-space: nowrap;
}

.result > .result-row { cursor: pointer; transition: background var(--dur-fast) var(--ease-standard); }
.result > .result-row:hover { background: var(--surface-inset); }
.result > .result-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus-ring); }

/* The row whose drawer is open: outlined, so it's clear which IP is showing */
.result-row--current,
.result-row--current:hover {
    background: var(--surface-inset);
    box-shadow: inset 0 0 0 2px var(--accent);
    border-radius: var(--radius-sm);
}

.result-cell { min-width: 0; }

/* The one-line network summary a closed row shows on narrow screens */
.result-cell--summary { display: none; }

.result-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-cell--feeds .result-value,
.result-cell--abuse .result-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Five pips and the number, in the risk's tone */
.neighbourhood {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--risk);
}

.neighbourhood__pips { display: inline-flex; gap: 3px; }
.neighbourhood__pips i {
    width: 8px;
    height: 8px;
    border-radius: 1px;
    border: 1px solid var(--border-strong);
}
.neighbourhood__pips i.on { background: var(--risk); border-color: var(--risk); }

.result-more { display: none; margin-top: 6px; font-size: var(--text-xs); line-height: 1.5; }

.result-more__label {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--text-muted);
}

.result-more__label:first-child { margin-top: 0; }
.result-more__text { color: var(--text-secondary); overflow-wrap: anywhere; }

.ip-text {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}
a.ip-text { color: inherit; text-decoration: none; }
a.ip-text:hover { text-decoration: underline; text-underline-offset: 3px; }
a.ip-text:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }

/* Feed decision: a state-coloured square and label */
.decision {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--state);
    white-space: nowrap;
}

.decision::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    background: var(--state);
}

.abuse-risk--high   { color: #E56A6A; }
.abuse-risk--medium { color: var(--status-warning); }

.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.result-row .tag-chips { flex-wrap: nowrap; overflow: hidden; }
.tag-chip--more { color: var(--text-muted); }

.result-caret {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    transition: transform var(--dur-fast) var(--ease-standard);
}

.result-row--current .result-caret { color: var(--accent); }

.context-missing { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-xs); }

.results-empty { padding: 16px 12px; font-size: var(--text-sm); color: var(--text-muted); }

/* Context build, feed rule, exclusions and the methodology link */
.results-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

/* Tag */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--fw-regular);
    color: var(--text-secondary);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
}

/* plevin's tags (e.g. TOR): set apart from our feeds' free-text tag chips so
   a feed's "vpn" tag can't be mistaken for plevin's. Info slate rather than
   ember, which reads as high severity. */
.context-chip {
    position: relative;
    color: var(--text-primary);
    font-weight: var(--fw-semibold);
    background: color-mix(in srgb, var(--sev-info) 18%, transparent);
    border: 1px dashed color-mix(in srgb, var(--sev-info) 70%, transparent);
    cursor: help;
}

.context-chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.context-chip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    width: max-content;
    max-width: min(320px, 80vw);
    /* one line per fact */
    white-space: pre-line;
    background: var(--surface-card);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px 9px;
    font-family: var(--font-sans);
    font-size: var(--text-2xs);
    font-weight: var(--fw-medium);
    opacity: 0;
    pointer-events: none;
    transform: translateY(2px);
    transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
    z-index: 10;
}

.context-chip:hover::after,
.context-chip:focus-visible::after { opacity: 1; transform: translateY(0); }


/* ============================================================
   One IP: the drawer beside the results, and the IP page (/ip/<ip>)
   ============================================================ */
.ip-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(680px, 100vw);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-card);
    border-left: 1px solid var(--border-default);
    box-shadow: -24px 0 48px rgba(0, 0, 0, 0.5);
}
.ip-drawer[hidden] { display: none; }

.ip-view { display: flex; flex-direction: column; color: var(--text-secondary); font-size: var(--text-sm); }
.ip-view__head {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 24px 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.ip-view--drawer .ip-view__head { position: sticky; top: 0; z-index: 1; background: var(--surface-card); }
.ip-view__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.ip-view__nav,
.ip-view__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ip-view__btn { min-height: 36px; padding: 0 12px; font-size: var(--text-xs); }
.ip-view__nav .ip-view__btn { min-width: 36px; padding: 0; }
.ip-view__btn:disabled { opacity: 0.4; cursor: default; }
.ip-view__count { margin-left: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.ip-view__close-narrow { display: none; }
.ip-view__back { font-size: var(--text-sm); }
.ip-view__ip {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: var(--fw-semibold);
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.ip-view__ip:focus { outline: none; }
.ip-view__title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ip-view__copy-ip { min-height: 32px; padding: 0 10px; }
/* A tooltip below a header button: what it does and its keys */
.ip-view__tip { position: relative; }
.ip-view__tip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    max-width: min(260px, 80vw);
    padding: 5px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-2xs);
    font-weight: var(--fw-medium);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
    z-index: 3;
}
.ip-view__tip:hover::after,
.ip-view__tip:focus-visible::after { opacity: 1; transform: translateY(0); }
/* Touch screens have no hover: no tooltip to get stuck open */
@media (hover: none) { .ip-view__tip::after { display: none; } }
.ip-view__verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ip-view__verdict .decision { font-size: var(--text-sm); }
.ip-view__why { color: var(--text-secondary); }
.ip-view__asof { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-muted); }
.ip-view__facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
.ip-view__fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ip-view__fact dt {
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
}
.ip-view__fact dd { color: var(--text-primary); overflow-wrap: anywhere; }

.ip-view__body { display: flex; flex-direction: column; gap: 24px; padding: 18px 24px 28px; }
.ip-view__part { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ip-view__part[hidden] { display: none; }
.ip-view__part-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.ip-view__part-title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
}
.ip-view__part-note {
    font-family: var(--font-sans);
    font-size: var(--text-2xs);
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-muted);
}
.ip-view__quiet { color: var(--text-muted); }
.ip-view__more { font-size: var(--text-xs); }

/* Feeds per day, last 30 days */
.ip-spark__bars {
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    gap: 2px;
    align-items: end;
    height: 40px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}
.ip-spark__bar {
    height: calc(3px + var(--feeds) * 8px);
    max-height: 100%;
    border-radius: 1px;
    background: var(--border-strong);
}
.ip-spark__bar--suspicious { background: var(--sev-low); }
.ip-spark__bar--malicious { background: var(--sev-critical); }
.ip-spark__bar--today { outline: 1px dashed var(--text-secondary); outline-offset: 1px; }
.ip-spark__axis {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

/* The history as events, newest first, on a vertical line */
.ip-events { list-style: none; display: flex; flex-direction: column; }
.ip-events__item { display: grid; grid-template-columns: 96px 20px minmax(0, 1fr); column-gap: 10px; }
.ip-events__date {
    padding-top: 9px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}
.ip-events__mark { position: relative; display: flex; justify-content: center; }
.ip-events__mark::before { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--border-default); }
.ip-events__mark::after {
    content: '';
    position: relative;
    margin-top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 3px var(--surface-card);
}
.ip-events__item--malicious .ip-events__mark::after { background: var(--sev-critical); }
.ip-events__item--suspicious .ip-events__mark::after { background: var(--sev-low); }
.ip-events__item--change .ip-events__mark::after { background: var(--status-warning); }
.ip-events__item--quiet .ip-events__mark::after { margin-top: 15px; width: 8px; height: 8px; }
.ip-events__text { padding: 7px 0 14px; min-width: 0; }
.ip-events__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.ip-events__title { color: var(--text-primary); font-weight: var(--fw-medium); }
.ip-events__item--quiet .ip-events__title { color: var(--text-secondary); font-weight: var(--fw-regular, 400); }
.ip-events__note { font-size: var(--text-xs); color: var(--text-muted); }
.ip-events__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ip-events__chip {
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    background: var(--surface-inset);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.ip-events__chip--start { background: var(--accent-soft); color: var(--ember-300); }
.ip-events__chip--feed { font-family: var(--font-mono); color: var(--text-primary); }
.ip-events__chip--change { background: color-mix(in srgb, var(--status-warning) 18%, transparent); color: var(--status-warning); }

/* The IP page: the same view in a card, history and passive DNS side by side */
.ip-page { display: flex; flex-direction: column; gap: 20px; }
.ip-page > .results-card > * + * { margin-top: 0; }
#ip-view.results-card { padding: 0; }
.ip-view--page .ip-view__head { padding: 22px 24px; }
.ip-view--page .ip-view__body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.ip-view--page .ip-view__body--solo { grid-template-columns: minmax(0, 1fr); }

.ip-pdns__list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.ip-pdns__list li {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    justify-content: space-between;
}

.ip-pdns__name { font-family: var(--font-mono); color: var(--text-primary); overflow-wrap: anywhere; }
.ip-pdns__meta { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-muted); }
.ip-pdns__more { margin-top: 10px; font-size: var(--text-2xs); color: var(--text-muted); }

/* The IP page's day-by-day lanes: a grid with one column per UTC day and a
   sticky label column, then one line for the selected day */
.ip-history {
    --history-label: 170px;
    --history-day: 22px;
    --history-gap: var(--surface-card);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.ip-history__title {
    margin-bottom: 10px;
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ip-history__note { margin-bottom: 14px; font-size: var(--text-2xs); color: var(--text-muted); }

/* A line where there is no grid: loading failed, or nothing to show */
.ip-history--quiet .ip-history__title { margin-bottom: 4px; }
.ip-history--quiet .history-legend,
.ip-history--quiet .ip-history__note { display: none; }
.ip-history--quiet .ip-history__body { font-size: var(--text-xs); color: var(--text-muted); }

.history-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 8px;
    font-size: var(--text-xs);
}

.history-legend li { display: flex; align-items: center; gap: 6px; }
.history-legend__swatch { flex: none; width: 12px; height: 12px; border-radius: 2px; background: var(--surface-inset); }
.history-legend__swatch--malicious { background: var(--sev-critical); }
.history-legend__swatch--suspicious { background: var(--sev-low); }
.history-legend__swatch--sightings { background: color-mix(in srgb, var(--accent) 75%, transparent); }
.history-legend__swatch--changed { width: 3px; background: var(--ember-400); border-radius: 0; }

/* Days we have no record of: hatched and muted */
.history-cell.history-cell--untracked,
.history-seg.history-seg--untracked,
.history-legend__swatch.history-legend__swatch--untracked {
    background: repeating-linear-gradient(135deg, transparent 0 4px, var(--border-default) 4px 5px), var(--surface-base);
    color: var(--text-muted);
}

/* Days whose plevin view wasn't recorded at the time: lighter, dashed */
.history-seg.history-seg--unrecorded,
.history-legend__swatch.history-legend__swatch--unrecorded {
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
}

.history-scroll { overflow-x: auto; padding-right: 28px; margin-bottom: 16px; }

.history-grid {
    position: relative;
    min-width: calc(var(--history-label) + 30 * var(--history-day) + 28px);
    display: flex;
    flex-direction: column;
}

.history-row {
    display: grid;
    grid-template-columns: var(--history-label) repeat(30, minmax(var(--history-day), 1fr));
    align-items: center;
}

.history-label {
    position: sticky;
    left: 0;
    z-index: 2;
    padding-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--history-gap);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* The label fills its row, so nothing shows through it as the grid scrolls */
.history-label { align-self: stretch; line-height: 26px; }
.history-row--feed .history-label,
.history-row--axis .history-label { line-height: 22px; }
.history-row--feed .history-label { font-family: var(--font-mono); }
.history-label__days { color: var(--text-muted); }

.history-group {
    margin: 14px 0 4px;
    font-size: var(--text-2xs);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
}

/* The selected day's column */
.history-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--history-label) + (100% - var(--history-label)) * var(--history-selected, 29) / 30);
    width: calc((100% - var(--history-label)) / 30);
    z-index: 1;
    border: 2px solid var(--text-primary);
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* Every day is a button: the axis, count and feed cells */
.history-cell {
    display: block;
    width: 100%;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--surface-inset);
    box-shadow: inset 0 0 0 1.5px var(--history-gap);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-primary);
    cursor: pointer;
}

.history-cell:focus-visible { outline: none; box-shadow: var(--shadow-focus); position: relative; z-index: 3; }

/* Today is provisional: its cells are outlined, not solid */
.history-cell--provisional { outline: 1px dashed var(--text-secondary); outline-offset: -3px; }

.history-cell--axis {
    height: 22px;
    background: transparent;
    box-shadow: none;
    font-size: var(--text-2xs);
    text-align: left;
    white-space: nowrap;
    overflow: visible;
    color: var(--text-muted);
}

.history-cell.history-cell--axis { background: transparent; }
.history-cell--axis[aria-pressed="true"] { color: var(--text-primary); }

.history-cell--count { height: 26px; font-weight: var(--fw-semibold); }
.history-cell--malicious { background: var(--sev-critical); }
.history-cell--suspicious { background: var(--sev-low); }

/* Ember shade by sightings that day */
.history-cell--step-1 { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.history-cell--step-2 { background: color-mix(in srgb, var(--accent) 75%, transparent); }
.history-cell--step-3 { background: var(--accent); }

.history-seg {
    display: flex;
    align-items: center;
    height: 26px;
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--text-xs);
    box-sizing: border-box;
    background: var(--surface-inset);
    box-shadow: inset 0 0 0 1.5px var(--history-gap);
}

.history-seg--blank { color: var(--text-muted); background: transparent; }

/* A change starts here */
.history-seg--changed { border-left: 3px solid var(--ember-400); }

/* plevin's tags, dashed like the app's plevin tag chips */
.history-seg--tags.history-seg--recorded:not(.history-seg--blank) {
    border: 1px dashed color-mix(in srgb, var(--sev-info) 70%, transparent);
    background: color-mix(in srgb, var(--sev-info) 18%, transparent);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

.history-seg--level-low { background: color-mix(in srgb, var(--sev-low) 35%, transparent); }
.history-seg--level-medium { background: color-mix(in srgb, var(--sev-medium) 35%, transparent); }
.history-seg--level-high,
.history-seg--level-critical { background: color-mix(in srgb, var(--sev-critical) 50%, transparent); }

/* The selected day, one line under the grid: only what the grid can't show */
.history-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-secondary);
}
.history-line__date { font-family: var(--font-mono); font-weight: var(--fw-semibold); color: var(--text-primary); }
.history-line__name { font-family: var(--font-mono); color: var(--text-primary); }
.history-line__tags,
.history-line__quiet { color: var(--text-muted); }
.history-line__time { font-family: var(--font-mono); color: var(--text-primary); }
.history-line__plevin-changes { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.history-line__change,
.history-line__was {
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    background: color-mix(in srgb, var(--status-warning) 18%, transparent);
    color: var(--status-warning);
}
/* plevin's values for the day: only on a phone, where the lanes have no room for words */
.history-line__plevin { display: none; }

@media (max-width: 760px) {
    /* A list on a phone: Lookup goes full width under the box */
    .search-section--list:not(.search-section--summary) .search-field { flex-wrap: wrap; }
    .search-section--list:not(.search-section--summary) #bulk-input { flex-basis: 100%; }
    .search-section--list:not(.search-section--summary) #bulk-lookup-btn { flex: 1 1 100%; }
    .ip-history { --history-label: 96px; }
    .history-line { flex-direction: column; gap: 4px; }
    .history-line__plevin-changes { margin-left: 0; }
    .history-line__plevin { display: grid; grid-template-columns: 96px minmax(0, 1fr); width: 100%; margin-top: 6px; }
    .history-line__plevin dt,
    .history-line__plevin dd { padding: 6px 0; border-top: 1px solid var(--border-subtle); }
    .history-line__plevin dt { font-size: var(--text-xs); color: var(--text-secondary); }
    .history-line__plevin dd { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; color: var(--text-primary); overflow-wrap: anywhere; }
}

.ip-missing { display: flex; flex-direction: column; gap: 12px; }
.ip-missing p { color: var(--text-secondary); }
.ip-missing code { font-family: var(--font-mono); color: var(--text-primary); }

/* ============================================================
   Performance metrics — StatBlock grid
   ============================================================ */
.timing-card {
    padding: 20px 24px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.timing-title {
    font-size: var(--text-md);
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.timing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.timing-item {
    padding: 14px;
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.timing-label {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    margin-bottom: 8px;
}

.timing-value {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    line-height: 1;
    color: var(--text-primary);
}

/* ============================================================
   Get Feeds modal — DS Dialog
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(16, 12, 10, 0.72);
    backdrop-filter: blur(3px);
    animation: fadeIn var(--dur-base) var(--ease-standard);
}

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

.modal {
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: var(--text-lg);
    letter-spacing: 0.02em;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-control);
}

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

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-loading, .modal-empty, .modal-error {
    padding: 16px 0;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.modal-error { color: var(--sev-critical); }

.feeds-field { margin: 0; }

.feeds-field label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
}

.feeds-field select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    appearance: none;
    background: var(--surface-inset);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition-control);
}

.feeds-field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }

.feeds-link-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.feeds-link-row input {
    flex: 1;
    min-width: 0;
    height: var(--control-h-md);
    padding: 0 12px;
    background: var(--surface-inset);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.feeds-copy-btn {
    flex: none;
    height: var(--control-h-md);
    padding: 0 16px;
    background: var(--accent);
    color: var(--text-on-accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: var(--transition-control);
}

.feeds-copy-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.feeds-copy-btn:active { background: var(--accent-press); border-color: var(--accent-press); }


/* The list's rules in Get Feeds: what it excludes, in two groups */
.feed-rules {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.feed-rules__intro { color: var(--text-secondary); margin-bottom: 4px; }
.feed-rules__heading {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--text-muted);
}

.feed-rules__row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-muted); }
.feed-rules__row > span:first-child { flex: 1; min-width: 0; }
.feed-rules__row::before { content: "·"; width: 12px; flex: none; }
.feed-rules__row--excluded { color: var(--text-primary); }
.feed-rules__row--excluded::before { content: "✕"; color: var(--status-warning); font-weight: var(--fw-bold); }
.feed-rules__count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }

.feeds-generated-at {
    margin: 0;
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

.feeds-modal-disclaimer { margin: 0 20px 20px; }

/* ============================================================
   Sources & methodology page
   ============================================================ */
.doc {
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 28px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.doc h1 { font-size: var(--text-3xl); text-wrap: balance; }
.doc h2 { font-size: var(--text-xl); margin-bottom: 10px; }
.doc h3 { font-size: var(--text-md); margin-bottom: 6px; }
.doc section > * + * { margin-top: 12px; }
.doc p { color: var(--text-secondary); max-width: 68ch; }
.doc strong { color: var(--text-primary); font-weight: var(--fw-semibold); }
.doc code { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); background: var(--surface-inset); padding: 1px 5px; border-radius: var(--radius-xs); }
.doc-lede { font-size: var(--text-md); }
.doc-note { color: var(--text-muted) !important; font-style: italic; }
.doc-stat {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted) !important;
}

.doc-feeds {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
}

.doc-feeds li {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 3px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    background: var(--surface-inset);
    color: var(--text-secondary);
}

.doc-states, .doc-fields { display: flex; flex-direction: column; gap: 10px; }
.doc-states > div, .doc-fields > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; }
.doc-states dd, .doc-fields dd { color: var(--text-secondary); font-size: var(--text-sm); }
.doc-fields dt {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--text-muted);
    padding-top: 2px;
}

/* A reference table on the Sources page; scrolls sideways only if it must. */
.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.doc-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: var(--fw-semibold);
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid var(--border-default);
}
.doc-table td {
    color: var(--text-secondary);
    padding: 8px 12px 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}
.doc-table code { white-space: nowrap; }

.doc-callout {
    padding: 14px 16px;
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--status-warning);
    border-radius: var(--radius-sm);
}

/* ============================================================
   Responsive — below 760px each row becomes a card: IP and decision
   on top, network on one line, and every column labelled when open
   ============================================================ */
@media (max-width: 760px) {
    body { padding: 20px 14px 60px; }

    .coffee-strip { margin: -20px -14px 20px; padding: 8px 14px; }

    header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .logo-link { gap: 10px; }
    .logo-text { font-size: 21px; }

    .search-title { font-size: var(--text-2xl); }
    .results-card { padding: 14px; }
    .results-shown { margin-left: 0; }

    .result-row--head { display: none; }

    .result { margin-top: 6px; }
    .result > .result-row {
        /* The IP always fits; the verdict wraps in what's left */
        grid-template-columns: max-content minmax(0, 1fr) 14px;
        grid-template-areas:
            "ip decision caret"
            "line line line";
        gap: 4px 10px;
        padding: 10px 12px;
        background: var(--surface-inset);
        border-bottom: none;
        border-radius: var(--radius-sm);
        box-shadow: inset 3px 0 0 var(--state);
    }

    .result-cell--ip { grid-area: ip; }
    .result-cell--ip .ip-text { font-size: var(--text-sm); }
    .result-cell--decision { grid-area: decision; justify-self: end; }
    .result-cell--decision .result-value { white-space: normal; overflow: visible; }
    .result-cell--decision .decision { white-space: normal; text-align: right; }
    /* The card's rail already carries the verdict's colour */
    .result-cell--decision .decision::before { display: none; }
    .result-cell--caret { grid-area: caret; }
    .result-cell--decision .result-more { display: none !important; }

    /* Closed: the network summary is the card's second line */
    .result-row .result-cell--feeds,
    .result-row .result-cell--country,
    .result-row .result-cell--asn,
    .result-row .result-cell--type,
    .result-row .result-cell--abuse,
    .result-row .result-cell--neighbourhood,
    .result-row .result-cell--tags { display: none; }
    .result-row .result-cell--summary {
        display: block;
        grid-area: line;
        font-size: var(--text-xs);
    }

    .ip-drawer { width: 100vw; border-left: none; }
    .ip-view__head, .ip-view__body { padding-left: 16px; padding-right: 16px; }
    .ip-view__close-wide { display: none; }
    .ip-view__close-narrow { display: inline; }
    .ip-view__bar { flex-direction: row-reverse; }
    .ip-view__actions .ip-view__btn:not(.ip-view__close) { display: none; }
    .ip-view--page .ip-view__actions .ip-view__btn { display: inline-flex; }
    .ip-view__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ip-view--page .ip-view__body { display: flex; }
    .ip-events__item { grid-template-columns: 62px 18px minmax(0, 1fr); column-gap: 8px; }

    .doc { padding: 20px; }
    .doc-states > div, .doc-fields > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ============================================================
   Pro edition — sign-in and account pages
   ============================================================ */
.auth-card { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.auth-card--wide { max-width: 640px; }
.auth-card__title { font-size: var(--text-xl, 20px); }
.auth-card__note { font-size: var(--text-xs); color: var(--text-muted); }
.auth-card__error { color: var(--state, #e5534b); font-size: var(--text-sm); }
.auth-card__signout { margin-top: 8px; }
.auth-card code { font-family: var(--font-mono); overflow-wrap: anywhere; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: var(--text-xs); color: var(--text-secondary); }
.auth-form input {
    font: inherit;
    font-family: var(--font-mono);
    padding: 10px 12px;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}
.auth-org { padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.auth-org__name { font-size: var(--text-sm); }
.auth-org__role { margin-left: 6px; font-size: var(--text-2xs); color: var(--text-muted); text-transform: uppercase; }
.auth-org__entitlements { margin-top: 6px; padding-left: 18px; font-size: var(--text-sm); color: var(--text-secondary); }
.auth-card__notice { font-size: var(--text-sm); color: var(--status-success); }
.auth-policy { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.auth-policy__title { font-size: var(--text-sm); }
.auth-policy__summary { font-size: var(--text-sm); color: var(--text-secondary); }
.auth-policy__bands { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.auth-policy__bands legend { grid-column: 1 / -1; margin-bottom: 8px; font-size: var(--text-xs); color: var(--text-secondary); }
.auth-policy__reset { align-self: flex-start; }
.header-signout { display: inline; }
.header-link--button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
