
:root {
  --canvas: #fafaf9; --surface: #ffffff; --ink: #17181c; --muted: #5f636b; --hairline: #e3e3df;
  --fill: #f1f1ee; --fill-hover: #e7e7e3; --action: #0f766e; --action-hover: #0b5f58; --on-action: #ffffff;
  --focus: #0f766e; --danger: #b42318; --danger-fill: #fdecea; --ok: #067647; --ok-fill: #e6f4ec;
  --warn: #b45309; --warn-fill: #fdf3e2; --danger-line: #f0c4be;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0e0f11; --surface: #16181b; --ink: #ecedee; --muted: #9a9da5; --hairline: #2a2d32;
    --fill: #1e2024; --fill-hover: #26292e; --action: #2dd4bf; --action-hover: #5eead4; --on-action: #0e0f11;
    --focus: #2dd4bf; --danger: #ff8a7a; --danger-fill: #3a1d1a; --ok: #4ade80; --ok-fill: #14291c;
    --warn: #fbbf24; --warn-fill: #2e2410; --danger-line: #5c2a24;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 48px 16px;
  background: var(--canvas); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { width: 100%; max-width: 400px; text-align: center; }
main:not(.wide) {
  padding: 40px 32px; border: 1px solid var(--hairline); border-radius: 16px; background: var(--surface);
}
.mark {
  display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 20px; border-radius: 10px;
  background: var(--ink); color: var(--canvas); font-size: 22px; font-weight: 650;
}
.mark.avatar { width: 72px; height: 72px; border-radius: 50%; font-size: 30px; background: var(--fill); color: var(--ink); }
h1 { margin: 0 0 8px; font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
p { margin: 0 0 28px; color: var(--muted); overflow-wrap: anywhere; }
.detail { margin: -16px 0 28px; font-size: 14px; }
ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
form { margin: 0; }
.button {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px;
  padding: 10px 48px; border: 1px solid var(--hairline); border-radius: 8px; text-decoration: none;
  font: inherit; font-weight: 500; line-height: 1.2; cursor: pointer;
  background: var(--surface); color: var(--ink);
  transition: background-color 120ms ease, border-color 120ms ease;
}
.button:hover { background: var(--fill); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button.primary { border-color: transparent; background: var(--action); color: var(--on-action); }
.button.primary:hover { background: var(--action-hover); }
.button svg { position: absolute; left: 18px; width: 20px; height: 20px; }
/* Provider colours follow each brand's sign-in button guidelines. */
.button.google { background: #ffffff; color: #1f1f1f; border-color: #747775; }
.button.google:hover { background: #f2f2f2; }
.button.apple { background: #000000; color: #ffffff; border-color: #000000; }
.button.apple:hover { background: #1d1d1f; }
.button.github { background: #24292f; color: #ffffff; border-color: #24292f; }
.button.github:hover { background: #32383f; }
@media (prefers-color-scheme: dark) {
  .button.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
  .button.google:hover { background: #1f1f20; }
  .button.apple { background: #ffffff; color: #000000; border-color: #ffffff; }
  .button.apple:hover { background: #e8e8ed; }
  .button.github { border-color: #6e7681; }
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--action); text-underline-offset: 3px; }
h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 18px; font-weight: 600; }
section { border: 1px solid var(--hairline); border-radius: 12px; padding: 24px; margin: 0 0 16px; background: var(--surface); }
section p { font-size: 15px; margin-bottom: 0; }
section ul { margin-top: 10px; gap: 6px; font-size: 15px; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--fill); color: var(--muted);
  font-size: 12px; font-weight: 500; line-height: 20px;
}
.badge.on { background: var(--ok-fill); color: var(--ok); }
.badge.off { background: var(--danger-fill); color: var(--danger); }
.badge.warn { background: var(--warn-fill); color: var(--warn); }
label { display: block; margin: 18px 0 6px; font-size: 14px; font-weight: 500; }
label small { margin-left: 6px; color: var(--muted); font-size: 13px; font-weight: 400; }
strong { font-weight: 600; }
input, textarea, select {
  display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 15px;
}
input[type="file"] { padding: 8px 0; border: 0; background: none; font-size: 14px; }
input:disabled { background: var(--fill); color: var(--muted); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 96px; resize: vertical; }
.copy textarea { font-family: inherit; font-size: 15px; }
.copy textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
textarea, code, time { font-family: var(--mono); font-size: 13px; }
time { white-space: nowrap; }
code { padding: 2px 6px; border-radius: 5px; background: var(--fill); overflow-wrap: anywhere; }
.caption { margin: 18px 0 0; color: var(--ink); font-size: 14px; font-weight: 500; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 20px; }
.row .button { width: auto; min-height: 40px; padding: 8px 18px; }
.row a { font-size: 15px; }
main:not(.wide) .row .button { width: 100%; }
.alert, .notice { margin: 0 0 20px; padding: 12px 14px; border-radius: 8px; border-left: 3px solid; font-size: 15px; text-align: left; }
.alert { background: var(--danger-fill); border-color: var(--danger); color: var(--danger); }
.notice { background: var(--fill); border-color: var(--action); color: var(--ink); }
.notice code { background: var(--surface); }
.alert a { color: inherit; font-weight: 500; }
.app { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.app form .button { width: auto; min-height: 0; padding: 6px 12px; }
.button.danger, .app form .button { color: var(--danger); }
.button.danger:hover, .app form .button:hover { background: var(--danger-fill); border-color: var(--danger); }
.button.small { width: auto; min-height: 0; padding: 6px 12px; font-size: 14px; }
form.fields { text-align: left; }
form.fields label:first-child { margin-top: 0; }
form.fields > .button { margin-top: 24px; }
/* Several providers share one row of logo buttons; the label stays for screen readers. */
.providers { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.providers .button { padding: 10px; }
.providers .button svg { position: static; width: 22px; height: 22px; }
.providers .button span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--hairline); }
.cf-turnstile { margin-top: 18px; min-height: 65px; }

/* Dashboard: a working tool, left-aligned under a top bar. */
body.wide { place-items: start center; padding: 0 16px 64px; }
main.wide { width: 100%; min-width: 0; max-width: 1080px; text-align: left; }
main.wide:not(.data) > :not(.bar, nav, h1) { max-width: 720px; }
main.wide p { margin-bottom: 20px; }
main.wide section p:last-child { margin-bottom: 0; }
main.wide h1 { margin: 28px 0 20px; }
main.wide > .mark:first-child { margin-top: 48px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; text-decoration: none; }
.brand .mark { width: 28px; height: 28px; margin: 0; border-radius: 7px; font-size: 14px; }
nav { display: flex; flex-wrap: wrap; gap: 0 22px; border-bottom: 1px solid var(--hairline); }
nav a { padding: 10px 0 9px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: 15px; text-decoration: none; }
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { border-bottom-color: var(--action); color: var(--ink); font-weight: 500; }
main.wide h1 + nav { margin: -8px 0 20px; }
.actions form { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { display: inline; width: auto; accent-color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Search and filters on one line above a list. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 16px; }
.toolbar input, .toolbar select { width: auto; height: 40px; padding: 0 12px; font-size: 14px; }
.toolbar .button { width: auto; min-height: 40px; padding: 0 18px; font-size: 14px; }
.toolbar > a { font-size: 14px; }
.search-field { position: relative; flex: 1 1 260px; max-width: 380px; }
.search-field input { width: 100%; padding-left: 36px; }
.search-field svg { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; margin-top: -8px; color: var(--muted); pointer-events: none; }
.toolbar .date { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 400; }
th a.sort { display: inline-flex; gap: 4px; color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--ink); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 14px 0 0; font-size: 15px; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dd time { white-space: normal; }
.table { overflow-x: auto; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); }
section .table { margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--hairline); }
th { background: var(--fill); color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--canvas); }
td .badge + .badge { margin-left: 4px; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
td.wrap { min-width: 200px; white-space: normal; overflow-wrap: anywhere; color: var(--muted); }
td form { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat { padding: 16px 18px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 6px; font-family: var(--mono); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 20px; }
.split > div { flex: 999 1 560px; min-width: 0; }
.split > aside { flex: 1 1 280px; min-width: 0; }
.health { margin: 8px 0 0; gap: 0; }
.health li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.health li span { flex: 1 1 220px; }
.health li span small { color: var(--muted); font-size: 15px; }
.health li svg { flex: none; width: 20px; height: 20px; }
.health .ok { color: var(--ok); }
.health .todo { color: var(--warn); }
.health button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--action); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.split .stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.step h2 { margin-bottom: 6px; }
.step-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--hairline); color: var(--muted); font-size: 14px; font-weight: 650;
}
.step.current .step-num { border-color: var(--action); background: var(--action); color: var(--on-action); }
.step form.fields { max-width: 440px; }
.step form.fields + p { margin-top: 24px; }
.step .notice:last-child { margin: 16px 0 0; }
.notice.warn { background: var(--warn-fill); border-color: var(--warn); }
.profile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.profile > div:first-child { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile .mark.avatar { flex: none; width: 56px; height: 56px; margin: 0; font-size: 22px; }
.profile h1 { margin: 0; }
.profile p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 15px; }
.profile .row { margin-top: 0; }
.crumb { margin: 22px 0 0; font-size: 14px; }
main.wide .crumb + .profile h1 { margin: 0; }
section.danger { border-color: var(--danger-line); }
section.danger h2 { color: var(--danger); }
.action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 14px 0; border-top: 1px solid var(--hairline); }
.action:first-of-type { margin-top: 14px; }
.action > div { flex: 1 1 260px; }
.action strong { font-weight: 500; }
.action p { margin: 2px 0 0; font-size: 14px; }
.action .check { margin: 8px 0 0; font-size: 14px; }
.action .button { width: auto; min-height: 40px; padding: 8px 16px; }
.action fieldset { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; border: 0; min-width: 0; }
.action legend { padding: 0; font-weight: 500; }
.action fieldset .check input { accent-color: var(--action); }
.foot { margin: 24px 0 0; font-size: 15px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.legal { margin-top: 32px; font-size: 13px; }
.legal a { color: var(--muted); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 18px 0 6px; }
.label-row label { margin: 0; }
.label-row a { font-size: 14px; text-decoration: none; }
/* Settings: one row per provider, opened to edit. */
.settings { margin: 0 0 32px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); overflow: hidden; }
.setting + .setting { border-top: 1px solid var(--hairline); }
.setting summary {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; list-style: none;
  font-weight: 500;
}
.setting summary::-webkit-details-marker { display: none; }
.setting summary:hover { background: var(--canvas); }
.setting summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.setting summary svg { flex: none; width: 22px; height: 22px; }
.setting summary span:first-of-type { flex: 1; }
.setting summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 4px 4px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform 120ms ease;
}
.setting[open] summary::after { margin-bottom: -4px; transform: rotate(-135deg); }
.setting[open] summary { border-bottom: 1px solid var(--hairline); }
.setting-body { padding: 20px 20px 24px; }
.setting-body > p { margin: 0; font-size: 15px; }
.callback { padding: 14px 16px; border-radius: 8px; background: var(--fill); }
.callback .caption { margin: 0; }
.copy-field { display: flex; gap: 6px; margin-top: 6px; }
.copy-field code { display: block; flex: 1; min-width: 0; padding: 10px 12px; background: var(--surface); -webkit-user-select: all; user-select: all; }
.copy-field .copy-button { width: 38px; height: auto; }
main.wide > .callback { margin: 0 0 20px; }
.picker-layout { display: grid; grid-template-columns: 260px minmax(0, 720px); gap: 24px; align-items: start; }
.picker-layout aside h2 { margin: 24px 0 6px 12px; color: var(--muted); font-size: 13px; font-weight: 500; }
.picker { gap: 2px; }
.picker a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none;
}
.picker a:hover { background: var(--fill); }
.picker a[aria-current="page"] { font-weight: 500; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.picker svg { flex: none; width: 20px; height: 20px; }
.picker span:first-of-type { flex: 1; }
.picker-layout section { margin: 0; }
.editor-head { display: flex; align-items: center; gap: 12px; margin: -4px 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.editor-head svg { flex: none; width: 28px; height: 28px; }
.editor-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; }
.switch {
  position: relative; flex: none; width: 44px; height: 24px; padding: 0; border: 0; border-radius: 12px;
  background: var(--muted); cursor: pointer; transition: background-color 120ms ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); transition: transform 120ms ease;
}
.switch[aria-checked="true"] { background: var(--action); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
dialog {
  width: min(460px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--hairline); border-radius: 12px;
  background: var(--surface); color: var(--ink); text-align: left;
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.confirm { display: flex; align-items: center; gap: 6px; margin: 18px 0 6px; }
.confirm label { margin: 0; }
.confirm code { font-size: 14px; }
.id-list { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.id-row { display: flex; align-items: center; gap: 8px; }
.id-row > svg { flex: none; width: 20px; height: 20px; }
.id-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; }
.id-row .copy-button { flex: none; width: 38px; height: 38px; }
.id-add { display: flex; flex-wrap: wrap; gap: 8px; }
.id-add .button { gap: 8px; }
.id-add .button svg { position: static; width: 16px; height: 16px; }
.copy-button {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--hairline);
  border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer;
}
.copy-button:hover { background: var(--fill); color: var(--ink); }
.copy-button svg { width: 16px; height: 16px; }
.copy-button .done, .copy-button.copied .idle { display: none; }
.copy-button.copied .done { display: block; color: var(--ok); }
/* Set by the admin script from the click until the next page arrives. */
body.loading::before {
  content: ""; position: fixed; top: 0; left: 0; z-index: 10; width: 100%; height: 3px; background: var(--action);
  transform-origin: left; animation: loading-bar 10s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}
main.wide { position: relative; }
body.loading main.wide > :not(.bar, nav) { animation: loading-hide 0s 120ms forwards; }
body.loading main.wide::after {
  content: ""; position: absolute; top: 180px; left: 50%; width: 28px; height: 28px; margin-left: -14px;
  border: 2.5px solid var(--hairline); border-top-color: var(--action); border-radius: 50%; visibility: hidden;
  animation: loading-spin 0.7s linear infinite, loading-show 0s 120ms forwards;
}
@keyframes loading-bar { from { transform: scaleX(0); } to { transform: scaleX(0.9); } }
@keyframes loading-hide { to { visibility: hidden; } }
@keyframes loading-show { to { visibility: visible; } }
@keyframes loading-spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 10px;
  max-width: min(420px, calc(100% - 32px)); padding: 10px 8px 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--canvas); font-size: 15px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
  animation: toast-in 160ms ease-out;
}
/* Success fades on its own; an error stays until dismissed. */
.toast.ok { animation: toast-in 160ms ease-out, toast-out 200ms ease-in 4s forwards; }
.toast.error { background: var(--danger); color: var(--on-action); }
.toast-close {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.toast-close:hover { background: rgb(127 127 127 / 0.25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
dialog h2 { margin-bottom: 8px; }
dialog p { margin: 0; font-size: 15px; }
@media (max-width: 760px) {
  .picker-layout { grid-template-columns: minmax(0, 1fr); }
  .toast { left: 16px; max-width: none; }
}
@media (max-width: 480px) {
  main:not(.wide) { padding: 32px 20px; }
  body:not(.wide) { padding: 24px 12px; }
}
@media (prefers-reduced-motion: reduce) { .button, .setting summary::after, .switch, .switch::after { transition: none; }
  body.loading::before { animation: none; transform: scaleX(0.6); }
  body.loading main.wide::after { animation: loading-show 0s 120ms forwards; }
  .toast { animation: none; }
  .toast.ok { animation: toast-out 0s 4s forwards; }
}
