/* ---------- Design tokens (espa playbook, warm off-white palette) ---------- */
:root {
    --bg:        #fcfaf9;
    --bg-card:   #ffffff;
    --ink:       #2d251e;
    --ink-soft:  #564f47;
    --ink-mute:  #8a8278;
    --line:      #e7e7e9;
    --line-soft: #ece9ea;
    --accent:    #e6ad70;
    --accent-2:  #f96e6b;
    --inverse:   #fdfdfd;
    --radius:    16px;
    --radius-lg: 24px;
    --shadow:    0 8px 24px rgba(45, 37, 30, 0.06), 0 1px 2px rgba(45, 37, 30, 0.04);
    --shadow-lg: 0 24px 48px rgba(45, 37, 30, 0.08), 0 2px 4px rgba(45, 37, 30, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
::selection { background: var(--accent); color: var(--ink); }

/* ---------- Auth shell (login + verify) ---------- */
.auth-shell {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    margin-bottom: 64px;
}
.brand-mark {
    width: 26px; height: 26px;
    background: var(--ink);
    color: var(--inverse);
    border-radius: 7px;
    display: grid; place-items: center;
    font-size: 14px; font-weight: 700;
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
    flex: 1;
}
.auth-card__head { margin-bottom: 28px; }
.kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    text-transform: uppercase;
    margin-bottom: 10px;
}
h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 10px;
}
.sub {
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.55;
}

.field {
    display: block;
    margin-bottom: 20px;
}
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 8px;
}
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--ink);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(45, 37, 30, 0.08);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ink);
    color: var(--inverse);
    padding: 13px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(45, 37, 30, 0.18);
}
.btn-primary:hover { background: #1a140e; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.fineprint {
    margin-top: 18px;
    font-size: 13px;
    color: var(--ink-mute);
    text-align: center;
}
.fineprint a { color: var(--ink); text-decoration: underline; }

.error, .status {
    margin-top: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}
.error {
    background: #fdecec;
    color: #8b1c1c;
    border: 1px solid #f4c6c6;
}
.status.is-info {
    background: #fff8eb;
    color: #6e5b1a;
    border: 1px solid #f1dfb1;
}
.status.is-success {
    background: #ecf7ed;
    color: #1d6b30;
    border: 1px solid #c2e5ca;
}
.error.is-success { background: #ecf7ed; color: #1d6b30; border-color: #c2e5ca; }

.auth-foot {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line-soft);
    color: var(--ink-mute);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.auth-foot .links { display: flex; gap: 16px; }
.auth-foot a:hover { color: var(--ink); }

@keyframes spin { to { transform: rotate(360deg); } }
#submit-spinner[style*="inline-block"] { animation: spin 0.9s linear infinite; }

/* ---------- /account ---------- */
.account-shell {
    max-width: 880px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    min-height: 100vh;
}
.account-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
}
.account-head__title h1 { font-size: 28px; }
.account-head__title .email {
    font-size: 14px;
    color: var(--ink-soft);
    margin-top: 4px;
}
.impersonation-banner {
    background: #fff4e0;
    border: 1px solid #f1dfb1;
    color: #6e5b1a;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 24px;
}
.account-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}
@media (max-width: 720px) {
    .account-grid { grid-template-columns: 1fr; }
}
.account-side {
    background: var(--bg-card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 24px;
    height: fit-content;
}
.account-side h3 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    text-transform: uppercase;
    margin-bottom: 12px;
}
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.kv span:first-child { color: var(--ink-soft); }
.kv span:last-child { color: var(--ink); font-weight: 500; }

.account-main {
    background: var(--bg-card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 28px;
}
.account-main h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 24px;
    margin-bottom: 18px;
}
.purchases {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.purchase {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    padding: 16px 18px;
}
.purchase__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.purchase__name { font-weight: 600; color: var(--ink); }
.purchase__status {
    font-size: 12px;
    color: var(--ink-soft);
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 999px;
}
.purchase__meta {
    font-size: 13px;
    color: var(--ink-soft);
}
.empty {
    color: var(--ink-mute);
    font-size: 14px;
    padding: 24px 0;
    text-align: center;
}
.empty a { color: var(--ink); text-decoration: underline; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover { border-color: var(--ink); background: #fff; }

/* ---------- /checkout ---------- */
.checkout-shell {
    max-width: 560px;
    margin: 0 auto;
    padding: 64px 24px;
    text-align: center;
}
.checkout-shell h1 {
    font-size: 32px;
    margin-bottom: 12px;
}
.checkout-shell .sub {
    margin-bottom: 32px;
}
.checkout-card {
    background: var(--bg-card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: left;
    box-shadow: var(--shadow);
}
.checkout-card label {
    display: block;
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 8px;
}
.checkout-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 20px;
}
.checkout-card input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(45, 37, 30, 0.08);
}
.checkout-card .btn-primary { margin-top: 8px; }
.checkout-tier {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.checkout-tier .name { font-weight: 600; }
.checkout-tier .price { color: var(--ink-soft); font-size: 14px; }
.checkout-foot {
    margin-top: 24px;
    font-size: 13px;
    color: var(--ink-mute);
    text-align: center;
}

/* "Optional" hint shown next to non-required form labels. Same ink-mute
 * color as .checkout-foot so it reads as secondary metadata, not an error. */
.optional-tag {
    color: var(--ink-mute);
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
}
