/* Applewood Express — multi-step application flow.
   Loaded only by /apply, on top of styles.css (tokens, buttons, footer). */

.apply-header{position:sticky;top:0;z-index:50;background:rgba(255,255,255,.94);backdrop-filter:blur(12px);border-bottom:1px solid var(--line)}
.apply-header .wrap{display:flex;align-items:center;justify-content:space-between;height:78px}
.apply-phone{font-family:var(--display);font-weight:800;color:var(--navy);font-size:1rem}
@media(max-width:480px){.apply-header .wrap{height:66px}.apply-header .brand img{height:36px}}

.apply-main{background:linear-gradient(180deg,#f4f8fc 0%,#ffffff 55%);min-height:calc(100vh - 78px);padding:44px 24px 90px}
/* Reclaim 16px of width on phones — it is the difference between the date
   selects being cramped and comfortable. */
@media(max-width:480px){.apply-main{padding:28px 16px 64px}.apply-intro{margin-bottom:24px}}
.apply-intro{max-width:760px;margin:0 auto 34px;text-align:center}
.apply-intro h1{font-size:clamp(2rem,4.4vw,3rem);margin:14px 0 26px}

/* Progress */
.cs-progress{position:relative;height:34px;border-radius:999px;background:#e8eef6;overflow:hidden}
.cs-progress-bar{position:absolute;inset:0 auto 0 0;width:10%;background:linear-gradient(90deg,var(--green) 0%,#5fd07e 100%);border-radius:999px;transition:width .35s cubic-bezier(.4,0,.2,1)}
.cs-number{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-family:var(--display);font-weight:700;font-size:.92rem;color:var(--navy)}

/* Steps */
.apply-form{max-width:760px;margin:0 auto}
.cs-step{background:#fff;border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow-lg);padding:40px 38px}
.cs-step-hidden{display:none}
.cs-question{display:block;font-family:var(--display);font-weight:800;font-size:clamp(1.35rem,2.6vw,1.75rem);line-height:1.18;letter-spacing:-.015em;text-align:center;margin-bottom:26px}
.cs-note{display:block;text-align:center;font-size:.86rem;color:var(--muted);margin-top:22px;line-height:1.55}
.cs-text{text-align:center;color:var(--muted);margin-bottom:12px}
@media(max-width:560px){.cs-step{padding:28px 20px;border-radius:18px}}

/* Radio card groups */
.cs-card-group{list-style:none;display:grid;gap:14px}
.cs-cols-3{grid-template-columns:repeat(3,1fr)}
.cs-cols-4{grid-template-columns:repeat(4,1fr)}
.cs-cols-5{grid-template-columns:repeat(5,1fr)}
.cs-card-group input{position:absolute;opacity:0;width:0;height:0}
.cs-card-group label{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;height:100%;min-height:96px;padding:20px 14px;text-align:center;background:#fff;border:1.5px solid var(--line);border-radius:14px;font-weight:700;font-size:.95rem;color:var(--ink);cursor:pointer;transition:border-color .16s,background .16s,transform .16s,box-shadow .16s}
.cs-card-group label:hover{border-color:var(--green);background:var(--green-soft);transform:translateY(-2px)}
.cs-card-group input:focus-visible + label{outline:3px solid rgba(39,161,73,.35);outline-offset:2px}
.cs-card-group input:checked + label{border-color:var(--green);background:var(--green-soft);color:var(--green-deep);box-shadow:0 0 0 3px rgba(39,161,73,.14)}
.cs-card-group .ic{color:var(--green-deep)}
.cs-card-group .ic svg{width:38px;height:38px}

/* Vehicle photo cards. The renders sit on a white background; multiply blends
   that white into whatever the card is behind it, so the cutout is exact on
   both the white and the green selected state — no halo, no fake alpha. */
.cs-card-group.has-photos label{padding:14px 12px 16px;gap:2px;min-height:0}
.cs-vehicle{display:block;width:100%;max-width:200px;height:auto;mix-blend-mode:multiply}
@media(max-width:700px){.cs-card-group.has-photos label{padding:12px 10px 14px}.cs-vehicle{max-width:170px}}
@media(max-width:700px){.cs-cols-4,.cs-cols-5{grid-template-columns:repeat(2,1fr)}.cs-cols-3{grid-template-columns:1fr}}
/* Two columns down to very narrow phones. A single column at 375px turned the
   5-option steps into a 670px scroll for what is one question. */
@media(max-width:340px){.cs-cols-4,.cs-cols-5{grid-template-columns:1fr}}

/* Text inputs */
.cs-text-inputs{display:grid;gap:14px}
.cs-two-up{grid-template-columns:1fr 1fr}
@media(max-width:560px){.cs-two-up{grid-template-columns:1fr}}
.cs-label{display:block;font-size:.8rem;font-weight:700;margin-bottom:6px;color:#33415a}
.cs-input{width:100%;padding:14px 15px;border:1.5px solid var(--line);border-radius:10px;font-family:var(--body);font-size:1rem;background:#fff;color:var(--ink);transition:border-color .15s,box-shadow .15s}
.cs-input:focus{outline:none;border-color:var(--green);box-shadow:0 0 0 3px rgba(39,161,73,.13)}
.cs-input.cs-invalid{border-color:var(--red);box-shadow:0 0 0 3px rgba(192,32,31,.12)}
.cs-error{display:block;color:var(--red);font-size:.82rem;margin-top:6px;font-weight:600}
#verification{text-align:center;letter-spacing:.5em;font-size:1.5rem;font-weight:700;padding-left:.5em}
#verification::-webkit-outer-spin-button,#verification::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
#verification{-moz-appearance:textfield}

/* Date of birth */
.cs-dob{display:grid;grid-template-columns:1fr 1fr 1.2fr;gap:12px}
/* At 375px these boxes were 82px around 80px of content — two pixels of slack,
   and iOS draws a wider arrow than Chrome does, which is what made them look
   cramped on a real handset. Tighter padding and a smaller gap buy real room. */
@media(max-width:560px){
  .cs-dob{grid-template-columns:1fr 1fr 1.25fr;gap:8px}
  .cs-dob .cs-input{padding-left:10px;padding-right:8px;text-overflow:ellipsis}
}
.cs-invalid-row .cs-dd-btn{border-color:var(--red);box-shadow:0 0 0 3px rgba(192,32,31,.12)}

/* Controlled dropdown. iOS puts a native <select> popover where it likes —
   over the header rather than under the field — and that cannot be styled, so
   the options are rendered here instead and always open beneath their field.
   The <select> stays as the value; it is only hidden from view and from the
   tab order. */
.cs-dd{position:relative}
.cs-dd-native{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;
  clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden}
.cs-dd-btn{display:flex;align-items:center;justify-content:space-between;gap:6px;
  text-align:left;cursor:pointer;font-weight:600}
.cs-dd-btn.is-placeholder{color:#8a97ad;font-weight:500}
.cs-dd-btn::after{content:"";flex:0 0 auto;width:8px;height:8px;margin-right:2px;
  border-right:2px solid #6b7a92;border-bottom:2px solid #6b7a92;
  transform:rotate(45deg) translate(-2px,-2px)}
.cs-dd-btn[aria-expanded="true"]{border-color:var(--green);box-shadow:0 0 0 3px rgba(39,161,73,.13)}

.cs-dd-list{position:absolute;z-index:60;top:calc(100% + 6px);left:0;right:0;
  max-height:260px;overflow-y:auto;-webkit-overflow-scrolling:touch;
  background:#fff;border:1.5px solid var(--line);border-radius:12px;
  box-shadow:0 16px 40px rgba(15,29,56,.18);padding:6px}
.cs-dd-list.is-above{top:auto;bottom:calc(100% + 6px)}
.cs-dd-list[hidden]{display:none}
.cs-dd-option{padding:11px 12px;border-radius:8px;font-size:1rem;color:var(--ink);
  cursor:pointer;min-height:44px;display:flex;align-items:center}
.cs-dd-option:hover{background:var(--green-soft);color:var(--green-deep)}
.cs-dd-option:focus{outline:none;background:var(--green-soft);color:var(--green-deep);
  box-shadow:inset 0 0 0 2px rgba(39,161,73,.45)}
.cs-dd-option.is-selected{background:var(--green-soft);color:var(--green-deep);font-weight:700}


/* Address — Google's suggestion dropdown is appended to <body>, so it needs to
   sit above the sticky header and the step card's stacking context. */
.pac-container{z-index:2000;border-radius:10px;border:1px solid var(--line);box-shadow:var(--shadow);font-family:var(--body);margin-top:4px}
.pac-item{padding:8px 12px;font-size:.92rem;cursor:pointer;border-top:1px solid var(--line)}
.pac-item:first-child{border-top:0}
.pac-item:hover,.pac-item-selected{background:var(--green-soft)}
.pac-item-query{font-size:.95rem;color:var(--ink)}
.cs-selected{margin-top:12px;font-size:.9rem;color:var(--muted)}
.cs-selected strong{color:var(--ink)}
/* Was 15-30px tall. Anything tappable needs ~44px, or it is a coin-flip on a
   phone — and these are the recovery links (resend a code, enter an address by
   hand) that someone reaches for precisely when they are already stuck. */
.cs-link{display:flex;align-items:center;justify-content:center;min-height:44px;
  margin:8px auto 0;padding:4px 12px;background:none;border:0;font-family:var(--body);
  font-size:.88rem;color:var(--green-deep);text-decoration:underline;
  text-underline-offset:2px;cursor:pointer;text-align:center}
.cs-link:hover{color:var(--green)}
#step-11 .cs-link{margin-top:18px;text-align:center}

/* Legal */
.cs-legal{font-size:.82rem;color:var(--muted);line-height:1.6;margin-top:18px;text-align:center}
.cs-legal a{color:var(--green-deep);text-decoration:underline;text-underline-offset:2px}

/* Buttons */
.cs-button-group{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:26px}
.cs-button-group .btn{min-width:190px}
@media(max-width:520px){.cs-button-group{flex-direction:column}.cs-button-group .btn{width:100%;min-width:0}}

/* Upload */
.cs-upload{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:44px 20px;border:2px dashed #c3d0e2;border-radius:16px;background:#f8fafd;color:var(--muted);font-weight:700;cursor:pointer;transition:border-color .16s,background .16s,color .16s}
.cs-upload:hover{border-color:var(--green);background:var(--green-soft);color:var(--green-deep)}
.cs-upload svg{width:38px;height:38px}
.cs-upload.has-file{border-style:solid;border-color:var(--green);background:var(--green-soft);color:var(--green-deep)}

/* Thank you */
.cs-done{width:72px;height:72px;border-radius:50%;background:var(--green-soft);color:var(--green-deep);display:flex;align-items:center;justify-content:center;margin:0 auto 20px}
.cs-done svg{width:36px;height:36px}

/* Dialogs */
.cs-dialog{border:0;border-radius:20px;padding:34px 32px;max-width:460px;width:calc(100% - 40px);box-shadow:var(--shadow-lg);color:var(--ink);text-align:center}
.cs-dialog::backdrop{background:rgba(15,29,56,.55)}
.cs-dialog .cs-title{display:block;font-family:var(--display);font-weight:800;font-size:1.4rem;margin-bottom:10px}
#countdown-timer{display:block;font-family:var(--display);font-weight:800;font-size:1.8rem;color:var(--navy);margin:6px 0 4px}

/* Busy state */
.is-busy{opacity:.65;pointer-events:none;position:relative}
  /* A dimmed button alone reads as a frozen page. Every busy button now carries
     a spinner so it is visibly working rather than merely inert. */
  .is-busy::after{content:"";position:absolute;top:50%;right:14px;width:16px;height:16px;
    margin-top:-8px;border:2px solid currentColor;border-right-color:transparent;
    border-radius:50%;animation:cs-spin .6s linear infinite;opacity:.9}

  @keyframes cs-spin{to{transform:rotate(360deg)}}

  /* Full-screen overlay for anything posting to the server. The submit at the
     end of the flow uploads a photo and can take several seconds, which is
     where the page felt frozen. */
  .cs-loading{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;
    justify-content:center;background:rgba(15,29,56,.55);backdrop-filter:blur(2px);
    animation:cs-fade .18s ease-out}
  .cs-loading[hidden]{display:none}
  .cs-loading-box{background:#fff;border-radius:18px;padding:30px 38px;text-align:center;
    box-shadow:0 18px 50px rgba(15,29,56,.3);max-width:min(320px,86vw)}
  .cs-loading-box .cs-spinner{display:block;margin:0 auto 14px;width:34px;height:34px;
    border:3px solid rgba(22,40,76,.18);border-top-color:var(--navy,#16284c);
    border-radius:50%;animation:cs-spin .7s linear infinite}
  .cs-loading-text{margin:0;font-weight:600;color:var(--navy,#16284c);font-size:1rem}

  @keyframes cs-fade{from{opacity:0}to{opacity:1}}

  @media (prefers-reduced-motion:reduce){
    .is-busy::after,.cs-loading-box .cs-spinner{animation-duration:1.6s}
    .cs-loading{animation:none}
  }

/* Way out of the flow */
.apply-exit{max-width:760px;margin:26px auto 0;text-align:center}
.cs-home-link{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:44px;padding:10px 20px;border-radius:999px;border:1.5px solid var(--line);
  background:#fff;color:var(--navy);font-weight:700;font-size:.92rem;text-decoration:none;
  transition:border-color .16s,background .16s,color .16s}
.cs-home-link:hover{border-color:var(--green);background:var(--green-soft);color:var(--green-deep)}
.cs-home-link svg{width:17px;height:17px}
@media(max-width:520px){.cs-home-link{width:100%}}

/* "Change phone number" throws away a code that has already been sent, so it is
   set well apart from Continue and styled quietly — a recovery path, not a
   second call to action. Must come after .cs-link: same specificity, so source
   order alone decides which wins. */
.cs-link-quiet{margin-top:30px;font-size:.8rem;color:var(--muted);font-weight:500;
  text-decoration-color:rgba(107,122,146,.5)}
.cs-link-quiet:hover{color:var(--ink)}
