/* Bastion sign-in. Light first; dark only when the person picked it in the app (localStorage bastion-theme). */
:root, [data-theme="light"] {
  --bg: #f4f6fa; --paper: #ffffff; --ink: #0d1526; --ink-2: #3b4658; --ink-3: #5d687b;
  --line: #d9dee7; --field: #ffffff; --brand: #13233f; --brand-2: #1f3a66; --accent: #2457c5;
  --accent-ink: #ffffff; --ok: #157347; --bad: #b42318; --bad-bg: #fdecea; --note-bg: #eef3fc;
  --side-ink: #e8eefa; --grid: rgba(255,255,255,.06); --focus: rgba(36,87,197,.28);
}
[data-theme="dark"] {
  --bg: #0a0f1a; --paper: #111827; --ink: #e8edf6; --ink-2: #b8c2d3; --ink-3: #94a0b4;
  --line: #2a3446; --field: #0d1422; --brand: #0b1322; --brand-2: #16233b; --accent: #5b8cff;
  --accent-ink: #0a0f1a; --ok: #4cc38a; --bad: #ff8a7a; --bad-bg: #2a1414; --note-bg: #142038;
  --side-ink: #dfe7f5; --grid: rgba(255,255,255,.05); --focus: rgba(91,140,255,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.shell { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }

.side {
  position: relative; overflow: hidden; color: var(--side-ink);
  background: radial-gradient(120% 90% at 15% 10%, var(--brand-2) 0%, var(--brand) 60%);
  display: flex; align-items: flex-start; padding: 40px 48px;
}
.side .grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 40px; height: 40px; border-radius: 9px; object-fit: contain; }
.brand .word { font-weight: 650; font-size: 22px; letter-spacing: -.01em; }
.brand.small { display: none; color: var(--ink); margin-bottom: 28px; }
.brand.small .mark { width: 32px; height: 32px; }
.brand.small .word { font-size: 19px; }

.paper { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--paper); }
.panel { width: 100%; max-width: 380px; }
.step[hidden] { display: none !important; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 8px; font-weight: 650; }
.kicker { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.lead { margin: 0 0 20px; color: var(--ink-2); }
form.step > h1 + .alert, form.step > h1 + .note, form.step > h1 + .field { margin-top: 20px; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px; }
input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
input.code { font: 600 22px/1 ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; letter-spacing: .35em; text-align: center; }
.caps { display: block; margin-top: 6px; color: var(--bad); font-size: 12.5px; }

.go {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 46px; margin-top: 6px;
  border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 15px; line-height: 1;
  font-family: inherit; cursor: pointer; text-decoration: none; transition: filter .15s, opacity .15s;
}
.go:hover:not(:disabled) { filter: brightness(1.07); }
.go:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.go:disabled { opacity: .5; cursor: not-allowed; }
.go.busy span::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .go.busy span::after { animation: none; } }

.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-family: inherit; font-weight: 500; font-size: 13.5px; line-height: 1.4; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish.under { display: block; margin: 14px auto 0; }

.alert { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 14px; }
.note { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--note-bg); color: var(--ink-2); font-size: 14px; }

.rules { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; color: var(--ink-3); }
.rules li { padding-left: 20px; position: relative; }
.rules li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--line); }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { background: var(--ok); border-color: var(--ok); }

.qr-wrap { display: flex; gap: 16px; align-items: center; margin: 0 0 18px; }
.qr { flex: 0 0 auto; width: 232px; height: 232px; padding: 0; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.key { min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-3); }
.key code { font: 500 13px/1.5 ui-monospace, Consolas, monospace; color: var(--ink); word-break: break-all; }
.key .linkish { align-self: flex-start; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .brand.small { display: flex; }
  .paper { align-items: flex-start; padding-top: 12vh; }
}
@media (max-width: 420px) {
  .qr-wrap { flex-direction: column; align-items: flex-start; }
  .rules { grid-template-columns: 1fr; }
}
