/* VanishPoint — one stylesheet for every member-facing page (Task 18).
   The Kin re-skin: soft paper, warm charcoal dark mode, rounded shapes,
   terracotta accent, big tap targets. Zero external fetches (the CSP's
   default-src 'self' allows only this same-origin sheet) and zero scripts.

   Themes, in priority order (no JavaScript anywhere):
   1. an explicit choice — the theme cookie rendered as <html data-theme=…>
      (POST /theme, the nav's form toggle, sets it);
   2. no cookie — the prefers-color-scheme media query follows the OS. */

:root {
  --bg: #fbf6ef;
  --ink: #3a3230;
  --muted: #7b6f66;
  --line: #eadfd2;
  --card: #fffdf9;
  --chip: #f4ead9;
  --accent: #c2571b;
  --accent-ink: #ffffff;
  --ok: #4a7c46;
  --warn: #8a6a1f;
  --bad: #b04030;
  --radius: 18px;
  --radius-small: 12px;
}

/* Dark = a warm charcoal (not a tech black). Explicit cookie choice wins
   over the OS setting: data-theme=light keeps light even on a dark OS. */
[data-theme="dark"] {
  --bg: #221d19;
  --ink: #f0e7dd;
  --muted: #a2938a;
  --line: #3a3129;
  --card: #2b2521;
  --chip: #382f28;
  --accent: #e0854d;
  --accent-ink: #221109;
  --ok: #7db87a;
  --warn: #c99a58;
  --bad: #e07568;
}

/* First visit (no cookie): follow the OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #221d19;
    --ink: #f0e7dd;
    --muted: #a2938a;
    --line: #3a3129;
    --card: #2b2521;
    --chip: #382f28;
    --accent: #e0854d;
    --accent-ink: #221109;
    --ok: #7db87a;
    --warn: #c99a58;
    --bad: #e07568;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 17px/1.6 'Avenir Next', 'Segoe UI', system-ui, -apple-system,
        'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------ layout chrome (Kin) ----- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.member-name { font-weight: 700; font-size: 1.1rem; }

.site-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link, .site-nav a {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.nav-link:hover, .site-nav a:hover { background: var(--chip); }

.site-main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 3rem;
}

h1 { font-size: 1.85rem; font-weight: 700; margin: 0.4rem 0 0.4rem; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 1.6rem 0 0.6rem; }

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
a:hover { text-decoration-color: var(--accent); }

/* the counters: the same <li> counts, now the Kin grid of rounded tiles */
.counts {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}

.counts li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.4rem 0.65rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.counts span {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.1rem;
}

#count-needs-you { color: var(--accent); }

/* the status banner: the Kin hello/status card (two-line copy) */
.banner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0.8rem 0 1.2rem;
}

.banner-big {
  font-size: 1.06rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}

.banner-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.banner-state { font-weight: 700; display: inline-block; }

.banner-working { color: var(--warn); }
.banner-submitted { color: var(--ok); }
.banner-queued { color: var(--warn); }
.banner-idle { color: var(--ok); }

.todo-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  margin: 0.9rem 0;
}

.todo-title { margin: 0 0 0.3rem; font-size: 1.15rem; font-weight: 700; }
.todo-why { margin: 0.2rem 0 0.6rem; color: var(--muted); }
.todo-fields { font-weight: 600; }

.todo-steps { margin: 0.4rem 0 0.8rem; padding-left: 1.3rem; }

.todo-links { list-style: none; padding: 0; margin: 0.4rem 0; }
.todo-links li { margin: 0.3rem 0; }

.todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

/* buttons: Kin pills; the chip-coloured default, the accent primary */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { filter: brightness(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-link {
  background: transparent;
  color: var(--accent);
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.btn-small { min-height: 44px; padding: 0.42rem 1rem; font-size: 0.94rem; }

.inline-form { display: inline; margin: 0; }

/* Run now: the mock's full-width primary */
.run-now { margin: 1.4rem 0; width: 100%; }
.run-now button#run-now {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.run-times, .page-intro, .page-note { color: var(--muted); }

/* the theme toggle: the mock's toolbar pill, as a form (no scripts) */
.theme-form { display: inline-flex; margin: 0; }

.theme-form select.button-pill {
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--chip);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  overflow-wrap: anywhere;
}

.draft-letter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1rem 0;
}

.draft-letter h2 { margin-top: 0.8rem; font-size: 1rem; }

.draft-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--chip);
  color: var(--ink);
  padding: 0.9rem;
  border-radius: var(--radius-small);
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.activity-table th, .activity-table td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.activity-table thead th {
  background: var(--chip);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.state-confirmed_removed td { color: var(--ok); font-weight: 600; }
.state-human_task_queued td, .state-blocked td { color: var(--bad); }

.error {
  background: #f9e7e3;
  border: 1px solid #eec3bb;
  color: var(--bad);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

[data-theme="dark"] .error,
:root:not([data-theme="light"]) .error {
  background: #3a2622;
  border-color: #54312a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .error {
    background: #3a2622;
    border-color: #54312a;
  }
}

.reference { color: var(--muted); }

.signup-form label, .picker-form label, .consent-label {
  display: block;
  margin: 0.8rem 0 0.2rem;
  font-weight: 600;
}

.signup-form input:not([type="checkbox"]), .signup-form textarea,
.signup-form select, .picker-form select,
.settings-form input, .settings-form textarea, .settings-form select {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--ink);
}

.signup-form .consent-label input { width: 1.45rem; height: 1.45rem; }
.signup-form .consent-label { font-weight: 400; }
.form-hint { color: var(--muted); font-size: 0.9rem; }

.signup-form button, .picker-form button, .settings-form button {
  margin-top: 1rem;
}

.existing-people, .todo-list { list-style: none; padding: 0; }
.existing-people li { margin: 0.45rem 0; }
.todo-none { color: var(--muted); }

.letter-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--chip);
  color: var(--ink);
  padding: 0.9rem;
  border-radius: var(--radius-small);
}

.consent-note, .consent-letter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.scan-items { list-style: none; padding: 0; }
.verdict { margin-top: 0.6rem; }
.verdict textarea { margin-top: 0.4rem; }

.site-footer {
  max-width: 46rem;
  margin: 1rem auto;
  padding: 0 1.2rem 2.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* narrow phones: the counter grid collapses before tiles get cramped */
@media (max-width: 560px) {
  .counts { grid-template-columns: repeat(2, 1fr); }
}