/* ============================================================
   base.css — PflichtPilot v2.0
   Cross-page foundation: reset, body, typography, theme-toggle
   visibility helpers, container, shared text styles (.eyebrow,
   .h2, .lead), site-header (sticky), site-footer, mobile-menu,
   .btn variants, .sr-only.
   Loaded SECOND on every page. References tokens.css.
   ============================================================ */

/* ============================================================
   BASE — reset, body, theme-toggle visibility helpers
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  /* Atmospheric ambience: flat canvas + subtle radial gradients overlay,
     viewport-fixed so the same atmosphere is visible on all pages regardless
     of scroll position. Gradient stays out of the body of large container
     cards (which keep --surface), so it shows in side margins + dividers. */
  background-color: var(--canvas);
  background-image: var(--page-bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: 100% auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* Theme-pair logo/emblem visibility — light is implicit default (no attr needed),
   dark requires explicit [data-theme="dark"]. Handles auth callback edge-case
   where callback-pre.js removes data-theme in auto+system-light. */
.brand-logo--dark,
.emblem--dark { display: none; }
[data-theme="dark"] .brand-logo--light,
[data-theme="dark"] .emblem--light { display: none; }
[data-theme="dark"] .brand-logo--dark,
[data-theme="dark"] .emblem--dark { display: revert; }

/* Skip-to-content link (a11y, WCAG 2.4.1) — visible on focus only */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 10px 16px;
  /* Theme-aware: always-dark badge (works in light AND dark theme) */
  background: var(--inverted-card-bg);
  color: var(--inverted-card-fg);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Print styles — clean printable output for Legal/Version/Wissens pages.
   Hides navigation chrome, removes shadows/gradients, ensures readable text. */
@media print {
  body {
    background: #fff !important;
    background-image: none !important;
    color: #000 !important;
    -webkit-print-color-adjust: economy;
    print-color-adjust: economy;
  }
  .site-header,
  .site-footer,
  .skip-link,
  .back-to-top,
  .kb-sidebar,
  .kb-related,
  .mobile-menu,
  .burger,
  .nav,
  .theme-toggle,
  .lang-switch,
  .footer-meta {
    display: none !important;
  }
  main, #main {
    padding: 0 !important;
    margin: 0 !important;
  }
  .doc-shell, .kb-shell, .auth-shell {
    max-width: 100% !important;
    padding: 0 !important;
    display: block !important;
  }
  .kb-article {
    grid-column: 1 / -1 !important;
  }
  .doc-card, .kb-callout, .kb-toc {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .doc-section, .doc-section h2, .kb-body h2 {
    page-break-after: avoid;
  }
  .doc-section, .kb-body p, .kb-body li {
    page-break-inside: avoid;
  }
  a[href^="http"]::after,
  a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-size: 11px;
    color: #555;
  }
  /* Don't print append for internal anchors */
  a[href^="#"]::after,
  a[href^="/"]::after { content: ""; }
}

/* Honor user's reduced-motion preference (a11y) — universal across all v2 pages */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus-visible system — universal outline on interactive elements.
   Uses --green accent for focus ring, generous offset for visibility. */
:where(.btn, .form-input, .form-actions__back, .nav__link,
       .theme-toggle__btn, .lang-switch__btn, .footer-meta a,
       .skip-link, .brand, .footer-emblem):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:where(details > summary):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x-mobile);
}
@media (min-width: 1024px) {
  .container { padding: 0 var(--pad-x-desktop); }
}
/* Tightened side-padding on smallest viewports to give 3-line H1 breathing room */
@media (max-width: 374px) {
  .container { padding: 0 12px; }
}

/* shared text */
.eyebrow {
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--green);
  margin: 0 0 14px;
}
.eyebrow--muted { color: var(--muted-2); }
.eyebrow--on-dark { color: #6BB042; }
.eyebrow--on-dark-muted { color: rgba(255,255,255,0.55); }

.h2 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0 0 16px;
  text-wrap: balance;
}
.h2--on-dark { color: #fff; }
.lead {
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 60ch;
}
.lead--on-dark { color: rgba(255,255,255,0.78); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  /* rgba fallback for browsers without color-mix (pre-Chrome 111 / FF 113 / Safari 16.4) */
  background: rgba(246, 248, 250, 0.85);
  background: color-mix(in oklab, var(--canvas) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
[data-theme="dark"] .site-header {
  background: rgba(11, 23, 34, 0.85);
  background: color-mix(in oklab, var(--canvas) 85%, transparent);
}
@media (min-width: 768px) { .site-header { height: 64px; } }
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x-mobile);
}
@media (min-width: 1024px) {
  .site-header__inner { padding: 0 var(--pad-x-desktop); }
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-logo { height: 22px; width: auto; }
@media (min-width: 768px) { .brand-logo { height: 24px; } }

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (min-width: 768px) { .nav { gap: 24px; } }

.nav__link {
  display: none;
  font-size: 14px;
  color: var(--ink);          /* slightly stronger than --muted for nav presence */
  font-weight: 500;
  padding: 6px 4px;
  transition: color .15s ease;
}
.nav__link:hover { color: var(--ink-strong); }
@media (min-width: 768px) { .nav__link { display: inline-flex; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 36px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  /* Theme-aware: light = dark-blue bg + white text;
     dark = green bg + white text. Both readable. */
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  transition: background .15s ease, transform .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-primary-bg-hover); }
.btn--lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 10px; }
.btn--ghost-on-dark {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}
.btn--ghost-on-dark:hover { background: rgba(255,255,255,0.06); }
/* Final-CTA "on dark" button — different in light vs dark theme:
   Light: white button with navy text (cleaner, less "loud green" on dark section).
   Dark:  green stays (matches accent on darker canvas, high contrast). */
.btn--green {
  background: #FFFFFF;
  color: var(--ink-strong);
}
.btn--green:hover { background: #E8EDF2; }
[data-theme="dark"] .btn--green {
  background: var(--green);
  color: #FFFFFF;
}
[data-theme="dark"] .btn--green:hover { background: #4D7A28; }
.btn .ic { width: 16px; height: 16px; }

.nav .btn { height: 32px; padding: 0 14px; font-size: 13px; }
@media (min-width: 768px) { .nav .btn { height: 36px; padding: 0 16px; font-size: 14px; } }

.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  border: 1px solid var(--border);
  background: transparent;
}
.burger:hover { color: var(--ink-strong); border-color: var(--border-hard); }
@media (min-width: 768px) { .burger { display: none; } }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px var(--pad-x-mobile);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 16px;
  text-align: center;
}
@media (min-width: 1024px) { .site-footer { padding: 36px var(--pad-x-desktop); } }
/* Force row-breaks: emblem, tagline, and meta each take full width.
   Theme-toggle + lang-switch flow inline on a shared row. */
.site-footer > .footer-emblem,
.site-footer > .footer-brand,
.site-footer > .footer-meta {
  flex: 0 1 100%;
}
.footer-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-emblem img { height: 22px; width: auto; }
@media (min-width: 768px) { .footer-emblem img { height: 24px; } }
.footer-brand {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}
.footer-brand strong { color: var(--ink-strong); font-weight: 700; }
.theme-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
  background: var(--surface);
}
.theme-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.theme-toggle__icon {
  width: 11px;
  height: 11px;
}
.theme-toggle__btn[aria-pressed="true"] {
  /* Uses theme-aware tokens (defined in tokens.css per [data-theme]).
     Light: dark-blue bg + white text. Dark: green bg + dark text. */
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}

/* Language switcher — visually paired with theme-toggle */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
  background: var(--surface);
}
.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.lang-switch__btn:hover { color: var(--ink-strong); }
.lang-switch__btn[aria-current="true"] {
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}
.lang-switch__btn[aria-current="true"]:hover { color: var(--toggle-active-fg); }

.footer-meta {
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
}
.footer-meta span + span::before { content: "·"; margin-right: 10px; color: var(--muted-3); }
.footer-meta a:hover { color: var(--ink-strong); }

/* mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 56px;
  left: 0; right: 0;
  background: rgba(246, 248, 250, 0.96); /* fallback */
  background: color-mix(in oklab, var(--canvas) 96%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 16px var(--pad-x-mobile);
  flex-direction: column;
  gap: 4px;
  z-index: 99;
}
[data-theme="dark"] .mobile-menu {
  background: rgba(11, 23, 34, 0.96);
  background: color-mix(in oklab, var(--canvas) 96%, transparent);
}
.mobile-menu.is-open { display: flex; }
.mobile-menu a {
  padding: 12px 4px;
  font-size: 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--border-soft);
}
.mobile-menu a:last-child { border-bottom: 0; }

@media (min-width: 768px) { .mobile-menu, .mobile-menu.is-open { display: none; } }

/* Back-to-top floating button (legacy app.js injects `.global-backtotop`).
   Hidden by default, becomes visible after 260px scroll via `.is-visible`. */
.global-backtotop {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-hard);
  background: var(--surface);
  color: var(--ink-strong);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(20, 35, 58, 0.10), 0 1px 2px rgba(20, 35, 58, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background .15s ease, border-color .15s ease;
  z-index: 50;
}
.global-backtotop.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.global-backtotop:hover {
  background: var(--ink-strong);
  color: var(--surface);
  border-color: var(--ink-strong);
}
[data-theme="dark"] .global-backtotop:hover {
  background: var(--green);
  color: var(--ink-strong);
  border-color: var(--green);
}
@media (min-width: 768px) {
  .global-backtotop {
    right: 28px;
    bottom: 28px;
    width: 44px;
    height: 44px;
    font-size: 19px;
  }
}

/* ============================================================
   DOC PAGES — legal, version, pricing (content-heavy)
   ============================================================ */
.doc-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px var(--pad-x-mobile) 56px;
}
@media (min-width: 768px) {
  .doc-shell { padding: 56px var(--pad-x-desktop) 56px; }
}
.doc-title {
  font-size: clamp(28px, 5vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.doc-lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 32px;
}
.doc-section { margin: 0 0 28px; }
.doc-section:last-child { margin-bottom: 0; }
.doc-section__head {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-strong);
  letter-spacing: 0.01em;
  margin: 0 0 10px;
}
/* Long-form variant: section-head as proper h2, no card-frame, just text */
.doc-shell--longform { max-width: 800px; }
.doc-shell--longform h2.doc-section__head {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  scroll-margin-top: 80px;
}
.doc-shell--longform .doc-section { margin-bottom: 32px; }
.doc-shell--longform .doc-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.doc-shell--longform .doc-card p {
  font-size: 16px;
  line-height: 1.7;
}
.doc-shell--longform .doc-card dt { margin-top: 16px; }
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
@media (min-width: 768px) {
  .doc-card { padding: 24px 28px; }
}
.doc-card p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.doc-card p:last-child { margin-bottom: 0; }
.doc-card p strong { color: var(--ink-strong); font-weight: 700; }
.doc-card a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.doc-card a:hover { color: var(--ink-strong); }
.doc-card .doc-row { line-height: 1.6; color: var(--ink); }
.doc-card dl { margin: 0; }
.doc-card dt {
  font-weight: 600;
  margin: 14px 0 4px;
  color: var(--ink-strong);
  font-size: 15px;
}
.doc-card dt:first-child { margin-top: 0; }
.doc-card dd {
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}

/* Hub grid (Wissens overview) */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 0;
}
@media (min-width: 768px) {
  .hub-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.hub-card__icon {
  width: 36px;
  height: 36px;
  color: var(--green);
  margin: 0 0 14px;
}
.hub-card__icon svg { width: 100%; height: 100%; display: block; }
.hub-card__title {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.hub-card__desc {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 18px;
}
.hub-card__links {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.hub-card__links li { margin: 0; }
.hub-card__links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink-strong);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  transition: color .15s ease;
}
.hub-card__links li:last-child a { border-bottom: 0; }
.hub-card__links a:hover { color: var(--green); }
.hub-card__links svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--muted-3);
  transition: transform .15s ease, color .15s ease;
}
.hub-card__links a:hover svg { color: var(--green); transform: translateX(2px); }

/* Version page jump nav */
.version-jump {
  margin: 0 0 32px;
  padding: 16px 20px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.version-jump__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink-strong);
}
.version-jump__select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--canvas);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-xs);
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.version-jump__select:focus {
  border-color: var(--ink-strong);
  box-shadow: 0 0 0 3px rgba(20, 35, 58, 0.08);
}
[data-theme="dark"] .version-jump__select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(107, 176, 66, 0.15);
}
.version-jump__hint {
  display: block;
  font-size: 12px;
  color: var(--muted-2);
  margin: 8px 0 0;
}

/* ============================================================
   KNOWLEDGE PAGES — sidebar + breadcrumbs + TOC + article
   ============================================================ */
.kb-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--pad-x-mobile) 56px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px) {
  .kb-shell {
    grid-template-columns: 240px 1fr;
    padding: 40px var(--pad-x-desktop) 56px;
    gap: 56px;
  }
}

/* Sidebar — categories + sub-links */
.kb-sidebar {
  position: relative;
}
@media (min-width: 1024px) {
  .kb-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}
.kb-sidebar__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 12px;
  padding: 0 12px;
}
.kb-sidebar__group {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}
.kb-sidebar__cat {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
  border-radius: var(--radius-xs);
  text-decoration: none;
}
.kb-sidebar__cat:hover { background: var(--surface-tint); }
.kb-sidebar__cat--active { background: var(--surface-tint2); }
.kb-sidebar__sub {
  list-style: none;
  padding: 0 0 4px 12px;
  margin: 4px 0 8px;
  border-left: 1px solid var(--border);
  margin-left: 16px;
}
.kb-sidebar__link {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-xs);
  line-height: 1.4;
}
.kb-sidebar__link:hover { color: var(--ink-strong); background: var(--surface-tint); }
.kb-sidebar__link[aria-current="page"] {
  color: var(--ink-strong);
  background: var(--green-soft);
  font-weight: 600;
}

/* Mobile: sidebar collapsed by default, expand on click */
.kb-sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.kb-sidebar__toggle svg { width: 16px; height: 16px; transition: transform .2s ease; }
.kb-sidebar__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.kb-sidebar__panel { padding-top: 12px; }
@media (max-width: 1023px) {
  .kb-sidebar__panel:not(.is-open) { display: none; }
}
@media (min-width: 1024px) {
  .kb-sidebar__toggle { display: none; }
  .kb-sidebar__panel { display: block !important; padding-top: 0; }
}

/* Article main */
.kb-article {
  min-width: 0;
}
.kb-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
}
.kb-breadcrumb a { color: var(--muted); text-decoration: none; }
.kb-breadcrumb a:hover { color: var(--ink-strong); }
.kb-breadcrumb__sep {
  color: var(--muted-3);
  font-size: 12px;
}
.kb-breadcrumb__current { color: var(--ink-strong); font-weight: 600; }

.kb-title {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0 0 12px;
  text-wrap: balance;
}
.kb-lead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 65ch;
}

/* TOC */
.kb-toc {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 0 0 36px;
}
.kb-toc__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 8px;
}
.kb-toc__list {
  list-style: decimal inside;
  padding: 0;
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
}
.kb-toc__list a {
  color: var(--ink);
  text-decoration: none;
}
.kb-toc__list a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }

/* Article body typography — wider than pure prose-optimum (65ch) so the
   right side doesn't feel empty inside the v2 1-fr column on wide screens. */
/* kb-body: full column width container; paragraphs/headings cap at reading width;
   figures, callouts, dl, ul/ol, tables span full column. */
.kb-body { max-width: none; }
/* Tightened vertical rhythm — earlier values felt too airy in continuous
   prose. h2/h3 still create section breaks but no longer "shout". */
.kb-body h2 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 30px 0 10px;
  scroll-margin-top: 80px;
  max-width: 80ch;
}
.kb-body h2:first-child { margin-top: 0; }
.kb-body h3 {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 20px 0 6px;
  max-width: 80ch;
}
.kb-body p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 12px;
  max-width: 80ch;
}
.kb-body p strong { color: var(--ink-strong); font-weight: 700; }
.kb-body a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.kb-body a:hover { color: var(--ink-strong); }
.kb-body ul, .kb-body ol {
  padding-left: 22px;
  margin: 0 0 12px;
  max-width: 80ch;
}
.kb-body li {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 4px;
}
.kb-body figure {
  margin: 24px 0;
}
.kb-body figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}
.kb-body figcaption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

/* Flow diagram — theme-aware HTML/CSS replacement for static SVG diagrams.
   Title + subtitle render as normal H3 + paragraph (matching body type scale).
   Steps + arrows + footer span full column width without surrounding card. */
.flow-diagram {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 22px 0;
}
.flow-diagram .flow-diagram__title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 24px 0 6px;
  max-width: 80ch;
  scroll-margin-top: 80px;
}
.flow-diagram .flow-diagram__subtitle {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 20px;
  max-width: 80ch;
}
.flow-diagram__steps {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.flow-step {
  flex: 1 1 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flow-diagram .flow-step__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.25;
  margin: 0;
  max-width: none;
}
.flow-diagram .flow-step__sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin: 4px 0 0;
  max-width: none;
}
.flow-arrow {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  position: relative;
}
/* Horizontal arrow: thin line + filled triangle at right.
   Line ends exactly at triangle's flat base (right: 13 == triangle's left edge). */
.flow-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  right: 13px;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%);
}
.flow-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent currentColor;
  transform: translateY(-50%);
}
/* Vertical-down arrow: triangle at bottom, line above. */
.flow-arrow--down::before {
  top: 6px;
  bottom: 13px;
  height: auto;
  left: 50%;
  right: auto;
  width: 2px;
  transform: translateX(-50%);
}
.flow-arrow--down::after {
  top: auto;
  bottom: 6px;
  right: 50%;
  border-width: 7px 5px 0 5px;
  border-color: currentColor transparent transparent transparent;
  transform: translateX(50%);
}
/* Vertical chain (top-to-bottom) — left-aligned to match body text flow */
.flow-diagram--vertical .flow-diagram__steps {
  flex-direction: column;
  align-items: stretch;
  max-width: 460px;
  margin: 0;
}
.flow-diagram--vertical .flow-arrow {
  flex: 0 0 28px;
  height: 28px;
  width: 100%;
}

.flow-diagram .flow-diagram__footer {
  margin: 16px 0 0;
  padding: 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.55;
  max-width: 80ch;
}
.flow-diagram__footer .small {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

/* Compare layout (2-col side-by-side, each is a vertical chain) */
.flow-diagram--compare .flow-diagram__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.flow-diagram__col-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  margin: 0 0 12px;
}
.flow-diagram--compare .flow-diagram__steps {
  flex-direction: column;
  align-items: stretch;
}
.flow-diagram--compare .flow-arrow {
  flex: 0 0 24px;
  height: 24px;
}

/* Mobile: horizontal chains collapse to vertical */
@media (max-width: 768px) {
  .flow-diagram__steps {
    flex-direction: column;
    align-items: stretch;
  }
  .flow-diagram__steps > .flow-arrow {
    flex: 0 0 24px;
    height: 24px;
    width: 100%;
  }
  /* Mobile: collapsed horizontal arrows render in vertical layout context.
     The .flow-arrow--down rules will only apply where explicitly set in HTML;
     for horizontal arrows that we collapse, we add an explicit override here. */
  .flow-diagram__steps > .flow-arrow:not(.flow-arrow--down)::before {
    top: 6px;
    bottom: 13px;
    left: 50%;
    right: auto;
    height: auto;
    width: 2px;
    transform: translateX(-50%);
  }
  .flow-diagram__steps > .flow-arrow:not(.flow-arrow--down)::after {
    top: auto;
    bottom: 6px;
    right: 50%;
    border-width: 7px 5px 0 5px;
    border-color: currentColor transparent transparent transparent;
    transform: translateX(50%);
  }
  .flow-diagram--compare .flow-diagram__cols { grid-template-columns: 1fr; }
}

/* Glossar definition list */
.glossar-list {
  margin: 0 0 28px;
  padding: 0;
}
.glossar-list dt {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 24px 0 6px;
  letter-spacing: -0.005em;
  scroll-margin-top: 80px;
}
.glossar-list dt:first-child { margin-top: 0; }
.glossar-list dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  max-width: 80ch;
}
.glossar-list dd:last-child { border-bottom: 0; }
.glossar-list dd a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.glossar-list dd a:hover { color: var(--ink-strong); }

/* Callout — "Wichtiger Hinweis" */
.kb-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 24px 0;
}
.kb-callout__icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--green);
  margin-top: 1px;
}
.kb-callout__body { min-width: 0; }
.kb-callout__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 4px;
}
.kb-callout__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

/* Related articles at end */
.kb-related {
  margin: 56px 0 0;
  padding: 24px 28px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.kb-related__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 12px;
}
.kb-related__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 768px) {
  .kb-related__list { grid-template-columns: 1fr 1fr; }
}
.kb-related__list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-xs);
  transition: background .15s ease;
}
.kb-related__list a:hover { background: var(--surface); color: var(--green); }
.kb-related__list a svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--muted-2); }

/* Pricing contact note (under tiers) */
.pricing-contact {
  max-width: 880px;
  margin: 24px auto 0;
  padding: 0 4px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.pricing-contact a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 600;
}
.pricing-contact a:hover { color: var(--ink-strong); }

/* Pricing page tiers */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 0 auto 32px;
  max-width: 880px;
}
@media (min-width: 768px) {
  .tier-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
.tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.tier--highlight {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), var(--shadow-soft);
}
.tier--muted {
  border-color: var(--border-soft);
  box-shadow: none;
  opacity: 0.85;
}
.tier--muted .tier__name { color: var(--muted); }
.tier__badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 0 12px;
}
.tier__name {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.tier__price {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
}
.tier__price strong { color: var(--ink-strong); font-weight: 700; font-size: 16px; }
.tier__features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.tier__features li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.tier__features svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--green);
  margin-top: 1px;
}

/* ============================================================
   AUTH / FORMS — shared primitives for /auth/*, future /pricing, etc.
   ============================================================ */
.auth-shell {
  min-height: calc(100vh - 56px - 200px); /* header + footer */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px var(--pad-x-mobile);
}
@media (min-width: 768px) {
  .auth-shell { min-height: calc(100vh - 64px - 200px); padding: 56px var(--pad-x-desktop); }
}
.auth-shell__title {
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0 0 24px;
  text-align: center;
}
.auth-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 28px;
}
@media (min-width: 768px) {
  .auth-card { padding: 36px; }
}
.form-actions {
  width: min(520px, 100%);
}

.form-field { display: block; margin: 0 0 16px; }
.form-field:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
  margin: 0 0 4px;
}
.form-hint {
  display: block;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input::placeholder { color: var(--muted-3); }
.form-input:focus {
  border-color: var(--ink-strong);
  box-shadow: 0 0 0 3px rgba(20, 35, 58, 0.08);
}
[data-theme="dark"] .form-input:focus { box-shadow: 0 0 0 3px rgba(107, 176, 66, 0.15); border-color: var(--green); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.form-meta {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.form-actions {
  width: min(480px, 100%);
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.form-actions__back {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 0;
}
.form-actions__back:hover { color: var(--ink-strong); }
.form-actions .btn { min-width: 200px; justify-content: center; }
.form-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   BACK-TO-TOP — fixed FAB, fades in after hero scrolled past
   ============================================================ */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-hard);
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, background .15s ease, border-color .15s ease;
  z-index: 90;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover { background: var(--surface-tint); border-color: var(--ink-strong); }
.back-to-top:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.back-to-top svg { width: 18px; height: 18px; }
@media (min-width: 768px) {
  .back-to-top { right: 24px; bottom: 24px; width: 44px; height: 44px; }
  .back-to-top svg { width: 20px; height: 20px; }
}

/* small util */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
