/* ═══════════════════════════════════════════════════════════════════
   ampron-auth — login + passkey management (spec 10)

   Ampron UI v2. Component values below are copied verbatim from
   ampron-component-baseline-spec.html (.btn, .amp-input, .card, .chip,
   .id-tag); nothing here is an approximation and nothing hardcodes a value
   that has a token. Layout-only measurements (page gutters, stack gaps)
   are the one thing invented here, because the baseline has no page shell.

   Two themes, identical markup — [data-theme] swaps tokens in tokens.css.
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* iOS PWA: keep content clear of the notch and the home indicator. */
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.shell {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  min-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.shell.wide { max-width: 640px; justify-content: flex-start; padding-top: 8px; }

/* ── Brand ───────────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: center;
}

/* The only decorative use of red on the page, and it is the brand mark —
   permitted by rule 4, which reserves red for mark, primary action, focus
   and "needs a human". */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--red);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

.brand-name { font-size: 19px; font-weight: 600; color: var(--ink-1); }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  overflow: hidden;
}
.card-pad { padding: 22px; }

.card-title { font-size: 18px; font-weight: 600; color: var(--ink-1); }
.card-meta  { font-size: 14px; color: var(--ink-3); margin-top: 3px; }

/* Static text carries no frame (rule 5). */
.lede { font-size: 15px; color: var(--ink-3); margin: 0; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 18px; }

.center { text-align: center; }

/* ── Buttons — baseline spec values, verbatim ────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; }
.btn.block { width: 100%; justify-content: center; }
.btn.sm { padding: 6px 13px; font-size: 14px; border-radius: 8px; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.btn-primary { background: var(--red); color: #fff; box-shadow: 0 2px 10px rgba(227, 6, 19, .30); }
.btn-primary:hover { background: #c9050f; }

.btn-secondary { background: var(--surface-1); color: var(--ink-2); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { background: var(--red-tint); color: var(--red); border: 1px solid var(--red-border); }
.btn-danger:hover { opacity: .82; }

/* ── Input ───────────────────────────────────────────────────────── */
.amp-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--ink-1);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.amp-input::placeholder { color: var(--ink-4); }
.amp-input:hover { border-color: var(--ink-3); }
.amp-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }

.input-label { font-size: 13px; font-weight: 500; color: var(--ink-3); display: block; margin-bottom: 6px; }

/* ── Chip ────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.green { background: var(--green-tint); color: var(--green); }
.chip.amber { background: var(--amber-tint); color: var(--amber); }
.chip.red   { background: var(--red-tint);   color: var(--red); }
.chip.blue  { background: var(--blue-tint);  color: var(--blue); }
.chip.gray  { background: var(--surface-3);  color: var(--ink-3); border: 1px solid var(--border); }

/* IDs, counts and timestamps are mono — rule 3. */
.mono, .id-tag { font-family: var(--font-mono); }
.id-tag {
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ── Divider with a label ────────────────────────────────────────── */
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-4);
  font-size: 13px;
}
.or::before, .or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

/* ── Status line — calm until deviation (rule 6) ─────────────────── */
.status {
  font-size: 14px;
  min-height: 21px;
  color: var(--ink-3);
  text-align: center;
  transition: color var(--dur) var(--ease);
}
.status.error { color: var(--red); }
.status.ok    { color: var(--green); }

/* ── Credential rows — interactive, so they get a frame ──────────── */
.rows { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.row-main { flex: 1; min-width: 0; }
.row-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
  display: flex;
  gap: 6px 12px;
  flex-wrap: wrap;
  align-items: center;
}
/* Each fact is one unwrappable unit; the gap separates them. No literal "·",
   which strands itself at the start of a line when the row wraps. */
.row-meta .meta-bit { white-space: nowrap; }

.empty {
  padding: 26px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.footnote { font-size: 13px; color: var(--ink-4); text-align: center; }
.footnote a { color: var(--ink-3); }

.spin {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
