/* Jalten app pages (sign-in, start, sign-up, forgot, reset, two-step, join, desktop): the parts the real
   pages need that the prototype's signin.css has no rule for. NOT from the prototype: every rule here is built
   from its tokens and components (si-card, field, btn, si-via, sp-filled, sp-steps) so the pages read as one
   design. Loaded after tokens.css, base.css and signin.css; it never overrides a prototype rule's look. */

/* Pages show and hide whole blocks with the hidden attribute; a class that sets display must not beat it. */
body.signin [hidden] { display: none !important; }

/* ---- card text ---- */
.si-card .si-lead { margin: 18px 0 0; font-size: 14.5px; color: var(--ink-2); }
.si-card .si-lead b, .si-card .si-sub b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.si-card p + p.si-lead { margin-top: 10px; }
.si-card .dim { margin: 14px 0 0; font-size: 13px; color: var(--ink-3); }
.si-card form { display: grid; gap: 14px; margin-top: 24px; }
.si-card form:not(#siForm) .si-wide { margin-top: 6px; }
.si-card form.si-inline { margin-top: 18px; }

/* ---- fields: the prototype's .field with a <label> (a reveal button may not sit inside a label) ---- */
.field .label { display: block; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-row a { font-size: 13px; font-weight: 600; color: var(--harbour-strong); }
.field > .pwwrap { position: relative; display: block; font-size: inherit; font-weight: 400; color: inherit; }
.field .input.has-reveal { padding-right: 44px; }
.reveal { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 40px; display: grid; place-items: center;
  border: 0; border-radius: var(--r); background: transparent; color: var(--ink-3); cursor: pointer; }
.reveal svg { width: 18px; height: 18px; }
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--ink); }
.field__help, .field > .field__help { margin: 0; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.field__err, .field > .field__err { margin: 0; font-size: 13px; font-weight: 500; color: var(--red); }
.field__err a { color: var(--red); font-weight: 600; }
.field.has-err .input, .field .input[aria-invalid="true"] { border-color: var(--red); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.code-input { font-family: var(--mono); font-size: 18px; letter-spacing: 0.12em; }

/* ---- status lines (auth.js showMsg and orgs.js showOrgMsg write these classes) ---- */
.form__msg { display: none; margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.form__msg.is-on { display: block; }
.form__msg--good { background: var(--safe-2); border-color: var(--safe-line); color: var(--brand-deep); }
.form__msg--bad { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.si-card > .form__msg, .si-card .si-block > .form__msg { margin-top: 18px; }

/* ---- "Continuing as …", "Signed in as …" (the prototype's .si-via) ---- */
.si-via .icon { color: var(--brand-deep); font-size: 16px; margin-top: 2px; flex: none; }
.si-via > span { min-width: 0; overflow-wrap: anywhere; }
.si-via .linkish { font-size: 13.5px; }
.si-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 18px 0 0; font-size: 13.5px; color: var(--ink-2); }
.si-who b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.si-who .linkish { font-size: 13.5px; }

/* ---- alternatives under a form ---- */
.si-alt { margin: 18px 0 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.si-alt a { color: var(--harbour-strong); font-weight: 600; }
.si-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.si-actions .btn { flex: 1 1 160px; }
.si-actions.is-stack { flex-direction: column; }
.si-actions.is-stack .btn { flex: none; width: 100%; }

/* ---- the quiet legal line under every app page (the prototype's pages have no footer) ---- */
.si-legal { margin: 0; font-size: 13px; color: var(--ink-3); text-align: center; }
.si-legal a { color: var(--ink-2); }
.si-legal .sep { margin: 0 8px; opacity: 0.5; }

/* ---- done and sent states ---- */
.si-tick { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 12px;
  background: var(--safe); color: var(--brand-deep); font-size: 22px; }
.si-tick.is-warn { background: var(--amber-bg); color: var(--amber); }
.si-resend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 20px 0 0; }
.si-resend .form-note { font-size: 13px; color: var(--ink-3); }
.si-facts { margin: 18px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); display: grid; gap: 8px; }
.si-facts div { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; font-size: 13.5px; }
.si-facts dt { color: var(--ink-3); }
.si-facts dd { margin: 0; color: var(--ink); font-weight: 550; overflow-wrap: anywhere; }

/* ---- two-step (enrol) ---- */
.mfa-qr { display: grid; justify-items: center; gap: 10px; margin: 20px 0 0; padding: 18px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-soft); }
.mfa-qr img { width: 180px; height: 180px; background: #fff; border-radius: 8px; }
.mfa-key { margin: 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.mfa-key code { display: inline-block; margin-top: 4px; padding: 2px 6px; border-radius: var(--r-xs); background: var(--surface);
  border: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; word-break: break-all; }

/* ---- desktop hand-off ---- */
.match { display: grid; gap: 6px; margin: 20px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--safe-2); border: 1px solid var(--safe-line); }
.match > span { font-size: 13.5px; color: var(--ink-2); }
.match__code { font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: 0.1em; color: var(--ink); }
.join-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.join-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.join-list b { font-weight: 600; overflow-wrap: anywhere; }
.si-block { margin-top: 18px; }
.si-block > p { font-size: 14.5px; color: var(--ink-2); }
.si-block > p + p { margin-top: 10px; }
.si-sep { height: 1px; margin: 22px 0 0; background: var(--line-soft); }

/* ---- /start: the request's status ---- */
.sp-state { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; }

/* ---- busy buttons ---- */
.btn .spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; animation: siSpin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .btn .spin { animation: none; } }

@media (max-width: 640px) {
  .si-facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .si-actions .btn { flex-basis: 100%; }
}
