:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --line: #dfe3e8;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --ok: #1d7a46;
  --warn: #9a5b00;
  --danger: #b42318;
  --radius: 8px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e6eaf0;
    --muted: #9aa7b6;
    --line: #2c3542;
    --accent: #5aa3d6;
    --accent-ink: #0d1520;
    --ok: #4cc283;
    --warn: #e0a440;
    --danger: #f0776b;
  }
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; color: var(--text); text-decoration: none; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: var(--accent); box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); }
#nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
#nav a { text-decoration: none; }
#nav .who { color: var(--muted); font-size: 0.9rem; }

main { max-width: 1060px; margin: 2rem auto; padding: 0 1.5rem; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.85rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.narrow { max-width: 440px; margin: 3rem auto; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.stack > * + * { margin-top: 0.9rem; }

label { display: block; font-weight: 550; font-size: 0.9rem; margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%; padding: 0.55rem 0.65rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type='checkbox'] { width: auto; }
.check { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; }

button, .btn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.95rem; font: inherit; font-weight: 550;
  border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer; text-decoration: none;
}
button.secondary, .btn.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
button:disabled { opacity: 0.55; cursor: progress; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
tr.is-deleted td { color: var(--muted); }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 99px; font-size: 0.78rem; font-weight: 600; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.danger { color: var(--danger); }
.badge.neutral { color: var(--muted); }

.notice { border-left: 3px solid var(--accent); background: var(--surface); padding: 0.75rem 1rem; border-radius: 0 6px 6px 0; }
.notice.warn { border-color: var(--warn); }
.notice.danger { border-color: var(--danger); }
.notice.ok { border-color: var(--ok); }
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; letter-spacing: 0.08em; padding: 0.75rem 1rem; background: var(--bg); border: 1px dashed var(--accent); border-radius: 6px; text-align: center; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

#toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); max-width: 90vw; }
#toast > div { background: var(--text); color: var(--bg); padding: 0.6rem 1rem; border-radius: 6px; margin-top: 0.5rem; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
#toast > div.error { background: var(--danger); color: #fff; }

.toolbar { margin: 1rem 0; }
.grow { flex: 1; min-width: 220px; }
.mt0 { margin-top: 0; }
.mt { margin-top: 1.25rem; }

/* ---- Erweiterungen ---- */
#nav a.active { font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }
.narrow-wide { max-width: 620px; margin: 0 auto; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stack-tight { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.picker { max-height: 340px; overflow: auto; padding-right: 0.5rem; }
.danger-text { color: var(--danger) !important; }
.pre { white-space: pre-line; }
.right { text-align: right; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 6px; }
.checklist { list-style: none; padding: 0; margin: 0.25rem 0; }
details > summary { cursor: pointer; }
.prose h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.prose h3 { font-size: 1.05rem; margin: 1.25rem 0 0.4rem; }
.prose blockquote { margin: 0.75rem 0; padding: 0.5rem 1rem; border-left: 3px solid var(--warn); color: var(--muted); }
.prose p, .prose li { max-width: 75ch; }
.invoice h1 { margin: 0; }
.invoice tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
textarea.mono { font-size: 0.82rem; }

@media print {
  .topbar, .no-print, #toast { display: none !important; }
  body, :root { background: #fff; color: #000; }
  main { margin: 0; max-width: none; }
  .card { border: none; padding: 0; }
  table { border: none; }
}
.brand { white-space: nowrap; }
#nav { gap: 0.4rem 0.9rem; font-size: 0.92rem; justify-content: flex-end; }
