/* TUNE-054: BeMusic-derived foundation and full public/Admin shell. */
:root {
    --th-background: oklch(1 0 0);
    --th-foreground: oklch(.2478 0 0);
    --th-card: oklch(1 0 0);
    --th-card-foreground: oklch(.2478 0 0);
    --th-popover: oklch(1 0 0);
    --th-primary: oklch(.6423 .1467 133.01);
    --th-primary-foreground: oklch(.9911 0 190.05);
    --th-secondary: oklch(.967 .001 286.375);
    --th-secondary-foreground: oklch(.21 .006 285.885);
    --th-muted: oklch(.9791 0 0);
    --th-muted-foreground: oklch(.556 0 0);
    --th-accent: oklch(.97 0 0);
    --th-destructive: oklch(.577 .245 27.325);
    --th-border: oklch(.922 0 0);
    --th-input: oklch(.922 0 0);
    --th-ring: oklch(.708 0 0);
    --th-sidebar: oklch(.985 0 0);
    --th-sidebar-foreground: oklch(.145 0 0);
    --th-sidebar-accent: oklch(.94 .001 286.37);
    --th-radius: .625rem;
    --th-radius-button: 1.5rem;
    --th-radius-input: .5rem;
    --th-radius-panel: .75rem;
    --th-hover-opacity: 4%;
    --th-selected-opacity: 8%;
    --th-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    /* Legacy selectors resolve through the BeMusic token layer while their
       route and behavior contracts remain unchanged. */
    --bg: var(--th-background);
    --surface: var(--th-card);
    --border: var(--th-border);
    --text: var(--th-foreground);
    --muted: var(--th-muted-foreground);
    --primary: var(--th-primary);
    --teal: var(--th-primary);
    --orange: var(--th-destructive);
    --shadow: 0 1px 2px color-mix(in oklab, var(--th-foreground) 6%, transparent);
}

html[data-theme="dark"], html.dark,
html[data-theme="system"].dark {
    --th-background: oklch(.0969 0 0);
    --th-foreground: oklch(1 0 0);
    --th-card: oklch(.1822 0 0);
    --th-card-foreground: oklch(.985 0 0);
    --th-popover: oklch(.205 0 0);
    --th-primary-foreground: oklch(1 0 0);
    --th-secondary: oklch(.274 .006 286.033);
    --th-secondary-foreground: oklch(.985 0 0);
    --th-muted: oklch(.269 0 0);
    --th-muted-foreground: oklch(1 0 0 / 70%);
    --th-accent: oklch(1 0 0 / 8%);
    --th-destructive: oklch(.704 .191 22.216);
    --th-border: oklch(1 0 0 / 10%);
    --th-input: oklch(1 0 0 / 15%);
    --th-ring: oklch(.556 0 0);
    --th-sidebar: oklch(.0969 0 0);
    --th-sidebar-foreground: oklch(.985 0 0);
    --th-sidebar-accent: oklch(.23 0 0);
    --th-hover-opacity: 4%;
    --th-selected-opacity: 12%;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        --th-background: oklch(.0969 0 0);
        --th-foreground: oklch(1 0 0);
        --th-card: oklch(.1822 0 0);
        --th-card-foreground: oklch(.985 0 0);
        --th-popover: oklch(.205 0 0);
        --th-primary-foreground: oklch(1 0 0);
        --th-secondary: oklch(.274 .006 286.033);
        --th-secondary-foreground: oklch(.985 0 0);
        --th-muted: oklch(.269 0 0);
        --th-muted-foreground: oklch(1 0 0 / 70%);
        --th-accent: oklch(1 0 0 / 8%);
        --th-destructive: oklch(.704 .191 22.216);
        --th-border: oklch(1 0 0 / 10%);
        --th-input: oklch(1 0 0 / 15%);
        --th-ring: oklch(.556 0 0);
        --th-sidebar: oklch(.0969 0 0);
        --th-sidebar-foreground: oklch(.985 0 0);
        --th-sidebar-accent: oklch(.23 0 0);
    }
}

html { background: var(--th-background); color-scheme: light; }
html[data-theme="dark"], html.dark { color-scheme: dark; }
body {
    background: var(--th-background) !important;
    color: var(--th-foreground) !important;
    font-family: var(--th-font) !important;
    line-height: 1.5;
    padding: 0 !important;
}
body::before { display: none; }
body.has-public-background::before {
    content: "";
    display: block;
    position: fixed;
    z-index: 0;
    inset: 0;
    pointer-events: none;
    background-image: var(--th-public-bg-light-desktop);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}
html.dark body.has-public-background::before { background-image: var(--th-public-bg-dark-desktop); }
@media (prefers-color-scheme: dark) { html[data-theme="system"] body.has-public-background::before { background-image: var(--th-public-bg-dark-desktop); } }
*, *::before, *::after { border-color: var(--th-border); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--th-ring) !important;
    outline-offset: 2px;
}
.sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); }
.bemusic-icon, .admin-icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* Public BeMusic shell */
.be-app-shell {
    display: grid;
    grid-template-rows: 64px auto;
    gap: 0;
    min-height: 100dvh;
    padding: 0 8px 8px;
    background: var(--th-background);
}
/* Let the selected artwork read through the public shell while keeping cards
   and controls on their semantic surfaces. */
body.has-public-background .be-app-shell { background: transparent; }
body.has-public-background .be-app-shell { position: relative; z-index: 1; }
body.has-public-background .be-navbar { background: color-mix(in oklab, var(--th-background) 52%, transparent); backdrop-filter: blur(10px); }
body.has-public-background .be-main-pane { background: transparent; }
@media (min-width: 1025px) {
    body.has-public-background .be-navbar { margin-right: -8px; }
    .be-public-main-layout > .be-sidebar {
        position: fixed;
        top: 72px;
        left: 8px;
        z-index: 20;
        width: 240px;
        height: calc(100dvh - 80px);
        max-height: calc(100dvh - 80px);
        margin: 0;
    }
    .be-public-main-layout > .be-main-pane {
        margin-left: 248px;
    }
    body.has-public-background .be-sidebar {
        background: color-mix(in oklab, var(--th-card) 68%, transparent);
        border: 1px solid color-mix(in oklab, var(--th-foreground) 10%, transparent);
        box-shadow: 0 16px 48px color-mix(in oklab, var(--th-foreground) 12%, transparent);
        backdrop-filter: blur(14px);
    }
}
@media (max-width: 1500px) {
    .background-themes-admin .admin-page-head { flex-wrap: wrap; }
}
@media (max-width: 1024px) {
    body.has-public-background::before { position: absolute; min-height: 100%; background-image: var(--th-public-bg-light-mobile); }
    html.dark body.has-public-background::before { background-image: var(--th-public-bg-dark-mobile); }
    html[data-theme="system"].dark body.has-public-background::before { background-image: var(--th-public-bg-dark-mobile); }
}
@media (max-width: 1024px) and (prefers-color-scheme: dark) {
    html[data-theme="system"] body.has-public-background::before { background-image: var(--th-public-bg-dark-mobile); }
}
.be-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 12px;
    background: var(--th-background);
    border-bottom: 1px solid var(--th-border);
}

.be-brand, .be-admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
    color: var(--th-foreground);
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -.025em;
    text-decoration: none;
}
.be-brand { min-width: 228px; }
.be-brand .brand-logo-shell, .be-admin-brand .brand-logo-shell {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--th-card);
}
.be-navbar-actions { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; margin-left: auto; }
.be-global-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 720px);
    flex: 0 1 720px;
    min-width: 0;
    margin-left: 28px;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--th-border);
    border-radius: 999px;
    background: var(--th-background);
    color: var(--th-muted-foreground);
    box-shadow: none;
}
.be-global-search:focus-within { border-color: var(--th-primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--th-primary) 25%, transparent); }
.be-global-search-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 58%;
    overflow-x: auto;
    scrollbar-width: none;
}
.be-global-search-filters::-webkit-scrollbar { display: none; }
.be-global-search-filters[hidden] { display: none; }
.be-global-search-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 190px;
    height: 26px;
    padding: 0 5px 0 7px;
    border: 1px solid color-mix(in oklab, var(--th-primary) 28%, var(--th-border));
    border-radius: 999px;
    background: color-mix(in oklab, var(--th-muted) 82%, transparent);
    color: var(--th-foreground);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}
.be-global-search-filter-chip-type {
    color: var(--th-muted-foreground);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.be-global-search-filter-chip-flag { font-size: 14px; line-height: 1; }
.be-global-search-filter-chip-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.be-global-search-filter-chip-remove {
    display: inline-grid;
    flex: 0 0 18px;
    place-items: center;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--th-muted-foreground);
    cursor: pointer;
}
.be-global-search-filter-chip-remove:hover,
.be-global-search-filter-chip-remove:focus-visible { background: var(--th-accent); color: var(--th-foreground); }
.be-global-search-filter-chip-remove .bemusic-icon { width: 12px; height: 12px; }
.be-global-search input { flex: 1 1 150px; width: auto; height: 40px; min-width: 0; min-height: 0; border: 0; outline: 0; background: transparent !important; color: var(--th-foreground); font-size: 14px; font-weight: 400; }
.be-global-search input:focus,
.be-global-search input:focus-visible { border: 0 !important; outline: 0 !important; outline-offset: 0 !important; box-shadow: none !important; }
.be-global-search input::placeholder { color: var(--th-muted-foreground); }
html[data-theme="dark"] .be-global-search,
html.dark .be-global-search,
html[data-theme="system"].dark .be-global-search { background: color-mix(in oklab, var(--th-muted) 72%, transparent); }
@media (min-width: 1025px) {
    .be-global-search[data-be-search-has-filters] {
        width: auto;
        max-width: none;
        flex: 1 1 auto;
    }
    .be-global-search[data-be-search-has-filters] .be-global-search-filters { max-width: min(68%, 620px); }
}
.be-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    width: min(720px, calc(100vw - 24px));
    max-height: min(620px, calc(100dvh - 88px));
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-panel);
    background: var(--th-popover);
    color: var(--th-card-foreground);
    box-shadow: 0 18px 44px color-mix(in oklab, var(--th-foreground) 18%, transparent);
}
.be-search-panel [hidden] { display: none !important; }
.be-search-panel[hidden] { display: none; }
.be-search-panel-head, .be-search-subview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.be-search-kicker, .be-search-context-note {
    color: var(--th-muted-foreground);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.be-search-panel h2, .be-search-panel h3 { margin: 2px 0 0; color: var(--th-card-foreground); }
.be-search-panel h2 { font-size: 20px; line-height: 28px; }
.be-search-panel h3 { font-size: 16px; line-height: 24px; }
.be-search-context-note { margin: 12px 0 16px; letter-spacing: 0; text-transform: none; }
.be-search-close, .be-search-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--th-muted-foreground);
    cursor: pointer;
}
.be-search-close:hover, .be-search-back:hover { background: var(--th-accent); color: var(--th-foreground); }
.be-search-back { justify-content: flex-start; padding-inline: 0 10px; border-radius: 8px; }
.be-search-back .bemusic-icon { transform: rotate(-90deg); }
.be-search-find, .be-search-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-input);
    background: var(--th-card);
    color: var(--th-card-foreground);
    text-align: left;
    cursor: pointer;
}
.be-search-find {
    min-height: 64px;
    padding: 12px 14px;
}
.be-search-find:hover, .be-search-group:hover, .be-search-option:hover { border-color: var(--th-primary); background: var(--th-accent); }
.be-search-find > span:nth-child(2), .be-search-group > span:nth-child(2) { display: grid; min-width: 0; flex: 1; gap: 2px; }
.be-search-find strong, .be-search-group strong, .be-search-option strong { font-size: 14px; font-weight: 600; }
.be-search-find small, .be-search-group small, .be-search-option small { color: var(--th-muted-foreground); font-size: 12px; }
.be-search-find-icon, .be-search-group-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--th-secondary);
    color: var(--th-secondary-foreground);
}
.be-search-find > .bemusic-icon, .be-search-group > .bemusic-icon { color: var(--th-muted-foreground); }
.be-search-group-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.be-search-group { min-height: 68px; padding: 10px; }
.be-search-typed {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-input);
    background: var(--th-card);
}
.be-search-typed > div { min-width: 0; flex: 1; }
.be-search-typed p { margin: 2px 0 0; color: var(--th-muted-foreground); font-size: 12px; }
.be-search-submit-query, .be-search-clear-all {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--th-primary);
    color: var(--th-primary-foreground);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.be-search-group-view { margin-top: 4px; }
.be-search-options {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}
.be-search-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--th-border);
    border-radius: 8px;
    background: var(--th-card);
    color: var(--th-card-foreground);
    text-decoration: none;
}
.be-search-option > span:first-child { min-width: 0; flex: 1; }
.be-search-option > span:first-child strong, .be-search-option > span:first-child small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.be-search-option-count { color: var(--th-muted-foreground); font-size: 12px; white-space: nowrap; }
.be-search-option--recent { padding: 0; }
.be-search-option--recent > a { min-width: 0; flex: 1; padding: 8px 0 8px 10px; color: inherit; text-decoration: none; }
.be-search-option-remove {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--th-muted-foreground);
    cursor: pointer;
}
.be-search-option-remove:hover { background: var(--th-accent); color: var(--th-foreground); }
.be-search-options-empty, .be-search-feedback {
    margin: 12px 0 0;
    color: var(--th-muted-foreground);
    font-size: 13px;
}
.be-search-feedback { padding: 8px 10px; border-radius: 8px; background: var(--th-muted); }
.be-search-clear-all { display: block; margin: 12px 0 0; background: transparent; color: var(--th-foreground); box-shadow: inset 0 0 0 1px var(--th-border); }
.be-search-clear-all:hover { background: var(--th-accent); }
.be-radio-discovery { display: grid; gap: 0; }
.be-radio-discovery-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--th-muted-foreground);
    font-size: 11px;
}
.be-radio-discovery-sync { margin-left: auto; color: var(--th-primary); font-weight: 600; white-space: nowrap; }
.be-radio-discovery-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 0 12px;
    border-top: 1px solid var(--th-border);
}
.be-radio-discovery-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.be-radio-discovery-label { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.be-radio-discovery-label .be-search-group-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
.be-radio-discovery-label-copy { display: grid; gap: 2px; min-width: 0; }
.be-radio-discovery-group h3 { margin: 0; font-size: 14px; line-height: 20px; }
.be-radio-discovery-label-copy p { margin: 0; color: var(--th-muted-foreground); font-size: 11px; line-height: 14px; }
.be-radio-discovery-group-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; flex: 1 1 auto; }
.be-radio-discovery-selected { display: flex; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; max-width: min(54vw, 520px); overflow-x: auto; scrollbar-width: none; }
.be-radio-discovery-selected::-webkit-scrollbar { display: none; }
.be-radio-discovery-selected-label, .be-radio-discovery-selected-empty { flex: 0 0 auto; color: var(--th-muted-foreground); font-size: 11px; white-space: nowrap; }
.be-radio-discovery-selected-list { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.be-radio-discovery-selected-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 160px; padding: 3px 7px; border: 1px solid var(--th-primary); border-radius: 999px; background: color-mix(in oklab, var(--th-primary) 12%, var(--th-card)); color: var(--th-card-foreground); font: inherit; font-size: 11px; font-weight: 600; line-height: 14px; white-space: nowrap; cursor: pointer; }
.be-radio-discovery-selected-chip:hover { background: color-mix(in oklab, var(--th-primary) 20%, var(--th-card)); }
.be-radio-discovery-selected-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.be-radio-discovery-selected-chip-remove { display: inline-grid; flex: 0 0 auto; place-items: center; width: 12px; height: 12px; }
.be-radio-discovery-selected-chip-remove .bemusic-icon { width: 11px; height: 11px; }
.be-radio-discovery-selected-flag { flex: 0 0 auto; font-size: 13px; line-height: 1; }
.be-radio-discovery-pagination { display: flex; gap: 4px; }
.be-radio-discovery-pagination button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--th-border);
    border-radius: 8px;
    background: var(--th-card);
    color: var(--th-card-foreground);
    cursor: pointer;
}
.be-radio-discovery-pagination button:hover:not(:disabled) { border-color: var(--th-primary); background: var(--th-accent); }
.be-radio-discovery-pagination button:focus-visible { outline: 2px solid var(--th-focus); outline-offset: 2px; }
.be-radio-discovery-pagination button:disabled { opacity: .45; cursor: not-allowed; }
.be-radio-discovery-pagination button[data-be-radio-discovery-direction="previous"] .bemusic-icon { transform: rotate(180deg); }
.be-radio-discovery-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; overflow: hidden; border: 1px solid var(--th-border); border-radius: 8px; }
.be-radio-discovery-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    height: 56px;
    min-height: 56px;
    flex: 0 0 56px;
    box-sizing: border-box;
    padding: 7px 30px 7px 10px;
    border: 0;
    border-right: 1px solid var(--th-border);
    border-bottom: 1px solid var(--th-border);
    border-radius: 0;
    background: transparent;
    color: var(--th-card-foreground);
    cursor: pointer;
}
.be-radio-discovery-option:nth-child(5n) { border-right: 0; }
.be-radio-discovery-option:nth-last-child(-n + 5) { border-bottom: 0; }
.be-radio-discovery-option:hover { background: var(--th-accent); }
.be-radio-discovery-option:has(input:focus-visible) { outline: 2px solid var(--th-focus); outline-offset: 2px; }
.be-radio-discovery-option input { width: 1px; height: 1px; position: absolute; opacity: 0; pointer-events: none; }
.be-radio-discovery-option-copy { display: flex; align-items: center; width: 100%; min-width: 0; flex: 1 1 auto; gap: 5px; overflow: hidden; font-size: 11px; font-weight: 600; }
.be-radio-discovery-option-copy > span:last-child { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px; }
.be-radio-discovery-flag { font-size: 14px; line-height: 1; }
.be-radio-discovery-option small { color: var(--th-muted-foreground); font-size: 10px; line-height: 14px; white-space: nowrap; }
.be-radio-discovery-option-check { position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 20px; height: 20px; color: var(--th-muted-foreground); pointer-events: none; }
.be-radio-discovery-option-check .bemusic-icon { width: 19px; height: 19px; }
.be-radio-discovery-option:has(input:checked) .be-radio-discovery-option-check { color: var(--th-primary); }
.be-radio-discovery-options { position: relative; min-height: 112px; }
.be-radio-discovery-loading { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 6px; background: color-mix(in oklab, var(--th-popover) 72%, transparent); backdrop-filter: blur(2px); color: var(--th-card-foreground); font-size: 11px; font-weight: 600; }
.be-radio-discovery-loading-icon { display: inline-grid; place-items: center; color: var(--th-primary); }
.be-radio-discovery-loading-icon .bemusic-icon { width: 16px; height: 16px; animation: be-radio-discovery-spin 900ms linear infinite; }
.be-radio-discovery-options[aria-busy="true"] .be-radio-discovery-option { opacity: .48; }
.be-radio-discovery-empty { display: grid; grid-column: 1 / -1; place-items: center; min-height: 112px; margin: 0; color: var(--th-muted-foreground); font-size: 11px; text-align: center; }
.be-radio-discovery-feedback { margin: 0 0 8px; color: var(--th-muted-foreground); font-size: 11px; }

@keyframes be-radio-discovery-spin {
    to { transform: rotate(360deg); }
}
.be-icon-button, .be-menu-toggle, .be-theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--th-foreground);
    cursor: pointer;
}
.be-icon-button:hover, .be-menu-toggle:hover, .be-theme-toggle:hover { background: var(--th-accent); }
.be-menu-toggle { display: none; }
.be-theme-toggle [data-theme-icon] { display: inline-grid; place-items: center; }
.be-theme-toggle [data-theme-icon][hidden] { display: none; }
.be-auth-link { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; text-decoration: none; font-size: 13px; }
.be-auth-link--primary { background: var(--th-primary); color: var(--th-primary-foreground); }
.be-auth-link--outline { border: 1px solid var(--th-primary); color: var(--th-primary); }
.be-user-menu { position: relative; }
.be-user-menu summary { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: 999px; cursor: pointer; list-style: none; }
.be-user-menu summary::-webkit-details-marker { display: none; }
.be-user-menu summary:hover { background: var(--th-accent); }
.be-user-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 190px; padding: 6px; border: 1px solid var(--th-border); border-radius: var(--th-radius-panel); background: var(--th-popover); box-shadow: 0 14px 38px color-mix(in oklab, var(--th-foreground) 16%, transparent); }
.be-user-menu-panel a, .be-user-menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--th-foreground); text-decoration: none; text-align: left; cursor: pointer; }
.be-user-menu-panel a:hover, .be-user-menu-panel button:hover { background: var(--th-accent); }
.be-public-main-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 8px; min-height: 0; }
.be-sidebar { min-height: 0; border: 0; border-radius: var(--th-radius-panel); background: var(--th-card); color: var(--th-sidebar-foreground); overflow: visible; }
.be-sidebar { padding: 10px 8px; }
.be-sidebar-group { margin: 10px 0 20px; }
.be-sidebar-label { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; color: color-mix(in oklab, var(--th-sidebar-foreground) 62%, transparent); font-size: 12px; font-weight: 500; }
.be-sidebar-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.be-sidebar-list a, .be-sidebar-list .be-sidebar-placeholder { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 12px; border-radius: 999px; color: inherit; font-size: 14px; text-decoration: none; }
.be-sidebar-list a:hover, .be-sidebar-list .be-sidebar-placeholder:hover { background: var(--th-sidebar-accent); }
.be-sidebar-list a.active, .be-sidebar-list a[aria-current="page"] { background: var(--th-sidebar-accent); font-weight: 600; }
.be-sidebar-placeholder { opacity: .65; cursor: pointer; }
.be-sidebar-placeholder[data-be-placeholder-focused="true"] { outline: 2px solid var(--th-ring); outline-offset: 2px; }
.be-playlist-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; color: color-mix(in oklab, var(--th-sidebar-foreground) 70%, transparent); font-size: 13px; }
.be-playlist-row a { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.be-main-pane { min-width: 0; min-height: 0; border-radius: var(--th-radius-panel); background: var(--th-background); overflow: visible; }
.be-content { width: min(100%, 1280px); margin: 0 auto; padding: 16px 28px 112px; }
.be-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 1280px; margin: 8px auto 0; padding: 16px 28px 24px; color: var(--th-muted-foreground); font-size: 12px; }
.be-footer nav { display: flex; flex-wrap: wrap; gap: 12px; }
.be-footer a { text-decoration: none; }
.be-footer a:hover { color: var(--th-foreground); }
.th-analytics-consent { position: fixed; right: 16px; bottom: 112px; left: 16px; z-index: 90; display: flex; justify-content: center; pointer-events: none; }
.th-analytics-consent[hidden] { display: none; }
.th-analytics-consent-card { display: flex; align-items: end; justify-content: space-between; gap: 24px; width: min(100%, 960px); padding: 20px; border: 1px solid var(--th-border); border-radius: var(--th-radius-panel); background: var(--th-card); color: var(--th-card-foreground); box-shadow: 0 14px 38px color-mix(in oklab, var(--th-foreground) 18%, transparent); pointer-events: auto; }
.th-analytics-consent-copy { min-width: 0; }
.th-analytics-consent-copy .eyebrow { margin: 0 0 4px; }
.th-analytics-consent-copy h2 { margin: 0 0 6px; color: var(--th-card-foreground); font-size: 18px; line-height: 1.25; }
.th-analytics-consent-copy p:not(.eyebrow) { max-width: 680px; margin: 0 0 8px; color: var(--th-muted-foreground); font-size: 13px; }
.th-analytics-consent-copy a { color: var(--th-foreground); font-size: 13px; text-underline-offset: 3px; }
.th-analytics-consent-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.th-analytics-consent-actions button { min-height: 40px; padding: 0 14px; cursor: pointer; }
.be-landing { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); align-items: stretch; gap: 16px; padding: 28px 0; }
.be-landing-copy, .be-landing-panel { border: 1px solid var(--th-border); border-radius: var(--th-radius-panel); background: var(--th-card); box-shadow: 0 1px 2px color-mix(in oklab, var(--th-foreground) 6%, transparent); }
.be-landing-copy { display: flex; flex-direction: column; justify-content: center; min-height: 340px; padding: clamp(24px, 5vw, 64px); background: linear-gradient(135deg, var(--th-card), color-mix(in oklab, var(--th-primary) 8%, var(--th-card))); }
.be-landing-copy h1 { max-width: 720px; margin: 8px 0 14px; color: var(--th-card-foreground); font-size: clamp(36px, 5vw, 64px); line-height: 1.04; letter-spacing: -.055em; }
.be-landing-copy .hero-copy { max-width: 560px; margin: 0; font-size: 18px; }
.be-landing-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.be-landing-actions a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; text-decoration: none; }
.be-landing-panel { display: flex; flex-direction: column; justify-content: flex-end; min-height: 340px; padding: 24px; background: var(--th-muted); }
.be-landing-panel-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: auto; border-radius: 16px; background: color-mix(in oklab, var(--th-primary) 16%, transparent); color: var(--th-primary); }
.be-landing-panel-icon .bemusic-icon { width: 28px; height: 28px; }
.be-landing-panel strong { display: block; color: var(--th-foreground); font-size: 18px; }
.be-landing-panel p { margin: 8px 0 0; color: var(--th-muted-foreground); font-size: 14px; }

/* Public/Admin pages consume the same BeMusic primitives. */
.be-content .radio-hero, .be-content .radio-filter-bar, .be-content .radio-toolbar, .be-content .section-head, .be-content .radio-groups-section, .be-content .station-grid, .be-content .radio-recent-grid, .be-content .load-more-row, .be-content .detail-page, .be-content .admin-shell, .be-content .auth-page, .be-content .legal-page { width: auto; max-width: none; margin-inline: 0; }
.radio-hero, .detail-page, .auth-card, .legal-page, .admin-card, .radio-filter-bar, .podcast-side-card, .podcast-main-column, .podcast-detail-episodes { border: 1px solid var(--th-border) !important; border-radius: var(--th-radius-panel) !important; background: var(--th-card) !important; box-shadow: 0 1px 2px color-mix(in oklab, var(--th-foreground) 5%, transparent) !important; }
.be-content .radio-hero { padding: 16px 0 28px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
.radio-hero h1, .detail-page h1, .auth-card h1, .legal-page h1, .admin-page-head h1 { color: var(--th-foreground) !important; letter-spacing: -.03em; }
.eyebrow, .card-meta, .hero-copy, .admin-muted, .radio-hero .hero-copy { color: var(--th-muted-foreground) !important; }
.be-content .radio-station-head { padding: 16px 0 10px; }
.be-content .radio-station-head .station-heading-row { align-items: end; }
.be-content .radio-station-heading-copy { min-width: 0; }
.be-content .radio-station-heading-copy .eyebrow { margin: 0; }
.primary-button, .secondary-button, .ghost-button, .radio-filter-trigger, .radio-sort-tab, .podcast-text-action { border-radius: var(--th-radius-button) !important; }
.primary-button { background: var(--th-primary) !important; border-color: var(--th-primary) !important; color: var(--th-primary-foreground) !important; }
.secondary-button { border: 1px solid var(--th-border) !important; background: var(--th-secondary) !important; color: var(--th-secondary-foreground) !important; }
.secondary-button:disabled { cursor: not-allowed; opacity: .5; pointer-events: none; }
.ghost-button { background: transparent !important; color: var(--th-foreground) !important; }
.ghost-button:hover, .secondary-button:hover { background: var(--th-accent) !important; }
input, select, textarea, .input-with-icon, .auth-input-shell { border-color: var(--th-input) !important; border-radius: var(--th-radius-input) !important; background: var(--th-card) !important; color: var(--th-foreground) !important; }
input::placeholder, textarea::placeholder { color: var(--th-muted-foreground) !important; }
.station-card, .podcast-card, .episode-card, .admin-station-card, .kpi-card { border: 1px solid var(--th-border) !important; border-radius: var(--th-radius-panel) !important; background: var(--th-card) !important; color: var(--th-card-foreground) !important; box-shadow: 0 1px 2px color-mix(in oklab, var(--th-foreground) 6%, transparent) !important; }
.station-card:hover, .podcast-card:hover, .admin-station-card:hover { border-color: color-mix(in oklab, var(--th-primary) 55%, var(--th-border)) !important; transform: translateY(-1px); }
.station-card .card-title, .podcast-card .card-title, .admin-station-card h3, .detail-page h2, .admin-card h2 { color: var(--th-card-foreground) !important; }
.station-card .station-meta-row, .station-card .station-unavailable-label, .podcast-data-placeholder { color: var(--th-muted-foreground) !important; }
.admin-table { color: var(--th-card-foreground); }
.admin-table th { background: var(--th-muted); color: var(--th-muted-foreground); }
.admin-table td, .admin-table th { border-color: var(--th-border) !important; }
.status-chip, .user-status, .filter-chip, .tag-row span { border-radius: 999px !important; background: var(--th-secondary) !important; color: var(--th-secondary-foreground) !important; }
.alert, .auth-alert, .auth-success { border-radius: var(--th-radius-input) !important; border-color: var(--th-border) !important; background: var(--th-muted) !important; color: var(--th-foreground) !important; }
.pagination a, .pagination span { border-color: var(--th-border) !important; background: var(--th-card) !important; color: var(--th-foreground) !important; }

/* Admin dashboard shell */
.be-admin-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; gap: 8px; padding: 8px; background: var(--th-background); }
.be-admin-sidebar { position: static !important; top: auto !important; height: auto !important; display: flex; flex-direction: column; gap: 8px !important; min-height: calc(100dvh - 16px); border-right: 0 !important; padding: 10px 8px; }
.admin-sidebar.be-admin-sidebar { background: var(--th-sidebar) !important; color: var(--th-sidebar-foreground) !important; }
.be-admin-sidebar .admin-brand { min-width: 0; padding: 8px 12px 16px; }
.be-admin-sidebar .admin-nav { display: grid; gap: 3px; }
.be-admin-sidebar .admin-nav a, .be-admin-sidebar .admin-nav > span { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 12px; border-radius: 999px; color: inherit; font-size: 14px; text-decoration: none; }
.be-admin-sidebar .admin-nav a:hover, .be-admin-sidebar .admin-nav a.active, .be-admin-sidebar .admin-nav > span:hover { background: var(--th-sidebar-accent); }
.be-admin-sidebar .admin-nav a.active { font-weight: 600; }
.be-admin-sidebar .admin-nav-submenu { display: grid; gap: 3px; margin: 0 0 4px 31px; }
.be-admin-sidebar .admin-nav-submenu a { min-height: 32px; border-radius: 8px; font-size: 13px; }
.be-admin-sidebar-card, .be-admin-help-card, .admin-sidebar-card.be-admin-sidebar-card, .admin-help-card.be-admin-help-card { border-color: var(--th-border) !important; border-radius: var(--th-radius-panel) !important; background: var(--th-card) !important; color: var(--th-card-foreground) !important; }
.be-admin-sidebar-card { margin-top: auto; }
.be-admin-main { min-width: 0; min-height: 0; overflow: auto; }
.be-admin-topbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 64px; padding: 8px 16px; border-radius: var(--th-radius-panel); background: var(--th-background); }
.be-admin-content { width: min(100%, 1440px); margin: 0 auto; padding: 8px 20px 32px; }
.be-admin-content > .admin-shell { width: auto; max-width: none; margin: 0; }
.be-admin-mobile-toggle { display: none; margin-right: auto; }
.admin-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 12px 0 20px; }
.admin-page-head h1 { margin: 0; font-size: clamp(24px, 2vw, 32px); }
.admin-page-head .hero-copy { max-width: 700px; }
.admin-kpis { gap: 12px !important; }
.kpi-card { min-height: 120px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; gap: 4px 12px; }
.kpi-card > span:not(.kpi-icon) { grid-column: 1; grid-row: 1; }
.kpi-card > strong { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 32px; line-height: 1; }
.kpi-card > small { grid-column: 1; grid-row: 2; }
.kpi-card:has(.kpi-icon) { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-rows: auto 1fr; }
.kpi-card:has(.kpi-icon) > .kpi-icon { grid-column: 1; grid-row: 1 / span 2; }
.kpi-card:has(.kpi-icon) > span:not(.kpi-icon) { grid-column: 2; grid-row: 1; }
.kpi-card:has(.kpi-icon) > strong { grid-column: 3; }
.kpi-card:has(.kpi-icon) > small { grid-column: 2; grid-row: 2; }
.catalog-filter-panel, .station-catalog-panel, .admin-table-wrap, .admin-form { border-color: var(--th-border) !important; background: var(--th-card) !important; }
.background-theme-library { display: grid; gap: 16px; }
.background-theme-card { overflow: hidden; }
.background-theme-previews { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.background-theme-previews figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--th-border); border-radius: var(--th-radius); background: var(--th-muted); }
.background-theme-previews img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--th-background); }
.background-theme-previews figcaption { padding: 7px 9px 8px; color: var(--th-muted-foreground); font-size: 12px; line-height: 1.25; }

/* Existing feature pages: retain behavior while normalizing BeMusic density. */
.radio-filter-bar { padding: 10px 14px !important; }
.radio-filter-brand { display: none !important; }
.radio-filter-layout { justify-content: flex-start !important; }
.radio-primary-controls { width: 100%; }
.radio-search-control { flex: 1 1 360px; }
.station-grid, .admin-station-grid { gap: 12px !important; }
.radio-group-link { border-color: var(--th-border); background: var(--th-card); color: var(--th-foreground); }
.radio-group-link-count { color: var(--th-muted-foreground); }
.radio-group-link:hover { border-color: color-mix(in oklab, var(--th-primary) 55%, var(--th-border)); background: var(--th-accent); }
.radio-group-link.is-selected { border-color: var(--th-primary); color: var(--th-primary); }
.radio-groups-feedback { color: var(--th-muted-foreground); }
.station-art, .detail-art { border-radius: 8px !important; }
.podcast-layout { gap: 12px !important; }
.podcast-side-column { gap: 12px !important; }
.podcast-side-card { padding: 16px !important; }
.auth-page { min-height: auto !important; padding: 24px 0 !important; }
.auth-card { width: min(100%, 560px) !important; margin: 0 auto !important; padding: 28px !important; }
.legal-page { padding: 28px !important; }
.legal-content { color: var(--th-card-foreground) !important; }
.detail-page { padding: 20px !important; }

@media (max-width: 1279px) {
    .be-public-main-layout { grid-template-columns: 240px minmax(0, 1fr); }
}

@media (min-width: 1025px) {
    .be-public-main-layout { display: block; }
    .be-sidebar[data-be-drawer][hidden] { display: block; }
    .be-admin-sidebar[data-be-drawer][hidden] { display: flex; }
}

@media (max-width: 1024px) {
    .be-app-shell { grid-template-rows: 56px auto; padding: 0; gap: 0; }
    .be-app-shell, .be-public-main-layout, .be-main-pane, .be-content { width: 100%; max-width: 100%; min-width: 0; }
    .be-navbar { display: flex; width: 100%; max-width: 100%; gap: 20px; padding: 8px 12px; border-bottom: 1px solid var(--th-border); }
    .be-brand { min-width: 0; font-size: 18px; }
    .be-brand .brand-logo-shell { width: 28px; height: 28px; }
    .be-menu-toggle { display: inline-grid; order: -1; }
    .be-global-search { height: 40px; max-width: none; margin-left: 0; }
    .be-search-panel { position: fixed; top: 56px; right: 12px; left: 12px; width: auto; max-height: calc(100dvh - 68px); }
    .be-navbar-actions .be-auth-link--outline,
    .be-navbar-actions .be-auth-link--primary { display: none; }
    .be-public-main-layout { display: block; }
    .be-sidebar { position: fixed; inset: 56px auto 0 0; z-index: 50; width: min(280px, calc(100vw - 48px)); border-radius: 0 var(--th-radius-panel) var(--th-radius-panel) 0; box-shadow: 18px 0 40px color-mix(in oklab, var(--th-foreground) 16%, transparent); overflow: auto; }
    body.has-public-background .be-sidebar { inset: 64px auto 8px 8px; border-radius: var(--th-radius-panel); }
    .be-sidebar[hidden] { display: none; }
    .be-main-pane { border-radius: 0; }
    .be-content { padding: 16px 16px 104px; }
    .be-footer { padding: 16px; }
    .th-analytics-consent { right: 12px; bottom: 88px; left: 12px; }
    .th-analytics-consent-card { align-items: stretch; flex-direction: column; gap: 16px; padding: 16px; }
    .th-analytics-consent-actions { justify-content: stretch; }
    .th-analytics-consent-actions button { flex: 1 1 180px; }
    .be-admin-layout { display: block; padding: 0; }
    .be-admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, calc(100vw - 48px)); min-height: 100dvh; border-radius: 0 var(--th-radius-panel) var(--th-radius-panel) 0; box-shadow: 18px 0 40px color-mix(in oklab, var(--th-foreground) 16%, transparent); }
    .be-admin-sidebar[hidden] { display: none; }
    .be-admin-main { overflow: visible; }
    .be-admin-topbar { min-height: 56px; border-bottom: 1px solid var(--th-border); border-radius: 0; }
    .be-admin-mobile-toggle { display: inline-grid; }
    .be-admin-content { padding: 8px 16px 28px; }
    .admin-page-head { flex-wrap: wrap; }
    .background-theme-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .be-radio-discovery-group-head { align-items: flex-start; }
}

@media (max-width: 640px) {
    .be-navbar { gap: 8px; }
    .be-global-search { flex: 1; }
    .be-global-search-filters { max-width: 58%; gap: 3px; }
    .be-global-search-filter-chip { max-width: 150px; height: 24px; padding-inline: 5px; }
    .be-global-search-filter-chip-type { font-size: 8px; }
    .be-global-search-filter-chip-remove { flex-basis: 17px; width: 17px; height: 17px; }
    .be-global-search input { flex-basis: 84px; font-size: 13px; }
    .be-search-panel { padding: 14px; border-radius: 0 0 var(--th-radius-panel) var(--th-radius-panel); }
    .be-radio-discovery-summary { display: grid; gap: 4px; }
    .be-radio-discovery-sync { margin-left: 0; }
    .be-radio-discovery-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .be-radio-discovery-group-head { flex-wrap: wrap; }
    .be-radio-discovery-group-actions { width: 100%; justify-content: space-between; }
    .be-radio-discovery-selected { max-width: calc(100% - 68px); justify-content: flex-start; }
    .be-radio-discovery-option:nth-child(5n) { border-right: 1px solid var(--th-border); }
    .be-radio-discovery-option:nth-last-child(-n + 5) { border-bottom: 1px solid var(--th-border); }
    .be-radio-discovery-option:nth-child(2n) { border-right: 0; }
    .be-radio-discovery-option:nth-last-child(-n + 2) { border-bottom: 0; }
    .be-search-group-grid { grid-template-columns: 1fr; }
    .be-navbar-actions { gap: 2px; flex: 0 0 auto; }
    .be-global-search { min-width: 0; }
    .be-user-menu .be-user-name { display: none; }
    .be-content { padding-inline: 12px; }
    .be-landing { grid-template-columns: 1fr; padding-top: 12px; }
    .be-landing-copy, .be-landing-panel { min-height: 260px; }
    .be-landing-copy h1 { font-size: clamp(34px, 11vw, 50px); }
    .radio-hero, .detail-page, .auth-card, .legal-page { padding: 18px !important; }
    .admin-page-head { padding-top: 4px; }
    .admin-page-head h1 { font-size: 24px; }
    .catalog-filter-form, .contribution-field-grid, .settings-grid { grid-template-columns: 1fr !important; }
    .admin-table-wrap { overflow-x: auto; }
    .admin-table { min-width: 680px; }
    .be-admin-content { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
    .station-card:hover, .podcast-card:hover, .admin-station-card:hover { transform: none; }
}
