/* ============================================================
   BILLXO — Premium checkout experience. Self-contained styles.
   Fintech-grade: neutral surfaces, thin borders, brand accents.
   ============================================================ */
:root {
    --cyan: #17C4DC;
    --cyan-700: #0E8FA1;
    --turquoise: #12B5A5;
    --green: #15803D;
    --green-50: #ECFDF3;
    --yellow: #F5B70A;
    --ink: #0B1220;
    --ink-2: #33404F;
    --muted: #667085;
    --muted-2: #98A2B3;
    --line: #E7EAEF;
    --line-2: #EFF1F5;
    --paper: #F7F8FA;
    --bg: #FBFCFD;
    --white: #FFFFFF;
    --danger: #B42318;
    --danger-50: #FEF3F2;
    --radius: 12px;
    --radius-sm: 9px;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 8px 28px -12px rgba(16, 24, 40, .18);
    --shadow-pop: 0 20px 50px -22px rgba(16, 24, 40, .35);
    --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Header ---------- */
.co-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line-2);
}
.co-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; }
/* Real Billxo glyph. The full logo.png is a portrait lockup (glyph over
   wordmark over tagline) and becomes illegible at header size, so the header
   pairs the glyph asset with the wordmark as live text. */
.co-brand__mark {
    width: 28px; height: 28px;
    object-fit: contain;
    display: block;
}
.co-brand__name { font-size: 16px; }
.co-secure {
    justify-self: center;
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 600; color: var(--muted);
}
.co-secure svg { width: 15px; height: 15px; color: var(--green); }
.co-support {
    justify-self: end;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-2);
    transition: color .2s var(--ease);
}
.co-support:hover { color: var(--ink); }
.co-support svg { width: 15px; height: 15px; }

/* ---------- Shell ---------- */
.co-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 64px;
}
.co-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
}

/* ---------- Left column ---------- */
.co-back {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13.5px; font-weight: 600; color: var(--muted);
    margin-bottom: 20px;
    transition: color .2s var(--ease), transform .2s var(--ease);
}
.co-back:hover { color: var(--ink); }
.co-back:hover svg { transform: translateX(-2px); }
.co-back svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }

.co-lead { margin-bottom: 26px; }
.co-lead h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(26px, 3.4vw, 34px);
    line-height: 1.12;
    letter-spacing: -.01em;
    margin: 0 0 10px;
}
.co-lead p { color: var(--muted); font-size: 15px; max-width: 46ch; margin: 0; }

/* ---------- Progress ---------- */
.co-progress {
    display: flex; align-items: center;
    gap: 8px;
    margin-bottom: 26px;
    font-size: 12.5px; font-weight: 600;
}
.co-progress__step { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-2); }
.co-progress__dot {
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--white); border: 1.5px solid var(--line);
    font-size: 11.5px; color: var(--muted-2);
    transition: all .3s var(--ease);
}
.co-progress__step.is-active .co-progress__dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.co-progress__step.is-active { color: var(--ink); }
.co-progress__step.is-done .co-progress__dot { background: var(--green); border-color: var(--green); color: #fff; }
.co-progress__step.is-done { color: var(--ink-2); }
.co-progress__dot svg { width: 12px; height: 12px; }
.co-progress__bar { flex: 1; height: 1.5px; background: var(--line); border-radius: 2px; max-width: 40px; }

/* ---------- Panel / steps ---------- */
.co-panel {
    position: relative;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: clamp(20px, 3vw, 30px);
}
.co-step { display: none; }
.co-step.is-active { display: block; animation: coStepIn .32s var(--ease) both; }
@keyframes coStepIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.co-step__eyebrow {
    display: inline-block;
    font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--cyan-700); margin-bottom: 10px;
}
.co-step__title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.co-step__sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

/* Welcome-back / account chip */
.co-whoami {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; margin-bottom: 18px;
    background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.co-whoami__avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--cyan), var(--turquoise));
    color: #042027; display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.co-whoami__meta { min-width: 0; }
.co-whoami__name { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.co-whoami__email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-whoami__edit { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--cyan-700); flex: none; }
.co-whoami__edit:hover { text-decoration: underline; }

/* Fields */
.co-field { margin-bottom: 16px; }
.co-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.co-inputwrap { position: relative; }
.co-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font-size: 15px; color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
    outline: none;
}
.co-input::placeholder { color: var(--muted-2); }
.co-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(23, 196, 220, .14); }
.co-input--pw { padding-right: 46px; }
.co-input--error { border-color: var(--danger); }
.co-input--error:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .12); }
.co-pwtoggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border: 0; background: transparent; cursor: pointer;
    display: grid; place-items: center; color: var(--muted); border-radius: 8px;
}
.co-pwtoggle:hover { color: var(--ink); background: var(--paper); }
.co-pwtoggle svg { width: 19px; height: 19px; }
.co-pwtoggle .ico-off { display: none; }
.co-pwtoggle.is-visible .ico-on { display: none; }
.co-pwtoggle.is-visible .ico-off { display: block; }

.co-fielderror {
    display: flex; align-items: center; gap: 6px;
    margin-top: 7px; font-size: 12.5px; color: var(--danger);
}
.co-fielderror svg { width: 14px; height: 14px; flex: none; }
.co-fieldhint { margin-top: 7px; font-size: 12px; color: var(--muted-2); line-height: 1.5; }
.co-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 440px) { .co-row2 { grid-template-columns: 1fr; } }

.co-forgot { display: inline-block; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--cyan-700); }
.co-forgot:hover { text-decoration: underline; }

/* Reassurance ticks */
.co-reassure { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 18px; }
.co-reassure span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.co-reassure svg { width: 14px; height: 14px; color: var(--green); }

/* Buttons */
.co-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    height: 50px; width: 100%;
    padding: 0 20px;
    font-size: 15.5px; font-weight: 700; letter-spacing: -.01em;
    border: 0; border-radius: var(--radius-sm); cursor: pointer;
    transition: transform .16s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), opacity .2s var(--ease);
}
.co-btn--primary {
    color: #042027;
    background: linear-gradient(135deg, var(--cyan), var(--turquoise));
    box-shadow: 0 10px 24px -12px rgba(18, 181, 165, .8);
}
.co-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(18, 181, 165, .9); }
.co-btn--primary:active { transform: translateY(0); }
.co-btn--ghost { background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.co-btn--ghost:hover { background: var(--paper); }
.co-btn .arrow { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.co-btn:hover .arrow { transform: translateX(3px); }
.co-btn[disabled], .co-btn.is-loading { opacity: .75; pointer-events: none; }
.co-btn .spinner {
    display: none; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(4, 32, 39, .28); border-top-color: #042027;
    animation: coSpin .7s linear infinite;
}
.co-btn.is-loading .label, .co-btn.is-loading .arrow { display: none; }
.co-btn.is-loading .spinner { display: inline-block; }
@keyframes coSpin { to { transform: rotate(360deg); } }
.co-btn.shake { animation: coShake .4s var(--ease); }
@keyframes coShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Inline alert */
.co-alert {
    display: none;
    align-items: flex-start; gap: 9px;
    padding: 11px 13px; margin-bottom: 16px;
    background: var(--danger-50); border: 1px solid #FDA29B; border-radius: var(--radius-sm);
    color: var(--danger); font-size: 13px;
}
.co-alert.show { display: flex; animation: coStepIn .25s var(--ease) both; }
.co-alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

.co-switch { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.co-switch a { color: var(--ink); font-weight: 700; }
.co-switch a:hover { color: var(--cyan-700); }

.co-legal { margin-top: 16px; font-size: 12px; color: var(--muted-2); text-align: center; line-height: 1.6; }
.co-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.co-legal a:hover { color: var(--ink); }

/* Payment step */
.co-payline {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; margin-bottom: 18px;
    background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.co-payline__plan { font-weight: 700; }
.co-payline__price { font-weight: 700; }
.co-payline__price b { font-size: 18px; }
.co-payline__price span { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.co-trustrow { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.co-trustrow svg { width: 15px; height: 15px; color: var(--green); }
.co-trustrow .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }

/* Already-on-plan */
.co-badgeOK {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--green-50); color: var(--green);
    display: grid; place-items: center; margin-bottom: 16px;
}
.co-badgeOK svg { width: 28px; height: 28px; }

/* ---------- Right column: order summary ---------- */
.co-summary {
    position: sticky; top: 88px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.co-summary__head {
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--line-2);
    background:
        radial-gradient(120% 120% at 100% 0, rgba(23, 196, 220, .10), transparent 60%),
        var(--white);
}
.co-summary__tag {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--cyan-700); margin-bottom: 10px;
}
.co-summary__tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }
.co-summary__price { display: flex; align-items: flex-end; gap: 6px; }
.co-summary__price b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.co-summary__price span { color: var(--muted); font-size: 14px; font-weight: 500; padding-bottom: 4px; }
.co-summary__desc { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }

.co-summary__body { padding: 18px 22px; }
.co-features { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.co-features li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.co-features li svg { width: 16px; height: 16px; flex: none; color: var(--green); }

.co-lines { border-top: 1px dashed var(--line); padding-top: 14px; display: grid; gap: 8px; }
.co-lines__row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.co-lines__row b { color: var(--ink-2); font-weight: 600; }
.co-total {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line);
}
.co-total__label { font-size: 14px; font-weight: 700; }
.co-total__value { text-align: right; }
.co-total__value b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.co-total__value span { display: block; color: var(--muted); font-size: 12px; }

.co-summary__foot {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-top: 1px solid var(--line-2);
    background: var(--paper); font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.co-summary__foot svg { width: 15px; height: 15px; color: var(--green); }
.co-summary__foot .rzp { font-weight: 700; color: var(--ink-2); }

/* Mobile collapsible summary */
.co-msummary { display: none; }
@media (max-width: 900px) {
    .co-grid { grid-template-columns: 1fr; }
    .co-summary { display: none; }
    .co-msummary {
        display: block;
        margin-bottom: 22px;
        background: var(--white); border: 1px solid var(--line);
        border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
    }
    .co-msummary__bar {
        width: 100%; border: 0; background: transparent; cursor: pointer;
        display: flex; align-items: center; gap: 12px;
        padding: 14px 16px; text-align: left;
    }
    .co-msummary__bar .plan { font-weight: 700; font-size: 14.5px; }
    .co-msummary__bar .price { margin-left: auto; font-weight: 800; font-size: 16px; }
    .co-msummary__bar .price span { color: var(--muted); font-weight: 500; font-size: 12px; }
    .co-msummary__bar .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .25s var(--ease); }
    .co-msummary.open .co-msummary__bar .chev { transform: rotate(180deg); }
    .co-msummary__panel { max-height: 0; overflow: hidden; transition: max-height .32s var(--ease); }
    .co-msummary.open .co-msummary__panel { max-height: 620px; }
    .co-msummary__inner { padding: 4px 16px 16px; border-top: 1px solid var(--line-2); }
    .co-progress__bar { max-width: 24px; }
}

/* ---------- Success / Failure ---------- */
.co-result {
    max-width: 520px; margin: clamp(24px, 6vw, 64px) auto;
    background: var(--white); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: var(--shadow-pop); padding: clamp(26px, 5vw, 44px); text-align: center;
}
.co-check { width: 76px; height: 76px; margin: 0 auto 20px; }
.co-check circle { fill: none; stroke: var(--green); stroke-width: 4; stroke-dasharray: 232; stroke-dashoffset: 232; animation: coDraw .7s var(--ease) forwards; }
.co-check path { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: coDraw .5s .55s var(--ease) forwards; }
.co-check .bg { fill: var(--green-50); stroke: none; }
@keyframes coDraw { to { stroke-dashoffset: 0; } }
.co-xmark { width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; background: var(--danger-50); display: grid; place-items: center; animation: coStepIn .4s var(--ease) both; }
.co-xmark svg { width: 34px; height: 34px; color: var(--danger); }
.co-result h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 4vw, 30px); margin: 0 0 8px; letter-spacing: -.01em; }
.co-result p.sub { color: var(--muted); font-size: 15px; margin: 0 0 22px; }
.co-detailcard { text-align: left; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 16px; margin-bottom: 24px; }
.co-detailcard .drow { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.co-detailcard .drow:last-child { border-bottom: 0; }
.co-detailcard .drow span { color: var(--muted); }
.co-detailcard .drow b { font-weight: 700; color: var(--ink); }
.co-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--green-50); color: var(--green); font-size: 12.5px; font-weight: 700; }
.co-actions { display: grid; gap: 10px; }
.co-result .co-btn { width: 100%; }
.co-result .foot { margin-top: 18px; font-size: 12.5px; color: var(--muted-2); }
.co-errbox { text-align: left; background: var(--danger-50); border: 1px solid #FDA29B; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 22px; color: var(--danger); font-size: 13.5px; }
.co-errbox b { display: block; margin-bottom: 3px; }

/* ---------- Entrance ---------- */
[data-enter] { opacity: 0; transform: translateY(12px); }
body.co-ready [data-enter] {
    opacity: 1; transform: none;
    transition: opacity .6s var(--ease), transform .6s var(--ease);
    transition-delay: var(--d, 0s);
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    [data-enter] { opacity: 1 !important; transform: none !important; }
    .co-check circle, .co-check path { stroke-dashoffset: 0 !important; }
}

