/*
 * The whole stylesheet. CSP is `style-src 'self'`, so there are no inline <style> blocks and
 * no style="" attributes anywhere in this project — if something needs to change appearance,
 * it toggles a class or the `hidden` attribute.
 */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --panel: #ffffff;
  --ink: #17181c;
  --muted: #5c6270;
  --line: #dfe1e6;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --warn-bg: #fff5e0;
  --warn-line: #e8c268;
  --warn-ink: #6b4a00;
  --bad-bg: #fdeceb;
  --bad-line: #e6a49e;
  --bad-ink: #8a1c12;
  --ok-bg: #e9f6ec;
  --ok-line: #9dcfa9;
  --ok-ink: #17572a;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f25;
    --ink: #e9eaee;
    --muted: #a0a7b4;
    --line: #2e333c;
    --accent: #6fa8ff;
    --accent-ink: #0d1117;
    --warn-bg: #3a2f10;
    --warn-line: #7a6420;
    --warn-ink: #f4dfa4;
    --bad-bg: #3b1c19;
    --bad-line: #7d3b33;
    --bad-ink: #f6c3bc;
    --ok-bg: #17301d;
    --ok-line: #34613f;
    --ok-ink: #b6e2c1;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main, header { max-width: 46rem; margin: 0 auto; }
header { padding: 2rem 0 1rem; }
header p { color: var(--muted); margin: 0.25rem 0 0; }

h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }

a { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.field { margin: 0 0 1rem; }
.field > label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0.3rem 0 0; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"], textarea, select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
textarea { min-height: 9rem; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 12rem; }
.inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

button {
  font: inherit;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

/* A copy control belongs to the box above it, not beside it at full size. Compact keeps it
   from dominating the panel; .copy-row is the breathing space that stops it looking welded
   to the field it copies. */
button.compact { padding: 0.3rem 0.65rem; font-size: 0.85rem; border-radius: 5px; }
.copy-row { margin-top: 0.65rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tabs button[aria-selected="true"] { border-color: var(--accent); font-weight: 600; }

.note, .warn, .bad, .ok {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.note { background: var(--panel); color: var(--muted); }
.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.note p:last-child, .warn p:last-child, .bad p:last-child, .ok p:last-child { margin-bottom: 0; }
.note p:first-child, .warn p:first-child, .bad p:first-child, .ok p:first-child { margin-top: 0; }

.mono, code, .secret-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  word-break: break-all;
}
.secret-link {
  display: block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  margin: 0.5rem 0 0;
}

pre.secret-text {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28rem;
  overflow: auto;
}

progress { width: 100%; height: 0.75rem; }

canvas.qr { max-width: 100%; height: auto; image-rendering: pixelated; background: #fff; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.spinner { color: var(--muted); font-size: 0.9rem; }

/* The one place the page shouts: a verification that has actually completed. */
.big-mark { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.4rem; }

footer { max-width: 46rem; margin: 2rem auto 0; color: var(--muted); font-size: 0.85rem; }
/* The app names itself here rather than in every <h1>: two of the three headings say what the
   page is for, which is more useful to the reader than a brand. APP_NAME is injected by the
   Worker into [data-app-name] (src/index.ts `brand`). */
.brand { color: var(--ink); font-weight: 600; margin: 0 0 0.35rem; }
