.theme-switch { position: relative; }

.theme-switch summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--theme-line, rgba(18, 24, 38, 0.14));
    border-radius: 12px;
    background: var(--theme-chip, #fff);
    color: var(--theme-ink, #121826);
    cursor: pointer;
    box-sizing: border-box;
}

.theme-switch summary::-webkit-details-marker { display: none; }

.theme-ico {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: inherit;
}

.theme-ico svg,
.theme-panel svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.theme-ico svg { display: none; }

.theme-ico[data-icon="light"] .i-light,
.theme-ico[data-icon="dark"] .i-dark,
.theme-ico[data-icon="system"] .i-system { display: block; }

.theme-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 176px;
    padding: 6px;
    display: grid;
    gap: 2px;
    background: var(--theme-menu, #fff);
    color: var(--theme-ink, #121826);
    border: 1px solid var(--theme-line, rgba(18, 24, 38, 0.12));
    border-radius: 14px;
    box-shadow: var(--theme-shadow, 0 16px 32px rgba(16, 20, 32, 0.16));
    z-index: 80;
}

.theme-switch--stacked { width: 100%; }

.theme-switch--stacked .theme-panel {
    position: static;
    margin-top: 8px;
    box-shadow: none;
}

.theme-panel button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    background: transparent;
    color: var(--theme-ink, #121826);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.theme-panel button svg {
    color: inherit;
    stroke: currentColor;
}

.theme-panel button:hover,
.theme-panel button.is-on {
    background: var(--theme-on, rgba(225, 29, 72, 0.1));
    color: var(--theme-ink, #121826);
}

.theme-panel button.is-on {
    box-shadow: inset 3px 0 0 #e11d48;
}

html:not(.dark) {
    --theme-chip: #ffffff;
    --theme-menu: #ffffff;
    --theme-ink: #121826;
    --theme-line: rgba(18, 24, 38, 0.12);
    --theme-on: rgba(225, 29, 72, 0.1);
    --theme-shadow: 0 16px 32px rgba(16, 20, 32, 0.14);
}

html.dark {
    --theme-chip: #1c2433;
    --theme-menu: #1c2433;
    --theme-ink: #eef1f6;
    --theme-line: rgba(255, 255, 255, 0.12);
    --theme-on: rgba(225, 29, 72, 0.2);
    --theme-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

.fi-theme-switcher { display: none !important; }
