@import url("./tokens.css");

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-bg);
}

a {
  color: var(--color-blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(30, 127, 212, 0.35);
}

a:hover {
  border-bottom-color: var(--color-blue);
}

/* font-size MUSS >= 16px bleiben: darunter zoomt iOS Safari beim Fokus
   automatisch ins Feld (unerwuenscht auf dem Smartphone). Nicht verkleinern. */
input,
textarea,
select {
  font-size: 16px;
  font-family: var(--font-sans);
}

/* --- Buttons (Component-Sheet §03) --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--color-blue);
  color: #fff;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--color-blue-dark);
  border-bottom-color: transparent;
}

.btn-secondary {
  background: #fff;
  color: var(--color-navy);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: #fff;
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.btn-bronze {
  background: var(--color-bronze);
  color: #fff;
}

.btn-bronze:hover {
  background: var(--color-bronze);
  filter: brightness(0.94);
}

.btn-ghost {
  background: transparent;
  color: var(--color-navy);
}

.btn-ghost:hover {
  background: transparent;
  color: var(--color-blue);
}

.btn[disabled],
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* --- Formulare (Component-Sheet §04) --- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  font-size: 15px;
}

.field textarea {
  display: block;
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(30, 127, 212, 0.15);
}

/* hint text under a field always sits on its own line */
.field .hint-text {
  display: block;
  margin-top: 6px;
}

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.field-check input {
  margin-top: 3px;
}

.error-text {
  color: var(--color-danger);
  font-size: 14px;
  margin: -8px 0 16px;
}

.hint-text {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-top: 8px;
}

.save-note {
  color: var(--color-success);
  font-size: 14px;
  margin: 0 0 16px;
}

/* Settings: schmale Inhaltsspalte, damit Formulare nicht ueber die volle Breite laufen. */
.settings-panel {
  max-width: 520px;
}
.settings-panel .intro-text {
  color: var(--color-text-muted);
  font-size: 15px;
  margin: 0 0 20px;
}

/* Konto-Seite: Sektionen als getrennte Blöcke. */
.settings-section {
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
}
.settings-section:first-child {
  border-top: none;
  padding-top: 0;
}
.settings-section h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 16px;
}
.settings-section--danger h2 {
  color: var(--color-danger);
}

.avatar-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.avatar-row__body {
  flex: 1;
  min-width: 0;
}
.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}
.avatar-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
/* Natives File-Input verstecken; das <label> ist der sichtbare Button. */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--color-danger);
  filter: brightness(0.92);
  border-bottom-color: transparent;
}

/* Breitere Inhaltsspalte fuer Einstellungs-/Formularseiten (nutzt die Flaeche).
   Doppelte Klasse fuer hoehere Spezifitaet als die spaetere .app-content__inner-Basisregel. */
.app-content__inner.app-content__inner--wide {
  max-width: 1080px;
}
/* Volle Breite (Tabellen/To-do/Liste): nutzt den ganzen verfuegbaren Bildschirm. */
.app-content__inner.app-content__inner--full {
  max-width: none;
  /* volle Hoehe, damit die rechte Leiste von ganz oben bis ganz unten laeuft */
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Unter-Navigation (Profil / Rechnungsdaten) — als Links, mobiltauglich. */
.account-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin: 0 0 24px;
}
.account-tabs a {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.account-tabs a:hover {
  color: var(--color-navy);
}
.account-tabs a.is-active {
  color: var(--color-blue);
  border-bottom-color: var(--color-blue);
}

/* Zwei-Spalten-Anordnung der Einstellungs-Sektionen ab Desktop; mobil gestapelt.
   Kein Card-Look (layout-spec): Sektionen bleiben durch Hairlines getrennt. */
.settings-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 48px;
}
@media (min-width: 1024px) {
  .settings-cols {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
.settings-col > .settings-section:first-child {
  border-top: none;
  padding-top: 0;
}
.settings-full {
  margin-top: 8px;
}

/* Rechnungen-Platzhalter (leerer Zustand). */
.invoice-empty {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 14px;
  text-align: center;
}

/* Mitgliederliste (Workspace-Einstellungen). */
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.member-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}
.member-list__item:first-child {
  border-top: none;
}
.member-list .avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
  background: var(--color-navy);
}
.member-list__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}
.member-list__role {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Unter-Blöcke innerhalb einer Sektion (z. B. Einladen/Offene Einladungen im Mitglieder-Block). */
.settings-subblock {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.settings-subblock h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 12px;
}

/* --- Auth-Split: enterprise-vertrauter Login/Register (SAP/Salesforce-Stil) ---
   Split bleibt bewusst erhalten (DEC-058), nur v2-Palette; Mesh-Panel behaelt
   seine Animation. */

.auth-split {
  position: relative;
  min-height: 100dvh;
  display: flex;
}

/* Links: Formularspalte. Auf Mobile volle Breite (Brand-Panel ausgeblendet). */
.auth-split__form {
  flex: 1 1 46%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--color-bg);
}

.auth-form-wrap {
  width: 100%;
  max-width: 360px;
}

/* Rechts: gebrandetes Panel mit dem Gedaechtnis-Netz-Motiv. */
.auth-split__brand {
  display: none;
  flex: 1 1 54%;
  position: relative;
  overflow: hidden;
  background: var(--color-panel);
  border-left: 1px solid var(--color-border);
}

@media (min-width: 1024px) {
  .auth-split__brand {
    display: block;
  }
}

.auth-split__brand .fabric {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 440px;
  padding: 72px 64px 0;
}

.auth-brand-copy__headline {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-navy);
  margin: 0 0 16px;
}

.auth-brand-copy__subline {
  font-size: 16px;
  color: var(--color-text);
  margin: 0;
}

/* Der Mesh-Hub zentriert auf diesem Anker; Knoten faechern darunter auf. */
.auth-split__brand .hub-anchor {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 380px;
  height: 1px;
  transform: translateX(-50%);
}

/* Logo-Lockup: Mini-Mesh links, Wortmarke, Bronze-Punkt rechts. */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  text-decoration: none;
  border-bottom: none;
}

.auth-brand span {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--color-navy);
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-bronze);
  display: inline-block;
}

.auth-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 24px;
}

.auth-form-wrap form {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
}

.auth-footer {
  margin-top: 20px;
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
}

/* Sprach-Switcher als klarer Segment-Toggle: aktive Sprache = blaue Pille,
   inaktive gedaempft. Deutlich als Umschalter erkennbar. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
}

/* Oben rechts ueber dem Auth-Screen: weisse Box mit Rahmen + weichem Schatten. */
.auth-split > .lang-switch {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 2;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
  padding: 3px;
  box-shadow: var(--shadow-card);
}

.lang-switch__opt {
  display: inline-block;
  padding: 6px 13px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: none;
  line-height: 1;
  letter-spacing: 0.02em;
}

.lang-switch__opt:hover {
  color: var(--color-navy);
}

.lang-switch__opt[aria-current="true"] {
  background: var(--color-blue);
  color: #fff;
}

.lang-switch__opt[aria-current="true"]:hover {
  color: #fff;
}

/* Der Slash entfaellt beim Segment-Toggle. */
.lang-switch__sep {
  display: none;
}

/* Sidebar-Variante (App, navy Hintergrund): gleiche Pille, ohne Box-Chrome. */
.lang-switch--sidebar {
  margin-top: 10px;
}

.lang-switch--sidebar .lang-switch__opt {
  color: var(--color-sidebar-fg-muted);
}

.lang-switch--sidebar .lang-switch__opt:hover {
  color: #fff;
}

.lang-switch--sidebar .lang-switch__opt[aria-current="true"] {
  background: var(--color-blue);
  color: #fff;
}

/* --- Passwort-Ampel + Regel-Checkliste (Registrierung) --- */
.pw-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 10px;
}

.pw-meter__track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
}

.pw-meter__bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.15s linear;
}

.pw-meter__bar[data-level="weak"] { width: 33%; background: var(--color-danger); }
.pw-meter__bar[data-level="medium"] { width: 66%; background: var(--color-warning); }
.pw-meter__bar[data-level="strong"] { width: 100%; background: var(--color-success); }

.pw-meter__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  min-width: 48px;
}

.pw-rules {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 13px;
}

.pw-rule {
  color: var(--color-text-muted);
  padding: 2px 0 2px 20px;
  position: relative;
}

.pw-rule::before {
  content: "\25CB";
  position: absolute;
  left: 0;
}

.pw-rule[data-ok="true"] {
  color: var(--color-text);
}

.pw-rule[data-ok="true"]::before {
  content: "\25CF";
  color: var(--color-success);
}

.pw-match {
  display: none;
  font-size: 13px;
  margin-top: 6px;
}

.pw-match[data-match="true"] { display: block; }
.pw-match[data-match="false"] { display: block; }
.pw-match[data-match="true"] .pw-match__no,
.pw-match[data-match="false"] .pw-match__ok { display: none; }
.pw-match__ok { color: var(--color-success); }
.pw-match__no { color: var(--color-danger); }

.backup-codes {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.8;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  columns: 2;
}

.qr-box img {
  display: block;
  margin: 16px 0;
  border-radius: var(--radius);
}

/* Klartext-TOTP-Schluessel fuer manuelle Eingabe (kein Scan). */
.manual-key {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  word-spacing: 0.15em;
  user-select: all;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 8px 0 16px;
  background: var(--color-panel);
}

/* --- App-Shell: navy Sidebar + Content (animationsfrei) --- */

.app-shell {
  display: flex;
  min-height: 100dvh;
}

.app-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-fg);
  padding: 20px 12px;
  display: none;
  flex-direction: column;
}

/* Mobile/Tablet: Sidebar ist ein Overlay-Panel, per Hamburger im Topbar
   geoeffnet (sofort ein/aus, keine Animation - layout-spec App shell). */
@media (max-width: 1279px) {
  body.sidebar-open .app-sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 264px;
    z-index: 40;
    overflow-y: auto;
  }
  .app-backdrop {
    display: none;
  }
  body.sidebar-open .app-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 46, 82, 0.4);
    z-index: 30;
  }
}

/* Desktop: dauerhaft sichtbar, sticky ueber volle Hoehe -> das Profil-Element
   bleibt unten am Rand fixiert, egal wie lang der Inhalt scrollt. */
@media (min-width: 1280px) {
  .app-sidebar {
    display: flex;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: hidden; /* nur die Seitenliste (.sidebar-nav) scrollt intern */
  }
}

/* Close-Button im Sidebar-Kopf nur auf Mobile sichtbar. */
.app-sidebar__close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-sidebar-fg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
@media (max-width: 1279px) {
  .app-sidebar__close {
    display: inline-block;
  }
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-sidebar-fg);
}

.workspace-switch-wrap {
  position: relative;
  margin-bottom: 16px;
}

.workspace-switch {
  width: 100%;
  border: 1px solid var(--color-sidebar-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--color-sidebar-fg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.workspace-switch:hover {
  background: var(--color-sidebar-active-bg);
}

/* Workspace-Dropdown: weisse Karte, nach unten aufklappend. */
.workspace-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 20;
}

.workspace-menu[hidden] {
  display: none;
}

.workspace-menu form {
  margin: 0;
}

.workspace-menu a,
.workspace-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  text-decoration: none;
  border: none;
  border-bottom: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}

.workspace-menu a:hover,
.workspace-menu button:hover {
  background: var(--color-panel);
}

.workspace-menu__item.is-active {
  font-weight: 700;
  color: var(--color-blue);
}

.workspace-menu__sep {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

.workspace-switch__name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-switch__name::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-bronze);
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto; /* nur die Seitenliste scrollt */
}
/* Kopfzeile ueber der Seitenliste: Titel + Alle-auf/zuklappen. */
.sidebar-nav__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
  color: var(--color-sidebar-fg-muted);
}
.sidebar-nav__headtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar-nav__tools {
  display: flex;
  gap: 2px;
}
.sidebar-nav__tool {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--color-sidebar-fg-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}
.sidebar-nav__tool:hover {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-fg);
}
/* Klapp-Caret vor Zeilen mit Unterseiten. */
.sidebar-nav__caret {
  flex-shrink: 0;
  width: 20px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--color-sidebar-fg-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
  padding: 0;
  transform: rotate(90deg); /* aufgeklappt: zeigt nach unten */
  transition: transform 0.12s ease;
}
.sidebar-nav__caret:hover {
  color: var(--color-sidebar-fg);
}
.sidebar-nav__caret.is-collapsed {
  transform: rotate(0deg); /* zugeklappt: zeigt nach rechts */
}
.sidebar-nav__caret--empty {
  cursor: default;
}
/* Fixierter unterer Block: Hinzufuegen -> Glocke -> Profil (immer sichtbar). */
.app-sidebar__bottom {
  flex-shrink: 0;
  /* keine Trennlinie mehr — die drei unteren Knoepfe (Hinzufuegen/Glocke/Profil)
     sind eine zusammenhaengende Button-Gruppe. */
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 13px;
  color: var(--color-sidebar-fg-muted);
  text-decoration: none;
  border-bottom: none;
  border-radius: var(--radius);
}

.sidebar-nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-sidebar-dot-muted);
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-nav a.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-fg);
}

.sidebar-nav a.active::before {
  background: var(--color-blue);
}

/* „+ Seite hinzufügen" — eigener Eintrag ÜBER der Trennlinie, gleiche Schrift/
   Größe wie die Baum-Einträge (steht außerhalb von .sidebar-nav). */
/* Gemeinsames, fest breites Icon-Feld für die drei unteren Buttons (Hinzufügen/
   Glocke/Profil) — sorgt dafür, dass alle Texte in einer Spalte starten. */
.sidebar-btn__icon {
  width: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.sidebar-btn__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-nav__add,
.app-bell {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-sidebar-fg-muted);
  text-decoration: none;
  border: none; /* globalen Link-Unterstrich (a{border-bottom}) unterdruecken */
  border-radius: var(--radius);
}
.sidebar-nav__add:hover,
.app-bell:hover {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-fg);
}
.sidebar-nav__add::before {
  content: none !important;
}
.sidebar-nav__add:hover {
  background: var(--color-sidebar-active-bg);
}
/* Baum-Zeile: Seiten-Link (flexibel) + „+"-Unterseite (auf Hover). */
.sidebar-nav__row {
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  padding-right: 4px;
}
.sidebar-nav__row:hover,
.sidebar-nav__row.active {
  background: var(--color-sidebar-active-bg);
}
.sidebar-nav__row[draggable="true"] {
  cursor: grab;
}
.sidebar-nav__row.drop-target {
  outline: 2px solid var(--color-blue);
  outline-offset: -2px;
  background: var(--color-sidebar-active-bg);
}
.sidebar-nav__item {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-nav__row:hover .sidebar-nav__item,
.sidebar-nav__row:hover .sidebar-nav__addsub {
  background: transparent;
}
.sidebar-nav__row.active .sidebar-nav__item {
  color: var(--color-sidebar-fg) !important;
}
.sidebar-nav__row.active .sidebar-nav__item::before {
  background: var(--color-blue);
}
/* Kleines „+" ganz rechts, erscheint beim Überfahren der Zeile. */
.sidebar-nav__addsub {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  line-height: 1;
  color: var(--color-sidebar-fg-muted) !important;
  border-radius: var(--radius);
  opacity: 0;
}
/* Spezifitaet ueber .sidebar-nav a (sonst bleibt font-size bei 13px). */
.sidebar-nav a.sidebar-nav__addsub {
  font-size: 21px;
}
.sidebar-nav__addsub::before {
  content: none !important;
}
.sidebar-nav__row:hover .sidebar-nav__addsub,
.sidebar-nav__addsub:focus {
  opacity: 1;
}
.sidebar-nav__addsub:hover {
  color: #fff !important;
  background: var(--color-sidebar-border) !important;
}
.sidebar-nav__empty {
  font-size: 12px;
  color: var(--color-sidebar-fg-muted);
  padding: 6px 8px;
  margin: 0;
  line-height: 1.5;
}

/* Seitentyp-Wahl (page-new). */
.type-choice {
  border: none;
  padding: 0;
  margin: 0 0 8px;
}
.type-choice legend {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 10px;
  padding: 0;
}
/* Platzierung: Hauptseite / Unterseite von … */
.placement-choice {
  margin-top: 18px;
}
/* Elternseiten-Auswahl erscheint erst bei „Unterseite" (progressive disclosure). */
.placement-parent {
  margin-top: 4px;
}
.placement-parent__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 6px;
}

/* Zentrale, CI-konforme Select-Komponente (kein Browser-Standard-Look). */
.ci-select-wrap {
  position: relative;
}
.ci-select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.ci-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  padding: 10px 34px 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  cursor: pointer;
}
.ci-select:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.12);
}
.type-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}
.type-option:has(input:checked) {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 1px var(--color-blue);
}
.type-option input {
  margin-top: 3px;
}
.type-option__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.type-option__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-navy);
}
.type-option__desc {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Neue Seite: zweispaltig — links Formular, rechts erklärendes Panel + Mesh. */
.page-new-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  max-width: 980px;
}
@media (min-width: 900px) {
  .page-new-split {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}
.page-new-form {
  min-width: 0;
}

.page-new-explain {
  position: relative;
  overflow: hidden;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 28px 28px 120px;
  min-height: 340px;
}
.page-new-explain__intro {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 20px;
}
.explain-block {
  position: relative;
  z-index: 1;
}
.explain-block[hidden] {
  display: none;
}
.explain-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-blue);
  margin-bottom: 14px;
}
.explain-icon svg {
  width: 24px;
  height: 24px;
}
.explain-block h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 10px;
}
.explain-block p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  margin: 0 0 12px;
}
.explain-block__diff {
  font-size: 13.5px !important;
  color: var(--color-text-muted) !important;
  border-left: 2px solid var(--color-bronze);
  padding-left: 10px;
}

/* Dezentes, statisches Gedächtnis-Netz unten im Panel (App: keine Animation). */
.page-new-mesh {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 120px;
  fill: none;
  stroke: var(--color-mesh-line);
  stroke-width: 1.2;
}
.page-new-mesh circle {
  fill: var(--color-navy);
  stroke: none;
  opacity: 0.5;
}
.page-new-mesh__hub {
  fill: var(--color-bronze) !important;
  opacity: 1 !important;
}

/* Seiten-Ansicht (page-view). */
.page-head {
  margin-bottom: 20px;
}
.page-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-blue);
  margin-bottom: 6px;
}
.page-placeholder {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* BlockNote-Editor-Container. BlockNote bringt eigenes CSS (editor.css) mit. */
.doc-editor {
  min-height: 420px;
  margin-left: -12px; /* BlockNote hat eigene Innenabstände */
}
/* Freiraum unter dem Text: klickbar -> Cursor ans Ende (Notion-Verhalten). */
.doc-editor-fill {
  min-height: 60vh;
  cursor: text;
}

/* Meta-Zeile unter dem Titel (Outline-/Notion-Optik): erstellt von … · Kommentieren · gesehen. */
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -12px 0 20px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.doc-meta__sep {
  color: var(--color-border);
}
.doc-meta__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.doc-meta__link:hover {
  color: var(--color-blue);
}
.doc-meta__icon {
  flex-shrink: 0;
}
/* Hinweis, dass eine KI an dieser Seite mitgearbeitet hat (nur "dass", nicht "was"). */
.doc-meta__ai {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eaf2fc;
  color: var(--color-blue);
  font-weight: 600;
}

/* Freundlichere Überschriften im Editor (weniger wuchtig als BlockNote-Default).
   #editor (ID) hebt die Spezifitaet ueber BlockNotes eigene editor.css. */
#editor .bn-block-content[data-content-type="heading"][data-level="1"],
#editor .bn-block-content[data-content-type="heading"][data-level="1"] .bn-inline-content {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-navy);
  letter-spacing: -0.01em;
}
#editor .bn-block-content[data-content-type="heading"][data-level="2"],
#editor .bn-block-content[data-content-type="heading"][data-level="2"] .bn-inline-content {
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--color-navy);
}
#editor .bn-block-content[data-content-type="heading"][data-level="3"],
#editor .bn-block-content[data-content-type="heading"][data-level="3"] .bn-inline-content {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Struktur-Tabelle (To-do / Liste / Tabelle). */
.data-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.data-table th,
.data-table td {
  border: 1px solid var(--color-border);
  padding: 0;
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  background: var(--color-panel);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-navy);
  white-space: nowrap;
}
.data-table td .data-cell {
  width: 100%;
  min-width: 90px;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font: inherit;
  color: var(--color-text);
}
.data-table td .data-cell:focus {
  outline: 2px solid var(--color-blue);
  outline-offset: -2px;
  background: #fff;
}
.data-table td input[type="checkbox"] {
  margin: 8px 12px;
  width: 16px;
  height: 16px;
}
.data-table__actions {
  width: 72px;
  white-space: nowrap;
  text-align: center;
  border: none !important;
}
.data-table__actions form {
  margin: 0;
  display: inline-block;
}
.data-table__del,
.data-table__sub {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 7px;
}
.data-table__sub:hover {
  color: var(--color-blue);
}
.data-table__del:hover {
  color: var(--color-danger);
}
.data-table__toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.data-table__toolbar form {
  margin: 0;
}

/* Datums-Zelle: readonly, wirkt klickbar (oeffnet eigenen Picker). */
.data-table td .data-cell.data-date {
  cursor: pointer;
}
/* Eigener Datums-Picker (datepicker.js) — kein Browser-Dialog. */
.datepicker {
  position: absolute;
  z-index: 95;
  width: 240px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 8px;
  user-select: none;
}
.datepicker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.datepicker__month {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-navy);
}
.datepicker__nav {
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--color-navy);
}
.datepicker__nav:hover {
  border-color: var(--color-blue);
  color: var(--color-blue);
}
.datepicker__weekdays,
.datepicker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.datepicker__weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 2px 0;
}
.datepicker__day {
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  color: var(--color-text);
}
.datepicker__day.is-empty {
  cursor: default;
}
.datepicker__day:not(.is-empty):hover {
  background: var(--color-panel);
}
.datepicker__day.is-today {
  box-shadow: inset 0 0 0 1px var(--color-mesh-line);
}
.datepicker__day.is-selected {
  background: var(--color-blue);
  color: #fff;
}
.datepicker__foot {
  margin-top: 6px;
  text-align: right;
}
.datepicker__clear {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.datepicker__clear:hover {
  color: var(--color-danger);
}

/* Sub-task-Kennzeichnung (deutlicher als nur Einrückung). */
.subtask-marker {
  color: var(--color-blue);
  margin-right: 2px;
  font-size: 15px;
  font-weight: 600;
}
.data-table tr.is-subtask {
  background: var(--color-panel);
}
/* Pfeil sitzt links NEBEN dem Text (nicht darueber): erstes Feld als Flex-Zeile. */
.data-table tr.is-subtask td:first-child {
  display: flex;
  align-items: center;
  border-left: 3px solid var(--color-blue);
}
.data-table tr.is-subtask td:first-child .subtask-marker {
  flex-shrink: 0;
}
.data-table tr.is-subtask td:first-child .data-cell {
  flex: 1;
  padding-left: 3px; /* nur ein kleiner Abstand nach dem Pfeil */
  color: var(--color-text-muted);
  font-size: 0.95em;
}

/* --- Inhalt + rechtes Kontext-Panel (hellblaue Leiste, ein-/ausklappbar) --- */
.page-layout {
  display: flex;
  gap: 0;
  flex: 1; /* fuellt die volle Hoehe des Content-Bereichs */
  align-items: stretch; /* hellblaue Leiste laeuft von ganz oben nach ganz unten */
}
.page-main {
  flex: 1;
  min-width: 0;
  /* Text nutzt die volle verfuegbare Breite (flexibel, "wie eine Schreibmaschine") */
  padding-right: 32px;
  padding-bottom: 24px;
}
.page-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
/* Rechte Leiste: hellblau, mit deutlichem vertikalen Strich links. */
.page-panel {
  position: relative;
  width: 316px;
  flex-shrink: 0;
  background: #EAF2FC;
  border-left: 1px solid #BFD4EA;
  padding: 46px 22px 28px;
  /* ueber die Innenabstaende des Content-Bereichs hinaus bis an die Kanten
     ziehen -> Leiste laeuft von ganz oben bis ganz unten und bis zum Rand */
  margin: -32px -24px -32px 0;
  transition: width 0.18s ease, padding 0.18s ease;
}
.panel-body {
  display: flex;
  flex-direction: column;
}
/* Ein-/Ausklapp-Symbol oben rechts in der Leiste. */
.panel-rail-toggle {
  position: absolute;
  top: 10px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #BFD4EA;
  background: #fff;
  border-radius: var(--radius);
  color: var(--color-blue);
  cursor: pointer;
}
.panel-rail-toggle:hover {
  border-color: var(--color-blue);
  background: #fff;
}
.panel-rail-icon {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); /* zeigt nach rechts -> einklappen */
  margin-left: -2px;
}
.page-layout.panel-closed .page-panel {
  width: 42px;
  padding: 46px 0 0;
}
.page-layout.panel-closed .panel-body {
  display: none;
}
.page-layout.panel-closed .panel-rail-icon {
  transform: rotate(135deg); /* zeigt nach links -> ausklappen */
  margin-left: 2px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}
.panel-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 4px;
  font-size: 12.5px;
}
.panel-meta dt {
  color: var(--color-text-muted);
}
.panel-meta dd {
  margin: 0;
  color: var(--color-text);
}
.panel-section {
  border-top: 1px solid #D5E3F2;
  padding-top: 14px;
  margin-top: 14px;
}
.panel-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-navy);
  margin: 0 0 8px;
}
.panel-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.panel-form label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-navy);
}
/* Zartere Eingabefelder auf der hellblauen Leiste. */
.panel-form input,
.comment-input {
  padding: 6px 9px;
  border: 1px solid #CBDCEF;
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
}
.panel-form input:focus,
.comment-input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.12);
}
/* Buttons in der Leiste etwas zarter. */
.page-panel .btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}
.panel-meta {
  font-size: 12px;
}
.panel-form .btn {
  align-self: flex-start;
}
.panel-assignees {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Chip-Eingabe (Tags/Kategorien): Komma -> Chip, x zum Entfernen (bei Hover). */
.chip-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #cbdcef;
  border-radius: var(--radius);
  background: #fff;
}
.chip-field:focus-within {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.12);
}
.chip-field__chips {
  display: contents;
}
.chip-field .chip-field__input {
  flex: 1;
  min-width: 70px;
  border: none;
  outline: none;
  padding: 2px 0;
  margin: 0;
  font: inherit;
  font-size: 13px;
  background: transparent;
  box-shadow: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 4px 2px 9px;
  background: #eaf2fc;
  color: var(--color-blue);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.chip__x {
  border: none;
  background: none;
  color: var(--color-blue);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 3px;
  opacity: 0;
  transition: opacity 0.1s;
}
.chip:hover .chip__x {
  opacity: 0.75;
}
.chip__x:hover {
  opacity: 1;
  color: var(--color-danger);
}
.panel-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text);
}
.panel-soon {
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .page-layout {
    flex-direction: column;
    flex: 0 1 auto;
  }
  .page-main {
    padding-right: 0;
  }
  .page-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid #BFD4EA;
    /* nur horizontal bis zum Rand bluten, vertikal normal */
    margin: 16px -24px -32px -24px;
    padding: 40px 16px 20px;
  }
  /* Auf Mobile immer offen (keine schmale Rail). */
  .page-layout.panel-closed .page-panel {
    width: 100%;
    padding: 40px 16px 20px;
  }
  .page-layout.panel-closed .panel-body {
    display: flex;
  }
}

/* Ab Desktop (Suchleiste sichtbar) mit rechtem Panel: 3-Spalten-Logik.
   Linke Sidebar + rechtes Panel haben Breiten-Prioritaet und laufen voll durch;
   die Suchleiste sitzt in der MITTLEREN Spalte, nicht ueber dem Panel.
   Umgesetzt per Grid auf .app-content; content__inner + page-layout werden per
   display:contents durchgereicht, damit page-main und page-panel echte
   Grid-Zellen werden. Collapse steuert die Panel-Spaltenbreite via :has(). */
@media (min-width: 1280px) {
  .app-content.app-content--panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 316px;
    grid-template-rows: auto 1fr;
    align-content: start;
  }
  .app-content.app-content--panel:has(#pageLayout.panel-closed) {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
  .app-content--panel .app-searchbar {
    grid-column: 1;
    grid-row: 1;
  }
  /* Suchleiste in der mittleren Spalte linksbuendig zum Inhalt (nicht zentriert). */
  .app-content--panel .searchbar {
    max-width: none;
    margin: 0;
  }
  .app-content--panel .app-content__inner.app-content__inner--full {
    display: contents;
  }
  .app-content--panel #pageLayout {
    display: contents;
  }
  .app-content--panel .page-main {
    grid-column: 1;
    grid-row: 2;
    /* die Innenabstaende, die sonst content__inner liefert, hier selbst setzen */
    padding: 32px 32px 24px 24px;
  }
  .app-content--panel .page-panel {
    grid-column: 2;
    grid-row: 1 / -1; /* volle Hoehe: von der Suchleiste bis ganz unten */
    width: auto;
    margin: 0;
  }
}

/* Abrechnung / Billing */
.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-navy);
  margin-bottom: 6px;
}
.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
  font-size: 14px;
}
.field-row {
  display: flex;
  gap: 14px;
}
.field-col {
  flex: 1;
  display: block;
}
.vat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.vat-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}
.vat-table td:last-child {
  text-align: right;
  white-space: nowrap;
}
.vat-table .vat-total td {
  font-weight: 700;
  color: var(--color-navy);
  border-bottom: none;
}
.bill-steps {
  list-style: none;
  margin: 14px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bill-steps li {
  padding-left: 24px;
  position: relative;
  font-size: 14px;
  color: var(--color-text-muted);
}
.bill-steps li::before {
  content: "○";
  position: absolute;
  left: 0;
  color: var(--color-border);
}
.bill-steps li.is-done {
  color: var(--color-text);
}
.bill-steps li.is-done::before {
  content: "✓";
  color: var(--color-success);
}
.order-box {
  margin-top: 8px;
}
.order-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 2px;
}
.order-vat {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 14px;
}

/* Rechtsklick-Kontextmenü (Tabellen: Spalte/Zeile löschen). */
.ctx-menu {
  position: absolute;
  z-index: 90;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 4px;
  min-width: 150px;
}
.ctx-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--color-danger);
  cursor: pointer;
  border-radius: var(--radius);
}
.ctx-menu__item:hover {
  background: var(--color-panel);
}

/* Rechtsklick-Menü im Block-Editor (Format + Blocktyp). */
.editor-ctx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.editor-ctx {
  position: fixed;
  z-index: 91;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 4px;
}
.editor-ctx__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius);
}
.editor-ctx__item b,
.editor-ctx__item i,
.editor-ctx__item s {
  display: inline-block;
  width: 16px;
  text-align: center;
  color: var(--color-text-muted);
}
.editor-ctx__item:hover {
  background: var(--color-panel);
}
.editor-ctx__sep {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* Versionierung (DEC-034/035/037): Banner beim Ansehen alter Versionen + Liste. */
.version-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fff8ec;
  border: 1px solid var(--color-bronze, #b8863b);
  border-radius: var(--radius);
  font-size: 13px;
}
.version-banner__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.version-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.version-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--color-border);
  font-size: 12.5px;
}
.version-item__meta {
  color: var(--color-text-muted);
}
.version-item__view {
  flex-shrink: 0;
}
.version-item__actions {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}
.version-item__restore {
  margin: 0;
}
/* Wiederherstellen-Button optisch wie der Ansehen-Link. */
button.version-item__view {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--color-blue);
  cursor: pointer;
}
button.version-item__view:hover {
  text-decoration: underline;
}
.version-src {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--color-panel);
  color: var(--color-text);
}
.version-src--ai {
  background: #eaf2fc;
  color: var(--color-blue);
}
.version-src--restore {
  background: #fff8ec;
  color: var(--color-bronze, #b8863b);
}

/* Notizen & Kommentare (DEC-035/043) + @mention-Autocomplete. */
.comment-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comment-item {
  padding: 8px 10px;
  background: var(--color-panel);
  border-radius: var(--radius);
  font-size: 13px;
}
.comment-item__head {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 3px;
}
.comment-item__author {
  font-weight: 600;
  color: var(--color-text);
}
.comment-item__body {
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-item__mentions {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.mention-chip {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eaf2fc;
  color: var(--color-blue);
}
.comment-input {
  width: 100%;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid #CBDCEF;
  background: #fff;
  border-radius: var(--radius);
}
.js-comment-form {
  position: relative;
}
.mention-menu {
  position: absolute;
  z-index: 95;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.mention-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius);
}
.mention-menu__item:hover {
  background: var(--color-panel);
}

/* Sidebar-Kontextmenü (Rechtsklick auf Seite) + Umbenennen/Verschieben-Overlay. */
.sb-menu {
  position: fixed;
  z-index: 100;
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 4px;
}
.sb-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius);
}
.sb-menu__item:hover {
  background: var(--color-panel);
}
.sb-menu__item.is-danger {
  color: var(--color-danger);
}
.sb-menu__sep {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}
.sb-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(11, 46, 82, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.sb-overlay__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-login);
  padding: 22px;
}
.sb-overlay__card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--color-navy);
}
.sb-overlay__input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.sb-overlay__input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.12);
}
.sb-overlay__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Lösch-PIN-Overlay (DEC-036). */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 46, 82, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pin-overlay__card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-login);
  padding: 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.pin-overlay__card h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 8px;
}
.pin-overlay__card p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}
.pin-overlay__num {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--color-navy);
  margin: 8px 0 16px;
}
.pin-overlay__input {
  width: 140px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.2em;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.pin-overlay__input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.15);
}
.pin-overlay__err {
  color: var(--color-danger) !important;
  font-size: 13px;
  margin: 0 0 12px !important;
}
.pin-overlay__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

/* Papierkorb-Liste. */
.trash-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  max-width: 640px;
}
.trash-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}
.trash-list__title {
  flex: 1;
  min-width: 140px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
}
.trash-list__meta {
  font-size: 12px;
  color: var(--color-text-muted);
}
.trash-list__actions {
  display: flex;
  gap: 8px;
}
.trash-list__actions form {
  margin: 0;
}
.page-manage {
  margin-top: 28px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  max-width: 520px;
}
.page-manage summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-muted);
}
.page-manage__inner {
  margin-top: 16px;
}
.page-manage__delete {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.app-sidebar__account {
  position: relative;
  padding-top: 8px;
}

/* Profil-Button (Avatar + Name) unten in der Sidebar. */
.app-account {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--color-sidebar-fg-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}

.app-account:hover {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-fg);
}

.app-account__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-account__chev {
  color: var(--color-sidebar-fg-muted);
  font-size: 16px;
}

/* Initialen- bzw. Bild-Avatar (MANIFEST: Kreis, Gewicht 700). */
.avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-sidebar-border);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Konto-Overlay: weisse Karte auf navy Sidebar, sofort ein/aus (kein Fade). */
.account-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 4px;
  z-index: 20;
}

.account-menu[hidden] {
  display: none;
}

.account-menu form {
  margin: 0;
}

.account-menu a,
.account-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  text-decoration: none;
  border: none;
  border-bottom: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}

.account-menu a:hover,
.account-menu button:hover {
  background: var(--color-panel);
}

/* Willkommens-/Empty-State im Content. */
.app-lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
}

/* --- Hilfe & Anleitung --- */
.help {
  max-width: 900px;
}
.help-chapter {
  max-width: 820px;
}

/* Help hub: chapter cards */
.help-hub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 22px 0 8px;
}
@media (min-width: 640px) {
  .help-hub {
    grid-template-columns: 1fr 1fr;
  }
}
.help-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.help-card:hover {
  border-color: var(--color-blue);
  transform: translateY(-1px);
}
.help-card__icon {
  font-size: 22px;
  line-height: 1.2;
  flex-shrink: 0;
}
.help-card__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.help-card__title {
  font-weight: 700;
  color: var(--color-navy);
  font-size: 15px;
}
.help-card__sum {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Chapter page: breadcrumb + pager */
.help-crumb {
  margin-bottom: 6px;
}
.help-crumb a {
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
}
.help-crumb a:hover {
  color: var(--color-blue);
}
.help-body h3 {
  font-size: 15px;
  color: var(--color-navy);
  margin: 22px 0 8px;
}
.help-pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}
.help-pager__link {
  font-size: 13.5px;
  color: var(--color-navy);
  text-decoration: none;
  max-width: 48%;
}
.help-pager__link:hover {
  color: var(--color-blue);
}
.help-pager__link--next {
  text-align: right;
  margin-left: auto;
}
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 8px;
}
.help-toc a {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--color-navy);
  text-decoration: none;
}
.help-toc a:hover {
  border-color: var(--color-blue);
  color: var(--color-blue);
  background: var(--color-panel);
}
.help-section {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 1px solid var(--color-border);
  scroll-margin-top: 20px;
}
.help-section h2 {
  font-size: 20px;
  color: var(--color-navy);
  margin: 0 0 12px;
}
.help-section h3 {
  font-size: 15px;
  color: var(--color-navy);
  margin: 18px 0 8px;
}
.help-section p {
  line-height: 1.65;
  margin: 0 0 12px;
}
.help-section ul {
  line-height: 1.7;
  padding-left: 20px;
  margin: 0 0 12px;
}
.help-section li {
  margin-bottom: 4px;
}
.help-fig {
  margin: 16px 0 6px;
}
.help-fig img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: block;
}
.help-fig figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
/* Step-by-step guide (Workspace Connect): numbered step + crop-sized shot. */
.guide-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
}
.guide-step:first-of-type {
  border-top: none;
}
.guide-step__num {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-blue);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-step__body {
  flex: 1;
  min-width: 0;
}
.guide-step__body p {
  margin: 2px 0 8px;
}
/* crop-sized screenshot slot (NOT fullscreen) */
.guide-shot {
  margin: 8px 0 2px;
  max-width: 440px;
}
.guide-shot img {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: block;
}
.guide-shot figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
}
/* placeholder until the real crop is dropped in — looks intentional, not broken */
.guide-shot--todo {
  max-width: 440px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-panel);
  padding: 14px 16px;
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.guide-shot--todo::before {
  content: "🖼  Ausschnitt: ";
  font-weight: 600;
  color: var(--color-navy);
}

/* Per-app accordion (choose your AI app) */
.connect-app {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  margin-bottom: 10px;
  overflow: hidden;
}
.connect-app > summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--color-navy);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.connect-app > summary::-webkit-details-marker {
  display: none;
}
.connect-app > summary::after {
  content: "▾";
  color: var(--color-text-muted);
  font-size: 12px;
}
.connect-app[open] > summary {
  border-bottom: 1px solid var(--color-border);
}
.connect-app[open] > summary::after {
  content: "▴";
}
.connect-app__body {
  padding: 8px 16px 16px;
}
.connect-app__body pre {
  background: var(--color-navy);
  color: #E7F0FA;
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  font-family: var(--font-mono);
}

.help-foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 14px;
}

/* --- Dashboard / Workspace-Startseite --- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 24px;
  max-width: 1000px;
}
@media (min-width: 760px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.dash-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  background: #fff;
}
.dash-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 14px;
}
.dash-stats {
  display: flex;
  gap: 36px;
}
.dash-stat {
  display: flex;
  flex-direction: column;
}
.dash-stat__num {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1;
}
.dash-stat__label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 5px;
}
.dash-access {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--color-text);
}
.dash-access__label {
  color: var(--color-text-muted);
}
/* Onboarding / Erste Schritte */
.dash-onboard {
  margin-bottom: 18px;
  max-width: 1000px;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 1px rgba(28, 116, 201, 0.25);
}
.dash-onboard__intro {
  margin: 0 0 14px;
}
.onboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.onboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--color-text);
}
.onboard-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  position: relative;
}
.onboard-item.is-done .onboard-check {
  border-color: var(--color-success);
  background: var(--color-success);
}
.onboard-item.is-done .onboard-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.onboard-item.is-done > a,
.onboard-item.is-done > span:not(.onboard-check) {
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.onboard-item__hint {
  color: var(--color-text-muted);
  font-size: 12.5px;
  text-decoration: none !important;
}

/* Workspace Connect */
.dash-ai {
  position: relative;
  overflow: hidden;
}
.dash-ai::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-border);
}
.dash-ai--on::before {
  background: var(--color-success);
}
.dash-ai--other::before {
  background: var(--color-bronze);
}
.dash-ai--api::before {
  background: var(--color-blue);
}
.dash-ai--api .dash-ai__dot {
  background: var(--color-blue);
}
.dash-ai--api .dash-ai__state-tag {
  background: rgba(28, 116, 201, 0.12);
  color: var(--color-blue);
}
.dash-ai--on {
  border-color: var(--color-success);
  box-shadow: 0 0 0 1px var(--color-success);
}
.dash-ai__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.dash-ai__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-muted);
}
.dash-ai--on .dash-ai__dot {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(46, 160, 90, 0.18);
}
.dash-ai--other .dash-ai__dot {
  background: var(--color-bronze);
}
.dash-ai__brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0;
}
.dash-ai__state-tag {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-bg-subtle, #f1f3f6);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.dash-ai--on .dash-ai__state-tag {
  background: rgba(46, 160, 90, 0.12);
  color: var(--color-success);
}
.dash-ai--other .dash-ai__state-tag {
  background: rgba(176, 122, 60, 0.14);
  color: var(--color-bronze);
}
.dash-ai__intro {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}
.dash-ai__status {
  font-size: 14px;
  margin: 0 0 4px;
  color: var(--color-text);
  font-weight: 600;
}
.dash-ai__status.is-on {
  color: var(--color-success);
}
.dash-ai__status.is-other {
  color: var(--color-navy);
}
.dash-ai__warn {
  font-size: 13px;
  margin: 0 0 4px;
  color: var(--color-bronze);
  font-weight: 600;
}
.dash-ai__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
/* Zuletzt angelegt */
.dash-recent__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-recent__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
}
.dash-recent__item:hover {
  background: var(--color-panel);
}
.dash-recent__title {
  font-weight: 600;
  color: var(--color-navy);
}
.dash-recent__on {
  font-size: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Hover-Tooltip fuer abgeschnittene Seitentitel: nahtlose Verlaengerung der Zeile
   (gleiche Farbe/Hoehe/Bullet), Schatten NUR nach rechts (kein linker Halo),
   linke Kante eckig -> geht buendig in die blaue Zeile ueber. */
.sidebar-tip {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 70vw;
  padding-left: 8px;
  padding-right: 14px;
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-fg);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: 6px 0 12px rgba(11, 46, 82, 0.35);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.sidebar-tip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-sidebar-dot-muted);
  flex-shrink: 0;
}

/* Marke oben ist ein Link zur App-Startseite (Dashboard). */
.app-sidebar__brandlink {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border: none;
}
.app-sidebar__brandlink:hover {
  opacity: 0.9;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
}

@media (min-width: 1280px) {
  .app-topbar {
    display: none;
  }
}

.app-topbar__menu {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-navy);
  padding: 6px 10px;
  cursor: pointer;
}
.app-topbar__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-topbar__search {
  display: inline-flex;
  align-items: center;
  color: var(--color-navy);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 6px 8px;
  flex-shrink: 0;
}

/* Globale Suche (Phase 4.7): Desktop-Leiste oben, mobil ueber die Lupe. */
.app-searchbar {
  display: none;
  padding: 14px 24px 0;
}
@media (min-width: 1280px) {
  .app-searchbar {
    display: block;
  }
}
.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1080px;
  margin: 0; /* linksbuendig wie der Inhalt — Position bleibt ueberall gleich */
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  padding: 5px 6px 5px 12px;
}
.searchbar:focus-within {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(28, 116, 201, 0.12);
}
.searchbar__icon {
  display: flex;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.searchbar__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  padding: 8px 4px;
  color: var(--color-text);
}
.searchbar__scope {
  border: none;
  background: #f1f3f6;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-navy);
  cursor: pointer;
  flex-shrink: 0;
}
.searchbar__submit {
  border: none;
  border-radius: var(--radius);
  background: var(--color-blue);
  color: #fff;
  font-weight: 700;
  font-family: inherit;
  padding: 8px 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.searchbar__submit:hover {
  background: var(--color-blue-dark);
}
.searchbar__suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(11, 46, 82, 0.14);
  overflow: hidden;
  z-index: 40;
}
.suggest-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
}
.suggest-item:last-child {
  border-bottom: none;
}
.suggest-item.is-active,
.suggest-item:hover {
  background: #f4f7fb;
}
.suggest-item__title {
  display: block;
  font-weight: 600;
  color: var(--color-navy);
}
.suggest-item__snippet {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
mark {
  background: rgba(28, 116, 201, 0.18);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Suchergebnis-Seite */
.search-page {
  max-width: 820px;
}
.search-scopes {
  display: flex;
  gap: 8px;
  margin: 4px 0 22px;
  flex-wrap: wrap;
}
.search-scope {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-navy);
  text-decoration: none;
  font-size: 13.5px;
}
.search-scope.is-active {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
}
.search-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin: 18px 0 12px;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-result {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: #fff;
  text-decoration: none;
}
.search-result:hover {
  border-color: var(--color-blue);
}
.search-result__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.search-result__title {
  font-weight: 700;
  color: var(--color-navy);
}
.search-result__type {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.search-result__snippet {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.55;
}
.search-empty {
  font-weight: 600;
  color: var(--color-navy);
}
.search-hint {
  margin-top: 8px;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Benachrichtigungs-Glocke in der Sidebar (ueber dem Profil). */
/* Glocke: Look wird zentral mit .sidebar-nav__add geteilt (siehe oben). */
.app-bell {
  position: relative;
}
.app-bell__icon {
  flex-shrink: 0;
}
.app-bell__badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* Benachrichtigungs-Seite. */
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notif-head form {
  margin: 0;
}
.notif-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-item__link {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
}
.notif-item__link:hover {
  border-color: var(--color-blue);
  background: var(--color-panel);
}
.notif-item.is-unread .notif-item__link {
  border-left: 3px solid var(--color-blue);
  background: #f4f8fc;
}
.notif-item__title {
  display: block;
  font-weight: 700;
  color: var(--color-navy);
  font-size: 14px;
}
.notif-item__body {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
  margin-top: 2px;
}
.notif-item__on {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.app-content__inner {
  max-width: 760px;
  padding: 32px 24px;
}

.app-content h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 24px;
}

.todo-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  font-size: 16px;
}

.todo-item:first-of-type {
  border-top: none;
}

/* ============ iOS-style toggle switch (DEC-031) ============
   The deliberate rounded exception in an otherwise sharp-corner system. Built on
   a hidden checkbox so it posts as a normal form field (name=…, value=on). */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 999px;
  transition: background 0.15s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(11, 46, 82, 0.25);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch__track {
  background: var(--color-blue);
}
.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}
.switch input:disabled {
  cursor: not-allowed;
}
.switch input:disabled + .switch__track {
  opacity: 0.5;
}

/* A labelled toggle row: text on the left, switch on the right. */
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}
.rule-row:first-of-type {
  border-top: none;
}
.rule-row__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rule-row__label strong {
  font-weight: 600;
  color: var(--color-navy);
  font-size: 15px;
}
.rule-row__label span {
  font-size: 13px;
  color: var(--color-text-muted);
}
.rule-row--nested {
  padding-left: 20px;
}

/* Governance sub-groups + the honesty note. */
.gov-group {
  margin-top: 18px;
}
.gov-group > h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 4px;
}
.gov-note {
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-panel);
  border-left: 3px solid var(--color-bronze);
  padding: 10px 12px;
  border-radius: var(--radius);
  margin: 12px 0;
}
.gov-range {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gov-range input[type="range"] {
  flex: 1;
}
.gov-range__end {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Connections / API keys list. */
.conn-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}
.conn-item:first-of-type {
  border-top: none;
}
.conn-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conn-item__name {
  font-weight: 600;
  color: var(--color-navy);
}
.conn-item__meta {
  font-size: 12px;
  color: var(--color-text-muted);
}
.conn-scope {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--color-panel);
  color: var(--color-navy);
  border: 1px solid var(--color-border);
}
.newkey-box {
  background: var(--color-panel);
  border: 1px solid var(--color-blue);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.newkey-box code {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  word-break: break-all;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 8px 0;
}
.newkey-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.newkey-row code {
  flex: 1;
  margin: 8px 0;
}
.newkey-row .btn {
  flex-shrink: 0;
}

/* ===== Settings page: airy card blocks (DEC-063) ===== */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.settings-row2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 900px) {
  .settings-row2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
.settings-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
}
.settings-card > h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 6px;
}
.settings-card__intro {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 22px;
}
/* a form that wraps two cards must not collapse their spacing */
.settings-stack > form {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin: 0;
}

/* Positive safeguard note (real, server-enforced guarantee — not a disclaimer). */
.safeguard-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #EAF5EE;
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 20px 0 0;
}
.safeguard-note strong {
  color: #1E5B33;
  font-size: 14px;
}
.safeguard-note span {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.55;
}

/* Per-actor rights matrix (KI | API), DEC-031. Reuses .switch. */
.rule-matrix {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.rule-matrix th {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  border-bottom: 2px solid var(--color-border);
  text-align: center;
}
.rule-matrix th.rule-matrix__head-label {
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
}
.rule-matrix td {
  padding: 15px 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  text-align: center;
}
.rule-matrix tr:last-child td {
  border-bottom: none;
}
/* fixed, comfortable width for the two toggle columns */
.rule-matrix th:not(.rule-matrix__head-label),
.rule-matrix td:not(.rule-matrix__label) {
  width: 76px;
}
/* td+class beats `.rule-matrix td` (both 0,1,1) by order — force left. */
.rule-matrix td.rule-matrix__label {
  text-align: left;
}
.rule-matrix__label strong {
  display: block;
  font-weight: 600;
  color: var(--color-navy);
  font-size: 15px;
}
.rule-matrix__label span {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* OAuth consent card (auth layout). */
.consent-card {
  text-align: left;
}
.consent-scope-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}
.consent-scope-opt strong {
  color: var(--color-navy);
}
.consent-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}
