:root {
  --primary: #21567f;
  --primary-dark: #173c59;
  --primary-soft: #eaf1f6;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #27343d;
  --muted: #677783;
  --border: #dce3e8;
  --shadow: 0 8px 28px rgba(27, 49, 66, 0.08);
  --sidebar-width: 315px;
  --topbar-height: 72px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
}

a { color: var(--primary); }

a:hover { color: var(--primary-dark); }

button, input { font: inherit; }

.topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(260px, 620px);
  align-items: center;
  gap: 34px;
  padding: 0 30px;
  background: rgba(255,255,255,.98);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}


.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  color: var(--primary-dark);
  font-size: 1.08rem;
}

.brand-text small {
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
}

.search-wrap {
  position: relative;
  width: min(100%, 620px);
}

.search-wrap input {
  width: 100%;
  padding: 11px 42px 11px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #f8fafb;
  color: var(--text);
}

.search-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(33,86,127,.12);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(68vh, 600px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.search-result {
  display: block;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid #edf0f2;
}

.search-result:last-child { border-bottom: 0; }

.search-result:hover,
.search-result:focus {
  background: var(--primary-soft);
}

.search-result strong {
  display: block;
  color: var(--primary-dark);
}

.search-result small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.search-empty {
  padding: 18px;
  color: var(--muted);
}

.sidebar {
  position: fixed;
  z-index: 20;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 22px 18px 36px 22px;
  background: #fff;
  border-right: 1px solid var(--border);
}

.nav-tree,
.nav-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-tree ul {
  margin: 5px 0 10px 12px;
  padding-left: 12px;
  border-left: 1px solid #e5eaee;
}

.nav-tree li { margin: 1px 0; }

.nav-tree a,
.nav-heading {
  display: block;
  padding: 7px 9px;
  border-radius: 7px;
  line-height: 1.35;
}

.nav-tree a {
  color: #43515b;
  text-decoration: none;
  font-size: .92rem;
}

.nav-tree a:hover { background: #f4f7f9; }

.nav-tree a.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 650;
}

.nav-heading {
  margin-top: 8px;
  color: var(--primary-dark);
  font-size: .92rem;
  font-weight: 750;
}

.main {
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 28px) clamp(24px, 4vw, 62px) 50px;
}

.breadcrumbs {
  max-width: 1020px;
  margin: 0 auto 12px;
  color: var(--muted);
  font-size: .86rem;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--primary); }

.content {
  max-width: 1020px;
  min-height: 55vh;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 54px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: none;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  line-height: 1.25;
  color: var(--primary-dark);
  scroll-margin-top: calc(var(--topbar-height) + 22px);
}

.content h1 {
  margin-top: 0;
  padding-bottom: .5em;
  border-bottom: 1px solid var(--border);
  font-size: clamp(1.85rem, 4vw, 2.5rem);
}

.content h2 {
  margin-top: 2em;
  color: var(--primary);
}

.content h3 { margin-top: 1.6em; }

.content p,
.content ul,
.content ol,
.content table,
.content blockquote,
.content pre {
  margin-top: 1em;
  margin-bottom: 1em;
}

.content li + li { margin-top: .3em; }

.content blockquote {
  margin-left: 0;
  padding: 10px 18px;
  background: #f3f7fa;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  color: #3d4f5d;
}

.content blockquote > :first-child { margin-top: 0; }
.content blockquote > :last-child { margin-bottom: 0; }

.content code {
  padding: .12em .35em;
  border-radius: 5px;
  background: #eef2f4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

.content pre {
  overflow: auto;
  padding: 16px;
  border-radius: 9px;
  background: #1f2931;
  color: #f6f8fa;
}

.content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.content table {
  width: 100%;
  border-collapse: collapse;
}

.content th,
.content td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--border);
}

.content th {
  background: #f0f4f7;
  color: var(--primary-dark);
}

.content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.content img {
  max-width: 100%;
  height: auto;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: 1020px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .78rem;
}

.loading { color: var(--muted); }

.error-box {
  padding: 18px;
  background: #fff5f3;
  border: 1px solid #efc6bd;
  border-radius: 9px;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  padding: 9px;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.menu-button span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--primary-dark);
}

.sidebar-backdrop {
  position: fixed;
  z-index: 15;
  inset: var(--topbar-height) 0 0 0;
  background: rgba(20,30,38,.38);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    padding: 0 14px;
  }

  .menu-button { display: block; }

  .brand {
    min-width: 0;
  }

  .brand-text small { display: none; }

  .search-wrap {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    width: auto;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid var(--border);
  }

  .search-results {
    left: 14px;
    right: 14px;
  }

  .sidebar {
    top: calc(var(--topbar-height) + 61px);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    top: calc(var(--topbar-height) + 61px);
  }

  .main {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 88px) 14px 38px;
  }

  .content {
    padding: 28px 22px 40px;
  }
}

@media (max-width: 600px) {
  .brand-mark { width: 36px; height: 36px; }
  .content { border-radius: 9px; }
  .footer { flex-direction: column; gap: 4px; }
}


/* Schullogo in der Kopfzeile */
.topbar .brand .school-logo {
    display: block;
    width: auto !important;
    height: 42px !important;
    max-width: 140px !important;
    max-height: 42px !important;
    object-fit: contain;
    flex-shrink: 0;
}
