@font-face {
    font-family: "Outfit";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/outfit-var.woff2") format("woff2");
}

:root {
    /* Brand palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    /* Shape consistency rule (keep this ramp everywhere):
       inputs & primary buttons -> --radius-sm (4px)
       panels, cards, dropdowns -> --radius-md (8px)
       pills: chips, tags, badges -> --radius-pill (full) */
    --border-strong: #cbd5e1;
    --danger: #ff4d4d;
    --focus-ring: rgba(37, 99, 235, 0.25);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
    --shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-pill: 9999px;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --text-xs: 0.7rem;
    --text-sm: 0.8rem;
    --text-base: 0.95rem;
    --text-md: 1rem;
    --text-lg: 1.2rem;
}

/* Semantic component tokens (badges, status surfaces, table heads) */
:root {
    --badge-neutral-bg: #e2e8f0;
    --badge-neutral-fg: #475569;
    --badge-source-bg: #dbeafe;
    --badge-source-fg: #1e40af;
    --badge-format-bg: #f1f5f9;
    --badge-format-fg: #334155;
    --badge-req-bg: #fee2e2;
    --badge-req-fg: #991b1b;
    --badge-ok-bg: #dcfce7;
    --badge-ok-fg: #166534;
    --badge-stale-bg: #fef9c3;
    --badge-stale-fg: #854d0e;
    --badge-fail-bg: #fee2e2;
    --badge-fail-fg: #991b1b;
    --warn-bg: #fffbeb;
    --warn-border: #fcd34d;
    --warn-fg: #78350f;
    --table-head: #f8fafc;

    /* High Priority toggle (semantic amber state) */
    --hp-bg: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    --hp-bg-hover: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    --hp-bg-active: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --hp-border: #fcd34d;
    --hp-border-active: #d97706;
    --hp-fg: #92400e;
    --hp-fg-hover: #78350f;
    --hp-fg-active: #ffffff;
}

/* ===== Dark mode (one token layer, page-level theme lock) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #60a5fa;
        --primary-hover: #93c5fd;
        --primary-light: rgba(96, 165, 250, 0.12);
        --bg: #0b1220;
        --surface: #131c2e;
        --surface-hover: #1a2537;
        --text-main: #e2e8f0;
        --text-muted: #94a3b8;
        --border: #1e293b;
        --border-strong: #334155;
        --danger: #f87171;
        --focus-ring: rgba(96, 165, 250, 0.35);
        --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.5);
        --shadow-md: 0 10px 15px -3px rgba(2, 6, 23, 0.6);
        --shadow-hover: 0 4px 12px rgba(2, 6, 23, 0.5);
        --badge-neutral-bg: #334155;
        --badge-neutral-fg: #cbd5e1;
        --badge-source-bg: rgba(96, 165, 250, 0.15);
        --badge-source-fg: #93c5fd;
        --badge-format-bg: #1e293b;
        --badge-format-fg: #cbd5e1;
        --badge-req-bg: rgba(248, 113, 113, 0.15);
        --badge-req-fg: #fca5a5;
        --badge-ok-bg: rgba(74, 222, 128, 0.15);
        --badge-ok-fg: #86efac;
        --badge-stale-bg: rgba(251, 191, 36, 0.15);
        --badge-stale-fg: #fde047;
        --badge-fail-bg: rgba(248, 113, 113, 0.15);
        --badge-fail-fg: #fca5a5;
        --warn-bg: rgba(245, 158, 11, 0.12);
        --warn-border: rgba(252, 211, 77, 0.35);
        --warn-fg: #fcd34d;
        --table-head: #0f172a;

        --hp-bg: rgba(245, 158, 11, 0.15);
        --hp-bg-hover: rgba(245, 158, 11, 0.25);
        --hp-bg-active: linear-gradient(135deg, #d97706 0%, #b45309 100%);
        --hp-border: rgba(251, 191, 36, 0.4);
        --hp-border-active: #b45309;
        --hp-fg: #fbbf24;
        --hp-fg-hover: #fcd34d;
        --hp-fg-active: #ffffff;
    }

    /* Solid-fill controls need dark-appropriate ink */
    .btn-primary {
        color: var(--bg);
        box-shadow: 0 1px 2px rgba(2, 6, 23, 0.5);
    }
    .btn-primary:hover {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #0b1220;
    }
    .chip.chip-active { color: var(--bg); }
    .badge.astro { background: #e2e8f0; color: #0f172a; }
}

/* ===== Manual scrape source chips ===== */
.advanced-source-list {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    max-height: 6.5rem;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.btn-crawl-source-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-main);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-crawl-source-chip:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-crawl-source-chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Display type: the headers carry the brand; body stays on the system stack */
h1,
.panel-title,
.event-title {
    font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.02em;
}

.event-date,
.timestamp,
.source-count,
#last-scraped-time {
    font-variant-numeric: tabular-nums;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    margin-bottom: 2rem;
}

h1 {
    margin: 0 0 0.5rem 0;
    color: var(--text-main);
}

.subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Panel chrome ===== */
.controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    background: var(--surface);
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.panel-title {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--text-main);
}

.scraper-action {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.scraper-action .btn {
    flex: 0 0 auto;
}

#last-scraped-time {
    font-size: var(--text-sm);
    color: var(--text-muted);
    white-space: nowrap;
}

#failure-indicator {
    color: var(--danger);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: help;
    white-space: nowrap;
}

/* Admin demoted to quiet text link */
.admin-link {
    color: var(--text-muted);
    font-weight: 500;
}

.admin-link:hover {
    color: var(--text-main);
}

#scraper-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Controls toolbar (keyword + Filters disclosure) =====
   Same DOM at every width: on desktop the search row renders exactly as before
   and the disclosure button is hidden, because the whole panel is visible. */
.controls-toolbar {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
}

.controls-toolbar .toolbar-search {
    flex: 1 1 auto;
    min-width: 0;
}

/* Desktop: the wrapper is transparent to layout so the panel sections stay
   direct flex children of .controls (identical density to the old markup). */
.filter-panel {
    display: contents;
}

.filters-toggle {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filters-toggle:hover,
.filters-toggle.has-active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.filters-toggle-icon {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
}

/* Disclosure chevron, matching the dropdown/advanced affordances */
.filters-toggle::after {
    content: '';
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-bottom: 2px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.filters-toggle[aria-expanded="true"]::after {
    margin-bottom: -1px;
    transform: rotate(-135deg);
}

.filters-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #ffffff;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

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

@media (prefers-color-scheme: dark) {
    .filters-toggle-count {
        color: #0b1220;
    }
}

/* Panel reveal: a 4px lift only, no height animation, so nothing below jumps */
@keyframes filter-panel-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ===== Staleness banner ===== */
.stale-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--warn-fg);
    font-size: var(--text-sm);
}

.stale-banner[hidden] {
    display: none;
}

.stale-banner-text {
    flex: 1 1 auto;
    min-width: 220px;
}

.stale-banner-text #stale-age-text {
    font-weight: 600;
}

.stale-banner-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 0 auto;
}

.stale-banner-actions .btn {
    flex: 0 0 auto;
    min-height: 2.25rem;
    padding: 0.4rem 0.9rem;
    font-size: var(--text-sm);
}

/* Link-style controls (Toggle All, Clear) */
.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

/* Data islands kept out of layout until JS reveals them */
#scrape-report-data,
#events-data,
#events-table,
#health-container {
    display: none;
}

/* Keyboard focus ring */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Tactile feedback: physical push on press */
.btn:active,
.chip:active,
.btn-crawl-source-chip:active,
.view-toggles button:active {
    transform: scale(0.98);
}

/* Reduced motion: collapse all transitions and transforms */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }

    .event-card:hover {
        transform: none;
    }
}

/* ===== Section layout ===== */
.filter-section {
    min-width: 0;
}

.field-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

/* Search row */
.search-row .search-input {
    height: 2.75rem;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    font-size: var(--text-md);
    border-radius: var(--radius-md);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 1.1rem;
}

/* Filter grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4) var(--space-5);
    align-items: end;
}

.filter-grid .span-2 {
    grid-column: span 2;
}

.filter-grid .span-3 {
    grid-column: 1 / -1;
}

/* ===== Group by segmented control ===== */
.segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    width: fit-content;
    max-width: 100%;
    padding: 3px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.segmented-btn {
    flex: 0 0 auto;
    padding: 0.35rem 0.9rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-md) - 3px);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented-btn:hover:not(.active) {
    background: var(--surface);
    color: var(--text-main);
}

.segmented-btn.active {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.segmented-btn:active {
    transform: scale(0.98);
}

.section-heading.group-heading {
    margin-bottom: 0;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

/* Form controls — consistent height + focus */
input[type="text"],
select,
input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--text-base);
    min-height: 2.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:hover,
select:hover,
input[type="date"]:hover {
    border-color: var(--border-strong);
}

input[type="text"]:focus,
select:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.9rem;
    cursor: pointer;
}

/* ===== Multi-select dropdown ===== */
.dropdown-multi {
    position: relative;
    width: 100%;
    z-index: 20;
}

.dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-main);
    font-size: var(--text-base);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.dropdown-trigger:hover {
    border-color: var(--border-strong);
}

.dropdown-trigger::after {
    content: '';
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin-right: 0.25rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.dropdown-multi.active .dropdown-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.dropdown-multi.active .dropdown-trigger::after {
    transform: rotate(-135deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: max-content;
    min-width: 100%;
    max-width: min(320px, calc(100vw - 2rem));
    max-height: min(420px, 60vh);
    z-index: 100;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.dropdown-multi.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.checkbox-list-container {
    max-height: 250px;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-header {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-toggle-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
}

.source-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-sm);
}

.checkbox-list-container label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease;
}

.checkbox-list-container label:hover {
    background: var(--surface-hover);
}

.checkbox-list-container input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.source-label {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 4px 4px 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease;
}

.source-label:hover {
    background: var(--surface-hover);
}

.source-label .source-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 2px 0;
    cursor: pointer;
}

.source-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-label.source-muted .source-check {
    opacity: 0.5;
}

.source-label.source-muted .source-name {
    text-decoration: line-through;
}

.source-count {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 500;
    flex: 0 0 auto;
}

/* Per-source mute toggle: eye when active, eye-off when muted */
.source-mute {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.source-mute:hover {
    background: var(--surface);
    color: var(--text-main);
    border-color: var(--border);
}

.source-mute svg {
    width: 15px;
    height: 15px;
    display: block;
}

.source-mute .icon-eye-off {
    display: none;
}

.source-mute.muted {
    color: var(--text-main);
    background: var(--surface-hover);
    border-color: var(--border);
}

.source-mute.muted .icon-eye {
    display: none;
}

.source-mute.muted .icon-eye-off {
    display: block;
}

/* Muted summary row inside the dropdown */
.mute-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.mute-summary[hidden] {
    display: none;
}

.mute-summary .text-link {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Date range ===== */
.date-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
}

.date-filters input[type="date"] {
    flex: 1 1 0;
    min-width: 0;
}

.date-separator {
    color: var(--text-muted);
    flex: 0 0 auto;
}

/* Horizon hint under the date inputs */
.horizon-hint {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.horizon-hint[hidden] {
    display: none;
}

.horizon-hint .text-link {
    font-size: var(--text-xs);
}

/* Look-back toggle under the date inputs */
.lookback-link {
    align-self: flex-start;
    font-size: var(--text-xs);
}

.lookback-link[aria-pressed="true"] {
    color: var(--text-main);
    text-decoration: underline;
}

/* ===== Chips ===== */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    gap: 6px;
    min-height: 2.5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-main);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chip.chip-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.chip.chip-active::before {
    content: "✓";
    margin-right: 0.35rem;
    font-size: 0.75em;
}

/* Tag chips: bounded height so a long list scrolls instead of dominating the panel */
#tag-chips {
    max-height: 7.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 2px 2px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#tag-chips::-webkit-scrollbar {
    width: 6px;
}

#tag-chips::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-pill);
}

#tag-chips::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== Chip-block sections (Categories, Tags) ===== */
.tags-section,
.category-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.section-heading .field-label {
    margin: 0;
}

.section-heading .text-link {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Advanced (collapsible) ===== */
.advanced-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

.advanced-toggle::-webkit-details-marker {
    display: none;
}

.advanced-toggle::after {
    content: '';
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.advanced-section[open] .advanced-toggle::after {
    transform: rotate(-135deg);
}

.advanced-toggle:hover {
    background: var(--surface-hover);
}

.advanced-section[open] .advanced-toggle {
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.advanced-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.manual-heading {
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
    margin-bottom: var(--space-2);
}

/* ===== Checkbox rows (Dedupe, Weekend) ===== */
.inline-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--text-base);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.inline-check:hover {
    border-color: var(--primary);
}

.inline-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.inline-check:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-hover);
    font-weight: 500;
}

.inline-check:has(input:focus-visible) {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ===== View toggles footer ===== */
.controls-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.view-toggles {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.view-toggles button {
    flex: 0 0 auto;
    padding: 0.35rem 0.7rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-md) - 3px);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.view-toggles button:hover:not(.active) {
    background: var(--surface);
    color: var(--text-main);
}

.view-toggles button.active {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

#btn-hp-view {
    background: var(--hp-bg);
    color: var(--hp-fg);
    border-color: var(--hp-border);
    font-weight: 700;
}

#btn-hp-view:hover {
    background: var(--hp-bg-hover);
    color: var(--hp-fg-hover);
}

#btn-hp-view.active {
    background: var(--hp-bg-active);
    border-color: var(--hp-border-active);
    color: var(--hp-fg-active);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: var(--text-base);
    text-align: center;
    text-decoration: none;
    flex: 1;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

/* Focus ring visible against solid primary fills */
.btn-primary:focus-visible,
.chip.chip-active:focus-visible,
.view-toggles button.active:focus-visible {
    outline-color: var(--primary-hover);
}

/* ===== Cards View ===== */
.view-cards #events-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.event-card .header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

/* Badge cluster shrinks so the date/time stays on the same row */
.header-meta-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
}

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--badge-neutral-bg);
    color: var(--badge-neutral-fg);
    font-weight: 500;
}

.badge.source {
    background: var(--badge-source-bg);
    color: var(--badge-source-fg);
    /* Long source names ellipsize instead of wrapping the header onto two lines */
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge.format {
    background: var(--badge-format-bg);
    color: var(--badge-format-fg);
}

.badge.req {
    background: var(--badge-req-bg);
    color: var(--badge-req-fg);
}

.badge.entity {
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid var(--border);
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge.astro {
    background: var(--badge-neutral-fg);
    color: var(--badge-neutral-bg);
    font-size: var(--text-xs);
}

.entity-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.event-date {
    flex: 0 0 auto;
    white-space: nowrap;
    font-weight: 600;
    color: var(--primary);
}

.event-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-main);
    line-height: 1.3;
}

.event-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    overflow-wrap: anywhere;
}

.event-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* ===== Table View ===== */
#events-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    /* visible (not hidden) so sticky group header rows can stick to the viewport */
    overflow: visible;
}

#events-table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

#events-table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

#events-table th,
#events-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#events-table th {
    background: var(--table-head);
    font-weight: 600;
    color: var(--text-muted);
}

#events-table tr:last-child td {
    border-bottom: none;
}

#events-table td[colspan] {
    padding: 2rem 1rem;
    color: var(--text-muted);
    background: var(--surface);
}

.hidden {
    display: none !important;
}

/* ===== Empty / no-results state ===== */
.no-events {
    grid-column: 1 / -1;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
}

.no-events p {
    margin: 0 0 var(--space-4) 0;
}

.no-events .empty-unmute {
    flex: 0 0 auto;
    width: auto;
    margin: 0 auto;
}

/* Table empty state cell mirrors the card empty state */
#events-table td.empty-cell {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
}

#events-table td.empty-cell p {
    margin: 0 0 var(--space-4) 0;
}

#events-table td.empty-cell .empty-unmute {
    flex: 0 0 auto;
    width: auto;
    margin: 0 auto;
}

/* ===== Skeleton loading state (shape-matched to event cards) ===== */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.skeleton-line {
    height: 0.8rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 50%, var(--surface-hover) 75%);
    background-size: 200% 100%;
    opacity: 0.9;
    animation: skeleton-shimmer 1.4s ease infinite;
}

.skeleton-line.title {
    height: 1.1rem;
    width: 75%;
    margin: var(--space-4) 0 var(--space-5);
}

.skeleton-line.body {
    width: 90%;
    margin-bottom: var(--space-3);
}

.skeleton-line.body.short { width: 60%; }

.skeleton-line.action {
    width: 35%;
    margin-top: auto;
}

@keyframes skeleton-shimmer {
    from { background-position: 200% 0; }
    to { background-position: 0 0; }
}

/* ===== Source Health view ===== */
.health-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.health-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.health-table th,
.health-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.health-table th {
    background: var(--table-head);
    font-weight: 600;
    color: var(--text-muted);
}

.health-table tr:last-child td {
    border-bottom: none;
}

.health-detail {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.badge.hp-ok {
    background: var(--badge-ok-bg);
    color: var(--badge-ok-fg);
}

.badge.hp-stale {
    background: var(--badge-stale-bg);
    color: var(--badge-stale-fg);
}

.badge.hp-fail {
    background: var(--badge-fail-bg);
    color: var(--badge-fail-fg);
}

/* ===== Date TBD (collapsed) section ===== */
.tbd-section {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tbd-section summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-3) var(--space-4);
    list-style: none;
    cursor: pointer;
    user-select: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
}

.tbd-section summary::-webkit-details-marker {
    display: none;
}

.tbd-section summary::before {
    content: '';
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.tbd-section[open] summary::before {
    transform: rotate(-135deg);
}

.tbd-section summary:hover {
    background: var(--surface-hover);
}

.tbd-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-5);
    padding: var(--space-4);
    border-top: 1px solid var(--border);
}

/* Table view: header row + hidden rows tbody */
#events-table tr.tbd-header td {
    background: var(--bg);
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.tbd-toggle {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 0.15rem 0.6rem;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tbd-toggle:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

#events-table tbody.tbd-rows[hidden] {
    display: none;
}

/* ===== Date group sections (cards view) ===== */
.event-group {
    grid-column: 1 / -1;
}

/* Keep a group or card from hiding under a stuck header when scrolled into view */
.event-group,
.event-card {
    scroll-margin-top: 3.75rem;
}

/* Sticky section header: a toggle button that sticks to the top of the viewport
   while scrolling through its own group, then the next group pushes it away. */
.group-header {
    position: sticky;
    top: 0;
    z-index: 5;
    width: 100%;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font: inherit;
    text-align: left;
    color: var(--text-main);
    cursor: pointer;
}

/* Chevron affordance on a collapsible group header */
.group-chevron {
    flex: 0 0 auto;
    align-self: center;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.group-header.collapsed .group-chevron,
.group-row-inner.collapsed .group-chevron {
    transform: rotate(-45deg);
}

/* Collapsed day/source group hides its card grid (per-source state is preserved) */
.event-group.collapsed .group-cards {
    display: none;
}

.group-label {
    font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: var(--text-md);
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.group-sub {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.group-count {
    margin-left: auto;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-hover);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Bulk-source collapse: hidden cards become grid items of the group grid */
.source-more {
    display: contents;
}

.source-more[hidden] {
    display: none;
}

.source-expander {
    grid-column: 1 / -1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.8rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.source-expander:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Per-event tag chips (secondary to title and source) */
.event-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0 0 1rem 0;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-hover);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.5;
}

.tag-chip.more {
    background: transparent;
    border-style: dashed;
}

/* ===== Date group rows (table view) ===== */
#events-table tr.group-row td.group-cell {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 0.7rem 1rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.group-row-inner {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    width: 100%;
    font: inherit;
    text-align: left;
    color: var(--text-main);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

#events-table tr.table-expander-row td {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

#events-table tr[hidden] {
    display: none;
}

/* Collapsed table group hides its rows (kept separate from per-source [hidden]) */
#events-table tr.group-collapsed {
    display: none;
}

/* ===== Responsive ===== */

/* Tablets and phones: compact chrome. The panel collapses behind the "Filters"
   button and the view switcher moves up under the toolbar, so results start
   near the top of the screen. Desktop (>= 960px) keeps the original layout. */
@media (max-width: 959px) {
    .controls {
        padding: var(--space-4);
        gap: var(--space-4);
    }

    /* Compact brand line: the title and last-updated share one row */
    header {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.15rem 0.6rem;
        margin-bottom: var(--space-4);
    }

    header h1 {
        margin: 0;
        font-size: 1.5rem;
        letter-spacing: -0.03em;
    }

    /* Small radar blip so the compact wordmark still reads as the brand */
    header h1::before {
        content: '';
        display: inline-block;
        width: 0.5rem;
        height: 0.5rem;
        margin-right: 0.45rem;
        border-radius: 50%;
        background: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
        transform: translateY(-1px);
    }

    header .subtitle {
        margin: 0;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .controls-header {
        order: 1;
        align-items: center;
        padding-bottom: 0;
        border-bottom: 0;
        gap: var(--space-2);
    }

    .controls-toolbar {
        order: 2;
        align-items: stretch;
        gap: var(--space-2);
    }

    /* The keyword label becomes screen-reader only so the bar stays one 44px row;
       the placeholder carries the visible hint. */
    .controls-toolbar .field-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        white-space: nowrap;
        clip-path: inset(50%);
    }

    .controls-footer {
        order: 3;
        justify-content: flex-start;
        padding-top: var(--space-3);
        border-top: 1px solid var(--border);
    }

    .filter-panel {
        order: 4;
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
        min-width: 0;
        animation: filter-panel-in 0.16s ease-out;
    }

    .advanced-toggle {
        min-height: 2.75rem;
    }

    .filter-panel.is-collapsed {
        display: none;
    }

    /* The "Filters" title is redundant beside the disclosure button */
    .controls-header .panel-title {
        display: none;
    }

    .filters-toggle {
        display: inline-flex;
    }

    /* One-line meta strip: last scrape left, Admin / failures right */
    .scraper-action {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: var(--space-3);
        min-height: 2.75rem;
    }

    #last-scraped-time {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .scraper-action .admin-link,
    #failure-indicator {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
    }

    .admin-link {
        min-height: 2.75rem;
        padding: 0 var(--space-1);
        font-size: var(--text-sm);
    }

    /* View switcher: one scrollable row of 44px targets under the toolbar */
    .view-toggles {
        width: fit-content;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .view-toggles::-webkit-scrollbar {
        display: none;
    }

    .view-toggles button {
        min-height: 2.75rem;
        padding: 0.4rem 0.85rem;
        border-radius: 3px;
    }

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-grid .span-2 {
        grid-column: span 2;
    }

    .filter-grid .span-3 {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0.75rem 1rem 1.5rem;
    }

    /* Tighter brand line than tablet: still one row at 390px */
    header {
        gap: 0.1rem 0.55rem;
        margin-bottom: var(--space-3);
    }

    header h1 {
        font-size: 1.2rem;
    }

    header h1::before {
        width: 0.45rem;
        height: 0.45rem;
        margin-right: 0.4rem;
    }

    header .subtitle {
        font-size: 0.68rem;
    }

    .controls {
        padding: var(--space-3);
        gap: var(--space-3);
        margin-bottom: var(--space-3);
    }

    .controls-footer {
        padding-top: var(--space-2);
    }

    /* All six views fit one row at 390px; narrower phones scroll sideways */
    .view-toggles button {
        padding: 0.4rem 0.5rem;
        font-size: 0.76rem;
    }

    .stale-banner {
        flex-wrap: nowrap;
        gap: var(--space-2);
        padding: 0.4rem 0.5rem 0.4rem 0.7rem;
        margin-bottom: var(--space-3);
    }

    .stale-banner-text {
        min-width: 0;
        font-size: var(--text-xs);
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .stale-banner-actions {
        width: auto;
        flex: 0 0 auto;
    }

    .stale-banner-actions .btn {
        flex: 0 0 auto;
        min-height: 2.75rem;
        padding: 0 0.7rem;
        font-size: var(--text-xs);
        white-space: nowrap;
    }

    /* 44px targets across the filter panel */
    input[type="text"],
    select,
    input[type="date"],
    .dropdown-trigger,
    .chip,
    .inline-check,
    .segmented-btn {
        min-height: 2.75rem;
    }

    /* Keeps short chips pill-shaped instead of circular at 44px tall */
    .chip {
        min-width: 3.5rem;
    }

    .segmented {
        width: fit-content;
        max-width: 100%;
        padding: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .segmented::-webkit-scrollbar {
        display: none;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-grid .span-2,
    .filter-grid .span-3 {
        grid-column: span 1;
    }

    .filter-item input[type="text"],
    .filter-item select {
        width: 100%;
    }

    .date-filters {
        flex-wrap: wrap;
    }

    /* Group headers stay compact and wrap their meta on small screens */
    .group-header {
        flex-wrap: wrap;
    }

    .group-sub {
        flex: 1 1 auto;
        min-width: 0;
    }

    .group-row-inner {
        flex-wrap: wrap;
    }
}
