.theme-settings {
    --page-accent: #fbbf24;
    --page-accent-strong: var(--hud-accent);
    --page-accent-rgb: 251, 191, 36;
    --page-glow: rgba(251, 191, 36, 0.24);
    --theme-primary: #fbbf24;
    --theme-secondary: var(--hud-accent);
    --theme-accent-rgb: 251, 191, 36;
    --theme-glow: rgba(251, 191, 36, 0.24);
}

.settings-header-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid var(--hud-outline);
    padding-bottom: 0.75rem;
}

.settings-top-tab {
    position: relative;
    padding: 0.7rem 1rem;
    border: none;
    background: transparent;
    color: #e5e7eb !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700 !important;
    border-radius: 0;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: color 0.2s ease;
}

.settings-top-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.75rem;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.settings-top-tab:hover {
    color: #fff !important;
}

.settings-top-tab:hover::after {
    background: var(--hud-outline-strong);
}

.settings-top-tab.active {
    color: #fff !important;
}

.settings-top-tab.active::after {
    background: var(--hud-accent);
    box-shadow: 0 0 12px rgba(245, 215, 161, 0.4);
}

.status-pill {
    padding: 4px 10px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--hud-outline);
    border-left: 2px solid var(--hud-outline);
    color: var(--hud-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    clip-path: polygon(0 0, calc(100% - 3px) 0, 100% 3px, 100% 100%, 0 100%);
}

.status-good {
    border-color: rgba(74, 222, 128, 0.35);
    border-left-color: rgb(74, 222, 128);
    background: rgba(74, 222, 128, 0.12);
    color: #bbf7d0;
    box-shadow: inset 0 1px 0 rgba(74, 222, 128, 0.15);
}

.status-bad {
    border-color: rgba(248, 113, 113, 0.4);
    border-left-color: rgb(248, 113, 113);
    background: rgba(248, 113, 113, 0.12);
    color: #fecdd3;
    box-shadow: inset 0 1px 0 rgba(248, 113, 113, 0.15);
}

.settings-provider-row {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.settings-provider-tab {
    position: relative;
    min-width: 0;
    text-align: center;
    scroll-snap-align: start;
}

.provider-tab-hud {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--hud-outline);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--hud-muted);
    overflow: visible;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 2px 6px rgba(0, 0, 0, 0.3);
    clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

.provider-tab-hud.active {
    color: #fff;
    border-color: var(--theme-secondary, var(--hud-accent));
    border-top-color: var(--theme-secondary, var(--hud-accent));
    box-shadow:
        inset 0 1px 0 rgba(var(--theme-accent-rgb, 245, 215, 161), 0.3),
        0 0 12px rgba(var(--theme-accent-rgb, 245, 215, 161), 0.3),
        0 4px 12px rgba(0, 0, 0, 0.4);
    background: linear-gradient(180deg, rgba(var(--theme-accent-rgb, 245, 215, 161), 0.12), rgba(var(--theme-accent-rgb, 245, 215, 161), 0.06));
}

.provider-tab-hud.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--theme-secondary, var(--hud-accent));
    box-shadow: 0 0 8px var(--theme-secondary, var(--hud-accent));
}

.provider-tab-hud:not(.active):hover {
    color: #fff;
    border-color: var(--hud-outline-strong);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    transform: translateY(-1px);
}

.provider-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.provider-content.hidden {
    display: none;
}

.unified-provider-tab {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--hud-outline);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--hud-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

.unified-provider-tab:hover:not(.active) {
    color: #fff;
    border-color: var(--hud-outline-strong);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    transform: translateY(-1px);
}

.unified-provider-tab.active {
    color: #fff;
    border-color: var(--hud-accent);
    border-top-color: var(--hud-accent);
    background: linear-gradient(180deg, rgba(245, 215, 161, 0.12), rgba(245, 215, 161, 0.06));
    box-shadow:
        inset 0 1px 0 rgba(245, 215, 161, 0.3),
        0 0 12px rgba(245, 215, 161, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

.unified-provider-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--hud-accent);
    box-shadow: 0 0 8px var(--hud-accent);
}

.unified-provider-content {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.unified-provider-content.hidden {
    display: none;
}

.provider-page-title {
    color: var(--hud-text);
}

.provider-security-label {
    color: var(--theme-secondary, var(--hud-accent));
}

.provider-overview-title {
    color: var(--hud-text);
}

.provider-overview-eyebrow {
    color: var(--theme-secondary, var(--hud-accent));
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.875rem;
}

.provider-overview-summary {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.provider-list-marker {
    color: var(--theme-secondary, var(--hud-accent));
}

.provider-list-marker-danger {
    color: #f87171;
}

.provider-sample-label {
    color: var(--theme-secondary, var(--hud-accent));
}

.provider-sample-copy {
    color: var(--hud-text);
    font-family: 'Consolas', monospace;
}

.provider-table-shell {
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.provider-model-table {
    width: 100%;
    background: transparent;
}

.provider-model-head {
    background: linear-gradient(180deg, rgba(var(--theme-accent-rgb, 245, 215, 161), 0.15), rgba(var(--theme-accent-rgb, 245, 215, 161), 0.08));
    border-bottom: 1px solid var(--hud-outline);
}

.provider-model-head-cell {
    color: var(--theme-secondary, var(--hud-accent));
}

.provider-model-body {
    background: rgba(0, 0, 0, 0.2);
}

.provider-model-row {
    border-bottom: 1px solid var(--hud-outline);
    transition: background 0.2s ease;
}

.provider-model-row:hover {
    background: rgba(var(--theme-accent-rgb, 245, 215, 161), 0.05);
}

.provider-model-row--featured {
    background: rgba(34, 197, 94, 0.05);
}

.provider-model-row--featured:hover {
    background: rgba(34, 197, 94, 0.1);
}

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

.provider-model-name {
    color: var(--hud-text);
}

.provider-model-id {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    color: var(--theme-secondary, var(--hud-accent));
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--hud-outline);
    font-family: 'Consolas', monospace;
}

.provider-capability-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.provider-capability-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
    line-height: 1;
    border-left-width: 3px;
    border-left-style: solid;
    background: rgba(255, 255, 255, 0.08);
}

.provider-capability-badge + .provider-capability-badge {
    margin-left: 0.25rem;
}

.provider-capability-badge--analysis {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #3b82f6;
    color: #93c5fd;
}

.provider-capability-badge--text {
    background: rgba(168, 85, 247, 0.15);
    border-left-color: #a855f7;
    color: #d8b4fe;
}

.provider-capability-badge--txt2img {
    background: rgba(34, 197, 94, 0.15);
    border-left-color: #22c55e;
    color: #86efac;
}

.provider-capability-badge--img2img {
    background: rgba(249, 115, 22, 0.15);
    border-left-color: #f97316;
    color: #fdba74;
}

@media (max-width: 767px) {
    .settings-provider-row {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .settings-provider-row::-webkit-scrollbar {
        display: none;
    }

    .settings-provider-tab {
        flex: 0 0 min(14rem, 78vw);
        width: min(14rem, 78vw);
    }
}

@media (min-width: 768px) {
    .settings-provider-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .settings-provider-tab {
        width: 100%;
    }
}

/* ─── No-Line Rule: remove structural borders (Synthetic Atmosphere) ─── */
[data-page="settings"] .hud-panel {
    border: none;
    clip-path: none;
    border-radius: 1rem;
}
[data-page="settings"] .hud-panel::before,
[data-page="settings"] .hud-panel::after {
    display: none;
}
[data-page="settings"] .hud-surface {
    border: none;
    background: rgba(18, 28, 42, 0.4);
}
[data-page="settings"] .hud-note {
    border: 1px solid rgba(73, 69, 81, 0.2);
    border-left: 1px solid rgba(73, 69, 81, 0.2);
}

/* ─── Headline font ─── */
.font-headline { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }

/* ─────────────────────────────────────────────────────────────
 * Provider pills — compact variant (v=5)
 * Matches interior/studio provider pill dimensions: shorter,
 * lighter borders, simple rounded-rect (no heavy clip-path),
 * name on the left + status badge on the right in a single row.
 * ───────────────────────────────────────────────────────────── */
body[data-page="settings"] .settings-provider-row {
    gap: 0.5rem;
}

body[data-page="settings"] .settings-provider-tab.provider-tab-hud {
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(9, 20, 33, 0.45);
    box-shadow: none;
    clip-path: none;
    min-height: 0;
    text-align: left;
    letter-spacing: 0;
    text-transform: none;
}

body[data-page="settings"] .settings-provider-tab .settings-provider-name {
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(217, 227, 246, 0.92);
    flex: 1 1 auto;
}

body[data-page="settings"] .settings-provider-tab .status-pill {
    padding: 0.18rem 0.5rem;
    font-size: 0.65rem;
    font-family: 'Geist Mono', ui-monospace, monospace;
    letter-spacing: 0.04em;
    text-transform: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    clip-path: none;
    color: rgba(203, 196, 211, 0.85);
    white-space: nowrap;
    box-shadow: none;
}

body[data-page="settings"] .settings-provider-tab.provider-tab-hud:not(.active):hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    transform: none;
}

body[data-page="settings"] .settings-provider-tab.provider-tab-hud.active {
    background: rgba(110, 231, 183, 0.10);
    border-color: rgba(110, 231, 183, 0.35);
    box-shadow: none;
}

body[data-page="settings"] .settings-provider-tab.provider-tab-hud.active::after {
    display: none;
}

body[data-page="settings"] .settings-provider-tab.provider-tab-hud.active .settings-provider-name {
    color: #fff;
}

/* Status pill state colors: configured / error / neutral */
body[data-page="settings"] .settings-provider-tab .status-pill.configured,
body[data-page="settings"] .settings-provider-tab .status-pill[data-status="configured"] {
    background: rgba(110, 231, 183, 0.14);
    border-color: rgba(110, 231, 183, 0.35);
    color: #6ee7b7;
}

body[data-page="settings"] .settings-provider-tab .status-pill.error,
body[data-page="settings"] .settings-provider-tab .status-pill[data-status="error"] {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecdd3;
}

/* Preserve compact look when legacy .status-good / .status-bad classes
 * are toggled on the pill by provider status updates */
body[data-page="settings"] .settings-provider-tab .status-pill.status-good {
    background: rgba(110, 231, 183, 0.14);
    border-color: rgba(110, 231, 183, 0.35);
    border-left-color: rgba(110, 231, 183, 0.35);
    color: #6ee7b7;
    box-shadow: none;
    clip-path: none;
}
body[data-page="settings"] .settings-provider-tab .status-pill.status-bad {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    border-left-color: rgba(248, 113, 113, 0.35);
    color: #fecdd3;
    box-shadow: none;
    clip-path: none;
}

/* Mobile: stack pills vertically so name + status fit cleanly on small screens.
 * Overrides the original 14rem-wide horizontal-scroll pattern. */
@media (max-width: 767px) {
    body[data-page="settings"] .settings-provider-row {
        flex-direction: column;
        overflow-x: visible;
        gap: 0.4rem;
    }
    body[data-page="settings"] .settings-provider-tab {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        scroll-snap-align: none;
    }
}
