/*
 * Diagnostic client styles.
 *
 * Values lifted from the storefront's design system (globals.css) rather than
 * approximated, so this reads as the same product: --violet #7b66ef,
 * --purple #473288, --ink #1f1d2b, --mut #6b6a78, --line rgba(23,20,40,.09),
 * --soft #f6f5fb, Archivo, .card at 20px radius, .btn as a 999px pill.
 *
 * Mobile first and specifically an IN-APP BROWSER: this link arrives by
 * WhatsApp or SMS, so most opens are inside an embedded webview — narrow, no
 * address bar, sometimes odd font scaling.
 */

:root {
  --purple: #473288;
  --violet: #7b66ef;
  --violet-l: #bfb9f3;
  --amber: #fca80f;
  --magenta: #d0098d;
  --ink: #1f1d2b;
  --mut: #6b6a78;
  --line: rgba(23, 20, 40, 0.09);
  --soft: #f6f5fb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--soft);
}

body {
  font-family: Archivo, system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* Webviews scale text unpredictably; pin it. */
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 20px env(safe-area-inset-bottom);
}

/* ── header ── */
.hdr { display: flex; align-items: center; gap: 10px; padding: 18px 0 0; }
.mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--violet);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.mark svg { width: 17px; height: 17px; }
.brand { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }

/* ── panes ── */
main { flex: 1; display: flex; flex-direction: column; }
.pane { flex: 1; display: flex; flex-direction: column; padding: 26px 0 26px; }
.center-pane { padding-top: 40px; }
.spacer { flex: 1; min-height: 20px; }
.center { text-align: center; }

h1 {
  font-size: 25px; font-weight: 800; line-height: 1.18;
  letter-spacing: -0.015em; margin: 14px 0 8px;
}
.mut { font-size: 15px; line-height: 1.55; color: var(--mut); margin: 0; }
.tiny { font-size: 12.5px; line-height: 1.5; color: rgba(107, 106, 120, 0.8); margin: 0; }

.step {
  display: inline-flex; align-items: center; align-self: flex-start;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--purple); background: rgba(123, 102, 239, 0.10);
  padding: 6px 13px; border-radius: 999px;
}

.card { background: #fff; border: 1px solid var(--line); border-radius: 20px; }

/* ── choices ── */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.list { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

.opt {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.opt:hover { border-color: var(--violet-l); }
.opt.on { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123, 102, 239, 0.10); }

/* Tiles (device grid) — 44px floor is a hard minimum, these are far above it. */
.opt.tile-opt {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 15px; min-height: 96px;
}
.opt.tile-opt .ic { width: 24px; height: 24px; }
.opt.tile-opt .ic svg { width: 100%; height: 100%; }
.opt.tile-opt img { width: 24px; height: 24px; object-fit: contain; }
.opt.tile-opt .nm { font-size: 14.5px; font-weight: 700; line-height: 1.3; }

/* Rows (app + network lists) */
.opt.row-opt {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 15px; min-height: 66px; border-radius: 14px;
}
.opt.row-opt .logo {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  background: rgba(71, 50, 136, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--purple);
  overflow: hidden;
}
.opt.row-opt .logo img { width: 100%; height: 100%; object-fit: contain; }
.opt.row-opt.on .logo { background: rgba(123, 102, 239, 0.12); }
.opt.row-opt .nm { flex: 1; font-size: 15px; font-weight: 700; }
.opt.row-opt .sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--mut); margin-top: 2px; }
.opt.row-opt .tick { width: 20px; height: 20px; flex: none; opacity: 0; }
.opt.row-opt.on .tick { opacity: 1; }

.opt.faint { background: transparent; border-style: dashed; border-color: rgba(23, 20, 40, 0.16); min-height: 60px; }
.opt.faint .nm { font-size: 14.5px; color: var(--purple); }
.opt.faint.dim .nm { color: var(--mut); }

.radio { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid rgba(23, 20, 40, 0.16); display: flex; align-items: center; justify-content: center; }
.opt.on .radio { border-color: var(--violet); }
.radio i { width: 11px; height: 11px; border-radius: 50%; background: transparent; display: block; }
.opt.on .radio i { background: var(--violet); }

.sep { height: 1px; background: var(--line); margin: 7px 2px; }

.other-wrap { display: block; margin-top: 12px; }
.other-lbl { display: block; font-size: 11.5px; color: var(--mut); margin-bottom: 6px; }
.inp {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 13px; background: #fff;
}
.inp:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123, 102, 239, 0.10); }

/* ── button ── */
.btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: inherit; font-weight: 700; font-size: 15.5px;
  padding: 16px 26px; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--violet); color: #fff; cursor: pointer;
  box-shadow: 0 12px 26px -12px rgba(123, 102, 239, 0.85);
  transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--purple); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.btn:disabled:hover { background: var(--violet); }
.btn .chev { width: 17px; height: 17px; flex: none; }

/* ── running ── */
.orb {
  width: 92px; height: 92px; margin: 0 auto; border-radius: 50%;
  background: #fff; border: 1.5px solid rgba(123, 102, 239, 0.28);
  box-shadow: 0 0 0 8px rgba(123, 102, 239, 0.07);
  display: flex; align-items: center; justify-content: center;
}
.orb svg { width: 38px; height: 38px; animation: tick 3s linear infinite; }
@keyframes tick { to { transform: rotate(360deg); } }

.bar-wrap { margin-top: 26px; }
.bar { height: 8px; border-radius: 999px; background: rgba(23, 20, 40, 0.07); overflow: hidden; }
.bar-fill { width: 0; height: 100%; border-radius: 999px; background: var(--violet); transition: width .3s ease; }
.bar-meta { display: flex; justify-content: space-between; margin-top: 9px; font-size: 12.5px; font-weight: 700; }
#bar-label { color: var(--purple); }
#bar-pct { color: var(--mut); }

.steps { margin-top: 24px; padding: 6px 18px; }
.srow { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: none; }
.srow .nm { flex: 1; font-size: 14px; color: var(--mut); }
.srow.busy .nm { font-weight: 700; color: var(--ink); }
.srow.todo .nm { color: rgba(107, 106, 120, 0.65); }
.srow .dot { width: 19px; height: 19px; flex: none; border-radius: 50%; border: 2px solid rgba(23, 20, 40, 0.12); }
.srow.busy .dot { border: 2.3px solid rgba(123, 102, 239, 0.25); border-top-color: var(--violet); animation: spin .8s linear infinite; }
.srow.done .dot { border: none; }
.srow .dot svg { width: 19px; height: 19px; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-lg {
  width: 34px; height: 34px; margin: 0 auto 16px;
  border-radius: 50%; border: 3px solid rgba(123, 102, 239, 0.22);
  border-top-color: var(--violet); animation: spin .8s linear infinite;
}

.warn, .hint {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 14px; padding: 14px;
}
.warn { background: rgba(208, 9, 141, 0.07); border: 1px solid rgba(208, 9, 141, 0.22); font-size: 13.5px; font-weight: 700; }
.hint { background: rgba(252, 168, 15, 0.10); border: 1px solid rgba(252, 168, 15, 0.30); margin-top: 20px; text-align: left; align-items: flex-start; font-size: 12.5px; line-height: 1.55; color: var(--mut); }
.warn svg, .hint svg { width: 17px; height: 17px; flex: none; }
.hint svg { margin-top: 1px; }

/* ── done ── */
.tile {
  width: 78px; height: 78px; margin: 0 auto; border-radius: 22px;
  background: rgba(123, 102, 239, 0.10);
  display: flex; align-items: center; justify-content: center;
}
.tile.grey { background: rgba(23, 20, 40, 0.05); }
.tile svg { width: 34px; height: 34px; }

.code-card { margin-top: 26px; padding: 26px 22px; text-align: center; }
.code-lbl { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mut); }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 33px; font-weight: 700; letter-spacing: 0.06em;
  margin: 13px 0 20px;
  /* Long-press to copy is how half of them will do it. */
  user-select: all; -webkit-user-select: all;
}
.note { margin-top: 18px; padding: 15px 16px; display: flex; gap: 11px; font-size: 13.5px; line-height: 1.55; color: var(--mut); }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.dead { justify-content: center; }

@media (min-width: 560px) {
  h1 { font-size: 28px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
