/* Mission — one small stylesheet, no build step. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #3b6ef5;
  --accent-soft: #e8eeff;
  --danger: #d9452f;
  --todo: #9aa3af;
  --doing: #d98c1f;
  --done: #2f9e6b;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --panel: #1c2027;
    --text: #e7e9ee;
    --muted: #9aa3af;
    --line: #2b313a;
    --accent: #6d94ff;
    --accent-soft: #232c40;
    --danger: #f0705a;
  }
}

* { box-sizing: border-box; }

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

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* --- top bar --- */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.tagline { color: var(--muted); font-size: 13px; }

/* --- panels & cards --- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.panel.tight { padding: 14px 18px; }

.panel h1, .panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.cards { display: grid; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card h2 { margin: 0; font-size: 17px; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.head h1 { margin: 0; }

.desc { color: var(--muted); margin: 8px 0 0; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.crumb { margin: 0 0 14px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.empty {
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  margin: 0;
}

/* --- forms --- */

.row-form { display: flex; flex-wrap: wrap; gap: 8px; }
.row-form input { flex: 1 1 180px; }

.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

input, textarea, button {
  font: inherit;
  color: var(--text);
  border-radius: 8px;
}

input, textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 9px 11px;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

button {
  background: var(--accent);
  border: 1px solid transparent;
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.actions { display: flex; gap: 8px; flex-shrink: 0; }

.actions button, button.ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
  padding: 7px 12px;
  font-size: 14px;
}

.actions button:hover { border-color: var(--accent); color: var(--accent); }
.actions button.danger:hover { border-color: var(--danger); color: var(--danger); }

button.icon {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
}

button.icon:hover { color: var(--danger); filter: none; }

/* --- progress --- */

.bar {
  height: 7px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 12px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--done);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.panel.tight .bar { margin-top: 0; }

/* --- tasks --- */

.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.task .text { flex: 1; min-width: 0; }

.task .title {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.task .title:hover { color: var(--accent); }

/* The body is free-form detail, so keep the author's line breaks and let
   long unbroken strings (URLs, paths) wrap instead of stretching the row. */
.task .body {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task .status, .task-detail .status {
  flex-shrink: 0;
  width: 64px;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 0;
  background: var(--accent-soft);
  color: var(--muted);
}

.status-todo  .status { color: var(--todo); }
.status-doing .status { color: var(--doing); }
.status-done  .status { color: var(--done); }
.status-done  .title  { color: var(--muted); text-decoration: line-through; }

/* --- a task's own view --- */

.task-detail h1 { font-size: 22px; }
.task-detail .status { margin-top: 5px; }
.task-detail .actions.end { justify-content: flex-end; margin-top: 12px; }

/* This is where a long body is meant to be read, so it gets the full text
   colour and size rather than the muted preview a list row shows. */
.task-detail .body,
.task-detail .desc {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-detail .body { color: var(--text); }

/* htmx sets this class on an element while its request is in flight. */
.htmx-request { opacity: 0.6; }
