:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1c1d1b;
  --muted: #6a6c66;
  --line: #e3e1da;
  --accent: #255f4a;
  --accent-ink: #ffffff;
  --sel: #e6f1ec;
  --warn: #9a4a12;
  --warn-bg: #fbeee2;
  --bad: #a1261d;
  --chip: #efede6;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513;
    --card: #1d1f1c;
    --ink: #ecebe6;
    --muted: #a3a59d;
    --line: #30332e;
    --accent: #6cc3a0;
    --accent-ink: #0d1a14;
    --sel: #1f3329;
    --warn: #f0a868;
    --warn-bg: #3a2a1a;
    --bad: #ff8a80;
    --chip: #2a2d28;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
main { max-width: 860px; margin: 0 auto; padding: 16px; padding-bottom: 80px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 40px; transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); }
.signin { max-width: 420px; margin: 10vh auto 0; display: grid; gap: 20px; }
.lede { font-size: 18px; margin: 0; }
.magic label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
input, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--bad); }
.genstatus { margin: 0 0 12px; color: var(--muted); font-size: 14px; min-height: 1.5em; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  appearance: none; background: none; border: 0; font: inherit; font-weight: 600; font-size: 15px;
  color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.count { font-weight: 500; color: var(--muted); font-size: 13px; }
.project {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.p-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.p-name { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.p-summary { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.p-links { margin: 8px 0 0; font-size: 14px; }
.p-links:empty { display: none; }
.p-links a { margin-right: 12px; }
a { color: var(--accent); }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.selected, .chip.building { background: var(--sel); color: var(--accent); }
.chip.built { background: var(--accent); color: var(--accent-ink); }
.chip.failed { background: var(--warn-bg); color: var(--warn); }
.ideas { display: grid; gap: 10px; margin-top: 12px; }
.idea { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.idea.is-selected { background: var(--sel); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.i-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.i-title { margin: 0; font-size: 16px; flex: 1 1 200px; }
.kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.i-body { margin: 8px 0 0; display: grid; grid-template-columns: 1fr; gap: 2px; }
.i-body dt { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.i-body dd { margin: 0; font-size: 15px; }
.i-result { margin: 8px 0 0; font-size: 14px; }
.i-result:empty { display: none; }
.i-result.warn { color: var(--warn); }
.i-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.i-notes { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.i-notes li { font-size: 14px; background: var(--chip); border-radius: 8px; padding: 4px 8px; }
.i-notes li time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.note-form { display: flex; gap: 8px; margin-top: 8px; }
.note-form input { font-size: 14px; padding: 6px 10px; }
.p-direction { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.p-direction summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.dir-form { display: grid; gap: 8px; margin-top: 8px; justify-items: start; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
@media (min-width: 640px) {
  .i-body { grid-template-columns: 140px 1fr; column-gap: 12px; }
  .i-body dt { margin-top: 2px; }
}
@media (max-width: 480px) {
  .top { flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
  .top-actions .primary { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
