/*
 * The design tokens: colour, type, radius, shadow. Nothing else lives here.
 *
 * ONE file, read by two things: the admin SPA, and the signed-out pages the
 * identity host renders on auth. (S9 decisions, 2026-09-26). Ascripto.Identity
 * embeds this exact file at build time rather than keeping a copy, so the
 * sign-in page and the app cannot drift into two slightly different products.
 *
 * Carried over from poc/12-signature-editor, where the palette was tried in both
 * themes and both editors.
 *
 * Theme (ux-plan, Cross-cutting): auto / light / dark. Dark is defined twice --
 * under prefers-color-scheme for "auto", and under [data-theme="dark"] for an
 * explicit choice -- so the toggle wins in both directions.
 *
 * Editor identity (U22): [data-mode="html"] retunes the chrome for the HTML
 * editor. The signature canvas reads --paper* only, which no theme and no mode
 * ever redefines (U11: the recipient's inbox is not themed by us).
 */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --ink: #16181d;
  --ink-2: #4a5061;
  --ink-3: #767d90;
  --line: #e3e6ec;
  --line-2: #eef0f4;
  /* The logo's green (#00a651, the dark themes' accent), darkened here to hold 4.5:1 on white. */
  --accent: #007a3c;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4ec;
  /* Success is a grass green, kept apart from the accent's emerald and the HTML editor's teal. */
  --ok: #3a6e0c;
  --ok-soft: #f0f6e2;
  --warn: #9a6206;
  --warn-soft: #fdf3e0;
  /* Who is imported: the box of what lets in, and of what leaves out. */
  --group-in-bg: #f2f7e9;
  --group-in-line: #c6daa9;
  --group-out-bg: #fdf5e6;
  --group-out-line: #ebd09f;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  /* Status dots: the text colours above are equally dark, and merge on a dimmed
     screen; these differ in lightness as well as hue, ringed to hold on white. */
  --dot-ok: #5abd28;
  --dot-warn: #f0a020;
  --dot-bad: #c62828;
  --dot-ring: rgb(0 0 0 / 0.22);
  /* Behind a provider's logo on its button, in either theme: the brands' colours are set on white. */
  --logo-tile: #ffffff;
  --chip: #e3f3e9;
  --chip-ink: #17482b;
  --chip-line: #b5d9c2;
  --shadow: 0 1px 2px rgba(16, 20, 30, .06), 0 8px 24px rgba(16, 20, 30, .08);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* The canvas is always paper (U11). Never redefined below. */
  --paper: #ffffff;
  --paper-ink: #1a1a1a;
  --paper-line: #e0e0e0;

  /* Source views (CodeMirror): CodeMirror's own light colours, so light is unchanged. */
  --code-keyword: #770088;
  --code-atom: #221199;
  --code-literal: #116644;
  --code-string: #aa1111;
  --code-special: #ee4400;
  --code-variable: #0000ff;
  --code-local: #3300aa;
  --code-tag: #008855;
  --code-class: #116677;
  --code-macro: #225566;
  --code-property: #0000cc;
  --code-comment: #994400;
  --code-meta: #404740;
  --code-invalid: #ff0000;
  --code-selection: #d7d4f0;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1b1f27;
    --ink: #e8eaf0;
    --ink-2: #a8aec0;
    --ink-3: #7b8296;
    --line: #282d38;
    --line-2: #20242d;
    --accent: #00a651;
    --accent-ink: #0f1115;
    --accent-soft: #15261d;
    --ok: #8cd369;
    --ok-soft: #1b2914;
    --warn: #e5b567;
    --warn-soft: #2a2113;
    --group-in-bg: var(--panel-2);
    --group-in-line: var(--line-2);
    --group-out-bg: var(--panel-2);
    --group-out-line: var(--line-2);
    --bad: #f2867d;
    --bad-soft: #2c1715;
    --dot-ok: #8cd369;
    --dot-warn: #e5b567;
    --dot-bad: #f2867d;
    --dot-ring: transparent;
    --chip: #1a2e22;
    --chip-ink: #b3e6c6;
    --chip-line: #2f5a40;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --code-keyword: #c7a2ec;
    --code-atom: #86aef0;
    --code-literal: #9ccf98;
    --code-string: #e2aa86;
    --code-special: #e9b872;
    --code-variable: #93b8f5;
    --code-local: #b7a6f0;
    --code-tag: #73c6bb;
    --code-class: #7fc4cc;
    --code-macro: #8fbfd2;
    --code-property: #93b8f5;
    --code-comment: #8f9a86;
    --code-meta: #a3aca6;
    --code-invalid: #f2867d;
    --code-selection: #2b4552;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1b1f27;
  --ink: #e8eaf0;
  --ink-2: #a8aec0;
  --ink-3: #7b8296;
  --line: #282d38;
  --line-2: #20242d;
  --accent: #00a651;
  --accent-ink: #0f1115;
  --accent-soft: #15261d;
  --ok: #8cd369;
  --ok-soft: #1b2914;
  --warn: #e5b567;
  --warn-soft: #2a2113;
  --group-in-bg: var(--panel-2);
  --group-in-line: var(--line-2);
  --group-out-bg: var(--panel-2);
  --group-out-line: var(--line-2);
  --bad: #f2867d;
  --bad-soft: #2c1715;
  --dot-ok: #8cd369;
  --dot-warn: #e5b567;
  --dot-bad: #f2867d;
  --dot-ring: transparent;
  --chip: #1a2e22;
  --chip-ink: #b3e6c6;
  --chip-line: #2f5a40;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --code-keyword: #c7a2ec;
  --code-atom: #86aef0;
  --code-literal: #9ccf98;
  --code-string: #e2aa86;
  --code-special: #e9b872;
  --code-variable: #93b8f5;
  --code-local: #b7a6f0;
  --code-tag: #73c6bb;
  --code-class: #7fc4cc;
  --code-macro: #8fbfd2;
  --code-property: #93b8f5;
  --code-comment: #8f9a86;
  --code-meta: #a3aca6;
  --code-invalid: #f2867d;
  --code-selection: #2b4552;
}

/* U22: the HTML editor's chrome. Cooler, and its own accent. */
:root[data-mode="html"] {
  --accent: #0b6e79;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1f3;
  --chip: #d9edf1;
  --chip-ink: #0a4f57;
  --chip-line: #8cc6cf;
  --bg: #eceff2;
  --panel: #f8fafb;
  --panel-2: #eef2f4;
  --line: #d5dde2;
  --line-2: #e6ecef;
}

@media (prefers-color-scheme: dark) {
  :root[data-mode="html"]:not([data-theme="light"]) {
    --accent: #4fc3cf;
    --accent-ink: #08161a;
    --accent-soft: #123037;
    --chip: #14323a;
    --chip-ink: #8fdbe4;
    --chip-line: #2c5a64;
    --bg: #0c1417;
    --panel: #121e22;
    --panel-2: #16242a;
    --line: #22383f;
    --line-2: #1a2c32;
  }
}

:root[data-theme="dark"][data-mode="html"] {
  --accent: #4fc3cf;
  --accent-ink: #08161a;
  --accent-soft: #123037;
  --chip: #14323a;
  --chip-ink: #8fdbe4;
  --chip-line: #2c5a64;
  --bg: #0c1417;
  --panel: #121e22;
  --panel-2: #16242a;
  --line: #22383f;
  --line-2: #1a2c32;
}

/*
 * The signed-out pages on auth. (ux-plan screen 9). Served after tokens.css,
 * which supplies every colour; nothing here names one.
 *
 * Small on purpose: five screens, one card, no script.
 */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 48px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--ui);
}

main {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.brand { margin: 0 0 20px; color: var(--ink); }
.brand svg { display: block; height: 16px; width: auto; }

h1 { font-size: 22px; line-height: 1.25; margin: 0 0 20px; font-weight: 600; overflow-wrap: break-word; }

p { margin: 0 0 16px; color: var(--ink-2); }

form { margin: 0; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; }

input[type="email"], input[type="password"], input[type="text"] {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin: 0 0 16px;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus-visible, .button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input.code { font-family: var(--mono); font-size: 20px; letter-spacing: .12em; text-align: center; }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  margin: 0 0 12px;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.button:hover { background: var(--panel-2); }

/* The provider buttons are the screen (U20). Primary is the filled one. */
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.05); }

/* The password path: present, unhidden, unpromoted. */
.button.quiet { width: auto; margin: 0 0 0 auto; white-space: nowrap; }

/* A form's default for Enter, ahead of a provider button; rendered, so every browser uses it. */
.default-button { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* The Terms box, its text beside it. */
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0 0 16px; }
.check input { margin: 3px 0 0; flex: none; }

.logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; background: var(--logo-tile); flex: none; }

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--ink-3);
  font-size: 13px;
}
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 4px 0 0; }
.row a { white-space: nowrap; font-size: 14px; }

.error {
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
  font-size: 14px;
}

.note {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
  font-size: 14px;
}

.links { margin: 20px 0 0; font-size: 14px; }
.links a, a { color: var(--accent); }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.link-button:disabled { color: var(--ink-3); cursor: default; text-decoration: none; }

.muted { color: var(--ink-3); font-size: 13px; }

/* The language switcher under the card's content (ideas/i18n.md L6). */
.languages { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 24px 0 0; font-size: 13px; color: var(--ink-3); }
.languages a { color: var(--ink-3); }
.languages [aria-current] { color: var(--ink); font-weight: 500; }

/* Staff (S10b slice 1a): the authenticator key, recovery codes and passkeys. */
.key { display: inline-block; user-select: all; font-family: var(--mono); font-size: 15px; letter-spacing: 0.08em; padding: 6px 10px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.codes { columns: 2; padding: 0; list-style: none; font-family: var(--mono); }
.codes li { margin: 4px 0; }
.passkeys { list-style: none; padding: 0; margin: 0 0 16px; }
.passkeys li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.links.spaced { margin: 8px 0 20px; }

/* Set it up for me's result (S14 slice 3b): each step with its mark. */
.steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps .mark { width: 1.2em; flex: none; text-align: center; font-weight: 700; }
.steps .ok .mark { color: var(--ok); }
.steps .bad .mark { color: var(--bad); }
.steps .off { color: var(--ink-3); }

