/* 主题切换器 — 前台/后台共用 */
.theme-switcher {
    position: relative;
    flex-shrink: 0;
}

.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--card) 92%, transparent);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: all .2s var(--ease-out, ease);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,.06));
    backdrop-filter: blur(8px);
}

.btn-theme-toggle:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
    transform: scale(1.04);
}

.theme-icon { font-size: 17px; line-height: 1; }

.theme-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 236px;
    padding: 14px;
    background: color-mix(in srgb, var(--card) 98%, transparent);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg, 0 16px 48px rgba(0,0,0,.12));
    z-index: 300;
    backdrop-filter: blur(16px);
    animation: themePanelIn .25s cubic-bezier(.22, 1, .36, 1);
}

@keyframes themePanelIn {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-panel.is-hidden { display: none !important; }

.theme-panel-title {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.theme-panel-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.theme-swatch-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 6px 4px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s ease;
}

.theme-swatch-btn:hover {
    background: rgba(var(--accent-rgb), .07);
    transform: scale(1.05);
}

.theme-swatch-btn.active {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .12);
}

.theme-swatch-btn .swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .08);
}

.theme-swatch-btn .swatch-name {
    font-size: 9px;
    color: var(--muted);
    line-height: 1.1;
    text-align: center;
}

.admin-theme-bar {
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 200;
}

@media (max-width: 640px) {
    .theme-panel {
        width: 210px;
        right: -8px;
    }
    .theme-panel-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
