/* Captive portal styling.
   Constraints that shaped this: it renders inside the OS's captive-portal
   mini-browser (no tabs, no zoom controls, sometimes an old WebView), on a phone,
   often outdoors in sunlight, held by someone waiting for their car. So: high
   contrast, large touch targets, no web fonts, no framework. */

:root {
  --green-900: #06281d;
  --green-700: #0b3d2c;
  --green-500: #128a5f;
  --green-100: #e6f4ee;
  --ink: #10201a;
  --ink-soft: #5b6b64;
  --line: #d9e4de;
  --paper: #ffffff;
  --ground: #f2f6f4;
  --danger: #a3231b;
  --danger-bg: #fdecea;
  --amber: #8a5a00;
  --amber-bg: #fdf3e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(6, 40, 29, .06), 0 8px 24px rgba(6, 40, 29, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

/* --- Header --- */
.head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 18px 20px;
  background: linear-gradient(160deg, var(--green-700), var(--green-900));
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.logo {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .14);
  border-radius: 12px;
}
.head h1 { margin: 2px 0 4px; font-size: 17px; line-height: 1.3; font-weight: 650; }
.head .sub { margin: 0; font-size: 13.5px; color: rgba(255, 255, 255, .82); }

/* --- Steps --- */
.step { display: none; }
.step.is-active { display: block; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--ink);
}
.step-title span { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.step-title.center { text-align: center; margin-bottom: 10px; font-size: 20px; }
.step-title.center span { font-size: 13.5px; }

.back {
  appearance: none; background: none; border: 0;
  color: var(--green-500); font: inherit; font-size: 14px;
  padding: 6px 0 12px; cursor: pointer;
}

/* --- Plan cards --- */
.plans { display: grid; gap: 10px; }
.plan {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 15px 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color .15s, transform .1s;
}
.plan:active { transform: scale(.99); }
.plan:focus-visible { outline: 3px solid var(--green-500); outline-offset: 2px; }
.plan-main { flex: 1; min-width: 0; }
.plan-name { font-weight: 650; font-size: 16px; }
.plan-name em { font-style: normal; color: var(--ink-soft); font-weight: 400; font-size: 13px; display: block; }
.plan-meta { margin-top: 4px; font-size: 12.5px; color: var(--ink-soft); }
.plan-price { flex: none; text-align: right; }
.plan-price b { display: block; font-size: 19px; font-weight: 700; color: var(--green-700); }
.plan-price small { font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; }

/* --- Chosen plan summary --- */
.chosen {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; margin-bottom: 18px;
  background: var(--green-100);
  border-radius: var(--radius);
  font-size: 14.5px;
}
.chosen b { color: var(--green-700); }

/* --- Form --- */
.field { display: block; margin-bottom: 18px; }
.label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.label em { font-style: normal; font-weight: 400; color: var(--ink-soft); }

.networks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.net {
  padding: 13px 10px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font: inherit; font-size: 14.5px; font-weight: 550;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.net[aria-checked="true"] {
  border-color: var(--green-500);
  background: var(--green-100);
  color: var(--green-700);
}
.net:focus-visible { outline: 3px solid var(--green-500); outline-offset: 2px; }

input[type="tel"] {
  width: 100%;
  padding: 14px 15px;
  font: inherit; font-size: 17px;
  letter-spacing: .02em;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
}
input[type="tel"]:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); }
.hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); }

.error {
  margin: 0 0 14px;
  padding: 11px 13px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 10px;
  font-size: 13.5px;
}

/* --- Call to action --- */
.cta {
  display: flex; justify-content: center; align-items: baseline; gap: 8px;
  width: 100%;
  padding: 16px;
  background: var(--green-700);
  color: #fff;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 16.5px; font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.cta:disabled { opacity: .55; cursor: default; }
.cta:active:not(:disabled) { transform: scale(.99); }
.cta.ghost { background: var(--paper); color: var(--green-700); border: 1.5px solid var(--green-500); }
.cta-amount { font-weight: 700; }

/* --- Waiting --- */
.spinner { display: flex; justify-content: center; gap: 7px; margin: 28px 0 20px; }
.spinner i {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--green-500);
  animation: pulse 1.15s ease-in-out infinite;
}
.spinner i:nth-child(2) { animation-delay: .18s; }
.spinner i:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { 0%, 70%, 100% { opacity: .25; transform: scale(.8); } 35% { opacity: 1; transform: scale(1); } }

.wait-copy, .done-copy { text-align: center; color: var(--ink-soft); font-size: 14.5px; margin: 0 0 20px; }
.wait-steps {
  margin: 0 0 18px; padding: 16px 16px 16px 34px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 14px; color: var(--ink-soft);
}
.wait-steps li { margin: 6px 0; }
.ref { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 0 0 6px; }
.ref strong { color: var(--ink); letter-spacing: .06em; }
.countdown { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 0; }

/* --- Success --- */
.tick, .warn {
  width: 62px; height: 62px; margin: 24px auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.tick { background: var(--green-100); color: var(--green-500); }
.warn { background: var(--amber-bg); color: var(--amber); }

.creds {
  padding: 16px; margin-bottom: 18px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* When the portal signs the device in itself, the code is reference material for
   a support call — not an instruction. Shrink it so it cannot be mistaken for
   something the customer has to do. */
.creds.is-footnote {
  background: none; box-shadow: none; padding: 6px 0;
  border-top: 1px solid var(--line); border-radius: 0;
  opacity: .72;
}
.creds.is-footnote .cred-row { padding: 5px 0; border-top: 0; font-size: 13px; }
.creds.is-footnote .cred-row strong { font-size: 14px; }
.creds.is-footnote .creds-note { font-size: 12px; margin-bottom: 4px; }
.creds-note { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); }
.cred-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line);
  font-size: 14px;
}
.cred-row:first-of-type { border-top: 0; }
.cred-row span { color: var(--ink-soft); }
.cred-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .08em; }

.reconnect-hint {
  margin: 12px 0 0; text-align: center;
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.45;
}

.loading { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 24px 0; }

.foot { margin-top: 26px; text-align: center; }
.foot p { margin: 0; font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8f0ec; --ink-soft: #9aada5; --line: #2a3b34;
    --paper: #14201b; --ground: #0b1410;
    --green-100: #16302a; --green-500: #35b183; --green-700: #0f4d38;
    --danger: #ff9f96; --danger-bg: #3a1a17;
    --amber: #f0c078; --amber-bg: #33260f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
  .cta { background: var(--green-500); color: #05231a; }
}
