:root {
    color-scheme: light;
    --portal-bg: #F6F4EE;
    --portal-card: #fff;
    --portal-ink: #1d2b24;
    --portal-muted: #6b7a72;
    --portal-line: #e5e1d6;
    --portal-brand: #23533C;
    --portal-brand-dark: #1b4230;
    --portal-gold: #E2AB30;
    --portal-warning: #b86e00;
    --portal-warning-bg: #fff4e0;
    --portal-soft: #eef5f1;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--portal-bg);
    color: var(--portal-ink);
    font: 15px/1.5 system-ui, sans-serif;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 0 max(16px, calc((100% - 820px) / 2));
    background: #fff;
    border-bottom: 1px solid var(--portal-line);
}

.portal-brand { display: inline-flex; align-items: center; }
.portal-brand img { display: block; height: 64px; width: auto; }

.portal-main {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 20px 40px;
}

h1 { margin: 6px 0 2px; font-size: 22px; }
h2 { margin: 0 0 10px; font-size: 18px; color: var(--portal-brand); }

.eyebrow {
    margin: 0;
    color: var(--portal-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
}

.muted { color: var(--portal-muted); }
.panel, .next-payment, .stat-card {
    border: 1px solid var(--portal-line);
    border-radius: 16px;
    background: var(--portal-card);
    box-shadow: 0 1px 3px rgba(29, 43, 36, .06);
}

.panel { padding: 22px; margin-bottom: 16px; }
.login-panel { margin: 0 0 16px; }
.login-panel > .muted { margin: 4px 0 20px; }

form { display: grid; gap: 8px; }
label { font-weight: 600; }
input {
    width: 100%;
    min-height: 44px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1.5px solid var(--portal-line);
    border-radius: 10px;
    font: inherit;
}
input:focus { outline: none; border-color: var(--portal-brand); box-shadow: 0 0 0 3px rgba(35, 83, 60, .15); }
input[type="checkbox"] { accent-color: var(--portal-brand); }

.button {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--portal-brand);
    border-radius: 12px;
    background: var(--portal-brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button:hover:not(:disabled) { background: var(--portal-brand-dark); }
.button:disabled { cursor: wait; opacity: .65; }
.button-outline { background: #fff; color: var(--portal-brand); }
.button-outline:hover:not(:disabled) { background: var(--portal-soft) !important; }
.button-gold { background: var(--portal-gold); border-color: var(--portal-gold); color: var(--portal-ink); }
.button-gold:hover:not(:disabled) { background: #d09a22 !important; }
.button-ghost { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; min-height: 34px; padding: 4px 12px; font-size: 13px; }
.button-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .15) !important; }
form > .button[type="submit"] { width: 100%; margin-top: 6px; }
.forgot-link { display: inline-block; margin-top: 14px; color: var(--portal-brand); }
.status { min-height: 1.5em; margin: 12px 0 0; color: var(--portal-muted); }
.status[data-kind="error"], .limit-warning { color: var(--portal-warning); }

.next-payment {
    margin: 14px 0 12px;
    padding: 14px;
    background: var(--portal-soft);
    border-color: #cfe0d6;
}

.next-payment-total { font-size: 20px; }
.next-payment p { margin: 5px 0; }
.progress-track { height: 8px; overflow: hidden; margin-top: 8px; border-radius: 99px; background: #ece8dc; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--portal-gold); transition: width .2s ease; }

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

.stat-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.stat-card span { color: var(--portal-muted); font-size: 12px; }
.stat-card strong { font-size: 22px; color: var(--portal-brand); }
.stat-highlight { background: var(--portal-soft); border-color: #cfe0d6; }
.content-section { margin-top: 16px; }
.stats-grid { margin-bottom: 16px; }
.link-list { display: grid; gap: 12px; }
.share-link { display: grid; gap: 8px; }
.share-link code { overflow-wrap: anywhere; padding: 8px 10px; border-radius: 8px; background: #f1f4ee; }
.share-link .button { justify-self: start; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 7px; border-bottom: 1px solid var(--portal-line); text-align: left; white-space: nowrap; }
th { color: var(--portal-muted); font-size: 12px; font-weight: 600; }
.numeric { text-align: right; }
.empty-cell { color: var(--portal-muted); text-align: center; }
.privacy-note, .legal-note { font-size: 12.5px; }
.annual-limit { margin-top: 16px; }
.annual-limit h2 { margin-bottom: 10px; }
.limit-warning { font-weight: 700; }
[hidden] { display: none !important; }

@media (min-width: 700px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .share-link { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .share-link .button { justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
    .progress-track span { transition: none; }
}

.button-link { display: inline-block; text-decoration: none; text-align: center; }
.type-toggle { display: flex; gap: 8px; margin: 12px 0; }
.type-option { flex: 1; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option span { display: block; padding: 10px 12px; border: 1.5px solid var(--portal-line); border-radius: 10px; text-align: center; font-weight: 600; }
.type-option input:checked + span { border-color: var(--portal-brand); background: var(--portal-soft); color: var(--portal-brand); }
.type-option input:focus-visible + span { outline: 2px solid var(--portal-brand); outline-offset: 2px; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 0.9rem; }
.consent-row input { width: auto; min-height: 0; margin-top: 3px; }
.consent-row a, .forgot-link { color: var(--portal-brand); }
.field-error { color: #b91c1c; font-size: 0.85rem; min-height: 0; margin: 4px 0 0; }
.field-error:empty { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.code-panel { display: grid; gap: 14px; background: linear-gradient(135deg, #23533C, #1b4230); border-color: #1b4230; color: #fff; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.code-label { display: block; font-size: 0.8rem; color: rgba(255, 255, 255, .75); margin-bottom: 4px; }
.partner-code { font-size: 32px; letter-spacing: 3px; line-height: 1.2; }
.code-link-wrap { min-width: 0; flex: 1; }
.code-link { display: block; overflow-wrap: anywhere; font-size: 0.9rem; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .12); }
.code-panel .muted { color: rgba(255, 255, 255, .75); margin: 0; }
.payment-banner { background: var(--portal-warning-bg); border: 1px solid #f0c37a; color: var(--portal-warning); padding: 10px 12px; border-radius: 10px; }
.payment-list { display: grid; gap: 8px; margin: 0 0 12px; }
.payment-list div { display: flex; gap: 12px; }
.payment-list dt { min-width: 110px; color: var(--portal-muted); }
.payment-list dd { margin: 0; }
.payment-panel .form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.payment-panel .form-actions { display: flex; gap: 8px; margin-top: 12px; }
.fiscal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pill { background: var(--portal-warning-bg); color: var(--portal-warning); padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.gauge-label { font-weight: 600; }

.pill-gold { display: inline-block; margin: 4px 0 18px; background: #fbefcf; color: #7a5600; }
.welcome h1 { margin: 6px 0 0; color: var(--portal-brand); }
.welcome p { margin: 0; }

.hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    padding: 28px 24px;
    border-radius: 18px;
    background: linear-gradient(135deg, #23533C, #1b4230);
    color: #fff;
}
.hero::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -30px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--portal-gold);
    opacity: .9;
}
.hero > * { position: relative; z-index: 1; max-width: 90%; }
.hero .eyebrow { color: rgba(255, 255, 255, .75); }
.hero h1 { margin: 6px 0 8px; font-size: 26px; color: #fff; }
.hero p { margin: 0; color: rgba(255, 255, 255, .9); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--portal-line); border-radius: 14px; background: #fff; font-size: 13.5px; font-weight: 600; }
.steps b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--portal-gold); color: var(--portal-ink); }

@media (max-width: 560px) {
    .steps, .stats-grid { grid-template-columns: 1fr; }
    .payment-panel .form-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 22px; }
    .panel { padding: 18px; }
}
