:root {
  --bg: #faf9f7;
  --panel: #ffffff;
  --ink: #111111;
  --ink-soft: #555555;
  --line: #e4e2dd;
  --line-strong: #c8c5be;
  --accent: #111111;
  --high: #c8312a;
  --med: #d97a16;
  --low: #b59a17;
  --done: #6c7a5b;
  --us: #d97a16;
  --them: #5a8a4a;
  --external: #6a6a6a;
  --chip-bg: #f1efe9;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
header.brand {
  background: var(--ink);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 4px solid var(--med);
}
header.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
header.brand h1 span.brand-sep {
  opacity: 0.4;
  margin: 0 12px;
  font-weight: 300;
}
header.brand .meta {
  font-size: 12px;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 80px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 6px;
}
.stat .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.stat .value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat .sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}
section.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 24px;
  overflow: hidden;
}
section.panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fafaf7;
}
section.panel > header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
section.panel > header .count {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
section.panel > .body {
  padding: 16px 20px;
}

.action {
  display: grid;
  grid-template-columns: 20px 24px 1fr auto;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.action:last-child { border-bottom: none; }
.action .tick {
  width: 15px;
  height: 15px;
  margin: 4px 0 0;
  cursor: pointer;
  accent-color: var(--done);
}
.done-fade { opacity: 0.35; text-decoration: line-through; transition: opacity 0.3s; }
.action .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.action .dot.high { background: var(--high); }
.action .dot.med  { background: var(--med);  }
.action .dot.low  { background: var(--low);  }
.action .title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.action .client {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.action .context {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.action .next {
  font-size: 13px;
  background: var(--chip-bg);
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid var(--med);
}
.action .age {
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

#add-task-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
#add-task-title {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}
#add-task-title:focus {
  outline: 2px solid var(--med);
  outline-offset: -1px;
}
#add-task-form button {
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
#add-task-form button:hover { background: #000; }

#link-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#link-chips:not(:empty) { margin-bottom: 16px; }
.chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.chip-q { flex: 1; min-width: 200px; }
.chip-btn {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.chip-yes {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.chip-yes:hover { background: #000; }
.chip-no:hover { background: var(--line); }

.table-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: center;
}
.search-box {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}
.search-box:focus {
  outline: 2px solid var(--med);
  outline-offset: -1px;
}
.filter-pill {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  font-size: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}
.filter-pill:hover { background: var(--chip-bg); }
.filter-pill.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
table.projects {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.projects th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
}
table.projects td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.projects tr:last-child td { border-bottom: none; }
table.projects tr.hidden { display: none; }
table.projects td.client {
  font-weight: 600;
  white-space: nowrap;
}
table.projects td.project {
  color: var(--ink-soft);
}
.ball {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.ball::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ball.us::before       { background: var(--us); }
.ball.them::before     { background: var(--them); }
.ball.external::before { background: var(--external); }
.ball.done::before     { background: var(--done); }
.stage-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.stage-pill.live         { background: #e4f1e4; color: #2c5a2c; }
.stage-pill.scoping      { background: #fef0d9; color: #8a5a14; }
.stage-pill.admin        { background: #ede9f7; color: #4a3d7a; }
.stage-pill.closed       { background: #ececec; color: #555555; }
.stage-pill.new-business { background: #fde0dc; color: #8a2c25; }
td.summary {
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 480px;
}
td.last { white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

ul.simple {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.simple li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
ul.simple li:last-child { border-bottom: none; }
ul.simple .nb-name {
  font-weight: 600;
  margin-bottom: 4px;
}
ul.simple .nb-meta {
  font-size: 12px;
  color: var(--ink-soft);
}
ul.simple .nb-next {
  font-size: 12px;
  margin-top: 4px;
  color: var(--ink);
}
details.done summary {
  cursor: pointer;
  padding: 8px 0;
  color: var(--ink-soft);
  font-size: 13px;
}
details.done ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
}
details.done li { margin-bottom: 4px; }

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 20px 0 40px;
}
footer code {
  font-size: 11px;
  background: var(--chip-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

#banner {
  background: var(--high);
  color: #fff;
  padding: 10px 28px;
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  main { padding: 16px; }
  .action { grid-template-columns: 20px 18px 1fr; }
  .action .age { grid-column: 1 / -1; text-align: left; }
  table.projects th.summary-col, table.projects td.summary { display: none; }
  header.brand { padding: 14px 16px; }
}
