/* =========================================
   WireBuddy UI System
   Zentrale Design-Definition für konsistentes UI
   ========================================= */

/* ---------- 1. Design Tokens ---------- */

:root {
    /* Spacing System (UI-Lint: VERTICAL_GAP 22-26px, target: 24px) */
    --wb-space-1: 6px;
    --wb-space-2: 12px;
    --wb-space-3: 24px;
    --wb-space-4: 32px;

    /* Layout: Footer height for padding calculations (set via JS if dynamic) */
    --wb-footer-height: 48px;

    /* Typography */
    --wb-font-base: 0.875rem;
    /* 14px */
    --wb-font-sm: 0.75rem;
    /* 12px */
    --wb-font-lg: 1rem;
    /* 16px */
    --wb-font-xl: 1.25rem;
    /* 20px */

    --wb-heading-page: 1.4rem;
    --wb-heading-card: 0.95rem;

    /* Radius */
    --wb-radius-sm: 6px;
    --wb-radius-md: 10px;
    --wb-radius-lg: 12px;

    /* Shadows */
    --wb-shadow-1: 0 2px 8px rgba(0, 0, 0, 0.04);
    --wb-shadow-2: 0 4px 16px rgba(0, 0, 0, 0.06);

    /* Muted backgrounds */
    --wb-muted-bg: rgba(0, 0, 0, 0.035);
    --wb-hover-bg: rgba(0, 0, 0, 0.025);

    /* Transitions (specific for better performance) */
    --wb-transition-shadow: box-shadow 0.2s ease;
    --wb-transition-bg: background-color 0.2s ease;
    --wb-transition-transform: transform 0.2s ease;
}

[data-bs-theme="dark"] {
    --wb-shadow-1: 0 2px 8px rgba(0, 0, 0, 0.55);
    --wb-shadow-2: 0 4px 18px rgba(0, 0, 0, 0.65);
    --wb-muted-bg: rgba(255, 255, 255, 0.06);
    --wb-hover-bg: rgba(255, 255, 255, 0.04);
}


/* ---------- 2. Base Typography ---------- */

body {
    font-size: var(--wb-font-base);
    font-weight: 400;
}

.page-title {
    font-size: var(--wb-heading-page);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-title {
    font-size: var(--wb-heading-card);
    font-weight: 600;
}

.small,
small {
    font-size: var(--wb-font-sm);
}


/* ---------- 3. Cards ---------- */

.card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--wb-radius-lg);
    box-shadow: var(--wb-shadow-1);
    transition: var(--wb-transition-shadow);
    /* Fallback for browsers without clip support */
    overflow: hidden;
    /* Preferred: clip doesn't create a scroll container, avoiding layout side effects */
    overflow: clip;
}

.card:hover {
    box-shadow: var(--wb-shadow-2);
}

[data-bs-theme="dark"] .card {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-header {
    padding: 0.6rem 1rem;
}

.card-body {
    padding: 1rem;
}

/* Ensure scrollable card-body respects parent border-radius */
.card-body:last-child {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* Opt-in: keep the card body on the card surface so bottom radii stay visible. */
.wb-card-body-surface {
    background-color: inherit;
}


/* ---------- 4. KPI Cards (Dashboard, DNS, etc.) ---------- */

.wb-kpi-card .card-body {
    padding: 1rem;
}

.wb-kpi-icon {
    font-size: 2.2rem;
    opacity: 0.95;
}

[data-bs-theme="dark"] .wb-kpi-icon {
    color: var(--wb-kpi-icon-dark, #e5e7eb);
    opacity: 1;
}

.wb-kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.wb-kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Mobile: slightly smaller icon */
@media (max-width: 575.98px) {
    .wb-kpi-icon {
        font-size: 2rem;
    }
}


/* ---------- 5. Buttons ---------- */

.btn {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: var(--wb-radius-md);
    transition: var(--wb-transition-bg), var(--wb-transition-shadow);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
}

.btn .material-icons {
    font-size: 1rem;
    vertical-align: middle;
    line-height: 1;
    pointer-events: none;
    /* Ensure touch events pass through to button */
}

/* Buttons with text + icon: add right margin to icon */
.btn .material-icons:not(:only-child) {
    margin-right: 0.35rem;
}

/* Icon-only buttons: center the icon */
.btn .material-icons:only-child {
    display: inline-flex;
    margin: 0;
}

/* Icon-only buttons */
.btn-icon {
    padding: 0.3rem 0.5rem;
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Fix: input-group buttons must match form-control height exactly
   form-control: content = 0.85rem × 1.5 = 1.275rem, padding = 0.75rem, border = 2px
   button icon:  content = 1.125rem (18px), needs extra 0.075rem padding per side
   → button padding = 0.375rem + 0.075rem = 0.45rem */
.input-group .btn-icon {
    padding: 0.45rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Enforce consistent height for input-group elements (UI-lint requirement: 44px ±2px)
   Base height is set globally on .form-control/.form-select (Section 8).
   This rule ensures .btn inside input-groups also matches. */
.input-group .btn {
    height: 44px;
}

.input-group .btn-icon .material-icons {
    font-size: 1.125rem;
    /* 18px */
    line-height: 1;
}

.btn-icon .material-icons {
    margin-right: 0;
}

/* Disabled danger buttons should appear gray, not light red */
.btn-danger:disabled,
.btn-danger.disabled {
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--bs-secondary);
    --bs-btn-disabled-border-color: var(--bs-secondary);
}

/* Checkbox and switch touch target improvement (44px minimum) */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    min-width: 24px;
    min-height: 24px;
    margin-top: 0;
}

/* Restore switch toggle proportions (Bootstrap default: 2em × 1em) */
.form-switch .form-check-input {
    width: 2.71em;
    height: 1.1em;
    min-width: 44px;
    min-height: 22px;
    margin-left: 0;
}

.form-check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0;
}

.form-check .form-check-input {
    float: none;
    margin-left: 0;
    margin-right: 0;
}

.form-check-label {
    margin-bottom: 0;
}

/* Peer modal blocklist options: wrap badges below name on small screens */
#peer-blocklist-options .form-check-label,
#edit-peer-blocklist-options .form-check-label {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem 0.375rem;
}

#peer-blocklist-options .badge,
#edit-peer-blocklist-options .badge {
    margin-left: 0 !important;
}


/* ---------- 6. Tables ---------- */

.table {
    font-size: 0.8rem;
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom-width: 1px;
}

.table tbody tr {
    transition: var(--wb-transition-bg);
}

.table tbody tr:hover {
    background-color: var(--wb-hover-bg);
}


/* ---------- 7. Badges ---------- */

.badge {
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.35em 0.6em;
    border-radius: var(--wb-radius-sm);
}


/* ---------- 8. Form Controls ---------- */

.form-control,
.form-select {
    font-size: 0.85rem;
    height: 44px;
    border-radius: var(--wb-radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Small variants use Bootstrap's natural height (compact headers/toolbars) */
.form-control-sm,
.form-select-sm {
    height: auto;
}

/* Multi-line textareas must grow freely */
textarea.form-control {
    height: auto;
}

summary {
    cursor: pointer;
}


/* ---------- 9. Section Spacing ---------- */

.wb-section {
    margin-bottom: var(--wb-space-3);
}

.wb-page {
    padding-top: var(--wb-space-3);
    padding-bottom: var(--wb-space-3);
}

@media (min-width: 992px) {
    .wb-main-grid>[class*="col-"] {
        margin-top: 0;
    }
}


/* ---------- 10. Subtle Panels ---------- */

.wb-muted-panel {
    background: var(--wb-muted-bg);
    border-radius: var(--wb-radius-md);
    padding: 0.75rem 1rem;
}


/* ---------- 11. Page Header ---------- */

.wb-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--wb-space-3);
}

.wb-page-header .page-title {
    margin-bottom: 0;
}


/* ---------- 12. Stat Cards ---------- */

.wb-stat-card {
    text-align: center;
}

.wb-stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.wb-stat-card .stat-label {
    font-size: var(--wb-font-sm);
    color: var(--bs-secondary-color);
}


/* ---------- 13. Icon Consistency ---------- */

/* Prevent layout shift during font loading - use line-height instead of
   fixed width/height to avoid clipping in flex layouts and baseline alignment issues */
.material-icons {
    line-height: 1;
    vertical-align: middle;
    color: currentColor;
    flex-shrink: 0;
}

.material-icons.icon-sm {
    font-size: 1rem;
}

.material-icons.icon-md {
    font-size: 1.25rem;
}

.material-icons.icon-lg {
    font-size: 1.5rem;
}

/* Standard icon spacing in text */
.material-icons+span,
span+.material-icons {
    margin-left: 0.35rem;
}


/* ---------- 14. List Groups ---------- */

.list-group-item {
    font-size: var(--wb-font-base);
    padding: 0.6rem 1rem;
    transition: var(--wb-transition-bg);
}


/* ---------- 15. Alerts ---------- */

.alert {
    font-size: var(--wb-font-base);
    border-radius: var(--wb-radius-md);
    padding: 0.75rem 1rem;
}


/* ---------- 16. Dropdowns ---------- */

.dropdown-menu {
    font-size: var(--wb-font-base);
    border-radius: var(--wb-radius-md);
    box-shadow: var(--wb-shadow-2);
}

.dropdown-item {
    padding: 0.4rem 1rem;
    transition: var(--wb-transition-bg);
}


/* ---------- 17. Modal Consistency ---------- */

.modal-content {
    border-radius: var(--wb-radius-lg);
    box-shadow: var(--wb-shadow-2);
}

.modal-header {
    padding: 1rem 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
}


/* ---------- 18. Nav Tabs ---------- */

.nav-tabs .nav-link {
    font-size: var(--wb-font-base);
    padding: 0.5rem 1rem;
    border-radius: var(--wb-radius-md) var(--wb-radius-md) 0 0;
    transition: var(--wb-transition-bg), border-color 0.2s ease;
}


/* ---------- 19. Progress Bars ---------- */

.progress {
    height: 0.5rem;
    border-radius: var(--wb-radius-sm);
}


/* ---------- 20. Tooltips ---------- */

.tooltip-inner {
    font-size: var(--wb-font-sm);
    border-radius: var(--wb-radius-sm);
    padding: 0.35rem 0.6rem;
}


/* ---------- 21. Utility Classes ---------- */

.text-muted-light {
    color: var(--bs-secondary-color) !important;
}

.bg-muted-light {
    background-color: var(--wb-muted-bg) !important;
}

.rounded-wb {
    border-radius: var(--wb-radius-md) !important;
}

.rounded-wb-lg {
    border-radius: var(--wb-radius-lg) !important;
}


/* ---------- 22. Bootstrap Grid Gutter Overrides ---------- */

/* Map Bootstrap gutter classes to WireBuddy spacing tokens
   so g-3 = 24px (layout gap) matches UI-Lint VERTICAL_GAP 22-26px */

.g-1 {
    --bs-gutter-x: var(--wb-space-1);
    --bs-gutter-y: var(--wb-space-1);
}

.g-2 {
    --bs-gutter-x: var(--wb-space-2);
    --bs-gutter-y: var(--wb-space-2);
}

.g-3 {
    --bs-gutter-x: var(--wb-space-3);
    --bs-gutter-y: var(--wb-space-3);
}

.g-4 {
    --bs-gutter-x: var(--wb-space-4);
    --bs-gutter-y: var(--wb-space-4);
}

.gx-1 {
    --bs-gutter-x: var(--wb-space-1);
}

.gx-2 {
    --bs-gutter-x: var(--wb-space-2);
}

.gx-3 {
    --bs-gutter-x: var(--wb-space-3);
}

.gx-4 {
    --bs-gutter-x: var(--wb-space-4);
}

.gy-1 {
    --bs-gutter-y: var(--wb-space-1);
}

.gy-2 {
    --bs-gutter-y: var(--wb-space-2);
}

.gy-3 {
    --bs-gutter-y: var(--wb-space-3);
}

.gy-4 {
    --bs-gutter-y: var(--wb-space-4);
}


/* ---------- 23. Bootstrap Margin Utility Overrides ---------- */

/* CAUTION: Global Bootstrap utility overrides - affects all Bootstrap components!
   Map Bootstrap margin classes to WireBuddy spacing tokens for consistent spacing.
   mb-3 = 24px matches g-3 = 24px for row-to-row gaps.
   
   RISK: Third-party components expecting Bootstrap defaults may break.
   ALTERNATIVE: Consider using wb-mb-3 prefixed utilities instead of global overrides.
   
   body prefix for maximum specificity to override Bootstrap !important */

/* TODO: Evaluate migrating to scoped .wb-mb-* utilities to reduce global override risk */

body .mb-1,
html body .mb-1 {
    margin-bottom: 6px !important;
}

body .mb-2,
html body .mb-2 {
    margin-bottom: 12px !important;
}

body .mb-3,
html body .mb-3 {
    margin-bottom: 24px !important;
}

body .mb-4,
html body .mb-4 {
    margin-bottom: 32px !important;
}

body .mt-1,
html body .mt-1 {
    margin-top: 6px !important;
}

body .mt-2,
html body .mt-2 {
    margin-top: 12px !important;
}

body .mt-3,
html body .mt-3 {
    margin-top: 24px !important;
}

body .mt-4,
html body .mt-4 {
    margin-top: 32px !important;
}

body .my-1,
html body .my-1 {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
}

body .my-2,
html body .my-2 {
    margin-top: 12px !important;
    margin-bottom: 12px !important;
}

body .my-3,
html body .my-3 {
    margin-top: 24px !important;
    margin-bottom: 24px !important;
}

body .my-4,
html body .my-4 {
    margin-top: 32px !important;
    margin-bottom: 32px !important;
}


/* ---------- 24. Mobile Optimizations ---------- */

/* Reduzierte Seitenabstände für bessere Viewport-Nutzung auf mobilen Geräten */
@media (max-width: 767.98px) {

    /* Main content area - reduziertes Padding (consistent bottom for footer spacing) */
    .main-content {
        padding-top: 0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: calc(1rem + var(--wb-footer-height));
    }

    /* Grid Rows - nur horizontale Gutters reduziert; vertikale bleiben
       beim Layout-Standard (24px) für konsistente Kachelabstände. */
    .row.g-3,
    .row.g-4 {
        --bs-gutter-x: 0.75rem;
    }

    /* Container - minimales Padding für mehr Platz */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Navbar container - Logo bündig mit Kacheln, Buttons mit Abstand vom Rand */
    .navbar .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 1rem !important;
    }

    /* Navbar controls - zusätzlicher Abstand vom rechten Rand */
    .navbar .navbar-controls {
        margin-right: 0.5rem;
    }

    /* Navbar brand - Logo mit leichtem Einzug vom linken Viewport-Rand */
    .navbar .navbar-brand {
        margin-left: 0.8rem;
    }

    /* Page wrapper - angepasstes vertikales Padding (spacing-2 = 12px) */
    .wb-page {
        padding-top: var(--wb-space-2);
        padding-bottom: var(--wb-space-2);
    }

    /* Page header - kompakteres Layout */
    .wb-page-header {
        margin-bottom: var(--wb-space-2);
        gap: 0.5rem;
    }

    /* Sections - reduzierter Abstand */
    .wb-section {
        margin-bottom: var(--wb-space-2);
    }

    /* Cards - kompakteres Padding */
    .card-header {
        padding: 0.5rem 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }
}

/* Keep footer spacing consistent with dashboard on small phones */
@media (max-width: 575.98px) {
    .wb-page {
        padding-bottom: 2rem;
    }
}

/* Tablet-Optimierungen für mittlere Bildschirmgrößen */
@media (min-width: 768px) and (max-width: 991.98px) {

    /* Grid Rows - nur horizontale Gutters angepasst; vertikale bleiben
       beim Layout-Standard (24px) für konsistente Kachelabstände. */
    .row.g-3,
    .row.g-4 {
        --bs-gutter-x: 1rem;
    }

    /* Main content - leicht reduziertes Padding (consistent bottom for footer spacing) */
    .main-content {
        padding-top: 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: calc(1.25rem + var(--wb-footer-height));
    }

    /* Container - moderates Padding */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Navbar container */
    .navbar .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 1.25rem !important;
    }

    /* Navbar controls - moderater Abstand */
    .navbar .navbar-controls {
        margin-right: 0.5rem;
    }

    /* Navbar brand - Logo Alignment */
    .navbar .navbar-brand {
        margin-left: 0.25rem;
    }

    /* Page wrapper - spacing-3 like desktop */
    .wb-page {
        padding-top: var(--wb-space-3);
        padding-bottom: var(--wb-space-3);
    }
}


/* ---------- 25. Read-Only Mode (Non-Admin) ---------- */

/* Container class applied to settings content when user is not admin.
   Disables all interactive elements uniformly while keeping content visible.
   
   SECURITY NOTE: pointer-events:none only blocks mouse/touch — keyboard users
   can still Tab into inputs and modify values. For true read-only enforcement:
   1. Apply `inert` attribute to the container in HTML/JS, OR
   2. Set `tabindex="-1"` + `aria-disabled="true"` on each input
   3. ALWAYS enforce authorization server-side — CSS is UI-only */

.wb-readonly .btn:not(.nav-link):not([data-bs-toggle="tab"]) {
    pointer-events: none;
    opacity: 0.45;
    filter: grayscale(40%);
    cursor: default;
    box-shadow: none;
}

.wb-readonly .form-control,
.wb-readonly .form-select,
.wb-readonly textarea.form-control {
    pointer-events: none;
    background-color: var(--bs-secondary-bg);
    opacity: 0.65;
}

.wb-readonly .form-check-input {
    pointer-events: none;
    opacity: 0.45;
}

.wb-readonly .form-range {
    pointer-events: none;
    opacity: 0.45;
}

.wb-readonly .input-group .btn {
    pointer-events: none;
    opacity: 0.45;
}

/* Dark mode: ensure readonly inputs have visible contrast */
[data-bs-theme="dark"] .wb-readonly .form-control,
[data-bs-theme="dark"] .wb-readonly .form-select,
[data-bs-theme="dark"] .wb-readonly textarea.form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}


/* ---------- 26. Status Page Components ---------- */

/* Status page main container — replaces inline style */
.status-main {
    max-width: 860px;
}

/* Flag icons — consistent sizing across all pages */
.flag-icon {
    width: 16px;
    height: 12px;
    flex: 0 0 auto;
    display: inline-block;
    object-fit: cover;
    border-radius: 2px;
}

.flag-icon-sm {
    width: 14px;
    height: 10px;
    flex: 0 0 auto;
}

/* ---------- 27. Accessibility — Reduced Motion ---------- */

/* Respect user's motion preferences for decorative animations.
   Preserves functional transitions (focus rings, collapse indicators) while
   disabling potentially disorienting decorative animations. */
@media (prefers-reduced-motion: reduce) {

    /* Decorative animation classes */
    .flow-line,
    .pulse-marker,
    .wb-animate,
    [data-animate] {
        animation: none !important;
    }

    /* Disable scroll-behavior site-wide */
    html {
        scroll-behavior: auto !important;
    }
}


/* ---------- 28. Visually Hidden (Screen Reader Only) ---------- */

/* Bootstrap provides .visually-hidden; .sr-only is included for legacy
   compatibility with older templates using the Bootstrap 4 class name. */
.visually-hidden,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* ---------- 29. Blocklist Components (DNS Settings) ---------- */

/* Grid layout for blocklist cards with responsive columns */
.blocklist-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* Individual blocklist card */
.blocklist-item {
    min-width: 0;
    height: 100%;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--wb-radius-lg);
    background: var(--bs-body-bg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Enhanced border for enabled blocklists */
.blocklist-item.enabled {
    border-color: color-mix(in srgb, var(--bs-primary) 28%, var(--bs-border-color));
    background: var(--bs-tertiary-bg);
}

/* Card content layout: text left, toggle right */
.blocklist-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    height: 100%;
}

.blocklist-row>.form-check.form-switch,
.settings-switch-control.form-check.form-switch {
    min-height: auto;
    align-items: flex-start;
    padding-top: 0;
}

.settings-switch-row {
    align-items: flex-start !important;
}

/* Blocklist title with level badge */
.blocklist-title {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Level indicators (Moderate, Balanced, Extreme, 18+) */
.blocklist-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
}

.blocklist-level-icon {
    font-size: 0.8rem;
    color: var(--bs-warning);
    line-height: 1;
}

/* Blocklist description text */
.blocklist-desc {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    margin-top: 0.3rem;
}

/* Meta information (domain count, last updated) */
.blocklist-meta {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.3rem;
}

.blocklist-meta-mono {
    font-family: var(--bs-font-monospace);
    color: var(--wb-monospace-fg);
    background-color: var(--wb-monospace-bg);
    border-radius: var(--wb-radius-sm);
    padding: 0.1rem 0.35rem;
    display: inline-block;
}

.blocklist-meta-separator {
    font-family: var(--bs-body-font-family);
}

/* Responsive grid: 1 column (mobile) → 2 columns (tablet) → 4 columns (desktop) */
@media (min-width: 768px) {
    .blocklist-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .blocklist-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Mobile: Toggle left, title right (same line) */
@media (max-width: 767px) {
    .blocklist-row {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1rem;
    }

    .blocklist-row>.form-check.form-switch {
        order: -1;
        flex: 0 0 auto;
    }

    .blocklist-row>.flex-grow-1 {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
    }
}