/* Dunkles Theme, ein Stylesheet, keine Abhängigkeiten */
:root {
  --bg: #14161a;
  --panel: #1c1f25;
  --line: #2b303a;
  --text: #e6e8ec;
  --muted: #8b93a1;
  --accent: #5b9dff;
  --danger: #ff6b6b;
  --ok: #4cc38a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.layout { display: flex; min-height: 100vh; max-width: 1000px; margin: 0 auto; }

/* Seitenleiste */
.side {
  width: 220px; flex: none; padding: 24px 12px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.side button.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer;
}
.side button.nav:hover { background: var(--panel); }
.side button.nav.active { background: var(--panel); color: var(--accent); font-weight: 600; }
.side .count { color: var(--muted); font-size: 12px; }
.side .count.hot { color: var(--danger); font-weight: 600; }
.side .sep { height: 1px; background: var(--line); margin: 8px 0; }
.side .newlist { display: flex; gap: 6px; margin-top: 8px; }
.side .newlist input { min-width: 0; flex: 1; }

.main { flex: 1; min-width: 0; padding: 24px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0 0 16px; font-size: 24px; }

/* Formularfelder */
input, select, button { font: inherit; }
input[type=text], input[type=date], select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #07101f; font-weight: 600; }
button.ghost { background: none; }
button.danger { color: var(--danger); }

.add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.add #addText { flex: 1 1 220px; }

.msg { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: #3a1d1d; color: #ffb4b4; }

/* To-do-Liste */
.todos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.todo {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px;
}
.todo.overdue { border-color: var(--danger); background: #2a1c1f; }
.todo.done .text { text-decoration: line-through; color: var(--muted); }
.todo input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--ok); cursor: pointer; }
.todo .text { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.todo .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.badge.due.overdue { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.badge.due.today { color: var(--accent); border-color: var(--accent); }
.todo .actions { display: flex; gap: 2px; }
.icon { background: none; border: 0; color: var(--muted); padding: 4px 8px; }
.icon:hover { color: var(--text); }
.icon.danger:hover { color: var(--danger); }

/* Bearbeiten */
.todo.editing { flex-wrap: wrap; }
.todo.editing .editor { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.todo.editing .editor input[type=text] { flex: 1 1 200px; }

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

/* Schmale Bildschirme: Listen oben als Tabs */
@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side button.nav { width: auto; }
  .side .sep { display: none; }
  .main { padding: 16px 12px; }
}
