:root {
  color-scheme: dark;
  --bg: #0e1013;
  --surface: #171a1f;
  --surface-edit: #1b1f25;
  --border: #262b33;
  --text: #e6e8eb;
  --muted: #8b929c;
  --placeholder: #5a616b;
  --accent: #6b93ff;
  --accent-soft: #1b2540;
  --done: #3fbf6f;
  --danger: #f06464;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 40px 16px 64px; }

header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 9px 14px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }

.filters { display: flex; gap: 6px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.list { display: flex; flex-direction: column; gap: 12px; }

.task {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow);
  cursor: text; transition: border-color .15s, background .15s;
}
.task:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.task:focus-within { border-color: var(--accent); background: var(--surface-edit); }

.check {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid var(--border); border-radius: 6px; background: transparent;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.check:hover { border-color: var(--done); }
.check svg { width: 14px; height: 14px; opacity: 0; }
.task.done .check { background: var(--done); border-color: var(--done); }
.task.done .check svg { opacity: 1; }

.body { flex: 1; min-width: 0; }
.title, .desc { outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.title { font-size: 16px; font-weight: 600; min-height: 1.5em; }
.desc { margin-top: 4px; color: var(--muted); font-size: 14px; min-height: 1.5em; }
.title:empty::before, .desc:empty::before { content: attr(data-placeholder); color: var(--placeholder); pointer-events: none; }
/* prázdný popis neruší, dokud se blok needituje */
.task:not(:focus-within) .desc:empty { min-height: 0; margin: 0; }
.task:not(:focus-within) .desc:empty::before { content: none; }
.task.done .title { text-decoration: line-through; color: var(--muted); }

.delete {
  flex: none; width: 26px; height: 26px; margin: -2px -6px 0 0; padding: 5px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.delete svg { width: 100%; height: 100%; }
.task:hover .delete, .task:focus-within .delete { opacity: 1; }
.delete:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.empty { margin-top: 48px; color: var(--muted); text-align: center; }

@media (max-width: 520px) {
  header { flex-direction: column; align-items: stretch; }
  .delete { opacity: 1; }
}
