/* Sane defaults, nothing more.
   P14a has no design system on purpose: the real one arrives with the marketing
   site (P14d) and the dashboard (P14c), and a placeholder that looks finished is
   the kind of thing that ships. */

:root {
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e4e6eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #16181d;
  --danger: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9eaee;
    --muted: #9aa1ad;
    --line: #2a2e37;
    --bg: #101216;
    --card: #171a20;
    --accent: #e9eaee;
    --danger: #f97066;
  }
}

* { box-sizing: border-box; }

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

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

.wordmark {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.who { display: flex; align-items: center; gap: 0.75rem; }
.who form { margin: 0; }
.email { color: var(--muted); font-size: 0.875rem; }

main { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
}
.card.narrow { max-width: 26rem; margin: 2rem auto; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

h1 { font-size: 1.35rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
.card-head h1 { margin: 0; }

p { margin: 0 0 0.85rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.meta { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--danger); font-size: 0.9rem; }

a { color: inherit; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
}

input[type="email"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

button {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 550;
  color: var(--card);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}
.card-head button { margin-top: 0; }
button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* The sign-out control is a form button that should read as a link. */
button.link {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: underline;
}

.empty {
  margin-top: 1.25rem;
  padding: 1.75rem 1.25rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.empty p:last-child { margin-bottom: 0; }

.projects { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.projects li + li { margin-top: 0.5rem; }
.projects a {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}
.projects a:hover { border-color: var(--muted); }
.projects .name { display: block; font-weight: 550; }
.projects .meta { display: block; }

/* ---------------------------------------------------------------------------
   P14b: the setup wizard and the keys page.
   Same posture as the rest of this file — enough structure to read clearly,
   no design system. That still arrives with P14c/P14d.
   --------------------------------------------------------------------------- */

h2 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }

/* A link that has to read as a button (the "Add an app" control, "Next"). */
a.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  font-weight: 550;
  color: var(--card);
  background: var(--accent);
  border-radius: 7px;
  text-decoration: none;
}
.card-head a.button { margin-top: 0; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.steps .n {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.75rem;
}
.steps li.now { color: var(--ink); font-weight: 550; }
.steps li.now .n { border-color: var(--ink); }
.steps li.done .n { border-color: var(--muted); }

input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

fieldset.checks {
  margin: 1.25rem 0 0;
  padding: 0.75rem 1rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
fieldset.checks legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.35rem; }
label.check { display: inline-block; margin: 0 1rem 0.5rem 0; color: var(--ink); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.code {
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.code-head .muted { font-size: 0.8rem; }
.code pre {
  margin: 0;
  padding: 0.85rem 0.9rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre;
}

.banner {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 6px;
  background: var(--bg);
}
.banner.ok { border-left-color: #12805c; }
.banner p { margin: 0; }

.checklist { margin: 0.5rem 0 1.25rem; padding-left: 1.25rem; }
.checklist li { margin-bottom: 0.6rem; }

.members { margin: 0.25rem 0 1rem; padding-left: 1.25rem; font-size: 0.9rem; }

table.keys {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.keys th {
  text-align: left;
  font-weight: 550;
  color: var(--muted);
  font-size: 0.78rem;
}
table.keys th, table.keys td {
  padding: 0.5rem 0.6rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.keys tr.dead { color: var(--muted); }
table.keys form { margin: 0; }
button.link.danger { color: var(--danger); }

.mint { display: grid; gap: 1.25rem; }
@media (min-width: 40rem) { .mint { grid-template-columns: 1fr 1fr; } }
.mint form {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.mint label { margin-top: 0; }

/* ---------------------------------------------------------------------------
   P14c — the dashboard.

   `main` is widened here because the dashboard is the one page with tables that
   have somewhere to go; the reading-width column still applies to everything
   else. Two accent colours are introduced for the chart's two series and they
   are the only decorative colours in this stylesheet — both are set as custom
   properties so the SVG and the legend swatches cannot drift apart.
   --------------------------------------------------------------------------- */

:root {
  --opens: #2f6fed;
  --sessions: #12805c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --opens: #6b9bff;
    --sessions: #3ec99a;
  }
}

body:has(.tiles) main { max-width: 58rem; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 0.25rem;
}
.range { display: flex; gap: 0.4rem; }
.toggle p { margin: 0.35rem 0 0; }

.chip {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--card);
}
.chip:hover { border-color: var(--muted); }
.chip.on { color: var(--card); background: var(--accent); border-color: var(--accent); }

.tiles {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin: 1.25rem 0;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tile-label { color: var(--muted); font-size: 0.8rem; }
.tile-value { font-size: 1.7rem; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.tile-note { font-size: 0.75rem; }
.delta { font-size: 0.78rem; color: var(--muted); }
.delta.up { color: var(--sessions); }
.delta.down { color: var(--danger); }
.delta .muted { font-size: 0.78rem; }

.chart { margin: 0.5rem 0 1.5rem; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.opens { stroke: var(--opens); fill: var(--opens); }
.chart .line.sessions { stroke: var(--sessions); fill: var(--sessions); }
.legend { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.legend .swatch { display: inline-block; width: 0.7rem; height: 0.2rem; border-radius: 2px; }
.legend .swatch.opens { background: var(--opens); margin-left: 0.6rem; }
.legend .swatch.sessions { background: var(--sessions); }
.legend .swatch:first-child { margin-left: 0; }

table.data {
  width: 100%;
  margin: 0.5rem 0 1.25rem;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data th {
  text-align: left;
  font-weight: 550;
  color: var(--muted);
  font-size: 0.78rem;
}
table.data th, table.data td {
  padding: 0.45rem 0.6rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.on { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.env { display: grid; gap: 0 1.5rem; }
@media (min-width: 44rem) { .env { grid-template-columns: 1fr 1fr; } }
.env h3 { font-size: 0.9rem; margin: 0.75rem 0 0; }

.settings { max-width: 30rem; }
.checks { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; }
.checks legend { color: var(--muted); font-size: 0.8rem; padding: 0 0.4rem; }
.check { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; }
.check input { width: auto; margin: 0; }
