:root {
  --blue: #0b4f8a;
  --blue-dark: #083a66;
  --blue-light: #e8f1fa;
  --ink: #1d2530;
  --muted: #5d6b7a;
  --line: #dde3ea;
  --bg: #f5f7fa;
  --ok: #2e9e44;
  --warn: #d93025;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--blue); }
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #fff; border-bottom: 3px solid var(--blue); padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  background: var(--blue); color: #fff; font-weight: 800; letter-spacing: 1px;
  border-radius: 8px; padding: 6px 9px; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 12px; }
.site-title { color: var(--muted); font-size: 14px; border-left: 1px solid var(--line); padding-left: 18px; }
.who { margin-left: auto; font-size: 14px; color: var(--muted); }
.wrap { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 20px 40px; }
.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 14px 24px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: #fff;
}
h1 { font-size: 28px; margin: 0 0 6px; }
h2 { font-size: 22px; margin: 28px 0 10px; }
h3 { font-size: 18px; margin: 22px 0 8px; }
.lead { color: var(--muted); font-size: 17px; margin-top: 0; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.narrow { max-width: 460px; margin: 30px auto; }
label { display: block; font-weight: 600; margin: 14px 0 5px; font-size: 14px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 10px 12px; border: 1px solid #b9c4cf; border-radius: 8px; font-size: 16px; background: #fff;
}
.btn {
  display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--blue-dark); }
.btn.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { background: var(--warn); }
.error { background: #fdecea; color: #8a1c14; border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.notice { background: var(--blue-light); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.hint { color: var(--muted); font-size: 13px; }

/* Themenübersicht */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 20px; }
.topic { display: flex; flex-direction: column; gap: 8px; }
.topic h2 { margin: 0; font-size: 20px; }
.topic .meta { color: var(--muted); font-size: 14px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
.topic .btn { align-self: flex-start; margin-top: 6px; }

/* Lektion */
.lesson { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.toc { position: sticky; top: 16px; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: ch; }
.toc li a {
  display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: 14px;
}
.toc li a::before { counter-increment: ch; content: counter(ch); color: var(--muted); font-weight: 600; min-width: 16px; }
.toc li a:hover { background: var(--blue-light); }
.toc li.current a { background: var(--blue); color: #fff; }
.toc li.current a::before { color: #fff; }
.toc li.done a::after { content: "✓"; margin-left: auto; color: var(--ok); font-weight: 700; }
.toc li.current.done a::after { color: #fff; }
.toc .tools { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.content { min-width: 0; }
.content .chapter-no { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.content h1 { margin-top: 4px; }
.content table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; background: #fff; font-size: 15px; }
.content th, .content td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.content th { background: var(--blue-light); }
.content ol li, .content ul li { margin: 4px 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.box { border-left: 4px solid var(--blue); background: var(--blue-light); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; }
.box.warn { border-color: var(--warn); background: #fdecea; }
.box.ok { border-color: var(--ok); background: #e9f6ec; }
.shot { margin: 18px 0; }
.shot img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.shot figcaption { color: var(--muted); font-size: 13px; margin-top: 4px; }
.shot-missing { border: 2px dashed #c8a400; background: #fff9db; padding: 10px; border-radius: 8px; font-size: 13px; margin: 14px 0; }

/* Schemazeichnungen */
.sketch { margin: 18px 0; }
.sketch svg { width: 100%; max-width: 640px; height: auto; display: block; font-family: inherit; }
.sketch figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Farblegende */
.legend { display: flex; flex-wrap: wrap; gap: 14px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; }
.legend div { display: flex; align-items: center; gap: 10px; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #9aa5b1; flex: none; display: inline-block; vertical-align: middle; }
.dot.black { background: #1a1a1a; } .dot.red { background: #d93025; } .dot.purple { background: #8e44ad; }
.dot.green { background: #2e9e44; } .dot.pink { background: #f4a6c6; }
.legend strong { display: block; line-height: 1.2; }
.legend small { color: var(--muted); }
td .dot { width: 16px; height: 16px; margin-right: 6px; }
.content table.colors td:first-child { white-space: nowrap; }

/* Selbstcheck */
.check { list-style: none; padding: 0; }
.check li { margin: 8px 0; }
.check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; font-size: 16px; cursor: pointer; }
.check input { margin-top: 5px; width: 18px; height: 18px; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.list th { background: var(--blue-light); white-space: nowrap; }
.badge { display: inline-block; border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.badge.on { background: #e9f6ec; color: #1d6b2e; } .badge.off { background: #fdecea; color: #8a1c14; }
.row-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-form input[type=text], .row-form input[type=password] { width: auto; padding: 5px 8px; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { margin: 0 0 4px; }
.checks { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.checks label { font-weight: 400; margin: 0; display: flex; gap: 8px; align-items: center; }

/* Druck / Handout */
.print-only { display: none; }
@media print {
  .topbar, .foot, .toc, .pager, .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 11pt; }
  .wrap { padding: 0; max-width: none; }
  .lesson { display: block; }
  .print-chapter { page-break-inside: avoid; }
  .print-chapter + .print-chapter { margin-top: 18pt; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 800px) {
  .lesson { grid-template-columns: 1fr; }
  .toc { position: static; }
  .site-title { display: none; }
}

/* Zugangsdaten nach dem Anlegen */
.creds { border: 2px solid var(--ok); }
.creds textarea { width: 100%; font-family: Consolas, monospace; font-size: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f9fbfc; }

/* Kalender-Markierungen wie in timeCard */
.mk { display: inline-block; vertical-align: middle; margin-right: 8px; flex: none; }
.mk.dot { width: 12px; height: 12px; border-radius: 50%; border: 0; }
.mk.sq { width: 12px; height: 12px; border-radius: 1px; }
.mk.dot.black { background: #111; } .mk.dot.red { background: #e5413a; } .mk.dot.purple { background: #8a2be2; }
.mk.sq.green { background: #2e9e5b; } .mk.sq.pink { background: #f2a0bd; }
.mk.sq.hollow { background: transparent; border: 1.5px solid #8fae8f; }
.mk.day { min-width: 30px; height: 26px; line-height: 26px; text-align: center; font-size: 13px; border-radius: 3px; }
.mk.day.holiday { background: #9fd8ea; } .mk.day.today { border: 2px solid #111; line-height: 22px; } .mk.day.selected { background: #fdc300; }
.legend .mk.dot, .legend .mk.sq { width: 16px; height: 16px; }

/* ---- Rubriken und Level (ergänzt) ---- */
.rubrik { margin-top: 28px; }
.rubrik-title { font-size: 22px; margin: 0; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.rubrik .topics { margin-top: 14px; }
.level { display: inline-block; background: #0b5cad; color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }

/* E-Mail-, Zahl- und Datumsfelder wie Textfelder */
input[type=email], input[type=number], input[type=date] { width: 100%; padding: 10px 12px; border: 1px solid #b9c4cf; border-radius: 8px; font-size: 16px; background: #fff; }
.row-form input[type=email], .row-form input[type=number] { width: auto; padding: 5px 8px; font-size: 13px; }
