/* 3-step checkout + live work-order ticket, shared by /residential-start and
   /str-onboarding (see assets/stepped-checkout.js). Uses each page's tokens.
   Steps only hide each other once JS adds .is-stepped; without JS the whole
   form shows as one page and the step controls stay hidden. */

.checkout-grid { max-width: 1180px; margin: 0 auto; padding: 64px 32px 80px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
.checkout-grid > .form-card { min-width: 0; }

/* ── Stepper ─────────────────────────────────────────────────────────────── */
.co-stepper { display: none; list-style: none; margin: 0 0 28px; padding: 0; grid-template-columns: repeat(3, 1fr); position: relative; counter-reset: co; }
.is-stepped .co-stepper { display: grid; }
.co-stepper::before { content: ''; position: absolute; top: 15px; left: 16.66%; right: 16.66%; height: 2px; background: var(--border); }
.co-stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); text-align: center; }
.co-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; background: var(--white); border: 2px solid var(--border); display: grid; place-items: center; transition: background .25s, border-color .25s; }
.co-dot svg { width: 15px; height: 15px; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s cubic-bezier(0.22, 1, 0.36, 1); }
.co-stepper li.is-current { color: var(--navy); }
.co-stepper li.is-current .co-dot { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(245, 166, 35, .22); }
.co-stepper li.is-done { color: var(--navy); }
.co-stepper li.is-done .co-dot { background: var(--navy); border-color: var(--navy); color: var(--accent); }
.co-stepper li.is-done .co-dot svg { opacity: 1; transform: none; }

/* Phone-only one-line plan summary under the stepper */
.co-strip { display: none; }

/* ── Steps ───────────────────────────────────────────────────────────────── */
.co-step + .co-step { margin-top: 36px; padding-top: 32px; border-top: 1px solid var(--lt-gray, #e8eef5); }
.is-stepped .co-step + .co-step { margin-top: 0; padding-top: 0; border-top: 0; }
.co-step[hidden] { display: none; }
.co-step [data-step-heading]:focus { outline: none; }
.co-step [data-step-heading]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.co-nav { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.co-nav:empty { display: none; }
/* Continue/Back only work with JS; the final submit button always shows. */
.co-nav [data-step-next], .co-nav [data-step-back] { display: none; }
.is-stepped .co-nav [data-step-next] { display: block; }
.is-stepped .co-nav [data-step-back] { display: inline-flex; align-items: center; }
.co-nav .btn-submit { flex: 1; margin-top: 0; }
.co-back { flex: 0 0 auto; min-height: 50px; padding: 0 22px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); color: var(--navy); font-family: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s; }
.co-back:hover { border-color: var(--accent); background: rgba(245, 166, 35, .08); }
.co-back:focus-visible, .co-nav .btn-submit:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.co-subhead { font-size: 1.05rem; color: var(--navy); margin: 0 0 4px; }
.co-disclosure { margin-top: 18px; padding: 12px 14px; border-radius: 8px; background: var(--off-white); border: 1px solid var(--border); font-size: .82rem; line-height: 1.55; color: var(--muted); }

@keyframes co-in-fwd { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes co-in-back { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.co-enter-fwd { animation: co-in-fwd .32s cubic-bezier(0.16, 1, 0.3, 1); }
.co-enter-back { animation: co-in-back .32s cubic-bezier(0.16, 1, 0.3, 1); }

/* ── Work-order ticket ───────────────────────────────────────────────────── */
.co-ticket-col { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 18px; }
.co-ticket { position: relative; background: var(--navy-dark); color: #e8eef5; border-radius: 14px; padding: 24px 24px 22px; box-shadow: 0 12px 36px rgba(13, 43, 69, .18); --gold-text: #f5a623; overflow: hidden; }
.co-ticket-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.co-ticket-top span:last-child { color: #a9bccf; font-weight: 600; letter-spacing: .04em; text-transform: none; font-size: .78rem; }
.co-ticket h2, .co-ticket .co-ticket-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.4rem; line-height: 1.2; color: var(--white); margin: 10px 0 16px; font-weight: 700; }
.co-rows { margin: 0; display: grid; gap: 0; }
.co-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(232, 238, 245, .12); font-size: .88rem; }
.co-row dt { color: #a9bccf; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.co-row dd { margin: 0; color: var(--white); font-weight: 600; overflow-wrap: anywhere; }
.co-row dd.is-empty { color: #8ea4ba; font-weight: 500; font-style: italic; }
.co-row[hidden] { display: none; }
@keyframes co-flash { 0% { background: rgba(245, 166, 35, .38); } 100% { background: transparent; } }
.co-row dd.is-flash, .co-total .is-flash { animation: co-flash .9s ease-out; border-radius: 4px; }
.co-dates { margin-top: 12px; }
.co-dates[hidden] { display: none; }
.co-dates ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.co-dates li { padding: 5px 10px; border-radius: 999px; background: rgba(245, 166, 35, .14); border: 1px solid rgba(245, 166, 35, .42); color: #fbd38d; font-size: .76rem; font-weight: 700; }
.co-dates p { margin: 8px 0 0; font-size: .74rem; color: #a9bccf; line-height: 1.45; }
.co-included { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; font-size: .82rem; color: #d6e0ea; }
.co-included li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.co-included li::before { content: ''; flex: 0 0 14px; height: 14px; margin-top: 2px; background: no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23f5a623'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 010 1.4l-8 8a1 1 0 01-1.4 0l-4-4a1 1 0 011.4-1.4L8 12.6l7.3-7.3a1 1 0 011.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E"); }
/* Perforated tear line with punched notches */
.co-perf { position: relative; margin: 20px -24px 16px; border-top: 2px dashed rgba(232, 238, 245, .28); }
.co-perf::before, .co-perf::after { content: ''; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--co-page-bg, var(--white)); }
.co-perf::before { left: -9px; }
.co-perf::after { right: -9px; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: .9rem; color: #d6e0ea; }
.co-total strong { color: var(--white); font-size: 1.05rem; }
.co-total.co-total-today strong { color: var(--accent); font-size: 1.25rem; }
.co-total-lines { margin: 2px 0 6px; padding: 0; list-style: none; font-size: .8rem; color: #a9bccf; display: grid; gap: 3px; }
.co-ticket-note { margin: 10px 0 0; font-size: .74rem; line-height: 1.5; color: #a9bccf; }
.co-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg) scale(1.6); padding: 6px 18px; border: 4px solid var(--accent); border-radius: 8px; color: var(--accent); font-family: inherit; font-weight: 800; font-size: 1.7rem; letter-spacing: .16em; opacity: 0; pointer-events: none; transition: opacity .25s ease-out, transform .45s cubic-bezier(0.22, 1, 0.36, 1); background: rgba(8, 28, 46, .72); }
.co-ticket.is-submitted .co-stamp { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
.co-ticket.is-submitted .co-rows, .co-ticket.is-submitted .co-dates, .co-ticket.is-submitted .co-included { opacity: .62; }

.co-review { margin: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--white); }
.co-review blockquote { margin: 0; font-size: .9rem; line-height: 1.6; color: var(--navy-dark); }
.co-review figcaption { margin-top: 10px; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.co-review figcaption strong { color: var(--navy); }
.co-review a { color: var(--gold-text); font-weight: 700; }

/* ── Success panel ───────────────────────────────────────────────────────── */
.co-next { list-style: none; counter-reset: co-next; margin: 18px auto 0; padding: 0; max-width: 440px; text-align: left; display: grid; gap: 12px; }
.co-next li { counter-increment: co-next; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; font-size: .9rem; line-height: 1.55; color: var(--navy-dark); }
.co-next li::before { content: counter(co-next); width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--accent); font-weight: 800; display: grid; place-items: center; font-size: .85rem; }

@media (max-width: 960px) {
  .checkout-grid { grid-template-columns: minmax(0, 1fr); padding: 40px 24px 60px; gap: 24px; }
  .co-ticket-col { position: static; }
  .is-stepped .co-strip { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: -12px 0 24px; padding: 10px 14px; border-radius: 10px; background: var(--navy-dark); color: #e8eef5; font-size: .82rem; font-weight: 600; line-height: 1.35; }
  .co-strip b { color: var(--accent); font-weight: 800; }
}
@media (max-width: 600px) {
  .checkout-grid { padding: 28px 16px 48px; }
  .co-stepper li { font-size: .74rem; }
  .co-nav { flex-wrap: wrap; }
  .co-ticket { padding: 22px 18px 20px; }
  .co-perf { margin-left: -18px; margin-right: -18px; }
  .co-row { grid-template-columns: 92px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .co-enter-fwd, .co-enter-back, .co-row dd.is-flash, .co-total .is-flash { animation: none; }
  .co-dot, .co-dot svg, .co-stamp { transition: none; }
}
