:root {
  --ink: #1f2a30;
  --muted: #5d6b72;
  --paper: #f3f5f4;
  --surface: #ffffff;
  --line: #d5dcd9;
  --accent: #1d5c63;
  --danger: #b3402f;
  --st-notstarted: #6b777d;
  --st-inprogress: #2f6db5;
  --st-blocked: #b3402f;
  --st-complete: #3a7d4f;
  --radius: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { margin: 0; font-size: 1.25rem; font-weight: 650; }
h2 { margin: 0 0 .25rem; font-size: 1.15rem; font-weight: 650; }
.muted { color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Buttons & inputs ─────────────────────────────────────────────────────── */
.btn {
  font: inherit;
  padding: .45rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }

label { display: block; margin: .8rem 0 .25rem; font-size: .85rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
input:disabled, select:disabled, textarea:disabled { background: var(--paper); color: var(--ink); opacity: 1; }
textarea { resize: vertical; min-height: 5rem; }
.error { color: var(--danger); min-height: 1.4em; margin: .6rem 0 0; font-size: .9rem; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
}
.login-card .btn { width: 100%; margin-top: .4rem; }

/* ── App shell ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .9rem; }
.content { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: .88rem;
  padding: .3rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { color: var(--muted); margin-left: .35rem; }
.chip[aria-pressed="true"] .n { color: #cfd8dc; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: var(--paper); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8faf9; }
.name-btn { all: unset; cursor: pointer; font-weight: 600; }
.name-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); cursor: default; }

.pill { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.pill::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); }
.pill[data-status="Not Started"] { --c: var(--st-notstarted); }
.pill[data-status="In Progress"] { --c: var(--st-inprogress); }
.pill[data-status="Blocked"]     { --c: var(--st-blocked); }
.pill[data-status="Complete"]    { --c: var(--st-complete); }

.overdue { color: var(--danger); font-weight: 600; }
.prio-High { font-weight: 600; }

.progress { display: flex; align-items: center; gap: .6rem; min-width: 110px; }
.bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.progress small { color: var(--muted); white-space: nowrap; }

/* ── Detail dialog ────────────────────────────────────────────────────────── */
dialog {
  width: min(580px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop { background: rgba(20, 30, 35, .45); }
.panel-head { display: flex; justify-content: space-between; align-items: start; padding: 1.2rem 1.5rem 0; }
.panel-body { padding: 0 1.5rem 1.2rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
.actions .spacer { margin-right: auto; }
.steps { list-style: none; margin: .4rem 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps input[type="checkbox"] { width: auto; }
.steps .done span { color: var(--muted); text-decoration: line-through; }
.steps .grow { flex: 1; }
.step-label { margin: 0; font-weight: 400; }
.step-del { all: unset; cursor: pointer; color: var(--muted); padding: 0 .4rem; }
.step-del:hover { color: var(--danger); }
.step-del:focus-visible { outline: 2px solid var(--accent); }
.add-step { display: flex; gap: .5rem; margin-top: .6rem; }
.steps-section { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: .6rem; }
.steps-section h3 { margin: 0; font-size: .95rem; }

@media (max-width: 560px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .topbar { padding: .8rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
