/* Ozal identity, shared with the admin console (web/console) and the
   project page (site/): warm ink with an ivory primary, a camel signal and
   graphite depth (Marfil). Green and red keep one meaning each: done and refused. Geist is bundled locally (OFL,
   see OFL.txt) so the sign-in pages make no third-party request. */
@font-face { font-family: "Geist"; src: url("/_/auth/geist-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/_/auth/geist-600.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
:root {
  color-scheme: dark;
  --bg: #0e0e0d;
  --card: #171716;
  --raised: #1f1f1d;
  --fg: #f1ede6;
  --muted: #a19d96;
  --border: #2a2927;
  --accent: #f1ece2;
  --accent-fg: #0e0e0d;
  --lamp: #c4a17c;
  --depth: #55514a;
  --ok: #78cc8a;
  --err: #ee6b5e;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px 16px; background: radial-gradient(900px 480px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg);
  color: var(--fg); font: 16px/1.55 "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand .arch { fill: var(--accent); }
.brand .leaf { fill: var(--depth); }
.brand .light { fill: var(--lamp); }
.brand .name { display: block; font-weight: 600; font-size: 1rem; line-height: 1; letter-spacing: -0.01em; }
.brand .sub { display: block; margin-top: 5px; font: 0.68rem/1 var(--mono); color: var(--muted); }
main { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; box-shadow: 0 30px 80px -40px color-mix(in srgb, var(--accent) 35%, transparent); }
h1 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0 0 18px; color: var(--muted); }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input { width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); color: inherit; font: inherit; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .secondary { display: block; width: 100%; padding: 12px; border-radius: 10px; font: inherit; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
button { border: 0; background: var(--accent); color: var(--accent-fg); }
button:disabled { opacity: 0.55; cursor: progress; }
.secondary { margin-top: 10px; border: 1px solid var(--border); background: var(--raised); color: var(--fg); }
#status { margin: 16px 0 0; min-height: 1.5em; font-size: 0.95rem; }
#status:empty { display: none; }
#status[data-kind="ok"] { color: var(--ok); }
#status[data-kind="error"] { color: var(--err); }
.first-time { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--muted); background: var(--raised); border-radius: 10px; }
.first-time strong { display: block; margin-bottom: 4px; }
.first-time p, .hint { margin: 0; font-size: 0.88rem; }
.hint { margin-top: 14px; }
.choices { margin: 16px 0 0; padding: 0; border: 0; font-size: 0.88rem; }
.choices[hidden] { display: none; }
.choices summary { cursor: pointer; color: var(--muted); }
.choices summary:hover, .choices[open] summary { color: var(--fg); }
.choices > p { margin: 8px 0 0; }
.choices legend { margin-bottom: 8px; padding: 0; font-weight: 600; }
#choice-list { display: grid; gap: 8px; margin-bottom: 16px; }
.choice { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: start; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); font-size: 0.88rem; font-weight: 400; color: var(--muted); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--fg); }
.choice input { margin: 3px 0 0; grid-row: span 2; accent-color: var(--fg); }
.choice strong { font-weight: 600; color: var(--fg); }
.choice span { color: var(--muted); }
.choice-actions { display: grid; gap: 8px; margin-top: 10px; }
.choice-actions .secondary { margin-top: 0; }
.help section { margin-top: 22px; }
.help h2 { margin: 0 0 6px; font-size: 1.05rem; }
.help section p { margin: 0 0 6px; }
.help > .secondary { margin-top: 26px; }
.sites { display: grid; gap: 8px; margin-top: 16px; }
.sites a { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--raised); color: var(--fg); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.sites-title { margin: 8px 0 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sites a::after { content: "→"; color: var(--muted); margin-left: 12px; }
.sites a:has(small) { display: grid; grid-template-columns: 1fr auto; }
.sites a:has(small)::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.sites a small { grid-column: 1; margin-top: 2px; font-size: 0.78rem; font-weight: 400; color: var(--muted); }
.who { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -4px 0 18px; font-size: 0.88rem; color: var(--muted); }
.who strong { color: var(--fg); font-weight: 600; overflow-wrap: anywhere; }
.link-button { width: auto; padding: 0; background: none; border: 0; color: var(--fg); font-weight: 600; font-size: 0.88rem; text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.devices { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.devices li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: start; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--raised); }
.devices .icon { grid-column: 1; grid-row: 1 / span 2; box-sizing: content-box; width: 20px; height: 20px; padding: 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); }
.devices .provider { grid-column: 2; font-weight: 700; line-height: 1.3; padding-top: 2px; }
.devices .meta { grid-column: 2 / -1; font-size: 0.82rem; color: var(--muted); }
.devices .badge { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; vertical-align: 1px; border: 1px solid var(--border); color: var(--muted); }
.devices .badge.bound { border-color: color-mix(in srgb, var(--ok) 50%, transparent); color: var(--ok); }
.devices li button { grid-column: 3; grid-row: 1; width: auto; padding: 4px 10px; border-radius: 8px; background: transparent; color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 45%, transparent); font-size: 0.8rem; }
.devices li button:disabled { opacity: 0.35; cursor: not-allowed; }
.devices .badge.current { border-color: color-mix(in srgb, var(--fg) 40%, transparent); color: var(--fg); }
.devices .meta .details { display: block; margin-top: 4px; }
/* Rename sits beside Remove on the name's row: a quiet action, not a warning. */
.devices li:has(.rename-button) { grid-template-columns: auto 1fr auto auto; }
.devices li button.rename-button { grid-column: 3; grid-row: 1; color: var(--fg); border-color: var(--border); }
.devices li:has(.rename-button) > button:not(.rename-button) { grid-column: 4; }
.devices li .rename-button[hidden] { display: none; }
/* Renaming happens in place, under the passkey it names. */
.devices .rename { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; }
.devices .rename[hidden] { display: none; }
.devices .rename input { flex: 1 1 12rem; min-width: 0; margin: 0; }
.devices li .rename button.save { grid-column: auto; grid-row: auto; padding: 6px 12px; border: 0; background: var(--accent); color: var(--accent-fg); font-size: 0.85rem; }
.devices li .rename .link-button { grid-column: auto; grid-row: auto; padding: 0; border: 0; color: var(--fg); }
#sessions { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
#sessions li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--raised); }
#sessions li p { margin: 0; font-size: 0.82rem; color: var(--muted); }
#sessions li strong { display: block; color: var(--fg); font-size: 0.92rem; }
#sessions li .confirm { flex-basis: 100%; }
/* An in-page question in place of a destructive button (no native confirm()). */
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 6px 0 0; font-size: 0.88rem; }
.confirm[hidden] { display: none; }
.confirm > span { flex-basis: 100%; color: var(--fg); }
.confirm button.danger, .devices li .confirm button.danger { grid-column: auto; grid-row: auto; width: auto; padding: 6px 12px; border-radius: 8px; background: var(--err); color: var(--accent-fg); border: 0; font-size: 0.85rem; }
.devices li .confirm { grid-column: 1 / -1; }
.devices li .confirm .link-button { grid-column: auto; grid-row: auto; border: 0; color: var(--fg); padding: 0; }
footer { font-size: 0.75rem; color: var(--muted); text-align: center; }
a { color: var(--fg); text-underline-offset: 3px; }
footer a { color: inherit; }

/* The refusal page (CTX-007): the way forward is the one strong button. */
.action { display: block; width: 100%; padding: 12px; margin-top: 4px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-weight: 700; text-align: center; text-decoration: none; }
body[data-page="denied"] form { margin-top: 18px; }
.reference { margin: 12px 0 0; font: 0.75rem var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.host, .email { overflow-wrap: anywhere; }
