/* Captive portal — guest-facing. Mobile-first, accessible, light/dark aware.
   Intentionally NOT the operator dark-console aesthetic: this is clean and welcoming. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --border: #dbe1e8;
  --text: #1b2733;
  --text-muted: #5a6b7b;
  --primary: #1c6e8c;
  --primary-hover: #175a73;
  --primary-contrast: #ffffff;
  --danger: #b23b3b;
  --danger-hover: #94302f;
  --ok: #2e7d52;
  --focus: #2b8fb3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 8px 24px rgba(16, 32, 48, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --surface: #17212c;
    --surface-2: #1e2b38;
    --border: #2a3a49;
    --text: #e7edf3;
    --text-muted: #9fb0c0;
    --primary: #4bb3d6;
    --primary-hover: #64c1e0;
    --primary-contrast: #06222e;
    --danger: #e07070;
    --danger-hover: #eb8686;
    --ok: #5fc98d;
    --focus: #6fc9e6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
}

/* -------------------------------- Brand -------------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--primary);
  flex: none;
}
.brand-title { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }

/* -------------------------------- Views -------------------------------- */
.view-title { font-size: 18px; margin: 0 0 6px; font-weight: 700; }
.lead { margin: 0 0 20px; color: var(--text-muted); font-size: 15px; }

/* -------------------------------- Steps -------------------------------- */
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 16px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.step-badge {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 14px; font-weight: 700;
  display: grid; place-items: center;
}
.step-head { margin: 0; font-weight: 600; font-size: 15px; }
.step-body { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }

/* ------------------------------ Code card ------------------------------ */
.code-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.code-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px;
}
.code-card-title { margin: 0; font-weight: 600; font-size: 15px; }
.code-slot {
  text-align: center;
  font-size: 30px;
  letter-spacing: .28em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 12px 0 16px;
  font-variant-numeric: tabular-nums;
}
.code-card-note { margin: 12px 0 0; font-size: 13px; color: var(--text-muted); }
.code-value { color: var(--text); letter-spacing: .18em; }

.pill {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px;
}
.pill-soon { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary); }
.pill-ready { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--ok); }

/* Screen-reader-only text (visually hidden, still announced). */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* Callout note (e.g. "access expired?"). */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 4px;
}
.callout-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.callout-body { margin: 0; font-size: 14px; color: var(--text-muted); }

/* ------------------------------- Buttons ------------------------------- */
.btn {
  font: inherit; font-weight: 600; font-size: 16px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  min-height: 48px; /* touch target */
  transition: background-color .12s ease, opacity .12s ease;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:not([disabled]):hover { background: var(--primary-hover); }
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--primary-contrast);
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::after { animation: none; } }

/* -------------------------------- Footer ------------------------------- */
.foot { margin-top: 24px; text-align: center; }
.foot-text { margin: 0; font-size: 13px; color: var(--text-muted); }

@media (min-width: 520px) {
  body { align-items: flex-start; padding-top: 40px; }
}
