:root {
  --paper: #f6f5f0;
  --white: #fffefa;
  --ink: #222e28;
  --muted: #657068;
  --line: #d9dcd2;
  --green: #245943;
  --pale: #e9ede3;
  --danger: #a0382b;
  --focus: #a97922;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: normal; }
h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: 28px; margin: 0; }
h3 { font-size: 18px; margin: 0 0 10px; }
h4 { font-size: 18px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--green);
  border-radius: 2px;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--green); color: var(--white); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: 8px;
  top: -40px;
  background: var(--white);
  padding: 8px;
}
.skip:focus { top: 8px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.brand {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--ink);
  text-decoration: none;
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions form { margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 28px 64px; }
.narrow { max-width: 720px; }
.heading, .project-head, .chunk-head, .card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 28px; }
.filters a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
}
.filters a[aria-current="page"] { border-color: var(--ink); background: var(--pale); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card, .sheet, .chunk {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 20px;
}
.chunk { margin: 16px 0; }
.sheet { margin: 16px 0; }
.card h2 { font-size: 28px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card dl { margin: 12px 0 0; }
.card dl div { margin-bottom: 8px; }
.card dt { color: var(--muted); font-size: 13px; }
.card dd { margin: 0; }
.meta, .kicker { color: var(--muted); }
.kicker { letter-spacing: 0.04em; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--white);
  font-family: var(--sans);
  font-size: 13px;
}
.pill.active { border-style: solid; border-color: var(--green); }
.pill.blocked { border-style: dashed; border-color: var(--danger); }
.pill.paused { border-style: dotted; }
.pill.done { background: var(--pale); }
.pill.idea { border-style: double; }
.health { color: var(--ink); }
.badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 8px;
  border: 1px solid var(--danger);
  color: var(--danger);
  background: var(--white);
}
.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.column { background: var(--paper); border: 1px solid var(--line); padding: 12px; min-width: 0; }
.item { background: var(--white); border: 1px solid var(--line); padding: 12px; margin-bottom: 10px; }
.waiting { font-weight: 600; }
.item-actions, .row-form, .link-list li, .add { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.item-actions form, .link-list form { margin: 0; }
.link-list { list-style: none; padding: 0; margin: 0 0 12px; }
.link-list li { margin-bottom: 8px; }
label { display: grid; gap: 4px; margin: 8px 0; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
}
textarea { min-height: 180px; resize: vertical; }
.stack-form, .add { display: grid; gap: 8px; }
.notes textarea { min-height: 240px; }
button.fallback {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.note-preview { margin-top: 16px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.45 var(--sans); }
.activity { padding-left: 18px; }
.activity li { margin: 8px 0; }
details { margin-top: 12px; }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.back { margin-top: 0; }
.empty { margin-top: 24px; }
@media (max-width: 900px) {
  .project-layout, .board { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .topbar, .wrap { padding-left: 16px; padding-right: 16px; }
  .topbar { flex-wrap: wrap; }
  .heading, .card-top, .chunk-head { flex-direction: column; }
  .cards { grid-template-columns: 1fr; }
  .item-actions, .row-form { flex-direction: column; align-items: stretch; }
  .item-actions form, .item-actions button, .row-form button { width: 100%; }
}
