:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1d21;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2f6feb;
  --agent: #7c3aed;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --panel: #1f2229;
    --ink: #e8eaed;
    --muted: #99a0ad;
    --line: #2e323b;
    --accent: #6a9bff;
    --agent: #b18aff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { padding: 20px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { font-weight: 650; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.actor { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.error { color: #d33; font-size: 13px; }

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

.toolbar { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }

.filters { display: flex; gap: 6px; }
.filters a {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
}
.filters a.active { color: var(--panel); background: var(--accent); border-color: var(--accent); }

details.new > summary {
  cursor: pointer;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  list-style: none;
}
details.new[open] > summary { border-color: var(--accent); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

details.new .card { position: absolute; z-index: 5; margin-top: 8px; min-width: 280px; }

input, textarea, select, button {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea { resize: vertical; }
button { background: var(--accent); color: #fff; border-color: transparent; cursor: pointer; font-weight: 550; }
button:hover { filter: brightness(1.08); }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.column h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 2px 4px 10px;
  display: flex;
  gap: 6px;
}
.column .count { color: var(--line); }

.dropzone { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }

.task {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: grab;
}
.task.dragging { opacity: 0.4; }
.task-link { text-decoration: none; color: var(--ink); display: flex; gap: 8px; flex: 1; align-items: baseline; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.badge {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px;
}

.task-page { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.task-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.task-head h1 { font-size: 20px; margin: 0; flex: 1; }
.task-head .back { text-decoration: none; font-size: 13px; }
.task-page .body { white-space: pre-wrap; }

.thread { display: flex; flex-direction: column; gap: 10px; }
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.message .meta { display: flex; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.message .who { font-weight: 600; color: var(--ink); }
.message .body { white-space: pre-wrap; }
.message.actor-foreman { border-left-color: var(--agent); }

.login { max-width: 340px; margin: 12vh auto; }
.login h1 { font-size: 18px; margin: 0; }
