/* Aufbau und Bausteine. Farben, Flächen, Rundungen, Schriftgrössen und Abstände kommen nur
   aus tokens.css (Variablen). Breiten: schmal bis 860 px (Handy, Kopfzeile und Leiste unten),
   mittel bis 1180 px (ohne rechte Spalte), breit darüber. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--sp-5); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: var(--lh);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: var(--lh-tight); margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
/* Sprunglink: unsichtbar und ohne Schatten, bis er den Fokus hat */
.skip { position: absolute; left: var(--sp-3); top: var(--sp-3); z-index: 100; padding: var(--sp-2) var(--sp-4); background: var(--surface); color: var(--text); border-radius: var(--radius-s); clip-path: inset(50%); }
.skip:focus { clip-path: none; box-shadow: var(--shadow-pop); }
.main:focus { outline: none; }

kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; font-size: var(--fs-xs); line-height: 1.5; text-align: center;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}

/* ---- Hülle ----------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.shell.is-bare { display: block; }
.topbar, .tabbar, .scrim, .side-top .side-close { display: none; }

.side {
  position: sticky;
  top: var(--side-gap);
  align-self: start;
  height: calc(100vh - 2 * var(--side-gap));
  margin: var(--side-gap) 0 var(--side-gap) var(--side-gap);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-3) var(--sp-3);
  overflow-y: auto;
  color: var(--side-text);
  background: var(--side-bg);
  backdrop-filter: var(--side-blur);
  -webkit-backdrop-filter: var(--side-blur);
  border-radius: var(--side-radius);
  box-shadow: 0 0 0 1px var(--side-line);
  scrollbar-width: thin;
}
.side :focus-visible { outline-color: var(--side-focus); }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.brand { display: block; padding: 0 var(--sp-2) var(--sp-1); text-decoration: none; color: var(--side-strong); }
.monogram {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent-ink); background: var(--accent);
}
.brand-neutral { display: flex; align-items: center; gap: var(--sp-3); }
.brand-neutral .brand-name { display: grid; line-height: 1.25; min-width: 0; }
.brand-neutral .brand-name strong { font-family: var(--font-display); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-neutral .brand-name span { margin-top: 2px; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-faint); }
.card .monogram { width: 48px; height: 48px; font-size: 18px; border-radius: 12px; justify-self: start; }
.operated { font-size: var(--fs-xs); color: var(--faint); }
.brand img { display: block; height: 30px; width: auto; }
.brand > img + span { display: block; margin-top: 10px; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-faint); }

.quick {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-2) 0 var(--sp-3);
  color: var(--side-text); text-decoration: none; font-size: var(--fs-s);
  background: var(--side-field); border: 1px solid var(--side-line); border-radius: 8px;
}
.quick .icon { width: 17px; height: 17px; }
.quick span { flex: 1; }
.quick:hover { background: var(--side-hover); color: var(--side-strong); border-color: var(--side-line-strong); }
.quick-key { color: var(--side-faint); background: var(--side-field); border-color: var(--side-line); }

.side-nav { display: grid; gap: var(--sp-3); }
.nav-title { padding: var(--sp-2) 10px var(--sp-1); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--side-faint); }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; padding: 6px 10px;
  border-radius: 8px;
  color: var(--side-text); text-decoration: none; font-size: 14px;
}
.nav-icon { order: -1; width: 18px; height: 18px; opacity: 0.85; }
a.nav-item:hover { background: var(--side-hover); color: var(--side-strong); }
.nav-item.is-active { background: var(--side-active); color: var(--side-strong); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-line); }
.nav-item.is-active .nav-icon { opacity: 1; color: var(--accent); }
.nav-item.is-active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.is-soon { color: var(--side-faint); cursor: default; }
.nav-item.is-soon .nav-icon { opacity: 0.6; }
.nav-item small { margin-left: auto; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--side-faint); border: 1px solid var(--side-line); border-radius: var(--radius-pill); padding: 1px 7px; }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: var(--radius-pill);
  font-size: 11px; line-height: 20px; text-align: center; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
}

.side-foot { margin-top: auto; padding: var(--sp-3) var(--sp-1) 0; border-top: 1px solid var(--side-line); display: grid; gap: var(--sp-2); font-size: var(--fs-s); }
.theme-btn {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; width: 100%;
  font-size: var(--fs-s); text-align: left; color: var(--side-text);
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
.theme-btn:hover { background: var(--side-hover); color: var(--side-strong); }
.theme-btn .icon { width: 18px; height: 18px; display: none; }
.theme-btn[data-mode="auto"] .theme-auto, .theme-btn[data-mode="day"] .theme-day, .theme-btn[data-mode="night"] .theme-night { display: block; }
.who { display: flex; align-items: center; gap: 10px; padding: 0 0 0 6px; }
.who strong { flex: 1; min-width: 0; color: var(--side-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Der Name führt zu den eigenen Anmeldungen (/account) */
.who-link { flex: 1; min-width: 0; display: flex; align-items: center; min-height: var(--touch); border-radius: 8px; text-decoration: none; }
.who-link:hover strong { text-decoration: underline; }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%;
  font-family: var(--font-display); font-size: var(--fs-s); font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
}
.avatar.is-agent { color: var(--text); background: var(--surface-3); }

.icon-btn {
  display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); flex: none;
  color: inherit; background: none; border: 0; border-radius: 10px; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn-side { width: 36px; height: 36px; color: var(--side-faint); }
.icon-btn-side:hover { color: var(--side-strong); background: var(--side-hover); }

.main { min-width: 0; padding: var(--sp-7) clamp(16px, 4vw, 48px) 72px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.shell.is-bare .main { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-6) var(--sp-4); }

/* ---- Bausteine ------------------------------------------------------------- */

.eyebrow { font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--eyebrow); font-weight: 600; }
.lede { color: var(--muted); max-width: 68ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
.group + .group, .note.group { margin-top: var(--sp-5); }
.note.group { margin-top: 0; margin-bottom: var(--sp-4); }

.page-head { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; }
.head-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--sp-2) var(--sp-4); }
.head-row > .btn { justify-self: start; }
.head-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.panel {
  background: var(--surface);
  backdrop-filter: var(--surface-blur);
  -webkit-backdrop-filter: var(--surface-blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.panel-head h2 { font-size: var(--fs-m); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
.panel-head h2 .icon { width: 18px; height: 18px; color: var(--faint); }
.panel-body { padding: 0 var(--sp-5) var(--sp-5); }
.section-head { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-3); }
.section-head h2 { font-size: var(--fs-l); display: flex; align-items: center; gap: var(--sp-2); }
.section-head h2 .icon { color: var(--faint); }
.avatar .icon { width: 16px; height: 16px; }
.panel-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); font-size: var(--fs-s); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: var(--sp-5); align-items: start; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; min-height: 24px;
  border-radius: var(--radius-pill); font-size: var(--fs-xs); line-height: 20px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  text-decoration: none; white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; }
a.chip { min-height: 32px; padding: 4px 12px; }
a.chip:hover { border-color: var(--line-strong); color: var(--text); background: var(--hover); }
.chip.is-on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); font-weight: 600; }
.chip.is-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.is-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.is-link { background: var(--link-soft); color: var(--link); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--touch); padding: 0 var(--sp-5);
  font: inherit; font-weight: 600;
  color: var(--btn-text); background: var(--btn-bg);
  border: 0; border-radius: var(--radius-s);
  box-shadow: var(--btn-shadow);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { background: var(--btn-bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: var(--disabled); cursor: progress; transform: none; }
.btn-quiet { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-quiet:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--muted); }
.btn-ghost { color: var(--text); background: none; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { color: var(--danger); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.btn-small { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-s); }
.is-busy .btn[type="submit"], .btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid var(--btn-text); border-right-color: transparent; border-radius: 50%;
}
.btn-quiet.is-busy::after { border-color: var(--text); border-right-color: transparent; }

.field, .search input[type="search"], select.field, .filters select {
  min-height: var(--touch); padding: 0 var(--sp-4);
  font: inherit; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--radius-s);
}
.field:hover, .search input[type="search"]:hover { border-color: var(--muted); }
.field:focus, .search input:focus, .editor:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.field::placeholder, input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
.field { flex: 1 1 260px; }

.search { display: flex; gap: 10px; }
.search input[type="search"] { flex: 1; min-width: 0; }
.search-big { position: relative; flex: 1; min-width: 0; display: flex; }
.search-big input[type="search"] { width: 100%; }
.search-big .icon { position: absolute; left: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-big input[type="search"] { padding-left: 46px; }

.rows > li + li { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--sp-4); align-items: baseline;
  padding: var(--sp-3) var(--sp-5); color: inherit; text-decoration: none;
}
a.row:hover { background: var(--hover); }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { color: var(--faint); font-size: var(--fs-s); white-space: nowrap; }
.row-sub { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mehrere Angaben, die am Handy nicht abgeschnitten werden dürfen (Anmeldungen) */
.row-sub.is-wrap { white-space: normal; }
.rows:last-child > li:last-child .row { border-radius: 0 0 var(--radius) var(--radius); }

.empty { padding: var(--sp-7) var(--sp-5); color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: var(--sp-1); }

.note { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-s); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-s); }
.note.is-ok { background: var(--ok-soft); color: var(--ok); }
.note .icon { width: 18px; height: 18px; margin-top: 1px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-s); color: var(--faint); margin-bottom: var(--sp-3); }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }

/* ---- Meldungen ------------------------------------------------------------- */

.toasts { position: fixed; z-index: 60; right: var(--sp-5); bottom: var(--sp-5); display: grid; gap: var(--sp-2); width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  color: var(--toast-text); background: var(--toast-bg); border: 1px solid var(--toast-line); border-radius: 12px;
  box-shadow: var(--shadow-pop); font-size: var(--fs-s); pointer-events: auto;
}
.toast .icon { color: var(--toast-icon); }
.toast.is-gone { opacity: 0; transform: translateY(8px); }

/* ---- Schnellsuche (Ctrl+K) -------------------------------------------------- */

.palette {
  width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 48px)); padding: 0; margin: 12vh auto auto;
  color: var(--text); background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; }
.palette::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.palette-form { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); }
.palette-form > .icon { color: var(--faint); }
.palette-form input { flex: 1; min-width: 0; min-height: 48px; font: inherit; font-size: var(--fs-l); color: var(--text); background: none; border: 0; }
.palette-form input:focus { outline: none; }
.palette-form input::-webkit-search-cancel-button { display: none; }
.palette-list { flex: 1; overflow-y: auto; padding: var(--sp-2); scrollbar-width: thin; }
.palette-group { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.palette-item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 10px var(--sp-3); border-radius: var(--radius-s); cursor: pointer; }
.palette-item > .icon { margin-top: 2px; color: var(--faint); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.palette-item[aria-selected="true"] > .icon { color: var(--accent-text); }
.palette-text { display: grid; min-width: 0; gap: 1px; }
.palette-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { color: var(--muted); font-size: var(--fs-s); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.palette-path { color: var(--faint); font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.palette-empty { padding: var(--sp-5) var(--sp-4); color: var(--muted); font-size: var(--fs-s); }
.palette-foot { display: flex; flex-wrap: wrap; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--faint); }

/* ---- Heute ----------------------------------------------------------------- */

.hero { padding: clamp(8px, 3vw, 32px) 0 var(--sp-6); display: grid; gap: var(--sp-4); }
.hero h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.03em; }
.hero .search { max-width: 780px; margin-top: var(--sp-2); }
.hero .search input[type="search"] { min-height: 58px; font-size: var(--fs-l); }
.hero .btn { min-height: 58px; padding: 0 var(--sp-6); }
.hero-meta { color: var(--muted); font-size: var(--fs-s); display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); color: var(--muted); font-size: var(--fs-s); }
.facts strong { color: var(--text); font-variant-numeric: tabular-nums; }
.waiting-link { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--touch); padding: 0 var(--sp-4); border-radius: var(--radius-pill); font-weight: 600; text-decoration: none; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.waiting-link:hover { background: var(--selected); border-color: var(--accent); }
.waiting-link .icon { width: 18px; height: 18px; }

.track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px var(--sp-5) 22px; }
.track li { position: relative; padding: 30px 14px 0 0; }
.track li::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--track); }
.track li::after { content: ""; position: absolute; top: 2px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-strong); }
.track li.is-passed::before { background: var(--accent); }
.track li.is-passed::after { background: var(--accent); border-color: var(--accent); }
.track li.is-now::before { background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 34%, var(--track) 62%); }
.track li.is-now::after { background: var(--surface); border-color: var(--accent); box-shadow: var(--track-glow); }
.track strong { display: block; font-size: 14px; }
.track span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.track li.is-todo strong { color: var(--muted); font-weight: 500; }
.track li.is-todo span { color: var(--faint); }

/* ---- Suche ----------------------------------------------------------------- */

.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.hit { display: grid; gap: 2px; padding: var(--sp-4) var(--sp-5); color: inherit; text-decoration: none; }
.hit:hover { background: var(--hover); }
.hit-path { font-size: var(--fs-xs); color: var(--faint); font-family: var(--mono); overflow-wrap: anywhere; }
.hit-title { font-weight: 600; color: var(--link); overflow-wrap: anywhere; }
.hit-title .sep { color: var(--faint); font-weight: 400; }
.hit-snippet { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; max-width: 95ch; line-height: 1.6; }
mark { background: var(--mark); color: var(--mark-text); border-radius: 3px; padding: 0 2px; }

.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: var(--sp-3); padding: 0 var(--sp-5) var(--sp-5); }
.area {
  display: grid; gap: 2px; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius-s);
  text-decoration: none; color: inherit; background: var(--surface-2);
}
.area .icon { color: var(--accent-text); margin-bottom: var(--sp-1); }
.area:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.area strong { display: block; font-size: var(--fs-m); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area span { font-size: var(--fs-s); color: var(--muted); }

/* ---- Seite ------------------------------------------------------------------ */

.doc { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: var(--sp-7); align-items: start; }
.doc-main { padding: var(--sp-7) clamp(18px, 3.4vw, 48px) var(--sp-8); }
.doc-title { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.doc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); flex: none; }
.doc-main .lede { margin-top: var(--sp-2); font-size: var(--fs-l); }
dl.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: var(--sp-4) 0 var(--sp-1); padding: 0 0 var(--sp-4); border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
dl.doc-meta > div { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
dl.doc-meta dt { color: var(--faint); }
dl.doc-meta dd { margin: 0; color: var(--muted); }
dl.doc-meta .doc-tags dd { display: flex; flex-wrap: wrap; gap: 4px 10px; }
dl.doc-meta .doc-tags a { color: var(--link); text-decoration: none; }
dl.doc-meta .doc-tags a::before { content: "#"; color: var(--faint); }
dl.doc-meta .doc-tags a:hover { text-decoration: underline; }
.doc-main .prose > :is(p, ul, ol, blockquote, h3, h4, h5, h6) { max-width: 75ch; }

.toc-inline { display: none; margin: var(--sp-4) 0 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); }
.toc-inline summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--touch); padding: 0 var(--sp-4); cursor: pointer; font-weight: 600; font-size: var(--fs-s); }
.toc-inline ul { padding: 0 var(--sp-4) var(--sp-3); }
.toc-inline a { display: block; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: var(--fs-s); }
.toc-inline li.is-sub a { padding-left: var(--sp-3); }

.rail { position: sticky; top: var(--sp-6); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: thin; padding-bottom: var(--sp-2); }
.rail h2 { font-family: var(--font); font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: var(--sp-2); }
.rail .panel { padding: var(--sp-4); }
.rail li { margin: 0; }
.rail li a { display: block; padding: 5px 0; font-size: var(--fs-s); color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.rail li a:hover { color: var(--text); text-decoration: underline; }
.rail dl { margin: 0; display: grid; gap: var(--sp-2); font-size: var(--fs-s); }
.rail dt { color: var(--faint); font-size: var(--fs-xs); }
.rail dd { margin: 0; overflow-wrap: anywhere; }
.toc li a { position: relative; padding: 5px 0 5px var(--sp-3); border-left: 2px solid var(--line); }
.toc li.is-sub a { padding-left: var(--sp-6); }
.toc li a.is-current { color: var(--text); font-weight: 600; border-left-color: var(--accent); }
.backlinks a { display: flex !important; gap: var(--sp-2); align-items: center; }
.backlinks .icon { width: 15px; height: 15px; color: var(--faint); }

.prose { font-size: 1rem; line-height: var(--lh-prose); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1em; }
.prose > :first-child { margin-top: var(--sp-5); }
.prose h1 { font-size: var(--fs-xl); margin-top: 1.6em; }
.prose h2 { font-size: var(--fs-xl); margin-top: 1.8em; padding-top: 0.9em; border-top: 1px solid var(--line); letter-spacing: -0.01em; }
.prose h3 { font-size: var(--fs-l); margin-top: 1.6em; font-family: var(--font-display); }
.prose h4, .prose h5, .prose h6 { font-size: var(--fs-m); margin: 1.4em 0 0; }
.prose :is(h2, h3, h4)[id] { scroll-margin-top: var(--sp-5); position: relative; }
.prose .anchor-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin-left: 6px; vertical-align: middle;
  color: var(--faint); background: none; border: 0; border-radius: 8px; cursor: pointer; opacity: 0;
}
.prose .anchor-btn .icon { width: 16px; height: 16px; }
.prose :is(h2, h3, h4):hover .anchor-btn, .prose .anchor-btn:focus-visible { opacity: 1; }
.prose .anchor-btn:hover { color: var(--text); background: var(--hover); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li::marker { color: var(--faint); }
.prose li + li { margin-top: 0.35em; }
.prose li > ul, .prose li > ol { margin-top: 0.35em; }
.prose li:has(> .task), .prose li:has(> p > .task) { list-style: none; margin-left: -1.4em; }
.prose .task { width: 16px; height: 16px; margin: 0 8px 0 0; vertical-align: -3px; accent-color: var(--accent); }
.prose blockquote {
  margin-left: 0; margin-right: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--accent-line);
  background: var(--accent-soft); border-radius: var(--radius-s); color: var(--text);
}
.prose blockquote > * + * { margin-top: 0.6em; }
.prose code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--code-bg); padding: var(--sp-4); border-radius: var(--radius-s); overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose strong { font-weight: 650; }
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-s); scrollbar-width: thin; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.5; }
.prose th, .prose td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); font-weight: 600; white-space: nowrap; font-size: var(--fs-s); color: var(--muted); }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.prose tbody tr:hover td { background: var(--hover); }
.prose td:first-child { font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.prose .ta-right { text-align: right; }
.prose .ta-center { text-align: center; }
.prose a.wikilink { color: var(--link); background: var(--link-soft); padding: 0 4px; border-radius: 4px; text-decoration: none; }
.prose a.wikilink:hover { text-decoration: underline; }
.prose a.wikilink.missing { color: var(--warn); background: var(--warn-soft); }
.prose a.nolink { color: inherit; text-decoration: underline dotted; cursor: help; }
.prose a.external::after { content: " ↗"; font-size: 0.8em; color: var(--faint); }
.prose .md-image { display: inline-block; padding: 2px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); color: var(--muted); font-size: var(--fs-s); }
.prose :target { animation: flash 1.6s var(--ease); }
@keyframes flash { from { background: var(--mark); } to { background: transparent; } }

/* ---- Schreiben ------------------------------------------------------------- */

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: var(--sp-4); }
.editor {
  display: block; width: 100%; min-height: 160px; padding: var(--sp-4);
  font-family: var(--mono); font-size: 14px; line-height: 1.65; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--radius-s);
  resize: vertical; tab-size: 2;
}
.editor-page { min-height: 60vh; }
.edit-tools { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; padding: var(--sp-2) 0; background: var(--surface-solid); }
.edit-tools button { min-height: 36px; font-size: var(--fs-s); padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.edit-tools button:hover { border-color: var(--line-strong); background: var(--hover); }
.slash-menu { position: sticky; bottom: 16px; z-index: 5; margin-top: -8px; width: min(340px, 100%); padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); box-shadow: var(--shadow-pop); }
.slash-menu[hidden] { display: none; }
.slash-menu button { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.slash-menu button[aria-selected="true"], .slash-menu button:hover { background: var(--accent-soft); color: var(--accent-text); }
.slash-menu code { font-size: var(--fs-xs); color: var(--faint); }
.save-bar { position: sticky; bottom: 0; z-index: 4; margin: var(--sp-5) calc(-1 * clamp(18px, 3.4vw, 48px)) calc(-1 * var(--sp-8)); padding: var(--sp-4) clamp(18px, 3.4vw, 48px); background: var(--surface-solid); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.save-bar.actions { margin-top: var(--sp-5); }

/* ---- Freigaben ------------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: var(--sp-4); }
.pcard { display: grid; gap: var(--sp-3); align-content: start; padding: var(--sp-5); color: inherit; text-decoration: none; position: relative; }
a.pcard:hover { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.pcard-head { display: flex; align-items: center; gap: var(--sp-3); }
.pcard-who { display: grid; min-width: 0; line-height: 1.3; }
.pcard-who strong { font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-who span { font-size: var(--fs-xs); color: var(--faint); }
.pcard-head .chip { margin-left: auto; }
.pcard h3 { font-family: var(--font-display); font-size: var(--fs-l); overflow-wrap: anywhere; }
.pcard-why { color: var(--muted); font-size: var(--fs-s); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-where { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-where .chip { white-space: normal; overflow-wrap: anywhere; }
.pcard-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-s); color: var(--accent-text); }
.pcard-go .icon { width: 16px; height: 16px; }

.review-head { display: grid; gap: var(--sp-4); padding: var(--sp-5); }
.review-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: var(--sp-4); }
.review-meta > div { display: grid; gap: 2px; }
.review-meta dt, .review-label { font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.review-meta dd { margin: 0; overflow-wrap: anywhere; }
.review-who { display: flex; align-items: center; gap: var(--sp-2); }
.evidence { margin: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-s); white-space: pre-wrap; color: var(--muted); font-size: 14px; }

.change-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.change-title { font-family: var(--mono); font-size: var(--fs-s); font-weight: 500; overflow-wrap: anywhere; color: var(--muted); }
.change-title a { color: var(--link); }
.diff-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); margin: 0 var(--sp-5) var(--sp-3); }
.diff-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-xs); color: var(--muted); }
.diff-legend .is-del, .diff-legend .is-add { padding: 0 8px; border-radius: 4px; font-family: var(--mono); }
.diff-legend .is-del { background: var(--del-bg); color: var(--del-text); }
.diff-legend .is-add { background: var(--add-bg); color: var(--add-text); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 7px; font-size: var(--fs-s); color: var(--muted); text-decoration: none; }
.seg a:hover { color: var(--text); background: var(--hover); }
.seg a[aria-current="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--line); font-weight: 600; }
.seg .icon { width: 16px; height: 16px; }

.diff { margin: 0 var(--sp-5) var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius-s); overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
.diff-line { display: grid; grid-template-columns: 26px minmax(0, 1fr); padding: 0 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-sign { text-align: center; color: var(--faint); user-select: none; }
.diff-line.is-del { background: var(--del-bg); color: var(--del-text); }
.diff-line.is-add { background: var(--add-bg); color: var(--add-text); }
.diff-line.is-gap { color: var(--faint); background: var(--surface-2); }
.diff del { background: var(--del-mark); text-decoration: line-through; text-decoration-thickness: 1px; border-radius: 3px; }
.diff ins { background: var(--add-mark); text-decoration: none; border-radius: 3px; }
.diff-split { display: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.diff-split .diff-cell { padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.65em; }
.diff-split .diff-cell + .diff-cell { border-left: 1px solid var(--line); }
.diff-split .diff-cell.is-del { background: var(--del-bg); color: var(--del-text); }
.diff-split .diff-cell.is-add { background: var(--add-bg); color: var(--add-text); }
.diff-split .diff-cell.is-gap { color: var(--faint); background: var(--surface-2); }
.diff-split .diff-cell.is-empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px); }
.diff-split .diff-colhead { padding: 6px 12px; font-family: var(--font); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.is-split .diff-unified { display: none; }
.is-split .diff-split { display: grid; }

.adjust { padding-top: 0; }
.adjust summary { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); cursor: pointer; color: var(--link); font-size: 14px; }
.decide { display: grid; gap: var(--sp-4); margin-top: var(--sp-5); padding: var(--sp-5); }
.decide-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.reject { display: grid; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.reject .search input[type="search"] { min-width: 0; }

/* ---- Meetings ---------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.filters select, select.field { min-height: 40px; padding: 0 var(--sp-3); font-size: 14px; }
.mtable { display: grid; }
.mrow { display: grid; grid-template-columns: 104px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 110px; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-5); color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
a.mrow:hover { background: var(--hover); }
.mhead { border-top: 0; font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.mrow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtitle strong { font-weight: 600; }
.state-geplant { background: var(--link-soft); color: var(--link); border-color: transparent; }
.state-abgelegt { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.state-verworfen { background: var(--surface-2); color: var(--faint); text-decoration: line-through; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.board .cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0 14px 14px; }
.card-item { display: grid; gap: var(--sp-1); padding: var(--sp-3) 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); color: inherit; text-decoration: none; }
.card-item:hover { border-color: var(--line-strong); }
.board-col.is-geplant .panel-head h2::before, .board-col.is-abgelegt .panel-head h2::before, .board-col.is-verworfen .panel-head h2::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.board-col.is-geplant .panel-head h2::before { background: var(--link); }
.board-col.is-abgelegt .panel-head h2::before { background: var(--ok); }
.board-col.is-verworfen .panel-head h2::before { background: var(--faint); }
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: var(--sp-3) var(--sp-4); align-items: end; margin: var(--sp-5) 0 6px; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); }
.props label { display: grid; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--faint); letter-spacing: 0.04em; text-transform: uppercase; }
.props .field { min-height: 40px; font-size: 14px; text-transform: none; letter-spacing: 0; }
.props .wide { grid-column: 1 / -1; }
.props-new { margin-top: 0; background: var(--surface); padding: var(--sp-6); }

/* ---- Katalog ----------------------------------------------------------------- */

.group-title { font-family: var(--mono); font-size: var(--fs-s); color: var(--muted); font-weight: 500; }

/* ---- Anmelden, Hinweis ------------------------------------------------------- */

.card { width: min(520px, 100%); padding: clamp(24px, 5vw, 44px); display: grid; gap: var(--sp-4); }
.card h1 { font-size: clamp(26px, 5vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
.card img { height: 34px; width: auto; justify-self: start; }
.card .logo-plate { justify-self: start; padding: 10px 14px; border-radius: var(--radius-s); background: var(--side-sheet); }
.card code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; }
.card form { margin-top: var(--sp-1); }
.card .login-form { display: grid; gap: var(--sp-3); }
.card .login-form .field { width: 100%; }
.card .btn { width: 100%; }

/* ---- Fragen ------------------------------------------------------------------- */

.ask { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--sp-7); align-items: start; }
/* Eine Spalte, die nie breiter wird als der Platz: Sonst schiebt eine lange Quelle oder eine Tabelle
   (nowrap) die ganze Seite seitlich hinaus */
.ask-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); min-width: 0; }
.chat { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }
.turn { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); scroll-margin-top: var(--sp-5); }
.turn > *, .chat > * { min-width: 0; }
.bubble.is-question {
  justify-self: end; max-width: min(640px, 88%); padding: var(--sp-3) var(--sp-4);
  border-radius: 16px 16px 4px 16px; background: var(--bubble-bg); color: var(--bubble-text); box-shadow: var(--bubble-ring);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble.is-question .who { color: var(--bubble-who); }
.bubble .who { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; color: var(--faint); margin-bottom: var(--sp-1); }
.bubble.is-answer { padding: var(--sp-5) clamp(16px, 3vw, 28px); }
.bubble.is-answer.is-fehler, .bubble.is-answer.is-grenze, .bubble.is-answer.is-abgebrochen { border-color: var(--warn); }
.agent-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--accent-ink); background: var(--accent); }
.agent-mark .icon { width: 15px; height: 15px; }
.bubble .prose { font-size: var(--fs-m); }
.bubble .prose > :first-child { margin-top: var(--sp-2); }
.answer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.turn-meta { font-size: var(--fs-xs); color: var(--faint); }
.sources { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.sources-title { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.sources ul { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.sources li { min-width: 0; max-width: 100%; }
.source {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; min-height: 32px; padding: 4px 10px;
  font-size: var(--fs-s); color: var(--link); background: var(--link-soft); border: 1px solid transparent; border-radius: 8px; text-decoration: none;
}
.source:hover { border-color: var(--link); }
.source .icon { width: 15px; height: 15px; flex: none; }
.source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source small { color: var(--ok); font-size: 11px; font-weight: 600; }
.source.is-presearch { color: var(--muted); background: var(--surface-2); }

.activity { display: grid; gap: var(--sp-1); margin: var(--sp-2) 0 0; font-size: var(--fs-s); color: var(--muted); }
.activity-now { display: flex; align-items: center; gap: var(--sp-2); min-height: 24px; overflow-wrap: anywhere; }
.activity-now::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.activity-now.is-done::before { background: var(--faint); box-shadow: none; }
.activity-past summary { display: inline-flex; align-items: center; min-height: var(--touch); cursor: pointer; color: var(--faint); }
.activity-past ol { display: grid; gap: 2px; padding-left: var(--sp-5); list-style: decimal; color: var(--faint); overflow-wrap: anywhere; }
.live-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: var(--sp-3); line-height: var(--lh-prose); }
.live-text:empty { display: none; }
.caret { display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: var(--accent); border-radius: 2px; }

.ask-form { position: sticky; bottom: var(--sp-4); z-index: 5; padding: var(--sp-3); display: grid; gap: var(--sp-2); box-shadow: var(--shadow-2); background: var(--surface-solid); }
.ask-form textarea {
  width: 100%; min-height: 56px; max-height: 40vh; padding: var(--sp-3) var(--sp-4);
  font: inherit; color: var(--text); background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--radius-s); resize: vertical;
}
.ask-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.ask-actions .btns { display: flex; gap: var(--sp-2); margin-left: auto; }
.ask-form [data-ask-stop] { display: none; }
.ask-form.is-busy [data-ask-stop] { display: inline-flex; }
.ask-form.is-busy button[type="submit"] { display: none; }

.welcome { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-7) var(--sp-6); text-align: center; justify-items: center; }
.welcome .agent-mark { width: 48px; height: 48px; border-radius: 14px; }
.welcome .agent-mark .icon { width: 26px; height: 26px; }
.welcome h2 { font-size: var(--fs-xl); }
.suggest { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: var(--sp-2); width: 100%; margin-top: var(--sp-2); text-align: left; }
.suggest a {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 52px; padding: var(--sp-2) var(--sp-4);
  color: var(--text); text-decoration: none; font-size: var(--fs-s); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
}
.suggest a:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.suggest .icon { width: 16px; height: 16px; color: var(--accent-text); }
.suggest li, .suggest span { min-width: 0; overflow-wrap: anywhere; }
.ask-rail li a.is-current { color: var(--text); font-weight: 600; }
.convs li a { display: flex !important; gap: var(--sp-2); align-items: center; border-radius: 6px; padding: 7px 8px !important; margin: 0 -8px; }
.convs li a:hover { background: var(--hover); text-decoration: none !important; }
.convs li a.is-current { background: var(--accent-soft); }
.convs .icon { width: 15px; height: 15px; color: var(--faint); }
.convs span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rules li { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 5px 0; font-size: var(--fs-s); }
.lede.wide { grid-column: 1 / -1; }

/* ---- Mittel ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .doc, .ask { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
  .doc .rail .toc-panel { display: none; }
  .toc-inline { display: block; }
}

/* ---- Schmal (Handy) ------------------------------------------------------------ */

@media (max-width: 860px) {
  html { scroll-padding-top: 72px; }
  .shell { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--sp-3);
    min-height: 56px; padding: 0 var(--sp-1) 0 var(--sp-4);
    color: var(--side-strong); background: var(--side-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 1px 0 var(--side-line);
  }
  .topbar-brand { display: flex; align-items: center; min-height: var(--touch); padding-right: var(--sp-1); }
  .topbar-brand img { display: block; height: 24px; width: auto; }
  .topbar-brand .monogram { width: 30px; height: 30px; font-size: 12px; }
  /* Berührungsziele am Handy: alles Anklickbare mindestens 44 × 44 Pixel. Links im Fliesstext sind
     ausgenommen (WCAG 2.5.8). Kleine Marken bekommen die Fläche über Innenabstand. */
  .btn, a.chip, .btn-small, .seg a, .edit-tools button, .source, .icon-btn, .icon-btn-side, .quick, .theme-btn,
  .nav-item, .toc-inline summary, .activity-past summary, .adjust summary, .filters select, select.field,
  .props .field, .palette-item, .suggest a, .anchor-btn, .linkbtn { min-height: var(--touch); min-width: var(--touch); }
  .prose .anchor-btn { width: var(--touch); height: var(--touch); }
  .crumbs a, dl.doc-meta .doc-tags a, .rail dd a, .change-title a, .rail li a, .toc-inline a {
    display: inline-flex; align-items: center; min-height: var(--touch); min-width: var(--touch);
  }
  .crumbs a, dl.doc-meta .doc-tags a { justify-content: center; padding: 0 var(--sp-1); }
  .rail li a, .toc-inline a { display: flex; }
  .crumbs { margin: calc(-1 * var(--sp-2)) 0 var(--sp-1); }
  dl.doc-meta .doc-tags dd { gap: 0 var(--sp-1); }
  .edit-tools button { padding: 0 var(--sp-3); }
  .hero .kbd-hint { display: none; }
  .topbar-here { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .icon-btn:hover { background: var(--side-hover); }

  /* Die Seitenleiste wird zum Blatt von unten: offen mit #nav (ohne Skript) oder .is-open */
  .side {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; top: auto;
    height: auto; max-height: 86vh; margin: 0; padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0; background: var(--side-sheet);
    transform: translateY(105%); visibility: hidden;
  }
  .side:target, .side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-sheet); }
  .side-top .side-close { display: inline-grid; color: var(--side-text); }
  .side-close:hover { background: var(--side-hover); }
  .brand img { height: 26px; }
  .side-nav { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-1) var(--sp-4); }
  .nav-item { min-height: var(--touch); }
  .nav-item.is-active::before { display: none; }
  .nav-item.is-soon, .nav-group.is-all-soon { display: none; }
  .quick-key { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 45; background: var(--overlay); }
  .side:target ~ .scrim, .side.is-open ~ .scrim { display: block; }

  .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px var(--sp-2) calc(6px + env(safe-area-inset-bottom));
    background: var(--side-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 -1px 0 var(--side-line);
  }
  .tab {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px;
    color: var(--side-faint); text-decoration: none; font-size: 11px; font-weight: 500; border-radius: 12px;
  }
  .tab .icon { width: 22px; height: 22px; }
  .tab.is-active { color: var(--side-strong); }
  .tab.is-active .icon { color: var(--accent); }
  .tab.is-active::before { content: ""; position: absolute; top: 2px; width: 32px; height: 3px; border-radius: 3px; background: var(--accent); }
  .tab:hover { color: var(--side-strong); background: var(--side-hover); }
  .tab-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; line-height: 18px; text-align: center; font-weight: 700; color: var(--accent-ink); background: var(--accent); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); right: var(--sp-4); }

  .main { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
  .page-head { margin-bottom: var(--sp-5); }
  .head-row { grid-template-columns: minmax(0, 1fr); }
  .doc-main { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  .doc-head { flex-direction: column; gap: var(--sp-3); }
  .doc-actions .btn { min-height: var(--touch); padding: 0 var(--sp-3); font-size: 14px; }
  .prose { font-size: var(--fs-m); line-height: 1.65; }
  .prose h2 { font-size: var(--fs-l); }
  .prose .anchor-btn { opacity: 1; width: 28px; height: 28px; }
  /* Tabellen: Spalten behalten eine lesbare Breite und verschieben sich in ihrem Rahmen */
  .prose td, .prose th { min-width: 9.5em; }
  .save-bar { margin-left: calc(-1 * var(--sp-4)); margin-right: calc(-1 * var(--sp-4)); margin-bottom: calc(-1 * var(--sp-6)); padding: var(--sp-3) var(--sp-4); bottom: calc(68px + env(safe-area-inset-bottom)); }
  .search { flex-wrap: wrap; }
  .search .btn { flex: 1 1 100%; }
  .hero .btn { min-height: 50px; }
  .hero .search input[type="search"] { min-height: 52px; }
  .track { grid-template-columns: 1fr; gap: 0; padding-bottom: var(--sp-3); }
  .track li { padding: 0 0 var(--sp-4) 30px; }
  .track li::before { top: 4px; bottom: -4px; left: 6px; right: auto; width: 4px; height: auto; }
  .track li::after { top: 2px; }
  .track li:last-child::before { display: none; }
  .track li.is-now::before { background: linear-gradient(180deg, var(--accent) 0%, var(--accent) 34%, var(--track) 62%); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-side { grid-row: 3; }
  .mrow { grid-template-columns: 90px minmax(0, 1fr); }
  .mrow > span:nth-child(3), .mrow > span:nth-child(4) { display: none; }
  .mrow > span:nth-child(5) { grid-column: 2; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .bubble.is-question { max-width: 92%; }
  .bubble.is-answer { padding: var(--sp-4); }
  /* Mehr Platz zum Lesen: Eingabe einzeilig neben dem Knopf, wächst beim Tippen. Beim Tippen
     verschwindet die Leiste unten (app.js setzt is-typing), das Feld rückt nach unten. */
  .ask-form { bottom: calc(72px + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--sp-2); padding: var(--sp-2); }
  .ask-form textarea { min-height: var(--touch); padding: 10px var(--sp-3); }
  .ask-actions { gap: var(--sp-2); }
  .ask-actions [data-ask-status] { display: none; }
  .ask-actions .btn { padding: 0 var(--sp-3); }
  .ask-actions .btn .btn-label { display: none; }
  .is-typing .tabbar { display: none; }
  .is-typing .shell { padding-bottom: 0; }
  .is-typing .ask-form { bottom: var(--sp-2); }
  .is-typing .save-bar { bottom: 0; }
  .review-head { padding: var(--sp-4); gap: var(--sp-3); }
  .review-meta { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: center; }
  .review-meta > div { display: flex; align-items: center; gap: var(--sp-2); }
  .review-meta dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .review-meta .avatar { width: 26px; height: 26px; }
  .page-head h1 { font-size: var(--fs-xl); }
  .ask-actions .hint { display: none; }
  .diff, .diff-tools { margin-left: var(--sp-3); margin-right: var(--sp-3); }
  .is-split .diff-split { grid-template-columns: minmax(0, 1fr); }
  .is-split .diff-split .diff-cell + .diff-cell { border-left: 0; border-top: 1px dashed var(--line); }
  .is-split .diff-split .diff-colhead:nth-child(2) { display: none; }
  /* Untereinander gestapelt: Gleiche Zeilen nur einmal, leere Zellen gar nicht */
  .is-split .diff-split .diff-cell.is-empty, .is-split .diff-split .diff-cell.is-same:nth-child(even), .is-split .diff-split .diff-cell.is-gap:nth-child(even) { display: none; }
  .palette { margin-top: var(--sp-3); max-height: calc(100vh - 24px); }
  .palette-foot { display: none; }
}

@media (hover: none) {
  .kbd-hint, .quick-key { display: none; }
}

/* ---- Bewegung ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
  .btn, .nav-item, .row, .hit, .area, .chip, .tab, .icon-btn, .source, .suggest a, .pcard, .seg a, .quick, .theme-btn, .palette-item {
    transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
  }
  /* Nur beim Öffnen und Schliessen (app.js setzt is-anim), nicht beim Wechsel der Breite */
  .side.is-anim { transition: transform var(--dur-2) var(--ease), visibility var(--dur-2); }
  .toast { animation: rise var(--dur-2) var(--ease); transition: opacity var(--dur-2), transform var(--dur-2); }
  .palette[open] { animation: pop var(--dur-2) var(--ease); }
  .turn.is-new { animation: rise var(--dur-2) var(--ease); }
  .btn.is-busy::after { animation: spin 0.8s linear infinite; }
  .caret { animation: blink 1s steps(2) infinite; }
  .activity-now:not(.is-done)::before { animation: pulse 1.2s ease-in-out infinite; }
  .prose .anchor-btn { transition: opacity var(--dur-1); }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .prose :target { animation: none; }
}
