@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Colour roles (one meaning each): blue = act / information,
   amber + triangle = warning. No red or green anywhere. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #4a5059;
  --border: #d9dce1;
  --border-strong: #8a919c;
  --row: #e3e6ea;
  --accent: #174ea6;
  --accent-hover: #0e3a80;
  --on-accent: #ffffff;
  --info-bg: #eaf1fc;
  --info-text: #0e3a80;
  --warn-bg: #fff4e5;
  --warn-border: #b45309;
  --warn-text: #5c2e04;
  --tag-bg: #ecedef;
  --tag-text: #3d4249;
  --disabled-bg: #c5cad2;
  --disabled-text: #3d4249;
  --focus: #174ea6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1b1e22;
    --text: #eceef1;
    --muted: #b0b6bf;
    --border: #343940;
    --border-strong: #6b727d;
    --row: #2b3036;
    --accent: #8ab4ff;
    --accent-hover: #b3cdff;
    --on-accent: #0b1a33;
    --info-bg: #15243d;
    --info-text: #c9dcff;
    --warn-bg: #2e1f0a;
    --warn-border: #f0a14a;
    --warn-text: #ffe2bd;
    --tag-bg: #2b3036;
    --tag-text: #d3d7dd;
    --disabled-bg: #3a3f46;
    --disabled-text: #c3c8cf;
    --focus: #8ab4ff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-house { color: var(--accent); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.mainnav { display: flex; gap: 20px; }
.mainnav a[aria-current="page"] { color: var(--text); font-weight: 700; text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* Layout */
main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: 24px 16px; outline: none; }
.view { display: flex; flex-direction: column; gap: 20px; }
.view-narrow { max-width: 26rem; margin: 0 auto; padding-top: 16px; }
.loading { color: var(--muted); text-align: center; padding: 48px 0; }
.hero { display: flex; flex-direction: column; gap: 8px; }
.hero-title { display: flex; align-items: center; gap: 10px; }
.hero h1 { font-size: 1.9rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row-end { align-items: flex-end; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }
.links { display: flex; flex-direction: column; gap: 12px; padding: 0 4px; font-weight: 700; }
.back { font-weight: 700; align-self: flex-start; }
.bullets { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.optional { font-weight: 400; color: var(--muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 700; }
.hint { font-size: 0.9375rem; color: var(--muted); }
input[type="text"], select {
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 14px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.code-input { letter-spacing: 0.08em; }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Buttons */
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.btn-plain { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); font-weight: 400; min-height: 44px; }
.btn:disabled { background: var(--disabled-bg); color: var(--disabled-text); border-color: var(--disabled-bg); cursor: not-allowed; }
.btn-inline { align-self: flex-start; min-height: 44px; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.8; }

/* Notices: amber = warning, blue = information. Always with an icon. */
.notice, .alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 12px;
  padding: 14px 16px;
}
.notice-warn, .alert { background: var(--warn-bg); border: 2px solid var(--warn-border); color: var(--warn-text); }
.notice-warn .icon-warn, .alert .icon-warn { color: var(--warn-border); margin-top: 2px; }
.notice-info { background: var(--info-bg); border: 2px solid var(--accent); color: var(--info-text); flex-direction: column; gap: 8px; }
.notice-head { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.code-big { font-size: 1.4rem; letter-spacing: 0.06em; font-weight: 700; }
.status { color: var(--muted); min-height: 1.5em; }

/* Recovery codes */
.codes {
  margin: 0;
  padding: 16px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  font-size: 1rem;
  letter-spacing: 0.04em;
}
@media (max-width: 380px) { .codes { grid-template-columns: 1fr; } }

/* Lists of passkeys and invites */
.items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--row);
  border-radius: 10px;
  padding: 10px 12px;
}
.item-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--tag-bg);
  color: var(--tag-text);
}
.tag-waiting { background: var(--info-bg); color: var(--info-text); }
.stat { flex-direction: row; align-items: baseline; gap: 10px; }
.stat-n { font-size: 2rem; font-weight: 700; line-height: 1; }

.footer { padding: 16px; text-align: center; font-size: 0.875rem; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 120ms ease, border-color 120ms ease; }
}
