/* Rahmen des Portals. Nur Rollen aus tokens.css, Ecken 0, keine Schatten. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--size-body);
  line-height: 1.4;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Kopf */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6);
  padding: var(--space-4) max(16px, 3vw);
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; font-weight: var(--weight-bold); }
.brand svg { height: 20px; width: auto; color: var(--logo); }
#nav { flex: 1; min-width: 0; }

/* Board-Menü: der Titel des aktuellen Boards als Überschrift mit orangem Strich wie zuvor, daneben
   ein Pfeil als Hinweis auf das Menü; aufgeklappt alle Boards nach Bereich */
.menu { position: relative; display: inline-block; max-width: 100%; }
.menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) 0; border-bottom: 2px solid var(--orange);
  color: var(--text); font-weight: var(--weight-bold); max-width: 100%;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu summary::after { content: "▾"; color: var(--text-muted); font-size: var(--size-small); font-weight: var(--weight-regular); }
.menu[open] summary::after { content: "▴"; }
.menu summary:hover::after { color: var(--text); }
.menu-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0;
  width: min(720px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line);
  padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4);
}
.menu-home { font-size: var(--size-small); color: var(--text-muted); text-decoration: none; }
.menu-home:hover { color: var(--text); text-decoration: underline; }
.menu-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4) var(--space-6); }
.menu-group h3 {
  margin: 0 0 var(--space-1); font-size: var(--size-micro); font-weight: var(--weight-bold);
  text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted);
}
.menu-group a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: var(--size-small); }
.menu-group a:last-child { border-bottom: 0; }
.menu-group a:hover { color: var(--orange); }
.menu-group a[aria-current="page"] { font-weight: var(--weight-bold); }
.menu-group a[aria-current="page"]::before { content: "▸ "; color: var(--orange); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); font-size: var(--size-small); color: var(--text-muted); }
.signed-out { padding: var(--space-6) max(16px, 3vw); max-width: 640px; }
.logout { color: var(--text-muted); }
.logout:hover { color: var(--text); }
.stand::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 9999px; background: var(--good); margin-right: 6px; }
.stand[data-state="unknown"]::before, .stand[data-state="stale"]::before { background: var(--bad); }
.stand[data-state="stale"] { color: var(--bad); font-weight: var(--weight-bold); }
.seg { display: inline-flex; border: 1px solid var(--line); }
.seg button { font: inherit; font-size: var(--size-micro); padding: 6px 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); font-weight: var(--weight-bold); }

/* Inhalt */
main {
  max-width: 1440px; margin: 0 auto;
  padding: var(--space-6) max(16px, 3vw) 64px;
  display: flex; flex-direction: column; gap: var(--space-6);
}
h1 { font-size: 32px; font-weight: var(--weight-regular); line-height: 1.1; margin: 0; }
.area { margin: 0 0 var(--space-1); font-size: var(--size-small); color: var(--text-muted); }
.description { margin: var(--space-2) 0 0; color: var(--text-muted); max-width: 72ch; }

.board-head { display: flex; flex-direction: column; gap: var(--space-4); }

/* Begriffsliste unter der Beschreibung */
.glossary { margin-top: var(--space-3); max-width: 960px; font-size: var(--size-small); }
.glossary summary { cursor: pointer; color: var(--text-muted); list-style: none; }
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary::before { content: "▸ "; }
.glossary[open] summary::before { content: "▾ "; }
.glossary-label { font-weight: var(--weight-bold); color: var(--text); }
.glossary dl {
  margin: var(--space-3) 0 0; padding: var(--space-4); background: var(--card);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3) var(--space-6);
}
.glossary dt { font-weight: var(--weight-bold); }
.glossary dd { margin: 2px 0 0; color: var(--text); }

/* Filterleiste */
.filters { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3) var(--space-6); }
.filter-unit .seg button { font-size: var(--size-small); padding: 6px 12px; min-height: 36px; }
/* Schalter ohne Überschrift auf Höhe der übrigen Felder */
.filter-toggle { padding-top: 22px; }
.filter { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--size-small); }
.filter > label:not(.switch), .filter-label { font-size: var(--size-micro); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); }
.filter summary {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 0; padding: 6px 10px; min-height: 36px;
}
.filter summary { cursor: pointer; list-style: none; min-width: 180px; }
.filter summary::after { content: " ▾"; color: var(--text-muted); }
.filter details { position: relative; }
.filter .options {
  position: absolute; z-index: 10; top: 100%; left: 0; min-width: 260px;
  background: var(--card); border: 1px solid var(--line); padding: var(--space-2);
  display: flex; flex-direction: column; gap: var(--space-1);
}
.filter .options label { display: flex; gap: var(--space-2); align-items: center; padding: 2px 0; }
.filter .options .option { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; }
.filter .options .option button { align-self: center; color: var(--text-muted); padding: 4px 6px; }
.filter .options .option button:hover, .filter .options .option button:focus-visible { color: var(--text); }
.filter .options button {
  font: inherit; font-size: var(--size-micro); align-self: flex-start; background: none; border: 0;
  color: var(--text); text-decoration: underline; cursor: pointer; padding: 2px 0;
}
/* Suche in langen Mehrfachauswahlen */
.filter .option-search {
  font: inherit; font-size: var(--size-small); color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 0; padding: 5px 8px; min-height: 34px; width: 100%;
  box-sizing: border-box;
}
.filter .option-search:focus { border-color: var(--text); }
.filter .option-list { display: flex; flex-direction: column; gap: var(--space-1); max-height: min(60vh, 420px); overflow-y: auto; }
.filter .options .option[hidden], .filter .option-empty[hidden] { display: none; }
.filter .option-empty { margin: 0; padding: 2px 0; color: var(--text-muted); }
/* Zeitraum */
.filter-date_range summary { min-width: 280px; }
.filter-date_range summary b { font-weight: var(--weight-bold); }
.filter-hint { font-size: var(--size-micro); color: var(--text-muted); }
.filter .date-options { min-width: min(420px, calc(100vw - 32px)); gap: var(--space-2); padding: var(--space-3); }
.date-heading { margin: var(--space-2) 0 0; font-size: var(--size-micro); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); }
.date-heading:first-child { margin-top: 0; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1); }
.filter .presets button, .filter .date-row button {
  font: inherit; font-size: var(--size-small); text-decoration: none; text-align: left;
  border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 6px 10px; cursor: pointer;
}
.filter .presets button:hover, .filter .date-row button:hover { border-color: var(--text); }
.filter .presets button[aria-pressed="true"] { background: var(--text); color: var(--card); font-weight: var(--weight-bold); }
.filter .date-row button { align-self: center; }
.date-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.date-row input[type="number"] { width: 4.5em; }
.date-row input, .date-row select {
  font: inherit; font-size: var(--size-small); color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 0; padding: 5px 8px; min-height: 34px;
}
.date-row label { display: flex; gap: var(--space-1); align-items: center; font-size: var(--size-small); }
.date-error { margin: 0; color: var(--bad-fg); background: var(--bad-bg); padding: var(--space-2); font-size: var(--size-small); }
.date-error[hidden] { display: none; }
.date-note { margin: var(--space-1) 0 0; font-size: var(--size-micro); color: var(--text-muted); }

.switch { display: flex; gap: var(--space-2); align-items: center; min-height: 36px; }
.switch input, .filter .options input[type="checkbox"] { accent-color: var(--text); width: 16px; height: 16px; }

/* Abschnitte */
.sections { display: flex; flex-direction: column; gap: var(--space-3); }
.board-section { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-6); }
.board-section h2 { margin: 0; font-size: 24px; font-weight: var(--weight-regular); line-height: 1.2; }
.board-section .description { margin: 0; }
.group-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.placeholder {
  background: var(--card); border: 1px solid var(--line); color: var(--text-muted);
  padding: var(--space-4) 18px; font-size: var(--size-small);
}
.error { color: var(--bad-fg); background: var(--bad-bg); padding: var(--space-3) var(--space-4); }

/* Startseite: Bereiche mit Karten je Board */
.overview-group { display: flex; flex-direction: column; gap: var(--space-3); }
.overview-group h2 { margin: 0; font-size: 24px; font-weight: var(--weight-regular); line-height: 1.2; }
.overview { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-3); }
.overview li { display: flex; }
.overview a, .overview .broken {
  display: flex; flex-direction: column; gap: var(--space-2); width: 100%;
  background: var(--card); border: 1px solid var(--card-line); padding: var(--space-4) 18px;
  text-decoration: none; color: var(--text);
}
.overview a:hover { border-color: var(--text); }
.overview .title { font-size: var(--size-heading); font-weight: var(--weight-bold); line-height: 1.3; }
.overview .description { margin: 0; font-size: var(--size-small); max-width: none; }
.overview .error { margin: 0; font-size: var(--size-small); }
.muted { color: var(--text-muted); }
.agent-access { display: flex; flex-direction: column; gap: var(--space-2); max-width: 72ch; }
.agent-access h2 { margin: 0; font-size: 24px; font-weight: var(--weight-regular); line-height: 1.2; }
.agent-access p, .agent-access ul { margin: 0; font-size: var(--size-small); }
.agent-access ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--space-1); }
.agent-access code { font-size: inherit; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); padding: 1px 4px; }
