/* Iona ID — auth surface. One clean centered card; light/dark aware. */
:root {
  --bg: #f5f5f7; --card: #ffffff; --ink: #1a1a2e; --muted: #6b7280;
  --line: #e5e7eb; --accent: #6d5efc; --accent-ink: #ffffff;
  --ok: #0a7a3f; --err: #b3261e; --ring: rgba(109,94,252,.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d14; --card: #16161f; --ink: #f3f3f7; --muted: #9a9aa8;
    --line: #262633; --accent: #8b7dff; --accent-ink: #0d0d14; --ring: rgba(139,125,255,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}

.brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
  font-weight: 700; letter-spacing: -0.01em; color: var(--ink);
}
.brand .dot { width: 22px; height: 22px; border-radius: 7px; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); font-size: 13px; }

main.auth {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
main.auth h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
main.auth p { margin: 0 0 14px; color: var(--muted); }

.context {
  display: inline-block; margin-bottom: 14px; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  font-size: 12px; font-weight: 600;
}

form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
input[type=email], input[type=text] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font-size: 15px; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[type=submit], .btn {
  width: 100%; padding: 11px 13px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 600;
  text-align: center; text-decoration: none; display: block;
}
input[type=submit]:hover, .btn:hover { filter: brightness(1.06); }

.alt { margin-top: 16px; font-size: 14px; }
.alt a, main.auth a.link { color: var(--accent); text-decoration: none; }
.alt a:hover, main.auth a.link:hover { text-decoration: underline; }

.flash { width: 100%; max-width: 380px; margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.flash-notice { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.flash-alert  { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }

.foot { margin-top: 22px; color: var(--muted); font-size: 12px; }

/* --- Admin: manage delegating apps ------------------------------------------ */
main.auth.admin { max-width: 560px; text-align: left; }
.admin-head { display: flex; align-items: center; justify-content: space-between; }
.admin-head h1 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
main.auth.admin code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.btn-sm { padding: 7px 12px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }

.client-list { list-style: none; margin: 18px 0 0; padding: 0; }
.client-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.client-list li:first-child { border-top: 0; }
.swatch { width: 34px; height: 34px; border-radius: 9px; flex: none; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
.client-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.client-meta strong { letter-spacing: -0.01em; }

main.auth.admin label { display: block; margin-top: 16px; font-size: 13px; font-weight: 600; }
main.auth.admin label small { display: block; margin-top: 4px; font-weight: 400; }
main.auth.admin input[type=text], main.auth.admin input[type=email], main.auth.admin textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; }
main.auth.admin textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; resize: vertical; }
.color-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.color-row input[type=color] { width: 44px; height: 40px; padding: 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); cursor: pointer; flex: none; }
.color-row .accent-hex { margin-top: 0 !important; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.checkbox input { width: auto; margin: 0; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.form-actions input[type=submit] { width: auto; }
.form-actions .link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--accent); }
.form-actions .link.danger { color: var(--err); }
