/* Recheq: the one hand-written stylesheet (PLAN 3.2, 6, 6.1).
   Quiet neutral palette, ONE accent (ReadyStreet "Royal Midnight", lightened for dark mode),
   system font, generous whitespace. No inline styles anywhere (strict CSP: style-src 'self'). */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --fg: #1c2330;
  --muted: #5b6472;
  --line: #e1e5eb;
  --accent: #0b3d66;
  --accent-fg: #ffffff;
  --accent-soft: #e8eff6;
  --ok: #1d6b3a;
  --ok-soft: #e7f4ec;
  --bad: #a3261b;
  --bad-soft: #fbeceb;
  --focus: #2f7bd8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2028;
    --fg: #e6e9ee;
    --muted: #a0a9b6;
    --line: #2c343f;
    --accent: #8ab8e6;
    --accent-fg: #0d1a27;
    --accent-soft: #1d2a38;
    --ok: #7fd19b;
    --ok-soft: #173024;
    --bad: #f19a90;
    --bad-soft: #3a1f1d;
    --focus: #8ab8e6;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* ── header / footer ─────────────────────────────────────────────────────────── */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-in { max-width: 680px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 650; color: var(--fg); text-decoration: none; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 22px; height: 22px; }
.top nav { display: flex; gap: 16px; align-items: center; font-size: .95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--fg); }
.foot { max-width: 680px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: .875rem; }
.foot a { color: var(--muted); }

/* ── layout ──────────────────────────────────────────────────────────────────── */
.page { max-width: 680px; margin: 0 auto; padding: 32px 16px 16px; }
.page.narrow { max-width: 560px; }
h1 { font-size: 1.65rem; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.015em; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p { margin: 0 0 14px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > :last-child { margin-bottom: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.center { text-align: center; }
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 2rem; }

/* ── buttons ─────────────────────────────────────────────────────────────────── */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--fg); font: inherit; font-weight: 550; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--muted); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.primary:hover { filter: brightness(1.1); border-color: var(--accent); }
.danger { color: var(--bad); }
.linkish { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.wide { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.inline { display: inline; margin: 0; }
button[disabled] { opacity: .6; cursor: progress; }

/* ── wizard ──────────────────────────────────────────────────────────────────── */
progress { flex: 1; height: 6px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
ol.steps { margin: 4px 0 16px; padding: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding: 4px 0 10px 40px; min-height: 30px; }
ol.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: .9rem; display: flex; align-items: center; justify-content: center;
}
.choices { display: grid; gap: 10px; margin: 6px 0 4px; border: 0; padding: 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--muted); }
.choice input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice strong { display: block; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 2px; }
details.more > summary { cursor: pointer; color: var(--accent); margin: 8px 0; }
details.more[open] > summary { margin-bottom: 12px; }
progress.meter { display: block; width: 100%; height: 10px; margin: 4px 0 12px; }
ul.terms { padding-left: 20px; margin: 0 0 16px; }
ul.terms li { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .925rem; }

/* ── forms ───────────────────────────────────────────────────────────────────── */
label.field { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=number], textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; min-height: 44px;
}
input.mono, textarea.mono, code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
textarea { resize: vertical; }
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input, .copybox textarea { flex: 1; min-width: 0; }
.copybox.col { flex-direction: column; }
.copybox.col button { align-self: flex-start; }

/* ── messages ────────────────────────────────────────────────────────────────── */
.note { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; background: var(--accent-soft); }
.note.ok { background: var(--ok-soft); color: var(--ok); font-weight: 550; }
.note.bad { background: var(--bad-soft); color: var(--bad); font-weight: 550; }
.status { font-weight: 600; }
.status.ok { color: var(--ok); }
.status.wait { color: var(--muted); font-weight: 500; }
.js-only { display: none; }
.has-js .js-only { display: revert; }
.has-js .no-js { display: none; }

/* ── under-the-step helpers (ask your AI, I'm stuck) ─────────────────────────── */
.helpers { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: flex-start; font-size: .925rem; }
.helpers details { flex: 1 1 100%; }
.helpers summary { cursor: pointer; color: var(--accent); }
.helpers details[open] { padding-bottom: 6px; }
.helpers details[open] summary { margin-bottom: 8px; }
.helpers .stuck button { color: var(--muted); }
.back { font-size: .925rem; color: var(--muted); }

/* ── lists (dashboard, admin) ────────────────────────────────────────────────── */
ul.items { list-style: none; margin: 0; padding: 0; }
ul.items > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
ul.items > li:first-child { border-top: 0; padding-top: 2px; }
ul.items .meta { color: var(--muted); font-size: .875rem; }
.big { font-size: 1.8rem; font-weight: 650; letter-spacing: -.02em; }
table.admin { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.admin th, table.admin td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.admin th { color: var(--muted); font-weight: 600; border-top: 0; }
.scroll { overflow-x: auto; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.prose h2 { margin-top: 24px; }
.prose ul { padding-left: 20px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }

@media (max-width: 520px) {
  .page { padding-top: 22px; }
  h1 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.6rem; }
  .card { padding: 18px 16px; }
  .copybox { flex-direction: column; }
  .copybox button { align-self: flex-start; }
  .actions .primary { width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
}

/* inline "are you sure?" without dialogs (no JS needed) */
details.confirm { position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { border-color: var(--bad); }
details.confirm > form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); white-space: nowrap; }
ul.items .actions { margin-top: 0; }
.spaced { margin-top: 22px; }
.page.wide { max-width: 1000px; }
table.admin td:nth-child(6) { white-space: nowrap; }
