:root {
  --bg: #f7f7f8; --panel: #ffffff; --line: #e3e3e8; --text: #16161a; --muted: #6b6b76;
  --accent: #3b6cf6; --ok: #1c8a4a; --warn: #b26a00; --danger: #c2323d; --chip: #eceef3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316; --panel: #1b1b20; --line: #2c2c34; --text: #e9e9ee; --muted: #9a9aa6;
    --accent: #6d92ff; --ok: #4bbd7c; --warn: #d99b3a; --danger: #e3606b; --chip: #26262e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 11px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
input, select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px;
  width: 100%;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); }
.spacer { flex: 1; }

.topbar {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.topbar select { width: auto; min-width: 150px; }
.topbar form { margin: 0; }
.progress { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.bar { flex: 1; height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--ok); transition: width .3s ease; }

.filters {
  display: flex; gap: 10px; align-items: center; padding: 9px 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.filters #search { max-width: 300px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--chip); border-radius: 99px;
  padding: 3px 11px; font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.chk input { width: auto; }
.live { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; }
.live.on { color: var(--ok); border-color: var(--ok); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 14px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }

.tasks { display: flex; flex-direction: column; gap: 6px; }
.task {
  display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.task:hover { border-color: var(--accent); }
.task.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.task.closed .title { text-decoration: line-through; color: var(--muted); }
.task .title { flex: 1; min-width: 0; }
.task .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.task input[type=checkbox] { width: auto; margin-top: 4px; }
.tag, .badge {
  font-size: 12px; border-radius: 99px; padding: 1px 8px; background: var(--chip); color: var(--muted);
  white-space: nowrap;
}
.badge.claimed { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.badge.blocked { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.badge.urgent { background: var(--danger); color: #fff; }
.badge.high { background: var(--warn); color: #fff; }

.detail {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 14px;
  position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow: auto;
}
.detail h2 { margin: 0 0 4px; font-size: 17px; }
.detail .row { display: flex; gap: 8px; margin: 8px 0; }
.detail .row.end { justify-content: flex-end; }
.detail label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.notes { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.note { border-left: 2px solid var(--line); padding: 2px 0 2px 9px; font-size: 14px; }
.note .who { font-size: 12px; color: var(--muted); }
.deps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

dialog {
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--text);
  width: min(520px, 94vw); padding: 18px;
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 10px; font-size: 17px; }
dialog label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 9px; }
dialog .row { display: flex; gap: 10px; }
dialog .row > label { flex: 1; }

.login { max-width: 340px; margin: 14vh auto; text-align: center; padding: 0 16px; }
.login h1 { margin-bottom: 4px; }
.login form { display: flex; flex-direction: column; gap: 9px; margin: 18px 0; }
