/* e2e brand: same tokens as e2e.nz (navy #0d3c53, teal #16607e, lime #72cc50, Inter) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("brand/inter.woff2") format("woff2");
}
:root {
  --brand-dark: #0d3c53;
  --brand-deep: #082a3b;
  --lime: #72cc50;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: #18283a;
  --muted: #5c6f80;
  --line: #dde3e8;
  --accent: #16607e;
  --accent-hover: #1a7397;
  --accent-ink: #ffffff;
  --accent-soft: #e2eff5;
  --ok: #296d59;
  --ok-soft: #e4f3e6;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081c26;
    --surface: #0e2733;
    --surface-2: #133242;
    --ink: #e8eff3;
    --muted: #9db1be;
    --line: #1f4253;
    --accent: #5fb3d6;
    --accent-hover: #7cc3e0;
    --accent-ink: #06202c;
    --accent-soft: #12384a;
    --ok: #86d96a;
    --ok-soft: #173322;
    --warn: #f0b350;
    --warn-soft: #2e2412;
    --bad: #f97066;
    --bad-soft: #321a18;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: 0.95rem; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.boot { padding: 40px; color: var(--muted); }

/* Top bar */
.topbar { background: var(--brand-dark); position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; min-height: 62px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand .logo { height: 26px; width: auto; display: block; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; padding-left: 12px; border-left: 1px solid var(--line); line-height: 1.2; }
.brand.on-dark { color: #fff; }
.brand.on-dark .brand-name { border-left-color: rgba(255, 255, 255, 0.25); }
.logo-for-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  .logo-for-light { display: none !important; }
  .logo-for-dark { display: block !important; }
}
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: rgba(255, 255, 255, 0.72); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -11px; height: 3px; border-radius: 3px 3px 0 0; background: var(--lime); }
.who { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; }
.topbar button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.topbar button:hover { background: rgba(255, 255, 255, 0.1); }
.topbar a:focus-visible, .topbar button:focus-visible { outline-color: var(--lime); }
@media (max-width: 720px) {
  .topbar-inner { gap: 6px 12px; padding: 10px 16px 0; }
  .brand { flex: 1; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -8px; padding-bottom: 6px; }
  .nav a { white-space: nowrap; }
  .nav a.active::after { bottom: -6px; }
  .who > span { display: none; }
}

/* Layout */
main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid .card + .card { margin-top: 0; }
.card.wide { grid-column: 1 / -1; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Auth screens */
.auth {
  min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 32px 16px;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(114, 204, 80, 0.16), transparent 60%),
    linear-gradient(160deg, var(--brand-dark) 0%, var(--brand-deep) 100%);
}
.auth .card { width: 100%; max-width: 420px; padding: 32px; border: 0; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); }
.auth .brand { margin-bottom: 24px; }
.auth .brand .logo { height: 30px; }
.auth-foot { color: rgba(255, 255, 255, 0.6); font-size: 0.82rem; text-align: center; }
.auth-foot a { color: rgba(255, 255, 255, 0.85); }
.qr { display: block; margin: 8px auto 12px; border-radius: 8px; background: #fff; padding: 6px; width: 220px; height: 220px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0 0 6px; }
.field + .field { margin-top: 14px; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; }
.choice + .choice { margin-top: 8px; }
.choice input { margin-top: 4px; }
.choice b { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }

/* Buttons */
button, .btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--bad); border-color: var(--bad-soft); }
button.danger:hover { background: var(--bad-soft); }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--accent); font-weight: 500; }
button.small { padding: 5px 10px; font-size: 0.85rem; }
button:disabled { opacity: 0.55; cursor: default; }
.full { width: 100%; justify-content: center; margin-top: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges and notices */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); margin-bottom: 14px; }
.notice.ok { background: var(--ok-soft); }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.error { color: var(--bad); font-weight: 600; margin-top: 12px; }

/* Copy box */
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy code { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; background: var(--surface-2); padding: 9px 10px; border-radius: 8px; overflow-x: auto; white-space: nowrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px; border-left: 3px solid var(--lime); }
.stat .v { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 0.82rem; }

ol.steps { padding-left: 20px; margin: 0; }
ol.steps li + li { margin-top: 6px; }
details summary { cursor: pointer; font-weight: 600; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 20, 0.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.modal h2 { margin-bottom: 16px; font-size: 1.15rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 30; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
