/* ── Mobile: "Filters" button + bottom sheet ──────────────
   Below 760px the facet pills would take three rows (five on the
   Pronunciation Studio), so filter_bar.js moves the facets into a sheet that
   reuses the game modal's geometry: full width, 22px top corners, internal
   scroll, body scroll locked. Nothing here applies on desktop. */
.cfbar-sheet-trigger {
    appearance: none;
    display: none;                      /* revealed by the media query below */
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
}

.cfbar-sheet-trigger.is-filtered {
    border-color: var(--primary);
    background: linear-gradient(180deg, rgba(124, 121, 184, 0.10), rgba(124, 121, 184, 0.03));
    color: var(--primary-dark);
}

.cfbar-scrim {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(34, 42, 70, 0.45);
    backdrop-filter: blur(2px);
}

.cfbar-scrim[hidden] { display: none; }

.cfbar-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    border-radius: 22px 22px 0 0;
    background: #fff;
    box-shadow: 0 -12px 40px rgba(34, 42, 70, 0.22);
    animation: cfbarSheetIn 0.22s ease;
}

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

@keyframes cfbarSheetIn {
    from { transform: translateY(14px); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cfbar-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 8px 12px 20px;
    border-bottom: 1px solid var(--border);
}

.cfbar-sheet-head strong { font-size: 1.05rem; font-weight: 800; }

.cfbar-sheet-close {
    appearance: none;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.cfbar-sheet-close:hover { background: var(--accent); color: var(--primary-dark); }

.cfbar-sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px 12px;
}

.cfbar-sheet-section + .cfbar-sheet-section {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.cfbar-sheet-section-title {
    margin: 10px 8px 4px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* A facet living in the sheet: no pill, no floating panel, no own footer. */
.cfbar-facet.is-in-sheet { position: static; }
.cfbar-facet.is-in-sheet .cfbar-trigger,
.cfbar-facet.is-in-sheet .cfbar-pop-foot { display: none; }

.cfbar-facet.is-in-sheet .cfbar-opts {
    overflow: visible;            /* the sheet body scrolls, not each section */
    max-height: none;
}

.cfbar-facet.is-in-sheet .cfbar-pop {
    position: static;
    display: block;
    max-height: none;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.cfbar-sheet-more {
    appearance: none;
    margin: 4px 0 2px 10px;
    padding: 8px 14px;
    min-height: 40px;
    border-radius: 999px;
    border: 1px dashed var(--primary);
    background: transparent;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
}

.cfbar-sheet-foot {
    display: flex;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
}

.cfbar-sheet-reset,
.cfbar-sheet-apply {
    appearance: none;
    flex: 1 1 0;
    min-height: 48px;
    border-radius: 999px;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
}

.cfbar-sheet-reset {
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--muted);
}

.cfbar-sheet-apply {
    border: none;
    background: var(--primary);
    color: #fff;
}

.cfbar-sheet-apply:hover { background: var(--primary-dark); }

/* Page behind the sheet must not scroll. */
body.cfbar-sheet-open { overflow: hidden; }

@media (max-width: 760px) {
    .cfbar-sheet-trigger { display: inline-flex; flex: 1 1 auto; justify-content: space-between; }
}

/* ============================================================
   Course filter toolbar (home catalogue) — one sticky row of
   popover facets + a live result count, with the active
   selection shown as removable tokens underneath.
   Replaces the boxed .filters-panel chip grid (kept below for
   any page still using it).
   ============================================================ */
.cfbar {
    position: sticky;
    /* Sits under the sticky site header. */
    top: var(--cfbar-top, 92px);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: 0 8px 22px rgba(34, 42, 70, 0.06);
}

.cfbar-facets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.cfbar-facet { position: relative; }

.cfbar-trigger {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cfbar-trigger:hover { border-color: rgba(124, 121, 184, 0.45); }

.cfbar-trigger:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.16);
}

.cfbar-facet.is-open .cfbar-trigger,
.cfbar-trigger.is-filtered {
    border-color: var(--primary);
    background: linear-gradient(180deg, rgba(124, 121, 184, 0.10), rgba(124, 121, 184, 0.03));
    color: var(--primary-dark);
}

.cfbar-badge[hidden] { display: none; }

.cfbar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
}

/* Zero selections: keep the badge in place but read it as inactive. */
.cfbar-badge.is-zero {
    background: rgba(34, 42, 70, 0.10);
    color: var(--muted);
}

.cfbar-chev { font-size: 0.7rem; color: var(--muted); }
.cfbar-facet.is-open .cfbar-chev { transform: rotate(180deg); }

/* ── Search field (games / materials / pronunciation) ────── */
.cfbar-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--muted);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cfbar-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.16);
}

.cfbar-search input {
    appearance: none;
    align-self: stretch;      /* fill the 44px pill: the input is the target */
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    /* 16px+ on phones (see mobile.css) so iOS doesn't zoom on focus. */
    min-width: 12ch;
    width: 22ch;
    max-width: 100%;
}

.cfbar-search input::placeholder { color: #a8aec0; }

.cfbar-search-icon { display: inline-flex; flex: 0 0 auto; }

/* ── Popover ─────────────────────────────────────────────── */
.cfbar-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    min-width: 248px;
    max-height: min(60vh, 420px);
    /* Column layout so ONLY the option list scrolls: with a long list (23
       topics) a footer inside the scroll area sat below the fold and Clear /
       Done were unreachable without scrolling to the very end. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 18px 40px rgba(34, 42, 70, 0.16);
}

.cfbar-pop[hidden] { display: none; }

.cfbar-opts {
    display: grid;
    gap: 2px;
    min-height: 0;                /* let it shrink inside the flex column */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cfbar-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 44px row: the whole row is the tap target, not just the box. */
    min-height: 44px;
    padding: 0 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    user-select: none;
}

.cfbar-opt:hover { background: var(--accent); }

.cfbar-opt input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid #c5cae0;
    border-radius: 6px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.cfbar-opt input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}

.cfbar-opt input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.18);
}

.cfbar-pop-foot {
    flex: 0 0 auto;               /* always visible at the bottom of the panel */
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.cfbar-pop-clear,
.cfbar-pop-done {
    appearance: none;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cfbar-pop-clear {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
}

.cfbar-pop-clear:hover { border-color: var(--primary); color: var(--primary-dark); }

.cfbar-pop-done {
    border: none;
    background: var(--primary);
    color: #fff;
}

.cfbar-pop-done:hover { background: var(--primary-dark); }

/* ── Live result count ───────────────────────────────────── */
.cfbar-result {
    margin: 0;
    padding-right: 6px;
    font-size: 0.95rem;
    color: var(--muted);
    white-space: nowrap;
}

.cfbar-result strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}

/* ── Active-filter tokens ────────────────────────────────── */
.cfbar-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.cfbar-token {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 8px 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(124, 121, 184, 0.32);
    background: var(--accent);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cfbar-token:hover {
    background: rgba(124, 121, 184, 0.18);
    border-color: var(--primary);
}

.cfbar-token-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(124, 121, 184, 0.22);
    font-size: 0.9rem;
    line-height: 1;
}

.cfbar-token-clear {
    padding: 0 14px;
    background: #fff;
    border-color: var(--border);
    color: var(--muted);
}

@media (max-width: 1160px) {
    .cfbar { top: var(--cfbar-top, 86px); }
}

@media (max-width: 640px) {
    .cfbar {
        border-radius: 22px;
        padding: 10px 12px;
    }

    /* The facets share one row and shrink instead of wrapping; a search box,
       where the page has one, takes the full width above them. */
    .cfbar-facets {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .cfbar-search {
        flex: 1 1 100%;
        order: -1;
    }

    .cfbar-search input {
        width: 100%;
        font-size: 1rem;
    }

    .cfbar-trigger {
        flex: 1 1 40%;
        min-width: 0;
        justify-content: space-between;
        padding: 0 12px;
        font-size: 0.9rem;
    }

    /* Bars with several facets (the Pronunciation Studio has five) pack two per
       row rather than one each. */
    .cfbar-facet { flex: 1 1 40%; }

    .cfbar-trigger-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cfbar-result {
        flex: 1 1 100%;
        padding: 0 2px;
        font-size: 0.9rem;
    }

    /* Panel spans the whole bar (sheet-like) rather than the trigger's width:
       the facet stops being the positioning context, the sticky bar takes over. */
    .cfbar-facet { position: static; }

    .cfbar-pop {
        left: 10px;
        right: 10px;
        min-width: 0;
        max-height: min(56vh, 380px);
    }
}

.filters-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    display: grid;
    gap: 20px;
}

.filter-group {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.filter-label {
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    margin: 0;
}

/* --- Collapsible chip filters (for long topic lists) ------------------
   filter_chips.js hides chips past a threshold and appends a .chip-toggle
   so a 40-item topic filter shows ~2 rows with a "Show all (N)" expander. */
.chip-hidden {
    display: none !important;
}

.chip-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px dashed var(--primary);
    background: transparent;
    color: var(--primary-dark);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    transition: 0.18s ease;
}

.chip-toggle:hover {
    background: var(--accent);
    border-style: solid;
}

.pronunciation-page-header {
    margin-bottom: 0;
}

.pronunciation-container {
    max-width: 1380px;
}

.pronunciation-hero {
    margin-bottom: 24px;
    border-radius: 32px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(124, 121, 184, 0.16), transparent 28%),
        radial-gradient(circle at bottom left, rgba(124, 121, 184, 0.08), transparent 24%),
        linear-gradient(180deg, #ffffff 0%, #f9fafe 100%);
}

.pronunciation-hero-body {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.95fr);
    gap: 28px;
    align-items: end;
    padding: 30px 32px;
}

.pronunciation-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.pronunciation-page-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2.7rem, 4vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
}

.pronunciation-page-header p {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.72;
}

.pronunciation-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pronunciation-hero-stat {
    min-width: 0;               /* grid children must be allowed to shrink */
    padding: 18px 18px 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(34, 42, 70, 0.05);
}

/* "Words with audio" is longer than a third of the hero in several languages —
   it used to be `nowrap`, so the label ran straight out of its card. Let it
   wrap onto a second line instead. */
.pronunciation-hero-stat span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: break-word;
}

.pronunciation-hero-stat strong {
    color: var(--text);
    font-size: 1.9rem;
    line-height: 1;
}

.pronunciation-filter-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding: 14px;
    border: 1px solid rgba(226, 230, 240, 0.92);
    border-radius: 30px;
    background: rgba(245, 247, 252, 0.88);
    box-shadow: 0 14px 32px rgba(34, 42, 70, 0.08);
}

.pronunciation-filter-top {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.pronunciation-filter-advanced {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.pronunciation-filter-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 16px;
    align-items: stretch;
}

.pronunciation-filter-card,
.pronunciation-search-card,
.pronunciation-actions-card {
    background: #ffffff;
    border: 1px solid rgba(125, 117, 183, 0.12);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(40, 44, 90, 0.05);
    padding: 20px 20px 18px;
    min-width: 0;
    height: 100%;
}

.pronunciation-filter-card-wide {
    width: 100%;
}

.pronunciation-filter-card .filter-label,
.pronunciation-search-card .filter-label,
.pronunciation-actions-card .filter-label {
    margin-bottom: 12px;
}

.pronunciation-search-wrap {
    width: 100%;
}

.pronunciation-search-input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.98rem;
    line-height: 1.2;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pronunciation-search-input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.pronunciation-search-input:focus {
    border-color: rgba(125, 117, 183, 0.45);
    box-shadow: 0 0 0 4px rgba(125, 117, 183, 0.12);
    background: #ffffff;
}

.pronunciation-actions-card .chip-row {
    align-items: flex-start;
}

.pronunciation-actions-card .chip {
    min-width: 0;
}

/* Microphone picker: revealed by JS once the browser exposes device labels
   (i.e. after mic permission). Lets users escape a silent virtual default. */
.pronunciation-mic-control {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(125, 117, 183, 0.12);
}

.pronunciation-mic-control-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pronunciation-mic-select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pronunciation-mic-select:focus {
    border-color: rgba(125, 117, 183, 0.45);
    box-shadow: 0 0 0 4px rgba(125, 117, 183, 0.12);
    background: #ffffff;
}

.pronunciation-results-card {
    margin-bottom: 24px;
    border-radius: 24px;
}

.pronunciation-results-body {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

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

.pronunciation-active-filters {
    row-gap: 8px;
}

@media (max-width: 1100px) {
    .pronunciation-hero-body,
    .pronunciation-filter-top {
        grid-template-columns: 1fr;
    }

    .pronunciation-hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 700px) {
    .pronunciation-hero-body {
        padding: 22px 20px;
    }

    /* The desktop clamp floors at 2.7rem, which is oversized on a phone. */
    .pronunciation-page-header h1 {
        font-size: clamp(2rem, 7vw, 2.7rem);
    }

    .pronunciation-hero-stats {
        grid-template-columns: 1fr;
    }

    .filters-panel {
        padding: 18px;
        border-radius: 20px;
    }

    .pronunciation-filter-card,
    .pronunciation-search-card,
    .pronunciation-actions-card {
        padding: 16px;
        border-radius: 18px;
    }

    .pronunciation-filter-shell {
        padding: 12px;
        border-radius: 24px;
    }

    .pronunciation-search-input {
        min-height: 46px;
        padding: 0 14px;
        font-size: 0.95rem;
    }
}

.pronunciation-results-body {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.pronunciation-results-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#pronunciation-results-count,
#pronunciation-results-subtitle {
    font-size: 1rem;
    line-height: 1.2;
    margin: 0;
}

#pronunciation-results-count {
    font-weight: 800;
    color: var(--text);
}

#pronunciation-results-subtitle {
    font-weight: 500;
    color: var(--muted);
}

/* ============================================================
   Admin flavour of the .cfbar toolbar (see admin_filter_bar.js).
   Same pills, popovers, badges and result count as the public
   catalogues — but the facets are radios inside a GET form, so
   the server does the filtering. Only the deltas live here; the
   look comes from the .cfbar rules above.
   ============================================================ */
.cfbar-admin {
    /* Not sticky: the admin pages already carry a hero + stat strip, and a
       second sticky layer under the site header fights the page's own
       scroll-restore after a filter reload. */
    position: static;
    top: auto;
    margin-bottom: 10px;
}

/* Single-select facets use radios; the public multi-selects use checkboxes. */
.cfbar-opt input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid #c5cae0;
    border-radius: 50%;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.cfbar-opt input[type="radio"]:checked {
    border-color: var(--primary);
    border-width: 6px;           /* the ring itself becomes the dot */
}

.cfbar-opt input[type="radio"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.18);
}

/* Option text takes the slack so a per-option count sits flush right. */
.cfbar-opt .cfbar-opt-text { flex: 1 1 auto; min-width: 0; }

.cfbar-opt-count {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(34, 42, 70, 0.06);
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--muted);
}

/* Tokens are links here (each one is "the same URL minus this filter"), so
   they need the anchor reset the public button version doesn't. */
a.cfbar-token { text-decoration: none; }
a.cfbar-token:hover { border-color: var(--primary); }

.cfbar-admin .cfbar-reset {
    margin-left: 2px;
    align-self: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}
.cfbar-admin .cfbar-reset:hover { color: var(--primary-dark); text-decoration: underline; }

/* A note the page wants to hang off the bar (e.g. "click a stat to filter"). */
.cfbar-hint {
    margin: 0 0 18px;
    font-size: 0.88rem;
    color: var(--muted);
}
.cfbar-hint strong { color: var(--text); }

@media (max-width: 760px) {
    .cfbar-admin { border-radius: 22px; }
    .cfbar-admin .cfbar-facets { width: 100%; }
    .cfbar-admin .cfbar-search { flex: 1 1 100%; }
    .cfbar-admin .cfbar-search input { width: auto; flex: 1 1 auto; }
    .cfbar-admin .cfbar-result { width: 100%; padding-left: 4px; }
}

/* Tokens kept inside the bar (calendar: the bar is short and the page below it
   is a dense grid, so a separate token row would push the week out of view). */
.cfbar-inline-tokens {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* On/off quick filters that live in the bar next to the facets (evaluations:
   "Flagged only", "New only"). A single boolean reads better as a pill you can
   see the state of than as a popover you have to open. */
.cfbar-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    user-select: none;
}
.cfbar-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cfbar-toggle > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.cfbar-toggle > span svg { flex: 0 0 auto; }
.cfbar-toggle:hover > span { border-color: rgba(124, 121, 184, 0.45); }
.cfbar-toggle input:focus-visible + span {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.16);
}
.cfbar-toggle-warn input:checked + span {
    border-color: #f0c675;
    background: #fff3d6;
    color: #8a5418;
}
.cfbar-toggle-new input:checked + span {
    border-color: rgba(124, 121, 184, 0.55);
    background: var(--accent);
    color: var(--primary-dark);
}

/* Export action sitting at the end of a toolbar. */
.cfbar-export {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.cfbar-export:hover { background: var(--primary-dark); }
.cfbar-export:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Reset rendered as a <button> in manual-mode bars. */
button.cfbar-reset {
    appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}
