:root {
  --ink: #1f2a24;
  --muted: #5d6b63;
  --paper: #fbfaf6;
  --line: #d9dcd2;
  --accent: #2f6b4f;
  --alert: #a4412f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8ebe4;
    --muted: #a3ada6;
    --paper: #171c19;
    --line: #333b36;
    --accent: #7fc4a0;
    --alert: #e59a86;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

a {
  color: var(--accent);
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem;
}

input:not([type="checkbox"], [type="hidden"]) {
  display: block;
  width: 100%;
  padding: 0.5rem;
  font: inherit;
}

button {
  padding: 0.5rem 1rem;
  font: inherit;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

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

.site-name {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.message {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  color: var(--muted);
}

main.wide {
  max-width: 72rem;
}

select,
textarea {
  width: 100%;
  padding: 0.4rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
}

input:not([type="checkbox"], [type="hidden"], [type="file"]) {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

label {
  display: block;
}

label.check {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

button {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: inherit;
}

kbd {
  padding: 0 0.3rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.8em;
}

dialog {
  width: min(28rem, calc(100vw - 2rem));
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}

dialog h2 {
  margin-top: 0;
}

h2 {
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.key {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

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

.badge {
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.8rem;
}

.badge.priority-p0,
.badge.priority-p1,
.badge.blocked {
  border-color: var(--alert);
  color: var(--alert);
}

.message.error,
.notice {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--alert);
}

.notice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.items {
  width: 100%;
  border-collapse: collapse;
}

.items th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
}

.items th,
.items td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

[data-item].selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.empty {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.pages {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(14rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.column h2 {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.card {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.card p {
  margin: 0;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 2rem;
}

.prose {
  overflow-wrap: anywhere;
}

.prose pre {
  overflow-x: auto;
}

.comment {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}

.comment p.muted {
  margin: 0;
}

.plain,
.history {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.history li {
  padding: 0.15rem 0;
  overflow-wrap: anywhere;
}

.shortcuts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

.shortcuts dd {
  margin: 0;
}

@media (max-width: 48rem) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .items {
    table-layout: fixed;
  }

  .items td {
    overflow-wrap: anywhere;
  }

  .items th:nth-child(3),
  .items td:nth-child(3),
  .items th:nth-child(5),
  .items td:nth-child(5),
  .items th:nth-child(4),
  .items td:nth-child(4) {
    display: none;
  }
}

.chain {
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
}
