/* TickVisor responsive/device compatibility layer
   Loaded last so it can cleanly override the earlier desktop-heavy polish files. */

:root {
    --mobile-pad: clamp(16px, 4.5vw, 24px);
    --touch-target: 44px;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

@supports not (overflow-x: clip) {
    html,
    body { overflow-x: hidden; }
}

*,
*::before,
*::after {
    min-width: 0;
}

img,
svg,
canvas,
video,
iframe {
    max-width: 100%;
}

canvas,
video,
iframe {
    height: auto;
}

pre,
code,
.debug-content,
.method-list,
.compact-list,
.admin-v2-row-main,
.history-premium-meta,
.profile-subtitle,
.report-copy,
.report-narrative,
.billing-note-card,
.card,
.hero-card {
    overflow-wrap: anywhere;
    word-break: normal;
}

pre,
.debug-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-scroll,
.report-table,
.billing-table,
.admin-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="tel"],
input[type="file"],
select,
textarea {
    font-size: 16px;
}

button,
.button,
.account-link,
.account-button,
.theme-toggle,
.login-oauth {
    min-height: var(--touch-target);
    touch-action: manipulation;
}

.mobile-menu-toggle {
    display: none;
}

.site-main {
    padding-left: max(var(--pad, 24px), env(safe-area-inset-left));
    padding-right: max(var(--pad, 24px), env(safe-area-inset-right));
}

.site-header-shell,
.site-footer-shell {
    padding-left: max(clamp(18px, 3.4vw, 64px), env(safe-area-inset-left));
    padding-right: max(clamp(18px, 3.4vw, 64px), env(safe-area-inset-right));
}

.footer-copy {
    overflow-wrap: anywhere;
}

/* Tablet: stop two-column hero/admin panels from pretending tablets are cinema screens. */
@media (max-width: 1180px) {
    .landing-hero,
    .home-hero,
    .home-split-section,
    .dashboard-hero-premium,
    .dashboard-board,
    .dashboard-premium-grid,
    .dashboard-lower-grid,
    .analyze-hero-premium,
    .analyze-guide-grid,
    .history-hero-premium,
    .history-compare-grid,
    .billing-hero-premium,
    .billing-content-grid,
    .billing-ai-grid,
    .pricing-grid-clean,
    .support-hero,
    .support-guide-grid,
    .support-workflow-section,
    .support-faq-grid,
    .admin-command-grid,
    .admin-content-grid,
    .admin-v2-hero-grid,
    .admin-v2-main-grid,
    .admin-v2-webhook-grid,
    .profile-hero-grid,
    .profile-content-grid,
    .profile-top-clean,
    .profile-account-layout,
    .password-stage,
    .login-stage,
    .register-stage {
        grid-template-columns: 1fr !important;
    }

    .server-health-panel,
    .home-hero-copy,
    .dashboard-command-card,
    .analyze-input-panel,
    .history-activity-panel,
    .billing-status-panel,
    .profile-status-card,
    .admin-v2-chart-card,
    .admin-v2-panel,
    .login-form-card,
    .register-form-card,
    .password-form-card {
        max-width: none !important;
        width: 100% !important;
        justify-self: stretch !important;
    }

    .admin-v2-kpi-grid,
    .billing-status-grid,
    .history-activity-grid,
    .dashboard-kpi-row,
    .home-proof-strip,
    .home-step-grid,
    .home-plan-strip,
    .pricing-value-grid,
    .profile-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Phone navigation: real menu, not seven buttons compressed into a shiny accordion accident. */
@media (max-width: 820px) {
    :root {
        --pad: var(--mobile-pad);
    }

    body.mobile-menu-open {
        overflow-x: hidden;
    }

    .site-header-shell {
        padding-top: max(10px, env(safe-area-inset-top));
        background: linear-gradient(180deg, rgba(5, 8, 20, 0.94), rgba(5, 8, 20, 0.72) 72%, transparent) !important;
    }

    html[data-theme="light"] .site-header-shell {
        background: linear-gradient(180deg, rgba(246, 249, 255, 0.96), rgba(246, 249, 255, 0.78) 72%, transparent) !important;
    }

    .site-header.minimal-site-header {
        width: 100% !important;
        min-height: 64px !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        align-items: stretch !important;
        padding: 12px !important;
        border-radius: 22px !important;
        border: 1px solid rgba(140, 162, 200, 0.18) !important;
        background: rgba(8, 16, 32, 0.9) !important;
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22) !important;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    html[data-theme="light"] .site-header.minimal-site-header {
        background: rgba(255, 255, 255, 0.92) !important;
        box-shadow: 0 18px 48px rgba(35, 55, 96, 0.12) !important;
    }

    .site-header.minimal-site-header .header-left {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 14px !important;
        flex-wrap: nowrap !important;
    }

    .brand-logo .logo-light,
    .brand-logo .logo-dark {
        width: clamp(132px, 42vw, 168px) !important;
        max-width: clamp(132px, 42vw, 168px) !important;
    }

    .mobile-menu-toggle {
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        padding: 0 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        border: 1px solid rgba(103, 232, 165, 0.18);
        border-radius: 14px;
        color: var(--text, #f8fbff);
        background: rgba(7, 15, 31, 0.28);
        box-shadow: none;
        font-size: 0.88rem;
        font-weight: 900;
        line-height: 1;
        cursor: pointer;
    }

    html[data-theme="light"] .mobile-menu-toggle {
        color: var(--ink, #0a1640);
        background: rgba(244, 248, 255, 0.92);
        border-color: rgba(28, 49, 86, 0.12);
    }

    .mobile-menu-toggle:hover {
        transform: none;
        box-shadow: none;
    }

    .mobile-menu-toggle-bars {
        width: 18px;
        display: grid;
        gap: 4px;
    }

    .mobile-menu-toggle-bars span {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transition: transform .18s ease, opacity .18s ease;
    }

    body.mobile-menu-open .mobile-menu-toggle-bars span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    body.mobile-menu-open .mobile-menu-toggle-bars span:nth-child(2) {
        opacity: 0;
    }

    body.mobile-menu-open .mobile-menu-toggle-bars span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .site-header.minimal-site-header .site-nav,
    .site-header.minimal-site-header .account-nav {
        display: none !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .site-nav,
    body.mobile-menu-open .site-header.minimal-site-header .account-nav {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin: 12px 0 0 !important;
        padding-top: 12px !important;
        border-top: 1px solid rgba(140, 162, 200, 0.16) !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .site-nav a,
    body.mobile-menu-open .site-header.minimal-site-header .account-link,
    body.mobile-menu-open .site-header.minimal-site-header .account-button,
    body.mobile-menu-open .site-header.minimal-site-header .theme-toggle,
    body.mobile-menu-open .logout-form,
    body.mobile-menu-open .logout-form button {
        width: 100% !important;
        justify-content: center !important;
        min-height: 46px !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .site-nav a,
    body.mobile-menu-open .site-header.minimal-site-header .account-link,
    body.mobile-menu-open .site-header.minimal-site-header .theme-toggle {
        background: rgba(255, 255, 255, 0.045) !important;
        border: 1px solid rgba(140, 162, 200, 0.16) !important;
        border-radius: 14px !important;
    }

    html[data-theme="light"] body.mobile-menu-open .site-header.minimal-site-header .site-nav a,
    html[data-theme="light"] body.mobile-menu-open .site-header.minimal-site-header .account-link,
    html[data-theme="light"] body.mobile-menu-open .site-header.minimal-site-header .theme-toggle {
        background: rgba(246, 249, 255, 0.86) !important;
        border-color: rgba(28, 49, 86, 0.12) !important;
    }

    .site-main {
        padding-top: 22px !important;
        padding-bottom: 56px !important;
    }

    .site-footer {
        display: grid !important;
        grid-template-columns: 1fr !important;
        justify-items: stretch !important;
        gap: 18px !important;
        padding: 22px 0 max(22px, env(safe-area-inset-bottom)) !important;
    }

    .site-footer nav {
        justify-content: flex-start !important;
        gap: 10px 14px !important;
    }
}

@media (max-width: 720px) {
    .page-shell,
    .dashboard-premium-page,
    .analyze-premium-page,
    .history-premium-page,
    .billing-premium-page,
    .admin-v2-page,
    .profile-premium-page {
        gap: 24px !important;
    }

    h1,
    .home-hero h1,
    .dashboard-hero-copy h1,
    .analyze-hero-copy h1,
    .history-hero-copy h1,
    .billing-hero-copy h1,
    .support-hero-copy h1,
    .admin-v2-hero-copy h1,
    .profile-account-main h1,
    .login-visual-copy h1 {
        font-size: clamp(2.65rem, 13vw, 4.3rem) !important;
        line-height: 0.98 !important;
        letter-spacing: -0.075em !important;
    }

    h2,
    .admin-v2-panel-heading h2,
    .login-form-header h2 {
        font-size: clamp(2rem, 9vw, 3rem) !important;
        line-height: 1.02 !important;
    }

    .hero-card,
    .card,
    .metric-card,
    .score-card,
    .plan-card,
    .dashboard-command-card,
    .dashboard-panel,
    .analyze-hero-copy,
    .analyze-input-panel,
    .analyze-upload-card,
    .analyze-guide-card,
    .history-hero-copy,
    .history-activity-panel,
    .history-compare-panel,
    .history-upload-panel,
    .billing-hero-copy,
    .billing-status-panel,
    .billing-ai-panel,
    .billing-summary-panel,
    .billing-danger-panel,
    .billing-purchase-panel,
    .pricing-plan-card,
    .support-hero-copy,
    .support-health-card,
    .support-guide-card,
    .support-wide-card,
    .support-step-item,
    .support-faq-card,
    .admin-v2-hero-card,
    .admin-v2-chart-card,
    .admin-v2-kpi-card,
    .admin-v2-panel,
    .profile-account-card,
    .profile-status-card,
    .profile-form-card,
    .profile-help-card,
    .profile-wide-card,
    .login-visual-card,
    .login-form-card,
    .register-plan-panel,
    .password-security-panel {
        border-radius: 24px !important;
        padding: clamp(20px, 6vw, 26px) !important;
    }

    .grid.two,
    .grid.three,
    .grid.four,
    .home-proof-strip,
    .home-step-grid,
    .home-plan-strip,
    .dashboard-kpi-row,
    .dashboard-premium-grid,
    .dashboard-lower-grid,
    .dashboard-command-stats,
    .dashboard-progress-stack,
    .analyze-guide-grid,
    .analyze-file-stack,
    .analyze-progress-mini,
    .history-activity-grid,
    .history-compare-grid,
    .billing-status-grid,
    .billing-side-grid,
    .billing-ai-pack-grid,
    .pricing-value-grid,
    .pricing-grid-clean,
    .support-guide-grid,
    .support-faq-grid,
    .admin-v2-kpi-grid,
    .admin-v2-pulse-grid,
    .profile-status-grid,
    .profile-form-premium,
    .profile-help-list,
    .register-plan-metrics,
    .register-trial-flow,
    .login-oauth-grid,
    .login-metric-row,
    .login-benefit-grid,
    .password-step-list {
        grid-template-columns: 1fr !important;
    }

    .home-actions,
    .actions,
    .dashboard-hero-copy .home-actions,
    .dashboard-command-card .home-actions,
    .analyze-form-footer,
    .history-premium-actions,
    .billing-hero-copy .home-actions,
    .profile-actions,
    .profile-form-actions,
    .support-wide-card .home-actions,
    .login-form-row {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .home-actions .button,
    .actions .button,
    .dashboard-hero-copy .button,
    .dashboard-command-card .button,
    .analyze-form-footer .button,
    .analyze-form-footer button,
    .history-premium-actions .button,
    .billing-hero-copy .button,
    .profile-actions .button,
    .profile-form-actions .button,
    .profile-form-actions button,
    .support-wide-card .button,
    .login-submit {
        width: 100% !important;
    }

    .section-header,
    .history-section-header,
    .billing-section-header,
    .admin-v2-panel-heading,
    .admin-v2-report-top,
    .register-selected-plan,
    .password-security-header,
    .home-check-item,
    .support-step-item {
        display: grid !important;
        grid-template-columns: 1fr !important;
        justify-items: start !important;
        gap: 12px !important;
    }

    .server-health-panel,
    .heartbeat-card,
    .login-health-panel,
    .profile-identity-card {
        min-height: auto !important;
    }

    .heartbeat-wave,
    .login-wave,
    .admin-v2-chart-wrap,
    .dashboard-wave-card {
        min-height: 150px !important;
        height: auto !important;
    }

    .billing-tabs,
    .pricing-tabs,
    .report-jumpbar,
    .utility-strip,
    .home-kicker-row,
    .badges,
    .home-tag-row,
    .admin-v2-row-badges {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }

    .billing-tabs > *,
    .pricing-tabs > *,
    .report-jumpbar > *,
    .utility-strip > *,
    .home-kicker-row > *,
    .badges > *,
    .home-tag-row > *,
    .admin-v2-row-badges > * {
        flex: 0 0 auto;
    }

    .admin-v2-user-row,
    .admin-user-row,
    .history-premium-item,
    .profile-stat-card,
    .home-check-item,
    .support-step-item {
        grid-template-columns: auto minmax(0, 1fr) !important;
    }

    .admin-v2-row-badges,
    .history-premium-actions,
    .home-check-item em,
    .support-step-item em {
        grid-column: 1 / -1 !important;
    }

    .login-experience,
    .register-experience,
    .password-experience {
        min-height: 100vh !important;
        min-height: 100dvh !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: max(16px, env(safe-area-inset-top)) var(--mobile-pad) max(22px, env(safe-area-inset-bottom)) !important;
        align-items: flex-start !important;
    }

    .auth-fullscreen-body,
    .auth-fullscreen-body .auth-fullscreen-main {
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .login-stage,
    .register-stage,
    .password-stage {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding-top: 18px !important;
        gap: 18px !important;
    }

    .login-brand {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        margin: 0 auto 8px 0 !important;
    }

    .login-theme-toggle {
        top: max(16px, env(safe-area-inset-top)) !important;
        right: var(--mobile-pad) !important;
    }

    .login-visual-card {
        display: none !important;
    }

    .login-form-card,
    .register-form-card,
    .password-form-card {
        align-self: stretch !important;
        justify-self: stretch !important;
    }

    .login-divider {
        margin: 20px 0 !important;
    }
}

@media (max-width: 420px) {
    .mobile-menu-toggle-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .site-header-shell,
    .site-footer-shell {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .site-main {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .brand-logo .logo-light,
    .brand-logo .logo-dark {
        width: 128px !important;
        max-width: 128px !important;
    }
}

@supports not (height: 100dvh) {
    .login-experience,
    .register-experience,
    .password-experience,
    .auth-fullscreen-body,
    .auth-fullscreen-body .auth-fullscreen-main {
        min-height: 100vh !important;
    }
}

@supports not (backdrop-filter: blur(1px)) {
    .site-header.minimal-site-header,
    .login-visual-card,
    .login-form-card,
    .register-plan-panel,
    .admin-v2-panel,
    .profile-account-card {
        background-color: #0b1428 !important;
    }

    html[data-theme="light"] .site-header.minimal-site-header,
    html[data-theme="light"] .login-visual-card,
    html[data-theme="light"] .login-form-card,
    html[data-theme="light"] .register-plan-panel,
    html[data-theme="light"] .admin-v2-panel,
    html[data-theme="light"] .profile-account-card {
        background-color: #ffffff !important;
    }
}

@supports not (color: color-mix(in srgb, white, black)) {
    .site-header.minimal-site-header .site-nav a:hover,
    .site-header.minimal-site-header .site-nav a.active {
        background: rgba(103, 232, 165, 0.10) !important;
        border-color: rgba(103, 232, 165, 0.18) !important;
    }
}

@supports not (text-wrap: balance) {
    h1,
    h2,
    h3,
    .home-hero-copy h1,
    .dashboard-hero-copy h1,
    .admin-v2-hero-copy h1,
    .profile-account-main h1,
    .login-visual-copy h1 {
        word-break: normal;
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Global action button visual system
   One button language across the site. Because five competing CTA styles is apparently how CSS files reproduce. */
:root {
    --tv-btn-primary-start: #4849ff;
    --tv-btn-primary-mid: #8750ff;
    --tv-btn-primary-end: #ad3cf6;
    --tv-btn-secondary-bg: #0e192d;
    --tv-btn-secondary-bg-2: #0b1628;
    --tv-btn-secondary-border: #20304a;
    --tv-btn-secondary-border-hover: #344a70;
    --tv-btn-text: #ffffff;
    --tv-btn-radius: 13px;
    --tv-btn-height: 44px;
    --tv-btn-pad-x: 20px;
    --tv-btn-shadow: 0 16px 34px rgba(126, 79, 255, 0.28), 0 0 22px rgba(126, 79, 255, 0.14);
    --tv-btn-shadow-hover: 0 20px 42px rgba(126, 79, 255, 0.34), 0 0 28px rgba(126, 79, 255, 0.18);
}

.button,
.account-button,
.login-submit,
.compact-button,
button:not(.mobile-menu-toggle):not(.theme-toggle):not(.account-link),
input[type="submit"],
input::file-selector-button,
input::-webkit-file-upload-button {
    min-height: var(--tv-btn-height) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    padding: 0 var(--tv-btn-pad-x) !important;
    border: 0 !important;
    border-radius: var(--tv-btn-radius) !important;
    color: var(--tv-btn-text) !important;
    background: linear-gradient(135deg, var(--tv-btn-primary-start) 0%, var(--tv-btn-primary-mid) 52%, var(--tv-btn-primary-end) 100%) !important;
    box-shadow: var(--tv-btn-shadow) !important;
    font-size: 0.94rem !important;
    font-weight: 850 !important;
    line-height: 1 !important;
    letter-spacing: -0.01em !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease !important;
}

.button:hover,
.account-button:hover,
.login-submit:hover,
.compact-button:hover,
button:not(.mobile-menu-toggle):not(.theme-toggle):not(.account-link):hover,
input[type="submit"]:hover,
input::file-selector-button:hover,
input::-webkit-file-upload-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: var(--tv-btn-shadow-hover) !important;
}

.button.secondary,
.button.ghost,
button.secondary,
.account-link,
.theme-toggle,
.mobile-menu-toggle,
.login-oauth,
.profile-form-actions .button.secondary,
.profile-actions .button.secondary,
.profile-wide-button {
    min-height: var(--tv-btn-height) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    padding: 0 var(--tv-btn-pad-x) !important;
    border: 1px solid var(--tv-btn-secondary-border) !important;
    border-radius: var(--tv-btn-radius) !important;
    color: var(--tv-btn-text) !important;
    background: linear-gradient(180deg, var(--tv-btn-secondary-bg) 0%, var(--tv-btn-secondary-bg-2) 100%) !important;
    box-shadow: none !important;
    font-size: 0.94rem !important;
    font-weight: 850 !important;
    line-height: 1 !important;
    letter-spacing: -0.01em !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease !important;
}

.button.secondary:hover,
.button.ghost:hover,
button.secondary:hover,
.account-link:hover,
.theme-toggle:hover,
.mobile-menu-toggle:hover,
.login-oauth:not(.is-disabled):hover,
.profile-form-actions .button.secondary:hover,
.profile-actions .button.secondary:hover,
.profile-wide-button:hover {
    transform: translateY(-1px) !important;
    border-color: var(--tv-btn-secondary-border-hover) !important;
    background: linear-gradient(180deg, #12213a 0%, #0d1a31 100%) !important;
    box-shadow: 0 14px 30px rgba(3, 8, 20, 0.22) !important;
}

.button:focus-visible,
.account-button:focus-visible,
.login-submit:focus-visible,
.compact-button:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible,
.login-oauth:focus-visible,
input::file-selector-button:focus-visible,
input::-webkit-file-upload-button:focus-visible {
    outline: 3px solid rgba(143, 91, 255, 0.42) !important;
    outline-offset: 3px !important;
}

button:disabled,
button[disabled],
.button[aria-disabled="true"],
.login-oauth.is-disabled,
input[type="submit"]:disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.login-oauth span {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.theme-toggle-icon {
    flex: 0 0 auto !important;
}

.pricing-tabs {
    border-color: var(--tv-btn-secondary-border) !important;
    background: linear-gradient(180deg, rgba(14, 25, 45, 0.92), rgba(11, 22, 40, 0.92)) !important;
    box-shadow: none !important;
}

.pricing-tabs label {
    min-height: 40px !important;
    border-radius: calc(var(--tv-btn-radius) - 2px) !important;
    color: rgba(255,255,255,.82) !important;
}

#billing-monthly:checked ~ .pricing-tabs label[for="billing-monthly"],
#billing-quarterly:checked ~ .pricing-tabs label[for="billing-quarterly"],
#billing-yearly:checked ~ .pricing-tabs label[for="billing-yearly"] {
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--tv-btn-primary-start) 0%, var(--tv-btn-primary-mid) 52%, var(--tv-btn-primary-end) 100%) !important;
    box-shadow: 0 10px 26px rgba(126, 79, 255, 0.24) !important;
}

@media (max-width: 720px) {
    .button,
    .account-button,
    .login-submit,
    .compact-button,
    button:not(.mobile-menu-toggle):not(.theme-toggle):not(.account-link),
    input[type="submit"],
    .button.secondary,
    .button.ghost,
    button.secondary,
    .account-link,
    .theme-toggle,
    .mobile-menu-toggle,
    .login-oauth,
    .profile-wide-button {
        min-height: 46px !important;
        white-space: normal !important;
    }
}

/* Header/nav repair: desktop should show the nav, not a mobile menu cosplay. */
@media (min-width: 821px) {
    .mobile-menu-toggle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .site-header.minimal-site-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: clamp(16px, 2vw, 28px) !important;
    }

    .site-header.minimal-site-header .header-left {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: clamp(16px, 2.2vw, 42px) !important;
    }

    .site-header.minimal-site-header .brand.brand-logo {
        flex: 0 0 auto !important;
        max-width: 190px !important;
    }

    .site-header .brand-logo .logo-light,
    .site-header .brand-logo .logo-dark,
    .site-header img.logo-light,
    .site-header img.logo-dark {
        width: clamp(150px, 10.5vw, 190px) !important;
        max-width: 190px !important;
        min-width: 150px !important;
    }

    .site-header.minimal-site-header .site-nav {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
        gap: clamp(4px, 0.55vw, 8px) !important;
        overflow: visible !important;
    }

    .site-header.minimal-site-header .site-nav a {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        padding: 0 clamp(10px, 0.7vw, 13px) !important;
        font-size: clamp(0.84rem, 0.78vw, 0.92rem) !important;
    }

    .site-header.minimal-site-header .account-nav {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: clamp(7px, 0.7vw, 10px) !important;
    }

    .site-header.minimal-site-header .theme-toggle,
    .site-header.minimal-site-header .account-link,
    .site-header.minimal-site-header .account-button {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        padding-left: clamp(12px, 0.85vw, 18px) !important;
        padding-right: clamp(12px, 0.85vw, 18px) !important;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    .site-header.minimal-site-header {
        gap: 12px !important;
    }

    .site-header.minimal-site-header .header-left {
        gap: 14px !important;
    }

    .site-header.minimal-site-header .brand.brand-logo {
        max-width: 160px !important;
    }

    .site-header .brand-logo .logo-light,
    .site-header .brand-logo .logo-dark,
    .site-header img.logo-light,
    .site-header img.logo-dark {
        width: clamp(136px, 14vw, 160px) !important;
        max-width: 160px !important;
        min-width: 136px !important;
    }

    .site-header.minimal-site-header .site-nav {
        gap: 4px !important;
    }

    .site-header.minimal-site-header .site-nav a {
        min-height: 40px !important;
        padding: 0 8px !important;
        font-size: 0.82rem !important;
    }

    .site-header.minimal-site-header .account-nav {
        gap: 6px !important;
    }

    .site-header.minimal-site-header .theme-toggle,
    .site-header.minimal-site-header .account-link,
    .site-header.minimal-site-header .account-button,
    .site-header.minimal-site-header .logout-form button {
        min-height: 40px !important;
        height: 40px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        font-size: 0.82rem !important;
    }
}

@media (min-width: 821px) and (max-width: 980px) {
    .site-header.minimal-site-header .theme-toggle-text {
        display: none !important;
    }

    .site-header.minimal-site-header .theme-toggle {
        min-width: 44px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .site-header.minimal-site-header .account-link {
        max-width: 118px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* Mobile menu layout repair v2
   The nav lives inside .header-left, so flex layout was shoving it beside the logo. Brilliant little trap. */
@media (max-width: 820px) {
    .site-header.minimal-site-header {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-items: stretch !important;
        justify-items: stretch !important;
        gap: 0 !important;
    }

    .site-header.minimal-site-header .header-left {
        width: 100% !important;
        min-width: 0 !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-areas:
            "brand toggle"
            "nav nav" !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 12px !important;
        flex-wrap: initial !important;
    }

    .site-header.minimal-site-header .brand.brand-logo {
        grid-area: brand !important;
        min-width: 0 !important;
        max-width: min(168px, 56vw) !important;
        justify-self: start !important;
    }

    .site-header .brand-logo .logo-light,
    .site-header .brand-logo .logo-dark,
    .site-header img.logo-light,
    .site-header img.logo-dark {
        width: clamp(132px, 38vw, 168px) !important;
        max-width: min(168px, 56vw) !important;
        min-width: 0 !important;
    }

    .site-header.minimal-site-header .mobile-menu-toggle {
        grid-area: toggle !important;
        width: auto !important;
        min-width: 46px !important;
        max-width: max-content !important;
        justify-self: end !important;
        align-self: center !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    .site-header.minimal-site-header .site-nav,
    .site-header.minimal-site-header .account-nav {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: none !important;
        overflow: visible !important;
    }

    .site-header.minimal-site-header .site-nav {
        grid-area: nav !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .site-nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin: 4px 0 0 !important;
        padding: 14px 0 0 !important;
        border-top: 1px solid rgba(140, 162, 200, 0.16) !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .account-nav {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin: 10px 0 0 !important;
        padding: 10px 0 0 !important;
        border-top: 1px solid rgba(140, 162, 200, 0.16) !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .site-nav a,
    body.mobile-menu-open .site-header.minimal-site-header .account-link,
    body.mobile-menu-open .site-header.minimal-site-header .account-button,
    body.mobile-menu-open .site-header.minimal-site-header .theme-toggle,
    body.mobile-menu-open .site-header.minimal-site-header .logout-form,
    body.mobile-menu-open .site-header.minimal-site-header .logout-form button {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-content: center !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .logout-form {
        display: block !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .mobile-menu-toggle .mobile-menu-toggle-text {
        font-size: 0 !important;
    }

    body.mobile-menu-open .site-header.minimal-site-header .mobile-menu-toggle .mobile-menu-toggle-text::after {
        content: "Close";
        font-size: 0.88rem !important;
        line-height: 1 !important;
    }
}

@media (max-width: 420px) {
    body.mobile-menu-open .site-header.minimal-site-header .mobile-menu-toggle .mobile-menu-toggle-text::after {
        content: "";
    }
}
