/* Layout: Projektliste als Startseite; im Projekt links die Kapitel, rechts Eingabe und gesammelte Einträge. */
:root {
  --bg: #f2f4f1;
  --surface: #fbfcfa;
  --ink: #1d2420;
  --muted: #66706a;
  --line: #dce1dc;
  --accent: #2f5d50;
  --accent-ink: #fbfcfa;
  --accent-soft: rgba(47, 93, 80, 0.09);
  --danger: #a3402f;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --surface: #181d1a;
    --ink: #e4e9e5;
    --muted: #96a19a;
    --line: #2a322d;
    --accent: #84bba7;
    --accent-ink: #111513;
    --accent-soft: rgba(132, 187, 167, 0.12);
    --danger: #e08a78;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
[hidden] { display: none !important; }

h1, h2, .display { font-family: var(--font-display); font-weight: 500; text-wrap: balance; }

/* Buttons */
.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 600;
}
.primary:disabled { opacity: 0.45; cursor: default; }
.ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
a.ghost { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.link {
  background: none;
  border: 0;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px;
}
.link:hover { color: var(--accent); background: var(--accent-soft); }
.link.danger:hover { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { margin-top: -2px; }
.input, .textarea, .select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { width: auto; padding: 6px 10px; font-size: 13px; }

.status { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 20px; }
.status.err { color: var(--danger); }

/* Login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login h1 { margin: 0; font-size: 30px; }
.login p { margin: 0; color: var(--muted); }

/* Projektliste */
.page { max-width: 920px; margin: 0 auto; padding: 40px 24px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 38px; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; }
.projects { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 140px;
}
.project-card:hover { border-color: var(--accent); }
.project-card h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.project-card p { margin: 0; color: var(--muted); font-size: 14px; }
.project-card .stats { margin-top: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel h2 { margin: 0; font-size: 24px; }
.panel-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.empty { padding: 28px 0; color: var(--muted); max-width: 56ch; }

/* Projektansicht */
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100%; }
.app > * { min-width: 0; }
.side {
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.back { align-self: flex-start; }
.side-title h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.side-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 14px 10px 6px; }
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
}
.nav-btn:hover { background: var(--accent-soft); }
.nav-btn[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-btn.general { font-family: var(--font-display); font-size: 18px; }
.nav-btn .count { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 22px; text-align: right; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main { padding: 32px 40px 64px; max-width: 880px; width: 100%; }
.head h2 { margin: 0; font-size: 34px; line-height: 1.15; }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; white-space: pre-wrap; }

.compose {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.compose:focus-within { border-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kind {
  border: 1px solid var(--line);
  background: none;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 13px;
  color: var(--muted);
}
.kind[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.compose-text {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.6;
  padding: 4px 2px;
}
.compose-text:focus { outline: none; }
.compose-actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.mic {
  border: 1px solid var(--line);
  background: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mic.listening { border-color: var(--danger); color: var(--danger); }
.mic .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.list-head {
  margin-top: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.list-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.list-head h3 span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.search { width: 240px; max-width: 100%; font-size: 13px; padding: 6px 10px; }

.notes { list-style: none; margin: 0; padding: 0; }
.note { padding: 18px 0; border-bottom: 1px solid var(--line); }
.note-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.pill { border-radius: 999px; padding: 1px 9px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.note-text {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.55;
  max-width: 68ch;
  overflow-wrap: anywhere;
}
.note-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.edit-area { margin-top: 8px; font-size: 16px; min-height: 110px; border-color: var(--accent); }

/* Kapitel verwalten */
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chapter-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.chapter-item .top { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.chapter-item .name { font-weight: 600; }
.chapter-item .count { font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px 16px 12px; gap: 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav .label { display: none; }
  .nav-btn { width: auto; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .nav-btn.general { font-size: 15px; }
  .side-foot { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .main { padding: 20px 16px 48px; }
  .head h2 { font-size: 27px; }
  .page { padding: 24px 16px 48px; }
  .page-head h1 { font-size: 30px; }
  .search { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
