/* Senso Pro Anleitung – Stylesheet
   Farben als Tokens; hell/dunkel; Kontraste nach WCAG 2.1 AA geprüft (Text >= 4.5:1). */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #16202c;
  --text-muted: #4a5869;
  --border: #d5dde7;
  --primary: #0b4f8a;
  --primary-contrast: #ffffff;
  --primary-soft: #e3eef8;
  --focus: #c25e00;
  --ok: #1d6b38;
  --ok-soft: #e4f3e9;
  --warn: #8a4b00;
  --warn-soft: #fff1dc;
  --danger: #a3161a;
  --danger-soft: #fde7e7;
  --todo: #6b3fa0;
  --todo-soft: #f1eafa;
  --led-red: #d0161b;
  --led-green: #1a8f3c;
  --led-blue: #1560c9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 52, .06), 0 4px 14px rgba(16, 32, 52, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --surface: #18212b; --surface-2: #202b37; --text: #e8eef5; --text-muted: #a9b6c4;
    --border: #304051; --primary: #6fb0ec; --primary-contrast: #0b1520; --primary-soft: #1b3047;
    --focus: #ffb35c; --ok: #7fd49a; --ok-soft: #173525; --warn: #ffc06b; --warn-soft: #3a2a12;
    --danger: #ff8a8a; --danger-soft: #3d1a1c; --todo: #c9a7f2; --todo-soft: #2c2140;
    --led-red: #ff6b6f; --led-green: #5cd17f; --led-blue: #6aa8ff;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151c; --surface: #18212b; --surface-2: #202b37; --text: #e8eef5; --text-muted: #a9b6c4;
  --border: #304051; --primary: #6fb0ec; --primary-contrast: #0b1520; --primary-soft: #1b3047;
  --focus: #ffb35c; --ok: #7fd49a; --ok-soft: #173525; --warn: #ffc06b; --warn-soft: #3a2a12;
  --danger: #ff8a8a; --danger-soft: #3d1a1c; --todo: #c9a7f2; --todo-soft: #2c2140;
  --led-red: #ff6b6f; --led-green: #5cd17f; --led-blue: #6aa8ff;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.55; color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--primary); color: var(--primary-contrast); padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------- Kopfzeile ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__inner, .roles__inner, main, .footer { max-width: 1120px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; font-size: .95rem; }
.brand__text span { color: var(--text-muted); font-size: .8rem; }
.topbar__tools { display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; font-size: .85rem; padding: 8px 12px; min-height: 40px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--primary); color: var(--primary-contrast); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }

.roles { border-top: 1px solid var(--border); }
.roles__inner { display: flex; gap: 4px; }
.roles a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; min-height: 48px; text-decoration: none; color: var(--text-muted); font-weight: 600; border-bottom: 3px solid transparent; }
.roles a[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
@media (min-width: 720px) { .roles a { flex: 0 0 auto; padding: 12px 20px; } }

/* ---------- Hauptbereich ---------- */
main { padding-top: 20px; padding-bottom: 40px; outline: none; }
.lead { color: var(--text-muted); max-width: 70ch; }

.hero { display: grid; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.hero img { max-height: 220px; width: auto; justify-self: center; background: #fff; border-radius: 10px; padding: 6px; }
@media (min-width: 720px) { .hero { grid-template-columns: 1fr 200px; } }
.choice { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 560px) { .choice { grid-template-columns: 1fr 1fr; } }
.choice a { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: 12px; border: 2px solid var(--border); text-decoration: none; color: var(--text); background: var(--surface-2); }
.choice a:hover { border-color: var(--primary); }
.choice a svg { width: 2rem; height: 2rem; color: var(--primary); }
.choice small { display: block; color: var(--text-muted); }

/* Suche und Filter */
.toolbar { display: grid; gap: 12px; margin: 8px 0 18px; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search input { width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px 12px 44px; min-height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.search input::placeholder { color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: .9rem; font-weight: 600; padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.result-info { color: var(--text-muted); font-size: .9rem; margin: 0 0 10px; }

/* Karten */
.section-title { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; font-size: 1.1rem; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--primary); transform: translateY(-1px); }
.card__icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 4px; }
.card__icon svg { width: 24px; height: 24px; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card p { margin: 0; color: var(--text-muted); font-size: .95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag { font-size: .75rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); }
.tag--video { background: var(--primary-soft); color: var(--primary); }
.tag--todo { background: var(--todo-soft); color: var(--todo); }
.tag--self { background: var(--ok-soft); color: var(--ok); }

/* Detailansicht */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; margin-bottom: 12px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; }
.detail { display: grid; gap: 22px; }
@media (min-width: 960px) { .detail { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .detail__aside { position: sticky; top: 130px; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.figure { margin: 0 0 16px; }
.figure img { display: block; margin: 0 auto; background: #fff; border-radius: 10px; padding: 8px; max-height: 520px; width: auto; }
.figure figcaption { font-size: .85rem; color: var(--text-muted); text-align: center; margin-top: 6px; }
.figure--zoom a { display: block; cursor: zoom-in; }
.video video { width: 100%; border-radius: 10px; background: #000; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 12px; }
.steps > li { counter-increment: step; position: relative; padding: 4px 0 14px 48px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 0; width: 2px; background: var(--border); }
.steps .step-check { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .9rem; color: var(--text-muted); cursor: pointer; }
.steps .step-check input { width: 20px; height: 20px; accent-color: var(--primary); }

.note { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; margin: 0 0 14px; border-left: 5px solid; }
.note svg { margin-top: 2px; }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }
.note strong:first-child { display: block; }
.note--info { background: var(--primary-soft); border-color: var(--primary); }
.note--warn { background: var(--warn-soft); border-color: var(--warn); }
.note--danger { background: var(--danger-soft); border-color: var(--danger); }
.note--ok { background: var(--ok-soft); border-color: var(--ok); }
.note--todo { background: var(--todo-soft); border-color: var(--todo); }
.note--todo strong:first-child { color: var(--todo); }

.req { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.req li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.req .yes { color: var(--ok); } .req .no { color: var(--danger); }

.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 700; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 600; }
caption { text-align: left; padding: 10px 12px; font-weight: 700; }

.led { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.led::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px currentColor; }
.led--red { color: var(--led-red); } .led--green { color: var(--led-green); } .led--blue { color: var(--led-blue); }
.key { display: inline-block; padding: 1px 8px; border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 6px; background: var(--surface-2); font-weight: 600; font-size: .9em; white-space: nowrap; }
.terminals { display: flex; flex-wrap: wrap; gap: 4px; }
.terminals span { display: inline-block; min-width: 2.2em; text-align: center; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.terminals span.on { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

.aside-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.aside-list a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); min-height: 44px; }
.aside-list a:hover, .aside-list a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; }
.btn--primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

/* Planungsassistent */
.planner fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 6px; margin: 0 0 14px; }
.planner legend { font-weight: 700; padding: 0 6px; }
.planner label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.planner label:hover { background: var(--surface-2); }
.planner input[type="radio"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.planner .hint { display: block; font-size: .88rem; color: var(--text-muted); }
.result { border: 2px solid var(--primary); border-radius: 14px; padding: 16px; background: var(--surface); }
.result h3 { display: flex; align-items: center; gap: 8px; }
.result dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.result dt { font-weight: 700; } .result dd { margin: 0; }

.empty { padding: 30px; text-align: center; color: var(--text-muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }
mark { background: #ffe58a; color: #16202c; border-radius: 3px; padding: 0 2px; }

.footer { border-top: 1px solid var(--border); padding-top: 16px; padding-bottom: 32px; color: var(--text-muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .footer, .toolbar, .detail__aside, .pager, .skip-link { display: none !important; }
  body { background: #fff; } .panel { box-shadow: none; border: 0; padding: 0; }
}
