/* Theme tokens are shared by every page through themes.css. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    background: var(--page-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    color: inherit;
    font: inherit;
}

button,
summary,
label {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.settings-shell {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: var(--text-dim);
    font-size: 13px;
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}

.back-link svg {
    width: 15px;
    height: 15px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.page-header h1 {
    color: var(--text);
    font-size: clamp(27px, 3vw, 34px);
    font-weight: 680;
    letter-spacing: -0.035em;
}

.page-description {
    max-width: 560px;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.privacy-local-note {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding-bottom: 4px;
    color: var(--text-dim);
    font-size: 12px;
}

.privacy-local-note svg {
    width: 14px;
    height: 14px;
    color: var(--success);
}

.settings-layout {
    display: grid;
    grid-template-columns: 206px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
}

.settings-navigation {
    position: sticky;
    top: 24px;
    padding-right: 22px;
    border-right: 1px solid var(--border-soft);
}

.nav-group + .nav-group {
    margin-top: 21px;
}

.nav-group-label {
    display: block;
    margin: 0 10px 7px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.settings-tab {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: color 140ms ease, background-color 140ms ease;
}

.settings-tab:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.settings-tab[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.settings-tab svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: currentColor;
}

.settings-tab span {
    font-size: 13px;
    font-weight: 600;
}

.settings-content {
    min-width: 0;
}

.settings-banner {
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 13px;
}

.settings-banner[data-kind="success"] {
    border-color: color-mix(in srgb, var(--success) 42%, transparent);
    color: var(--success);
}

.settings-banner[data-kind="error"] {
    border-color: color-mix(in srgb, var(--danger) 42%, transparent);
    color: var(--danger);
}

.settings-panel {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading {
    padding: 25px 28px 23px;
}

.panel-heading h2 {
    color: var(--text);
    font-size: 19px;
    font-weight: 670;
    letter-spacing: -0.015em;
}

.panel-heading p {
    max-width: 650px;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

.settings-section {
    padding: 23px 28px;
    border-top: 1px solid var(--border-soft);
}

.section-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.section-heading h3 {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
}

.section-heading p {
    max-width: 560px;
    margin-top: 3px;
    color: var(--text-dim);
    font-size: 12px;
}

.status-line {
    display: flex;
    min-height: 45px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.status-label {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-line[data-state="ok"] .status-dot,
.status-line[data-state="ready"] .status-dot {
    background: var(--success);
}

.status-line[data-state="error"] .status-dot {
    background: var(--danger);
}

.status-line[data-state="loading"] .status-dot,
.status-line[data-state="degraded"] .status-dot {
    background: var(--warning);
}

.status-primary {
    color: var(--text);
    font-size: 13px;
    font-weight: 570;
}

.status-secondary {
    color: var(--text-dim);
    font-size: 12px;
}

.connection-guidance {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 18px;
    align-items: center;
    margin-top: 17px;
    padding: 14px 15px;
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--warning);
    border-radius: 10px;
    background: var(--surface-raised);
}

.connection-guidance[data-category="unconfigured"],
.connection-guidance[data-category="connected_no_plays"] {
    border-left-color: var(--accent);
}

.connection-guidance[data-category="auth_failed"],
.connection-guidance[data-category="tls_error"],
.connection-guidance[data-category="network_unreachable"],
.connection-guidance[data-category="upstream_error"],
.connection-guidance[data-category="invalid_response"],
.connection-guidance[data-category="unknown"] {
    border-left-color: var(--danger);
}

.connection-guidance-copy strong {
    display: block;
    color: var(--text);
    font-size: 13px;
}

.connection-guidance-copy p,
.connection-guidance-facts {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
}

.connection-guidance-facts {
    grid-column: 1 / -1;
    color: var(--text-dim);
}

.setting-list {
    border-top: 1px solid var(--border-soft);
}

.setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 310px);
    gap: 32px;
    align-items: center;
    min-height: 84px;
    padding: 17px 0;
    border-bottom: 1px solid var(--border-soft);
}

.setting-row:last-child {
    border-bottom: 0;
}

.setting-copy strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 620;
}

.setting-copy span {
    display: block;
    max-width: 470px;
    margin-top: 3px;
    color: var(--text-dim);
    font-size: 12px;
}

.theme-setting-row {
    display: block;
    padding-top: 22px;
    padding-bottom: 22px;
}

.theme-setting-row > .setting-copy {
    margin-bottom: 16px;
}

.theme-setting-row > .setting-copy span {
    max-width: 680px;
}

.theme-picker {
    display: flex;
    width: 100%;
    max-width: 760px;
    flex-direction: column;
    gap: 10px;
}

.theme-picker-section + .theme-picker-section {
    margin-top: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
}

.theme-picker-heading strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.theme-picker-heading span {
    display: block;
    max-width: 680px;
    margin-top: 3px;
    color: var(--text-dim);
    font-size: 12px;
}

.theme-mode-grid,
.theme-palette-grid {
    display: grid;
    gap: 8px;
}

.theme-mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.theme-swatch {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    color: inherit;
    cursor: pointer;
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.theme-swatch input {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
}

.theme-swatch:hover {
    border-color: var(--accent);
    background: var(--field-hover);
}

.theme-swatch:has(input:checked) {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.theme-swatch.is-customized::after {
    position: absolute;
    z-index: 2;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border: 2px solid var(--surface-raised);
    border-radius: 999px;
    background: var(--accent);
    content: "";
    pointer-events: none;
}

.theme-swatch:focus-within {
    outline: none;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.theme-swatch-preview {
    display: flex;
    height: 42px;
    align-items: flex-end;
    gap: 4px;
    overflow: hidden;
    padding: 8px;
    border-radius: 7px;
    background: var(--page-bg);
}

.theme-mode-grid .theme-swatch-preview {
    height: 52px;
}

.theme-swatch-preview i {
    height: 12px;
    flex: 1;
    border-radius: 3px;
    background: var(--accent);
}

.theme-swatch-preview i:nth-child(2) {
    background: var(--warning);
}

.theme-swatch-preview i:nth-child(3) {
    background: var(--success);
}

.theme-swatch-preview.is-system {
    padding: 0;
}

.theme-swatch-half {
    flex: 1;
    background: var(--page-bg);
}

.theme-swatch-name {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-save-state {
    min-height: 18px;
    margin: 0;
    color: var(--text-dim);
    font-size: 12px;
}

.theme-customization {
    margin-top: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface-raised) 72%, transparent);
}

.theme-customization > summary {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 13px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

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

.theme-customization > summary::after {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(45deg) translateY(-2px);
    transition: transform 140ms ease;
}

.theme-customization[open] > summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
}

.theme-customization-summary strong,
.theme-customization-summary span {
    display: block;
}

.theme-customization-summary strong {
    font-size: 13px;
    font-weight: 650;
}

.theme-customization-summary span {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 12px;
}

.theme-customization-body {
    padding: 4px 13px 14px;
    border-top: 1px solid var(--border-soft);
}

.theme-customization-base {
    margin: 11px 0 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.theme-color-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
}

.theme-color-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(92px, 112px) 34px;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.theme-color-row label {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-color-row input[type="color"] {
    width: 42px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field-bg);
    cursor: pointer;
}

.theme-color-row input[type="text"] {
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--text);
    font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.theme-color-row input[aria-invalid="true"] {
    border-color: var(--danger);
}

.theme-copy-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--text-muted);
    cursor: pointer;
}

.theme-copy-button:hover {
    border-color: var(--accent);
    color: var(--text);
}

.theme-contrast-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin: 10px 0 0;
    padding: 0;
    color: var(--success);
    font-size: 11px;
    list-style: none;
}

.theme-contrast-checks li::before {
    content: "✓";
    margin-right: 5px;
}

.theme-contrast-checks li[data-pass="false"] {
    color: var(--danger);
}

.theme-contrast-checks li[data-pass="false"]::before {
    content: "×";
}

.theme-customization-status {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--text-dim);
    font-size: 12px;
}

.theme-customization-status[data-kind="error"] {
    color: var(--danger);
}

.theme-customization-status[data-kind="success"] {
    color: var(--success);
}

.theme-customization-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 9px;
}

.settings-select {
    position: relative;
    min-width: 0;
}

.settings-select[data-disabled="true"] {
    opacity: 0.7;
}

.settings-select-trigger {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px 9px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--field-bg);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.settings-select-trigger:hover,
.settings-select[data-open="true"] .settings-select-trigger {
    border-color: var(--accent);
    background: var(--field-hover);
}

.settings-select-trigger:disabled {
    cursor: default;
}

.settings-select-trigger span {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-select-trigger span[data-placeholder="true"] {
    color: var(--text-dim);
}

.settings-select-trigger svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: var(--text-dim);
    transition: transform 140ms ease;
}

.settings-select[data-open="true"] .settings-select-trigger svg {
    transform: rotate(180deg);
}

.settings-options {
    position: absolute;
    z-index: 60;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    max-height: 224px;
    overflow: auto;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    box-shadow: var(--shadow);
}

.settings-option {
    position: relative;
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px 34px 8px 10px;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

.settings-option-lines {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.settings-option-label {
    color: var(--text);
    font-weight: 500;
}

.settings-option-subtitle {
    color: var(--text-dim);
    font-size: 11.5px;
}

.settings-option:hover,
.settings-option:focus-visible {
    background: var(--accent-soft);
    color: var(--text);
    outline: 0;
}

.settings-option[aria-selected="true"] {
    color: var(--accent-strong);
}

.settings-option[aria-selected="true"]::after {
    position: absolute;
    top: 9px;
    right: 12px;
    content: "✓";
    color: var(--success);
    font-size: 13px;
}

.switch {
    position: relative;
    width: 43px;
    height: 24px;
    justify-self: end;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--field-bg);
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    content: "";
    transition: transform 140ms ease, background-color 140ms ease;
}

.switch[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.switch[aria-checked="true"]::after {
    background: var(--accent);
    transform: translateX(19px);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.upload-button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
    transition: filter 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.primary-button {
    padding: 8px 15px;
    background: var(--accent);
    color: var(--accent-contrast);
}

.primary-button:hover {
    filter: brightness(1.07);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.text-button:disabled,
.upload-button:disabled {
    cursor: not-allowed;
    filter: none;
    opacity: 0.48;
}

.secondary-button,
.upload-button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--field-bg);
    color: var(--text);
}

.secondary-button:hover,
.upload-button:hover {
    border-color: var(--accent);
    background: var(--field-hover);
}

.danger-button {
    padding: 8px 14px;
    border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
    background: transparent;
    color: var(--danger);
}

.danger-button:hover {
    background: color-mix(in srgb, var(--danger) 9%, transparent);
}

.text-button {
    min-height: 30px;
    padding: 5px 7px;
    background: transparent;
    color: var(--accent-strong);
}

.text-button:hover {
    background: var(--accent-soft);
}

.text-button.danger {
    color: var(--danger);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 17px;
}

.form-field {
    min-width: 0;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.form-field input {
    width: 100%;
    min-height: 41px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--text);
    font-size: 13px;
}

.form-field input::placeholder {
    color: var(--text-dim);
}

.form-field input:focus {
    border-color: var(--accent);
    outline: 3px solid var(--focus);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    grid-column: 1 / -1;
    margin-top: 3px;
}

.source-enabled-control {
    display: flex;
    grid-column: 1 / -1;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface-raised);
    padding: 11px 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.source-enabled-control input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.source-enabled-control strong,
.source-enabled-control small {
    display: block;
}

.source-enabled-control strong {
    color: var(--text);
    font-size: 12px;
}

.source-enabled-control small {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.45;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.source-message {
    position: static;
    clear: both;
    margin-top: 14px;
    padding: 10px 12px;
    border-left: 2px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 12px;
}

.source-message[data-kind="success"] {
    border-left-color: var(--success);
    color: var(--success);
}

.source-message[data-kind="error"] {
    border-left-color: var(--danger);
    color: var(--danger);
}

.server-list {
    border-top: 1px solid var(--border-soft);
}

.server-row {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--border-soft);
}

.server-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.server-identity strong,
.server-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-identity strong {
    color: var(--text);
    font-size: 13px;
}

.server-identity span {
    color: var(--text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

.server-detail-line {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.server-url { min-width: 0; }

.server-status {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 6px;
    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 650;
}

.server-status[data-enabled="true"] { border-color: var(--success); color: var(--success); }
.server-status[data-enabled="false"] { border-color: var(--warning); color: var(--warning); }

.server-test-status { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.server-test-status[data-kind="success"] { color: var(--success); }
.server-test-status[data-kind="error"] { color: var(--danger); }
.server-test-status[hidden] { display: none; }

.row-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
}

.empty-line {
    padding: 14px 0;
    color: var(--text-dim);
    font-size: 12px;
}

.retention-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: 390px;
}

.retention-choice {
    position: relative;
    display: flex;
    min-height: 47px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--field-bg);
    color: var(--text-muted);
    cursor: pointer;
}

.retention-choice[data-selected="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}

.retention-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.retention-choice-copy {
    display: flex;
    flex-direction: column;
}

.retention-choice-copy strong {
    font-size: 12px;
    font-weight: 640;
}

.retention-choice-copy small {
    color: var(--text-dim);
    font-size: 10px;
}

.retention-check {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border);
    border-radius: 50%;
}

.retention-choice[data-selected="true"] .retention-check {
    border: 4px solid var(--accent);
}

.retention-slider {
    max-width: 390px;
    margin-top: 16px;
}

.retention-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    color: var(--text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.retention-preview {
    margin-top: 13px;
    color: var(--text-muted);
    font-size: 12px;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
}

.storage-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.storage-metric {
    min-width: 0;
    padding: 18px 0;
}

.storage-metric + .storage-metric {
    padding-left: 24px;
    border-left: 1px solid var(--border-soft);
}

.storage-metric:first-child {
    padding-right: 24px;
}

.storage-metric span {
    display: block;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.storage-metric strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.storage-metric small {
    display: block;
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 11px;
}

.user-operations {
    display: grid;
    grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.user-preview {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 11px;
}

.operation-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.merge-control {
    display: flex;
    width: 100%;
    align-items: start;
    justify-content: flex-end;
    gap: 8px;
    color: var(--text-dim);
    font-size: 11px;
}

.merge-control input {
    margin-top: 2px;
    accent-color: var(--accent);
}

.merge-control span {
    max-width: 290px;
}

.privacy-details {
    color: var(--text-muted);
    font-size: 12px;
}

.privacy-details summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 640;
}

.privacy-details ul {
    margin: 12px 0 0;
    padding-left: 18px;
}

.privacy-details li + li {
    margin-top: 5px;
}

.about-list {
    margin: 0;
}

.about-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
    gap: 20px;
    padding: 15px 0;
    border-top: 1px solid var(--border-soft);
}

.about-row dt {
    color: var(--text-dim);
    font-size: 12px;
}

.about-row dd {
    margin: 0;
    color: var(--text);
    font-size: 13px;
}

.about-row a {
    color: var(--accent-strong);
    text-underline-offset: 3px;
}

.login-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--overlay);
    backdrop-filter: blur(8px);
}

.login-form {
    width: min(390px, 100%);
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-form h2 {
    font-size: 18px;
}

.login-form > p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

.login-form .form-field {
    margin-top: 18px;
}

.login-form .primary-button {
    width: 100%;
    margin-top: 14px;
}

.login-error {
    margin-top: 10px !important;
    color: var(--danger) !important;
}

[data-motion="reduced"] *,
[data-motion="reduced"] *::before,
[data-motion="reduced"] *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

@media (max-width: 760px) {
    .settings-shell {
        width: min(100% - 28px, 680px);
        padding-top: 25px;
    }

    .page-header {
        display: block;
        margin-bottom: 20px;
    }

    .privacy-local-note {
        margin-top: 9px;
    }

    .settings-layout {
        display: block;
    }

    .settings-navigation {
        position: static;
        margin: 0 0 13px;
        padding: 0 0 10px;
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }

    #settingsTabBar {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .nav-group {
        display: contents;
    }

    .nav-group + .nav-group {
        margin-top: 0;
    }

    .nav-group-label {
        display: none;
    }

    .settings-tab {
        justify-content: center;
        gap: 6px;
        padding: 8px 6px;
        text-align: center;
    }

    .settings-tab span {
        font-size: 12px;
    }

    .panel-heading,
    .settings-section {
        padding-right: 20px;
        padding-left: 20px;
    }

    .setting-row {
        grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
        gap: 20px;
    }

    .user-operations {
        grid-template-columns: 1fr;
    }

    .operation-groups {
        justify-content: flex-start;
    }

    .merge-control {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .settings-shell {
        width: calc(100% - 20px);
        padding-top: 18px;
        padding-bottom: 30px;
    }

    .page-header h1 {
        font-size: 26px;
    }

    .privacy-local-note {
        display: none;
    }

    .settings-tab {
        min-width: 0;
        flex-direction: column;
        gap: 2px;
    }

    .settings-tab svg {
        width: 15px;
        height: 15px;
    }

    .settings-tab span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .settings-panel {
        border-radius: 11px;
    }

    .panel-heading,
    .settings-section {
        padding: 20px 16px;
    }

    .connection-guidance {
        grid-template-columns: 1fr;
    }

    .connection-guidance-facts {
        grid-column: auto;
    }

    .connection-guidance > button {
        justify-self: start;
    }

    .setting-row {
        display: block;
        min-height: 0;
        padding: 16px 0;
    }

    .setting-row > :last-child {
        width: 100%;
        margin-top: 11px;
    }

    .theme-color-fields {
        grid-template-columns: 1fr;
    }

    .theme-color-row {
        grid-template-columns: minmax(0, 1fr) 44px minmax(104px, 122px) 34px;
    }

    .theme-contrast-checks {
        grid-template-columns: 1fr;
    }

    .theme-customization-actions > button {
        flex: 1 1 120px;
    }

    .switch {
        width: 43px !important;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field.full {
        grid-column: auto;
    }

    .form-actions {
        grid-column: auto;
    }

    .server-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 13px 0;
    }

    .row-actions {
        margin-left: -7px;
    }

    .retention-choices {
        grid-template-columns: 1fr;
    }

    .storage-metrics {
        grid-template-columns: 1fr;
    }

    .storage-metric:first-child {
        padding-right: 0;
    }

    .storage-metric + .storage-metric {
        padding-left: 0;
        border-top: 1px solid var(--border-soft);
        border-left: 0;
    }

    .status-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .about-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}
