/*
 | Apply & Subscribe and the customer billing pages. Every rule is scoped to
 | .tk-billing (or an .account-area that contains it), so nothing else on the
 | site is affected. Dark is the default; html[data-tk-theme="light"] gets the
 | same light surfaces the footer pages use.
 */
.tk-billing {
    --tkb-surface: linear-gradient(180deg, rgba(15, 15, 15, 0.98), rgba(6, 6, 6, 0.98));
    --tkb-card: rgba(255, 255, 255, 0.03);
    --tkb-border: rgba(255, 255, 255, 0.09);
    --tkb-text: #ffffff;
    --tkb-muted: rgba(255, 255, 255, 0.62);
    --tkb-input: #070707;
    --tkb-accent: var(--primary-color-light, #4ef36f);
    --tkb-warn-bg: rgba(255, 184, 77, 0.12);
    --tkb-warn-text: #ffd08a;
    --tkb-danger-text: #ff9b9b;
    color: var(--tkb-text);
}

.tk-billing-page {
    padding: 150px 0 90px;
    background:
        radial-gradient(circle at top center, color-mix(in srgb, var(--primary-color) calc(0.14 * 100%), transparent), transparent 26%),
        #030303;
}

.tk-billing-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.tk-billing-head {
    text-align: center;
    margin-bottom: 32px;
}

.tk-billing-head h1 {
    margin: 0 0 10px;
    color: var(--tkb-text);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.1;
}

.tk-billing-head p {
    margin: 0 auto;
    max-width: 680px;
    color: var(--tkb-muted);
    font-size: 16px;
}

.tk-billing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.tk-billing-card {
    border: 1px solid var(--tkb-border);
    border-radius: 24px;
    background: var(--tkb-surface);
    padding: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.tk-billing-card h2,
.tk-billing-card h3 {
    margin: 0 0 16px;
    color: var(--tkb-text);
    font-size: 20px;
    font-weight: 700;
}

.tk-billing-summary {
    position: sticky;
    top: 130px;
}

.tk-billing-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.tk-billing-fields .full {
    grid-column: 1 / -1;
}

.tk-billing-field label,
.tk-billing-legend {
    display: block;
    margin-bottom: 8px;
    color: var(--tkb-text);
    font-size: 14px;
    font-weight: 600;
}

.tk-billing-field input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--tkb-border);
    background: var(--tkb-input);
    color: var(--tkb-text);
    padding: 13px 15px;
    font-size: 14px;
}

.tk-billing-field input:focus {
    outline: none;
    border-color: var(--tkb-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tkb-accent) 18%, transparent);
}

.tk-billing-error {
    margin-top: 6px;
    color: var(--tkb-danger-text);
    font-size: 13px;
}

.tk-billing-alert {
    margin-bottom: 18px;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    background: var(--tkb-warn-bg);
    color: var(--tkb-warn-text);
}

.tk-billing-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.tk-billing-options.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tk-billing-options.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tk-billing-option {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--tkb-border);
    border-radius: 16px;
    background: var(--tkb-card);
    padding: 14px;
    cursor: pointer;
    color: var(--tkb-text);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tk-billing-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tk-billing-option strong {
    font-size: 15px;
}

.tk-billing-option small {
    color: var(--tkb-muted);
    font-size: 12px;
}

.tk-billing-option:has(input:checked) {
    border-color: var(--tkb-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tkb-accent) 30%, transparent);
}

.tk-billing-option:has(input:focus-visible) {
    outline: 2px solid var(--tkb-accent);
    outline-offset: 2px;
}

.tk-billing-option:has(input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

.tk-billing-hint {
    margin: -10px 0 18px;
    color: var(--tkb-muted);
    font-size: 13px;
}

.tk-billing-rows {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.tk-billing-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--tkb-muted);
    font-size: 14px;
}

.tk-billing-row strong {
    color: var(--tkb-text);
    text-align: right;
}

.tk-billing-row.total {
    border-top: 1px solid var(--tkb-border);
    padding-top: 12px;
    font-size: 16px;
}

.tk-billing-row.total strong {
    color: var(--tkb-accent);
    font-size: 22px;
}

.tk-billing-terms {
    color: var(--tkb-muted);
    font-size: 13px;
    line-height: 1.55;
}

.tk-billing-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 16px 0;
    color: var(--tkb-text);
    font-size: 14px;
    cursor: pointer;
}

.tk-billing-check input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--tkb-accent);
    flex: 0 0 auto;
}

.tk-billing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 999px;
    padding: 12px 24px;
    background: linear-gradient(120deg, var(--primary-color-light), var(--primary-color-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.tk-billing-btn:hover,
.tk-billing-btn:focus-visible {
    color: #fff;
    filter: brightness(1.06);
}

.tk-billing-btn.ghost {
    background: transparent;
    border: 1px solid var(--tkb-border);
    color: var(--tkb-text);
}

.tk-billing-btn.danger {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--tkb-danger-text) 55%, transparent);
    color: var(--tkb-danger-text);
}

.tk-billing-btn.inline {
    width: auto;
}

.tk-billing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tk-billing-actions form {
    margin: 0;
}

.tk-billing-secure {
    margin-top: 12px;
    color: var(--tkb-muted);
    font-size: 12px;
    text-align: center;
}

.tk-billing-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 12px;
    background: color-mix(in srgb, var(--tkb-accent) 14%, transparent);
    color: var(--tkb-accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tk-billing-pill.warn {
    background: var(--tkb-warn-bg);
    color: var(--tkb-warn-text);
}

.tk-billing-pill.muted {
    background: var(--tkb-card);
    color: var(--tkb-muted);
}

.tk-billing-stack {
    display: grid;
    gap: 18px;
}

.tk-billing-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tk-billing-stat {
    border: 1px solid var(--tkb-border);
    border-radius: 18px;
    background: var(--tkb-card);
    padding: 16px;
}

.tk-billing-stat span {
    display: block;
    color: var(--tkb-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tk-billing-stat strong {
    display: block;
    margin-top: 6px;
    color: var(--tkb-text);
    font-size: 20px;
}

.tk-billing-table-wrap {
    overflow-x: auto;
}

.tk-billing-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--tkb-text);
}

.tk-billing-table th,
.tk-billing-table td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--tkb-border);
    font-size: 14px;
    text-align: left;
    vertical-align: middle;
}

.tk-billing-table th {
    color: var(--tkb-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tk-billing-link {
    color: var(--tkb-accent);
    font-weight: 700;
}

.tk-billing-muted {
    color: var(--tkb-muted);
}

@media (max-width: 991px) {
    .tk-billing-grid {
        grid-template-columns: 1fr;
    }

    .tk-billing-summary {
        position: static;
    }
}

@media (max-width: 640px) {
    .tk-billing-page {
        padding-top: 120px;
    }

    .tk-billing-card {
        padding: 20px;
        border-radius: 20px;
    }

    .tk-billing-fields,
    .tk-billing-options,
    .tk-billing-options.two,
    .tk-billing-options.four,
    .tk-billing-stats {
        grid-template-columns: 1fr;
    }

    .tk-billing-options.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- Light theme ---------- */
html[data-tk-theme="light"] .tk-billing {
    --tkb-surface: #ffffff;
    --tkb-card: #f6f8fa;
    --tkb-border: rgba(15, 23, 42, 0.12);
    --tkb-text: #0f172a;
    --tkb-muted: #475569;
    --tkb-input: #ffffff;
    --tkb-accent: var(--primary-color-dark, #138a2f);
    --tkb-warn-bg: #fff4e0;
    --tkb-warn-text: #8a5300;
    --tkb-danger-text: #b42318;
}

html[data-tk-theme="light"] .tk-billing-page {
    background: #F3F6F8;
}

html[data-tk-theme="light"] .tk-billing-card {
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

/* The account pages paint their own dark shell with inline styles; on the
   billing pages only, it follows the light theme too. */
html[data-tk-theme="light"] .content-area.account-area:has(.tk-billing) {
    background: #F3F6F8 !important;
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-sidebar,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-panel {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-heading h1,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-brand-copy strong,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav a,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav button {
    color: #0f172a;
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-heading p,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-brand-copy span {
    color: #475569;
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav a,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav button {
    background: #f6f8fa;
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav a.is-active,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav a:hover,
html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-nav button:hover {
    color: #ffffff;
}

html[data-tk-theme="light"] .account-area:has(.tk-billing) .account-status.success {
    color: #14532d;
}

/* 11.11 sale: crossed "original" price (display only). */
.tk-billing .tk-billing-sale-note {
    color: var(--tkb-accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tk-billing .tk-billing-strike {
    margin-left: 8px;
    color: var(--tkb-muted);
    font-size: 0.65em;
    font-weight: 500;
}
