/* Mobile-first. Ab 360 px Breite nutzbar, Touch-Ziele mindestens 44 px.
   Gestaltung „Salbei & Stille“, Vorgaben in docs/design.md.
   Schriften lokal unter static/vendor/ (SIL Open Font License), keine externen Quellen. */

@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../vendor/albert-sans-5.2.8/albert-sans-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../vendor/source-sans-3-5.2.9/source-sans-3-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../vendor/source-sans-3-5.2.9/source-sans-3-latin-wght-italic.woff2") format("woff2");
}

:root {
  /* Farben (hell). Namen nach Bedeutung, nicht nach Farbton. */
  --bg: #eef1ec; /* Seitenhintergrund */
  --surface: #fafbf8; /* Karten, Felder, Leisten */
  --sunken: #e3e8e1; /* Chips, Umschalter */
  --text: #1c2624;
  --muted: #5a6864; /* Nebentext, mindestens 4,5 : 1 auf --bg */
  --border: #d3dbd4;
  --accent: #2f5f58;
  --accent-text: #f4f8f5; /* Text auf --accent */
  --accent-soft: #d9e7e2;
  --danger: #a33a2c;
  --warning: #8a5300;
  --notice-bg: #f5e3dc; /* Krisenhinweis und Knopf „Hilfsangebote“ */
  --notice-text: #7d2d1f;
  --self: #e8dca8; /* Leuchten des Selbst auf der Karte */
  /* Rollen: gleiche Helligkeit und Sättigung, nur der Farbton wechselt */
  --r-manager: #4f7598;
  --r-firefighter: #c0773f;
  --r-exile: #8a6fa8;
  --r-unknown: #7d8a86; /* auch Anderer */
  --edge: #7d8a86; /* Beziehungslinien */

  /* Gefühlsfamilien (config/emotions.yaml), gedämpft und gleich hell; je Familie --e-<id> */
  --e-freude: #c29a2a;
  --e-ueberraschung: #3a8fa3;
  --e-wut: #c2553f;
  --e-angst: #b0627e;
  --e-abneigung: #7e8a3c;
  --e-scham: #8d6e63;
  --e-trauer: #4f73a8;
  --e-leer: #7d8790;
  --e-ruhe: #5e9a6c;
  --e-selbst: #b8a24a;

  /* Schrift */
  --font-display: "Albert Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Formen und Abstände */
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 16px;
  --touch: 44px;

  font-family: var(--font-body);
  font-size: 16px; /* 16 px verhindert Auto-Zoom bei Eingabefeldern auf iOS */
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a19;
    --surface: #1c2422;
    --sunken: #101514;
    --text: #e4ebe7;
    --muted: #9aa9a4;
    --border: #2e3a37;
    --accent: #8cc2b7;
    --accent-text: #0f1f1c;
    --accent-soft: #213431;
    --danger: #f08a7b;
    --warning: #e2b25c;
    --notice-bg: #3a231d;
    --notice-text: #f2b4a3;
    --self: #6b6a3a;
    --r-manager: #8fb0d2;
    --r-firefighter: #e0a070;
    --r-exile: #b9a2d6;
    --r-unknown: #8f9c98;
    --edge: #7f8d89;
    --e-freude: #e0c165;
    --e-ueberraschung: #7cc3d3;
    --e-wut: #e58c78;
    --e-angst: #d99ab1;
    --e-abneigung: #b4bf72;
    --e-scham: #c4a49a;
    --e-trauer: #92b0dc;
    --e-leer: #a9b3bb;
    --e-ruhe: #93c9a0;
    --e-selbst: #e0cf85;
  }
}

/* Rollenfarbe als Variable: .role-<rolle> setzt --role, Punkte und Kartenknoten lesen sie */
.role-manager { --role: var(--r-manager); }
.role-firefighter { --role: var(--r-firefighter); }
.role-exile { --role: var(--r-exile); }
.role-unknown { --role: var(--r-unknown); }

/* Gefühlsfamilie als Variable: .emo-<familie> setzt --emo (Rad, Chips, Punkte) */
.emo-freude { --emo: var(--e-freude); }
.emo-ueberraschung { --emo: var(--e-ueberraschung); }
.emo-wut { --emo: var(--e-wut); }
.emo-angst { --emo: var(--e-angst); }
.emo-abneigung { --emo: var(--e-abneigung); }
.emo-scham { --emo: var(--e-scham); }
.emo-trauer { --emo: var(--e-trauer); }
.emo-leer { --emo: var(--e-leer); }
.emo-ruhe { --emo: var(--e-ruhe); }
.emo-selbst { --emo: var(--e-selbst); }

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
}

/* --- Kopfzeile ---------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 4px var(--gap);
  padding-top: max(4px, env(safe-area-inset-top));
  /* Querformat mit Notch: seitliche Sicherheitsabstände (viewport-fit=cover) */
  padding-left: max(var(--gap), env(safe-area-inset-left));
  padding-right: max(var(--gap), env(safe-area-inset-right));
  min-height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

/* Zeichen wie das App-Icon */
.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand-bg {
  fill: var(--accent);
}

.brand-self {
  fill: var(--surface);
}

.brand-part {
  fill: var(--role);
  stroke: var(--surface);
  stroke-width: 3;
}

.topbar-right,
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Hilfsangebote: immer sichtbar und gut erkennbar */
.btn.btn-help {
  color: var(--notice-text);
  background: transparent;
  border-color: var(--notice-text);
}

/* Knopf nur mit Symbol (Einstellungen), Trefferfläche 44 px */
.btn.btn-icon {
  width: var(--touch);
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
}

/* Schmale Handys: Schriftzug ausblenden, das Zeichen bleibt (Navigation steht unten) */
@media (max-width: 400px) {
  .topbar .btn {
    padding: 8px 12px;
  }

  .brand-text {
    display: none;
  }
}

/* --- Hauptnavigation ---------------------------------------------------- */
/* Handy: Leiste unten, fest am Rand. Desktop (ab 768 px): in der Kopfzeile. */

:root {
  --tabbar-h: calc(64px + env(safe-area-inset-bottom, 0px));
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
}

.tab[aria-current="page"] {
  color: var(--text);
}

.tab[aria-current="page"] .tab-icon {
  background: var(--accent-soft);
}

.tab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

@media (max-width: 767px) {
  /* Platz für die Leiste, damit sie nichts verdeckt */
  body.has-tabbar .view {
    padding-bottom: calc(var(--tabbar-h) + var(--gap));
  }

  /* Im Gespräch sitzt die Eingabeleiste direkt über der Leiste */
  body.has-tabbar .view-chat {
    padding-bottom: var(--tabbar-h);
  }

  body.has-tabbar .composer {
    bottom: var(--tabbar-h);
  }

  /* Tastatur offen (Fokus in einem Textfeld): Leiste weg, Eingabe bekommt den Platz */
  body.keyboard-open .tabbar {
    display: none;
  }

  body.has-tabbar.keyboard-open .view {
    padding-bottom: var(--gap);
  }

  body.has-tabbar.keyboard-open .view-chat {
    padding-bottom: 0;
  }

  body.has-tabbar.keyboard-open .composer {
    bottom: 0;
  }
}

@media (min-width: 768px) {
  .tabbar {
    position: static;
    display: flex;
    gap: 4px;
    flex: 1;
    padding: 0;
    background: none;
    border: 0;
  }

  .tab {
    flex-direction: row;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px 0 10px;
    font-size: 0.95rem;
    border-radius: 999px;
  }

  .tab-icon {
    width: auto;
    height: auto;
    background: none;
  }

  .tab .icon {
    width: 20px;
    height: 20px;
  }

  .tab[aria-current="page"],
  .tab[aria-current="page"] .tab-icon {
    background: var(--accent-soft);
  }
}

/* --- Hilfsangebote und Sicherheitshinweis ------------------------------- */

.help-text {
  margin-bottom: var(--gap);
}

.help-text > :last-child {
  margin-bottom: 0;
}

.help-text ul {
  padding-left: 1.3em;
}

/* Nicht „sticky“: Auf dem Handy mit offener Tastatur bliebe sonst kaum Platz.
   Dauerhaft erreichbar ist der Knopf „Hilfsangebote“ in der Kopfzeile. */
.safety-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap);
  padding: 12px 14px;
  color: var(--notice-text);
  background: var(--notice-bg);
  border: 1px solid var(--notice-text);
  border-radius: var(--radius);
}

.safety-banner p {
  margin: 0;
  font-weight: 500;
}

/* --- Inhalt ------------------------------------------------------------- */

[hidden] {
  display: none !important;
}

.view {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--gap);
  padding-bottom: max(var(--gap), env(safe-area-inset-bottom));
  padding-left: max(var(--gap), env(safe-area-inset-left));
  padding-right: max(var(--gap), env(safe-area-inset-right));
}

.view:focus {
  outline: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.5vw, 2.1rem);
  margin: 0 0 12px;
}

/* Abschnittstitel in kleinen Versalien („Was du bemerkt hast“, „Gefühle“) */
.overline {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

p {
  margin: 0 0 12px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px var(--gap);
}

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

/* --- Formulare und Knöpfe ----------------------------------------------- */

label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type="password"],
input[type="text"],
textarea,
select {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.form-error {
  min-height: 1.5em;
  margin: 8px 0;
  color: var(--danger);
}

/* --- Login -------------------------------------------------------------- */

.login-form {
  max-width: 420px;
  margin: 8vh auto 0;
}

.login-form .btn {
  width: 100%;
}

.login-form input + label {
  margin-top: 14px;
}

.btn-block {
  width: 100%;
}

a.btn {
  text-decoration: none;
}

.stack > * + * {
  margin-top: var(--gap);
}

/* --- Startseite --------------------------------------------------------- */

.choices {
  margin: 0;
  padding: 0;
  border: 0;
}

.choices legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Auswahlkarte: ganze Fläche ist antippbar */
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: var(--touch);
  margin: 0 0 8px;
  padding: 12px 14px;
  font-weight: normal;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.choice input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
}

.choice-text {
  display: flex;
  flex-direction: column;
}

.choice-title {
  font-weight: 600;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  white-space: nowrap;
  padding: 1px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}

/* --- Review ------------------------------------------------------------- */

.review-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.review-group {
  margin: 16px 0 0;
}

.review-change {
  margin: 8px 0;
}

.review-change p {
  margin: 2px 0;
  white-space: pre-wrap;
}

.review-change-label {
  font-weight: 500;
}

.review-tag {
  display: inline-block;
  min-width: 64px;
  font-size: 0.8rem;
  color: var(--muted);
}

.review-evidence {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 3px solid var(--border);
  font-style: italic;
}

.review-text {
  white-space: pre-wrap;
}

.review-decision {
  margin-top: 8px;
}

.review-edit {
  margin: 8px 0;
}

.review-edit > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.review-edit label {
  margin-top: 8px;
}

.review-match .choice {
  margin-bottom: 6px;
}

.review-decided {
  margin: 12px 0;
}

.review-decided > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.welcome-info p {
  margin: 0;
}

.help-notice .help-text {
  margin-top: 8px;
}

.choice-description {
  color: var(--muted);
  font-size: 0.95rem;
}

.field-hint {
  margin: 4px 0;
  font-size: 0.9rem;
}

.form-status:empty {
  display: none;
}

textarea {
  resize: vertical;
}

.home-note {
  margin-top: 24px;
  font-size: 0.9rem;
}

/* --- Sitzungsliste ------------------------------------------------------ */

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--touch);
  margin-bottom: 10px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.session-item:hover {
  border-color: var(--muted);
}

.session-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.session-item-top .badge {
  margin-left: 0;
}

.session-item-date {
  font-size: 0.92rem;
}

.session-item:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.session-item-title {
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.session-item-meta {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* --- Chat --------------------------------------------------------------- */
/* Coach schreibt Fließtext ohne Blase (wie eine Antwort auf Papier), eigene
   Nachrichten stehen als Blase rechts (docs/design.md, Phase 3). */

/* Chat füllt die Höhe: Verlauf wächst, Eingabeleiste sitzt unten */
.view-chat {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.view-chat .msg-list {
  flex: 1;
}

.chat-header {
  margin-bottom: 4px;
}

.chat-header h1 {
  margin-bottom: 2px;
  font-size: clamp(1.35rem, 1.2rem + 0.8vw, 1.7rem);
}

.chat-meta {
  margin-bottom: 8px;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--gap);
}

.chat-actions:empty {
  display: none;
}

.turn-hint {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 0 var(--gap);
}

.msg {
  max-width: 85%;
  overflow-wrap: anywhere;
}

.msg-body > :last-child {
  margin-bottom: 0;
}

.msg-body ul,
.msg-body ol {
  margin: 0 0 12px;
  padding-left: 1.3em;
}

/* Coach: Fließtext, angenehme Lesebreite */
.msg-assistant {
  align-self: stretch;
  max-width: 65ch;
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Eigene Nachricht: Blase rechts in sanftem Akzent */
.msg-user {
  align-self: flex-end;
  padding: 10px 14px;
  color: var(--text);
  background: var(--accent-soft);
  border-radius: 18px 18px 6px 18px;
}

.msg-notice {
  align-self: stretch;
  max-width: none;
  padding: 12px 16px;
  color: var(--notice-text);
  background: var(--notice-bg);
  border: 1px solid var(--notice-text);
  border-radius: var(--radius);
}

.msg-note {
  margin-top: 4px;
  font-size: 0.85rem;
  opacity: 0.75;
}

/* Daumen unter Coach-Antworten: linksbündig unter dem Text */
.msg-assistant .fb-row {
  justify-content: flex-start;
}

.msg-assistant .fb-message {
  margin: 2px 0 -8px -10px;
}

/* „Schreibt …“: drei ruhig pulsierende Punkte (der Text „•“ wird ausgeblendet) */
.typing {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 1.6em;
  margin: 0;
  color: var(--muted);
}

.typing span {
  width: 7px;
  height: 7px;
  font-size: 0;
  background: currentColor;
  border-radius: 50%;
  animation: typing-blink 1.4s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing span {
    animation: none;
    opacity: 0.6;
  }
}

.composer-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.btn-end:not(.btn-primary) {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

/* Eingabeleiste bleibt unten sichtbar, auch bei geöffneter Bildschirmtastatur */
.composer {
  position: sticky;
  bottom: 0;
  margin: 0 calc(-1 * var(--gap));
  padding: 10px var(--gap) 4px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* Eingabefeld als Pille, wächst mit dem Text */
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 40vh;
  padding: 10px 18px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  border-radius: 22px;
}

/* Runder Knopf nur mit Symbol (Senden, Stopp) */
.btn.btn-round {
  flex: none;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border-radius: 50%;
}

.composer-status {
  min-height: 0;
  margin: 0 0 6px;
}

.composer-status:empty {
  display: none;
}

/* --- Allgemeine Bausteine (ab Schritt 4) -------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

input[type="search"] {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

input[type="search"]:focus-visible,
summary:focus-visible,
.chip-button:focus-visible,
.part-item:focus-visible,
.back-link a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
}

h3 {
  font-size: 1.08rem;
  margin: 0 0 8px;
}

.back-link {
  margin-bottom: 4px;
}

.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--touch);
  margin-left: -6px;
  padding-right: 8px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.back-link .icon {
  width: 20px;
  height: 20px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap);
}

.page-header h1 {
  margin: 0;
}

.field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

.field-group > * + * {
  margin-top: var(--gap);
}

/* Zwei Felder nebeneinander, auf schmalen Bildschirmen untereinander */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.95rem;
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.inline-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: var(--touch);
  margin: 0;
  font-weight: normal;
}

/* Punkt in Rollenfarbe vor dem Namen eines Anteils */
.role-dot {
  display: inline-block;
  flex: none;
  width: 0.6em;
  height: 0.6em;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--role, var(--r-unknown));
}

.notice {
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* Umschaltbare Chips (Statusfilter, Schlagworte) */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.chip-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: var(--touch);
  margin: 0;
  padding: 6px 12px;
  font-weight: normal;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.chip-toggle:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chip-toggle:has(input:disabled) {
  opacity: 0.55;
  cursor: default;
}

/* Chip mit Knopf (Fokus-Anteile im Chat) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--touch);
  padding: 0 4px 0 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.chip:not(:has(button)) {
  padding-right: 14px;
}

.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: calc(var(--touch) - 2px);
  font: inherit;
  font-size: 1.2rem;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.chip-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Teile-Liste -------------------------------------------------------- */

.parts-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--gap);
}

.parts-group {
  margin-bottom: 20px;
}

/* Gruppentitel in kleinen Versalien („BESCHÜTZER · 6“) */
.parts-group-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.part-list,
.relation-list,
.observation-list,
.history-list,
.merge-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.part-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--touch);
  margin-bottom: 10px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.part-item:hover {
  border-color: var(--muted);
}

.part-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.part-item-top .badge {
  margin-left: 0;
}

.part-item-title {
  display: flex;
  align-items: center;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.part-item-aliases,
.part-item-meta {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.part-status-dormant,
.part-status-archived,
.part-status-merged {
  opacity: 0.7;
}

/* --- Detailseite eines Anteils ------------------------------------------ */

.part-header {
  margin-bottom: 4px;
}

.part-header h1 {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.part-header p {
  margin-bottom: 6px;
}

/* Rolle über dem Namen, mit Punkt in Rollenfarbe */
.part-role {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.part-role .role-dot {
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 8px;
}

.part-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.part-badges .badge {
  margin-left: 0;
}

/* Status „aktiv“ ist der Normalfall und braucht kein Abzeichen */
.part-status-badge-active {
  display: none;
}

.badge.badge-quiet {
  color: var(--muted);
  background: transparent;
}

.part-section {
  margin-top: var(--gap);
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.part-section > * + * {
  margin-top: 10px;
}

.part-section h2 {
  font-size: 1.15rem;
}

.part-section .card {
  background: var(--bg);
}

/* Einklappbare Abschnitte: die ganze Überschrift ist antippbar, ▸/▾ zeigt den Zustand */
.part-details > summary {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  cursor: pointer;
}

.part-details > summary,
.focus-picker > summary {
  list-style: none;
}

.part-details > summary::-webkit-details-marker,
.focus-picker > summary::-webkit-details-marker {
  display: none;
}

/* Einklappbare Bereiche: kleiner Winkel, der sich beim Öffnen dreht (alle details-Bereiche) */
.part-details > summary::before,
.focus-picker > summary::before,
.review-edit > summary::before,
.review-decided > summary::before,
.dev-panel > summary::before {
  content: "";
  flex: none;
  width: 0.45em;
  height: 0.45em;
  margin: 0 12px 0 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.part-details[open] > summary::before,
.focus-picker[open] > summary::before,
.review-edit[open] > summary::before,
.review-decided[open] > summary::before,
.dev-panel[open] > summary::before {
  transform: rotate(45deg);
}

.part-details > summary h2 {
  margin: 0;
}

.profile-list {
  margin: 0 0 12px;
}

/* Profilangaben: Feldname in kleinen Versalien, darunter der Text */
.profile-list dt {
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-list dd {
  margin: 0 0 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.relation-item,
.observation-item,
.history-item {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.relation-item:first-child,
.observation-item:first-child,
.history-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.relation-item p,
.observation-item p,
.history-item p {
  margin: 0 0 4px;
}

.relation-text {
  font-weight: 500;
}

.relation-sentence em {
  font-style: italic;
  color: var(--accent);
}

.relation-status-resolved .relation-text {
  color: var(--muted);
  text-decoration: line-through;
}

.relation-meta,
.observation-meta,
.history-meta {
  font-size: 0.85rem;
}

.relation-notes,
.observation-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.relation-preview {
  margin: 0;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.direction .choice {
  margin-bottom: 6px;
}

.evidence {
  margin: 4px 0 0;
  padding-left: 10px;
  color: var(--muted);
  border-left: 3px solid var(--border);
  overflow-wrap: anywhere;
}

.history-changes {
  margin: 4px 0 0;
  padding-left: 1.2em;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.merge-list li {
  margin-bottom: 6px;
}

.merge-preview > * + * {
  margin-top: 10px;
}

/* --- Neue Sitzung: Fokus-Auswahl ------------------------------------- */

.focus-picker > summary {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  font-weight: 500;
  cursor: pointer;
}

/* Anteile als Kreise wie auf der Karte, nach Rolle gruppiert */
.pick-group {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.pick-group > legend {
  margin-bottom: 4px;
  padding: 0;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 4px;
}

.part-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: var(--touch);
  margin: 0;
  padding: 6px 4px 8px;
  font-weight: normal;
  text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pick-circle {
  width: 48px;
  height: 48px;
  overflow: visible;
}

.pick-halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  opacity: 0;
}

.part-pick-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Gewählt: Ring kräftiger gefüllt, Ring im Akzent außen herum, Name fett */
.part-pick:has(input:checked) .pick-ring {
  fill-opacity: 0.45;
}

.part-pick:has(input:checked) .pick-halo,
.part-pick:has(input:focus-visible) .pick-halo {
  opacity: 1;
}

.part-pick:has(input:checked) .part-pick-name {
  font-weight: 600;
}

.part-pick:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 0;
}

/* Höchstzahl erreicht: übrige Anteile blass */
.part-pick:has(input:disabled) {
  opacity: 0.4;
  cursor: default;
}

/* --- Chat: Zeile „Im Blick“ (was der Coach gerade weiß, Phase 2 P2) ------ */

.in-view {
  margin-bottom: var(--gap);
}

.in-view-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.in-view-row::-webkit-scrollbar {
  display: none;
}

.in-view-part {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 76px;
  min-height: var(--touch);
  padding: 2px 2px 4px;
  font: inherit;
  color: var(--text);
  text-align: center;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.in-view-part .pick-circle {
  width: 44px;
  height: 44px;
}

.in-view-part .part-pick-name {
  font-size: 0.8rem;
}

.in-view-part:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 0;
}

/* Plus-Kreis ohne Text, im Stil eines Anteils */
.in-view-add {
  width: 52px;
}

.plus-ring {
  fill: none;
  stroke: var(--muted);
}

.plus-mark {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
}

.in-view-add:hover .plus-ring,
.in-view-add:hover .plus-mark {
  stroke: var(--accent);
}

/* Erwähnt, aber nicht im Blick: blass, mit kleinem Plus */
.in-view-part.faded .pick-circle,
.in-view-part.faded .part-pick-name {
  opacity: 0.45;
}

.in-view-badge {
  position: absolute;
  top: 0;
  left: calc(50% + 12px);
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--accent-fg);
  background: var(--accent);
  border-radius: 50%;
}

.in-view-divider {
  flex: 0 0 1px;
  align-self: stretch;
  margin: 8px 6px 18px;
  background: var(--border);
}

.in-view .form-error:empty {
  display: none;
}

/* --- Overlay (sheet.js): Handy von unten, Desktop als Dialog ------------- */

dialog.sheet {
  width: 100%;
  max-width: 100%;
  max-height: 85dvh;
  margin: auto 0 0;
  padding: 6px max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 30px rgb(0 0 0 / 0.18);
}

dialog.sheet::backdrop {
  background: rgb(0 0 0 / 0.3);
}

dialog.sheet[open] {
  animation: sheet-up 0.22s ease;
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 4px auto 6px;
  background: var(--border);
  border-radius: 4px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.sheet-close {
  font-size: 1.5rem;
  line-height: 1;
}

.sheet-body {
  display: grid;
  gap: 12px;
}

.sheet-body .field-hint {
  margin: 0;
}

.sheet-action {
  justify-content: flex-start;
  gap: 10px;
}

.sheet-action-danger {
  color: var(--danger);
}

@media (min-width: 640px) {
  dialog.sheet {
    width: min(520px, calc(100% - 32px));
    margin: auto;
    padding: 6px 24px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .sheet-handle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open] {
    animation: none;
  }
}

/* --- Einstellungen ------------------------------------------------------ */

.settings-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
}

.settings-facts dt {
  color: var(--muted);
}

.settings-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Schalter: ganze Zeile antippbar, mindestens 44 px hoch */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--touch);
  padding: 8px 0;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.switch-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.switch-row input:disabled + .switch-text {
  opacity: 0.6;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-label {
  font-weight: 500;
}

/* --- Entwicklermodus ---------------------------------------------------- */

.dev-panel {
  margin-top: 6px;
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.dev-panel > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  padding: 0 10px;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-mono);
}

.dev-rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 0;
  padding: 0 10px 8px;
}

.dev-rows dt {
  color: var(--muted);
}

.dev-rows dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Sicherheitsstufe im Entwicklermodus: grau (none), gelb (concern), rot (acute) */
.dev-concern {
  border-color: var(--warning);
}

.dev-concern > summary {
  color: var(--warning);
}

.dev-acute {
  border-color: var(--danger);
}

.dev-acute > summary {
  color: var(--danger);
}

.dev-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* --- Feedback („Hilf deinem Coach“) ------------------------------------- */

.fb-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0;
}

.fb-row-start {
  justify-content: flex-start;
  gap: 8px;
}

/* Daumen: Symbol 18 px, Trefferfläche 44 px, gedämpft, ohne Hover-Abhängigkeit */
.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  opacity: 0.55;
  cursor: pointer;
}

.fb-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: url("../icons/thumb.svg") center / contain no-repeat;
  mask: url("../icons/thumb.svg") center / contain no-repeat;
}

.fb-down::before {
  transform: rotate(180deg);
}

.fb-btn[aria-pressed="true"] {
  color: var(--accent);
  opacity: 1;
}

.fb-btn:focus-visible,
.fb-choice:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 0;
}

.fb-btn:disabled {
  cursor: default;
}

.fb-message {
  margin: 2px -10px -8px 0;
}

.fb-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.fb-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.fb-status {
  margin: 0 4px 0 0;
  font-size: 0.85rem;
}

.fb-status:empty {
  display: none;
}

.fb-thanks {
  animation: fb-fade 2.5s ease-in forwards;
}

@keyframes fb-fade {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.fb-question {
  margin: 0;
  font-weight: 500;
}

.fb-session {
  margin-top: 8px;
}

/* Rückmeldung zur Sicherheitseinstufung (Entwicklermodus) */
.fb-safety {
  padding: 0 10px 10px;
}

.fb-choice {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.fb-choice[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.fb-thumbs {
  gap: 0;
  margin-left: -10px; /* Symbol bündig mit dem Text (Trefferfläche bleibt 44 px) */
}

/* Aufklappbare Bereiche im Review: Winkel siehe „Einklappbare Bereiche“ (Detailseite) */
.review-edit > summary,
.review-decided > summary,
.dev-panel > summary {
  list-style: none;
}

.review-edit > summary::-webkit-details-marker,
.review-decided > summary::-webkit-details-marker,
.dev-panel > summary::-webkit-details-marker {
  display: none;
}

/* --- Einheitliche Bausteine und übrige Seiten (Gestaltung Phase 6a) ---- */
/* Steht absichtlich nach den älteren Regeln und verfeinert sie. */

/* Ladeanzeige: erscheint erst nach kurzer Zeit (kein Aufblitzen bei schnellen Antworten) */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: loading-in 0.2s ease 0.35s both;
}

.loading::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: typing-blink 1.4s infinite ease-in-out;
}

@keyframes loading-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Leerer Zustand: ruhiger Kasten mit Text und ggf. einem Knopf */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 var(--gap);
  padding: 20px;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state p {
  margin: 0;
}

/* Abschnittskarten: gleiche Abstände und Überschriften überall */
.card {
  padding: 18px 20px;
}

.card > h2:first-child,
.part-section > h2:first-child {
  margin-top: 0;
}

.card h2,
.part-section h2 {
  font-size: 1.15rem;
}

.card + .card,
section.card + section.card {
  margin-top: var(--gap);
}

/* Formulare */
label,
.field-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field-hint {
  color: var(--muted);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
}

select {
  cursor: pointer;
}

.form-error {
  font-weight: 500;
}

.form-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-primary:hover:not(:disabled) {
  border-color: var(--accent);
  filter: brightness(1.08);
}

.btn.btn-danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--danger);
}

/* Auswahlkarten (Startseite, Willkommen, Review) */
.choices legend {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.choice {
  padding: 14px 16px;
  margin-bottom: 10px;
}

.choice:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: none;
}

.choice-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-family: var(--font-display);
}

.choice-title .badge {
  margin-left: 0;
}

/* Schalter: Kontrollkästchen mit role="switch" sieht aus wie ein Schalter (nur CSS) */
input[type="checkbox"][role="switch"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

input[type="checkbox"][role="switch"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s ease;
}

input[type="checkbox"][role="switch"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"][role="switch"]:checked::after {
  transform: translateX(18px);
}

input[type="checkbox"][role="switch"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

input[type="checkbox"][role="switch"]:disabled {
  opacity: 0.5;
  cursor: default;
}

.switch-row {
  gap: 14px;
  padding: 10px 0;
}

.switch-row input[type="checkbox"][role="switch"] {
  width: 44px;
  height: 26px;
  margin-top: 0;
}

.switch-label {
  font-weight: 600;
}

/* Einklappbare Bereiche: Überschrift als ganze Zeile antippbar */
.review-edit > summary,
.review-decided > summary,
.dev-panel > summary {
  display: flex;
  align-items: center;
}

/* Anmelden und „Gerade nicht erreichbar“: mittig, Zeichen über dem Formular */
.login-form {
  margin-top: 6vh;
  padding: 28px 24px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
}

.login-mark {
  width: 56px;
  height: 56px;
}

.login-brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--muted);
}

.login-form h1 {
  text-align: center;
  margin-bottom: 16px;
}

.login-form .btn {
  margin-top: 8px;
}

/* Willkommen */
.welcome-info {
  background: var(--accent-soft);
  border-color: transparent;
}

/* Startseite */
.review-hint {
  background: var(--accent-soft);
  border-color: transparent;
}

.home-note {
  font-size: 0.88rem;
}

/* Review */
.review-group {
  margin: 20px 0 10px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.review-card h4,
.review-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
}

.review-rows {
  padding: 0;
  font-size: 0.95rem;
}

.review-evidence {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  color: var(--muted);
  border-left: 3px solid var(--accent-soft);
}

.review-tag {
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Annehmen / Ablehnen / Später als zusammenhängende Knopfgruppe */
.review-decision {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0;
  margin-top: 12px;
}

.review-decision .fb-choice {
  min-height: var(--touch);
  padding: 0 16px;
  font-size: 0.95rem;
  border-radius: 0;
  margin-left: -1px;
}

.review-decision .fb-choice:first-child {
  margin-left: 0;
  border-radius: 999px 0 0 999px;
}

.review-decision .fb-choice:last-child {
  border-radius: 0 999px 999px 0;
}

.review-decision .fb-choice[aria-pressed="true"] {
  position: relative;
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.review-decided > summary {
  font-weight: 600;
}

/* Hilfsangebote: in der Hinweisfarbe, Nummern groß */
.help-text.card {
  color: var(--notice-text);
  background: var(--notice-bg);
  border-color: var(--notice-text);
}

.help-text strong {
  font-size: 1.15em;
}

.help-text a {
  color: inherit;
}

/* Einstellungen */
.settings-facts {
  gap: 6px 16px;
}

/* Entwicklermodus: nur an Farben und Schrift angeglichen */
.dev-panel {
  background: var(--sunken);
  border-color: var(--border);
}

@media (prefers-reduced-motion: reduce) {
  .loading,
  .loading::before {
    animation: none;
  }

  input[type="checkbox"][role="switch"],
  input[type="checkbox"][role="switch"]::after {
    transition: none;
  }
}

/* --- Profil, Verlauf und gemeinsame Kleinteile (Gestaltung Phase 6b) ---- */

/* Abschnittskopf: Überschrift links, Symbolknopf (Bearbeiten, Hinzufügen) rechts */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--touch);
  margin: -6px -6px 0 0;
}

.section-head h2 {
  margin: 0;
}

.btn.btn-icon .icon {
  width: 22px;
  height: 22px;
}

/* Zeile, die zu einer Unterseite führt (z. B. Einstellungen im Profil) */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-top: var(--gap);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.list-row .icon {
  margin-left: auto;
  color: var(--muted);
}

.list-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-row-hint {
  font-weight: 400;
  font-size: 0.9rem;
}

.list-row:hover {
  border-color: var(--muted);
}

/* Startseite: laufende Sitzung fortsetzen */
.resume-row {
  margin: 0 0 var(--gap);
  background: var(--accent-soft);
  border-color: transparent;
}

.review-hint .overline {
  margin: 0;
}

/* Gruppentitel in kleinen Versalien (Verlauf nach Monat) */
.group-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.session-group {
  margin-bottom: 20px;
}

/* Seitenkopf mit Symbolknöpfen (Liste/Karte, Neuer Anteil, „…“) */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: -8px;
}

/* Menü hinter „…“ */
.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
}

.menu-item {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 0 12px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--sunken);
  outline: none;
}

/* Teile-Liste: Filter eingeklappt */
.filter-details > summary {
  gap: 8px;
}

.filter-label {
  font-weight: 600;
}

.filter-summary {
  font-size: 0.9rem;
}

/* Karte: Rollen-Pillen und „?“ in einer Zeile, Legende klappt darunter auf */
.map-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.map-legend-toggle {
  position: relative;
  flex: none;
}

.map-legend-toggle > summary {
  list-style: none;
}

.map-legend-toggle > summary::-webkit-details-marker {
  display: none;
}

.map-legend-box {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  width: min(300px, calc(100vw - 32px));
  padding: 12px 14px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
}

.map-legend-box p {
  margin: 0 0 6px;
}

.map-legend-box p:last-child {
  margin-bottom: 0;
}

.map-relations {
  margin-top: 4px;
}

.map-relations > summary h2 {
  font-size: 1.05rem;
}

/* Detailseite eines Anteils (6b): Kopf mit Stift, Kurzprofil, kompakte Abschnitte */
.part-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.part-title-row h1 {
  margin-bottom: 8px;
}

.part-title-row .btn-icon {
  margin: -2px -8px 0 0;
}

.core-profile {
  margin: 14px 0 4px;
}

.core-profile .profile-list {
  margin: 0;
}

/* Zugeklappte Abschnitte: Titel, Anzahl und ggf. eine Zeile Vorschau */
.fold-title {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}

.fold-extra {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.fold-count {
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--sunken);
  border-radius: 999px;
}

.fold-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}

.part-details[open] .fold-preview {
  display: none;
}

/* Beziehungen: eine Zeile je Beziehung, ganze Zeile antippbar */
.relation-list .relation-item {
  padding: 0;
}

.relation-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  width: 100%;
  min-height: var(--touch);
  padding: 8px 0;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}

.relation-row > .icon {
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: var(--muted);
}

.relation-row:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.relation-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  flex: 1;
}

.relation-text {
  font-weight: 500;
}

.relation-meta {
  font-size: 0.85rem;
}

.relation-row .relation-notes {
  flex-basis: 100%;
  font-size: 0.9rem;
  white-space: normal;
}

.relation-actions {
  margin: 10px 0 6px;
}

.relations-resolved > summary {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
}

/* „Mehr“: Unterbereiche ohne eigene Karte */
.more-block {
  margin-top: 14px;
}

.more-block h3,
.part-details > summary h3 {
  margin: 0;
  font-size: 1rem;
}

/* Review: Fortschritt über den Vorschlägen */
.review-progress {
  margin: 0 0 8px;
}

/* Karte: leere Meldungszeile nimmt keinen Platz ein (Karte steht direkt unter dem Kopf) */
.view-wide > .form-error:empty {
  display: none;
}

/* Karte: „?“ und „…“ nebeneinander rechts neben den Rollen */
.map-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  margin-right: -6px;
}

/* Detailseite: untere Bereiche als eine Gruppe gleich gebauter Zeilen */
.fold-group {
  padding-top: 4px;
  padding-bottom: 4px;
}

.fold-row + .fold-row {
  border-top: 1px solid var(--border);
}

.fold-row > summary {
  min-height: 52px;
}

.fold-row > summary h2 {
  font-size: 1.05rem;
}

.fold-body {
  padding: 4px 0 14px;
}

.fold-body > * + * {
  margin-top: 10px;
}

/* Beziehung: Winkel dreht sich, wenn die Details offen sind */
.relation-row > .icon {
  transition: transform 0.15s ease;
}

.relation-row[aria-expanded="true"] > .icon {
  transform: rotate(90deg);
}

.relation-panel {
  padding: 0 0 12px;
}

.relation-panel p {
  margin: 0 0 6px;
}

.relation-list .relation-item + .relation-item {
  border-top: 1px solid var(--border);
}

/* Einstellungen: Schalter untereinander mit Trennlinie, Konto als eine Zeile */
.switch-list {
  padding-top: 6px;
  padding-bottom: 6px;
}

.switch-list .switch-row + .switch-row,
.switch-list .field-hint + .switch-row {
  border-top: 1px solid var(--border);
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.danger-zone > summary {
  color: var(--danger);
  font-weight: 600;
}

.danger-zone > * + * {
  margin-top: 10px;
}

/* 6c: Details erst beim Antippen, kürzere Angaben */

/* Startseite: Dauer neben dem Titel, Beschreibung nur bei der gewählten Karte */
.choice-duration {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
}

.choices .choice:not(:has(input:checked)) .choice-description {
  display: none;
}

/* Verlauf: Titel links, kurzes Datum rechts, Abzeichen darunter nur bei Bedarf */
.session-item-top .session-item-date {
  flex: none;
  font-size: 0.9rem;
}

.session-item > .badge {
  align-self: flex-start;
  margin: 4px 0 0;
}

/* Profil: „Über mich“ höchstens drei Zeilen */
.about-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  white-space: pre-wrap;
}

/* Chat: „Sitzung beenden“ als leiser Textlink (wird zum Knopf, wenn die Runden erreicht sind) */
.btn.btn-link:not(.btn-primary) {
  min-height: var(--touch);
  padding: 0 4px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Beziehung: „Auflösen“ als Text, Bearbeiten und Löschen als Symbole rechts */
.relation-actions {
  align-items: center;
  justify-content: space-between;
}

.relation-icons {
  display: flex;
  gap: 2px;
}

.btn.btn-icon.btn-icon-danger {
  color: var(--danger);
}

/* Detailseite: „Weitere Angaben“ direkt unter dem Kurzprofil, als leiser Aufklapper */
.more-fields > summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}

.more-fields > summary::-webkit-details-marker {
  display: none;
}

.more-fields > summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  margin-left: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}

.more-fields[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.more-fields > .profile-list {
  margin-top: 6px;
}

/* Home (6d): Begrüßung, täglicher Check-in, Fortsetzen, Offenes */
.start-head {
  margin-bottom: var(--gap);
}

.start-head h1 {
  margin-bottom: 2px;
}

.start-head p {
  margin: 0;
}

.checkin-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--accent-soft);
  border-color: transparent;
}

.checkin-card .overline,
.checkin-card p {
  margin: 0;
}

.checkin-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.checkin-done {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkin-done .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.checkin-card.is-done {
  background: var(--surface);
  border-color: var(--border);
}

.checkin-card .form-error:empty {
  display: none;
}

.checkin-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* Nächster Schritt (Home): ruhige Karte unter dem Check-in */
.next-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.next-card .overline,
.next-card p {
  margin: 0;
}

.next-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
}

.next-card .form-error:empty {
  display: none;
}

.next-card .checkin-actions {
  margin-top: 6px;
}

.start-group {
  margin-top: 24px;
}

.start-group .group-title {
  margin-bottom: 0;
}

.start-other {
  margin-top: 24px;
  background: transparent;
  border-style: dashed;
}

/* Neue Sitzung: Startknopf oben, leere Fehlerzeile ohne Platz */
.new-session > .form-error:empty {
  display: none;
}

/* --- Teile-Karte ------------------------------------------------------- */
/* Gestaltung Phase 5 (docs/design.md). Maße der Knoten setzt map.js in
   SVG-Einheiten (gleiche Pixelgröße auf jedem Bildschirm); hier nur Farben. */

/* Die Karte darf breiter sein als normale Seiten */
.view.view-wide {
  max-width: 1180px;
}

.map-layout {
  display: grid;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.map-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.map-wrap {
  padding: 4px;
}

.map-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  user-select: none;
  -webkit-user-select: none;
}

/* Hintergrund: Selbst und Zonen */
.map-self-stop {
  stop-color: var(--self);
}

.map-self-label {
  fill: var(--muted);
  font-style: italic;
  text-anchor: middle;
  pointer-events: none;
}

.map-zone {
  fill: var(--muted);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-anchor: middle;
  opacity: 0.85;
  pointer-events: none;
}

/* Anteile */
.map-node {
  cursor: grab;
  touch-action: none; /* Ziehen auf dem Handy, ohne die Seite zu scrollen */
  transition: opacity 0.2s;
}

.map-node.dragging {
  cursor: grabbing;
}

.map-node:focus {
  outline: none;
}

.map-hit {
  fill: transparent;
}

.map-tint {
  fill: var(--surface);
}

.map-ring {
  fill: var(--role, var(--r-unknown));
  fill-opacity: 0.16;
  stroke: var(--role, var(--r-unknown));
}

.map-core {
  fill: var(--role, var(--r-unknown));
}

.map-halo {
  fill: none;
  stroke: var(--accent);
  opacity: 0;
}

.map-node.selected .map-halo,
.map-node:focus-visible .map-halo {
  opacity: 1;
}

.map-name {
  fill: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}

.map-cap {
  fill: var(--muted);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-anchor: middle;
  pointer-events: none;
}

.map-node.dormant {
  opacity: 0.45;
}

/* Beziehungen in einer ruhigen Farbe; polarisiert im Akzent, „löst aus“ im Feuerwehr-Ton */
.map-edge {
  fill: none;
  stroke: var(--edge);
  stroke-linecap: round;
  transition: opacity 0.2s;
}

.map-arrow {
  fill: var(--edge);
}

.map-edge.rel-polarized {
  stroke: var(--accent);
}

.map-edge.rel-triggers {
  stroke: var(--r-firefighter);
}

.map-arrow.rel-triggers {
  fill: var(--r-firefighter);
}

/* Verbündet: breites, blasses Band */
.map-edge.rel-allied {
  stroke-opacity: 0.4;
}

.map-edge.resolved {
  stroke-opacity: 0.3;
}

/* Auswahl oder Rollenfilter: der Rest tritt zurück */
.map-canvas.dimmed .map-node:not(.lit) {
  opacity: 0.22;
}

.map-canvas.dimmed .map-node.dormant.lit {
  opacity: 0.55;
}

.map-canvas.dimmed .map-edge:not(.lit) {
  opacity: 0.1;
}

/* Filter nach Rolle */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 14px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.pill .role-dot {
  margin-right: 0;
}

.pill[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Ausgeschaltete Rolle: Pille blass, Punkt hohl */
.pill[aria-pressed="false"] {
  color: var(--muted);
}

.pill[aria-pressed="false"] .role-dot {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--role, var(--r-unknown));
}

.pill:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.pill-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* „Rückgängig“ nach „Nach Rollen ordnen“ */
.map-undo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

/* Vorschau eines Anteils */
.map-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.map-preview-head .part-role {
  margin: 12px 0 0;
}

.map-preview-close {
  margin: -4px -10px 0 0;
  font-size: 1.5rem;
  line-height: 1;
}

.map-preview-name {
  margin: 0 0 8px;
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}

.map-preview .profile-list {
  margin-top: 14px;
}

.map-preview-relations {
  margin-bottom: 16px;
}

.map-preview-relations ul {
  margin: 4px 0 0;
  padding-left: 1.1em;
}

.map-preview-relations li {
  margin-bottom: 4px;
}

.map-preview-handle {
  display: none;
}

.map-scrim {
  display: none;
}

/* Desktop: Vorschau rechts neben der Karte */
@media (min-width: 960px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }

  .map-preview {
    position: sticky;
    top: 72px;
    margin-top: 0; /* bündig mit der Karte */
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
  }
}

/* Handy und Tablet: Ablage von unten über der Navigationsleiste */
@media (max-width: 959px) {
  /* Stufe unter dem Namen nur am Desktop (auf dem Handy zu eng; sie steht in der Vorschau) */
  .map-cap {
    display: none;
  }

  /* Der Hinweis „Tippe einen Anteil an …“ gehört nur in die Spalte am Desktop */
  .map-preview-empty {
    display: none;
  }

  .map-preview {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-height: 78dvh;
    overflow-y: auto;
    padding: 6px max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 30px rgb(0 0 0 / 0.18);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }

  .map-preview.open {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }

  .map-preview-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 4px auto 0;
    background: var(--border);
    border-radius: 4px;
  }

  .map-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgb(0 0 0 / 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .map-scrim.open {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-preview,
  .map-preview.open,
  .map-scrim,
  .map-node,
  .map-edge {
    transition: none;
  }
}

.map-heading {
  margin-top: 16px;
}

.legend-line {
  width: 24px;
  height: 8px;
}

.map-filters legend {
  margin-bottom: 8px;
}

/* ------------------------------------------------------------------
   IFS-Glossar (#/glossar): Gruppen mit Titel in kleinen Versalien, Begriffe
   als eingeklappte Zeilen wie auf der Detailseite, Unterbegriffe eingerückt.
   ------------------------------------------------------------------ */
.glossary-intro {
  margin-bottom: 16px;
  max-width: 65ch;
}

.glossary-intro > .overline,
.glossary-aside > .overline {
  margin: 0 0 6px;
}

.glossary-intro > :last-child,
.glossary-text > :last-child,
.glossary-aside > :last-child {
  margin-bottom: 0;
}

#glossary-search {
  margin-bottom: 20px;
}

.glossary-group {
  margin-bottom: 20px;
}

.glossary-group-intro {
  margin: -4px 0 10px;
  font-size: 0.95rem;
  max-width: 65ch;
}

.glossary-entry > summary {
  padding: 8px 0;
}

.glossary-entry > summary::before {
  align-self: flex-start;
  margin-top: 0.55em;
}

/* Begriff mit Punkt und ggf. „Vertiefung“, darunter der Einzeiler */
.glossary-head {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.glossary-term-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.glossary-term-line .role-dot {
  margin-right: 0;
}

.glossary-term {
  margin: 0;
  font-size: 1.05rem;
}

.glossary-short {
  font-size: 0.95rem;
  line-height: 1.4;
}

.glossary-body {
  max-width: 65ch;
  padding-left: calc(0.45em + 16px); /* bündig mit dem Begriff, nicht mit dem Winkel */
}

.glossary-names {
  margin: 0;
  font-size: 0.85rem;
}

.glossary-aside {
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.glossary-note {
  background: var(--accent-soft);
}

/* Unterbegriffe: eingerückt mit leiser Linie links. Ab der zweiten Ebene ohne
   zusätzlichen Einzug im Text, damit auf dem Handy genug Breite bleibt. */
.glossary-children {
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.glossary-children .glossary-body {
  padding-left: 0;
}

/* Direktsprung (#/glossar/<begriff>): nicht unter der Kopfzeile landen */
.glossary-entry {
  scroll-margin-top: 84px;
}

.glossary-see {
  margin: 0;
  font-size: 0.92rem;
}

.glossary-see a {
  display: inline-block;
  padding: 10px 0; /* größere Tippfläche, ohne die Zeile zu sprengen */
  margin: -10px 0;
}

/* Das Selbst: Punkt im Leuchten der Kartenmitte, mit feinem Rand (helles Gelb) */
.role-dot.role-self {
  background: var(--self);
  box-shadow: 0 0 0 1px var(--muted);
}

.glossary-entry[open] > summary .glossary-term {
  color: var(--accent);
}

/* Home: Begriff des Tages (ganze Karte führt zum Glossar-Eintrag) */
.term-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  color: var(--text);
  text-decoration: none;
}

.term-card:hover {
  border-color: var(--muted);
}

.term-card > .icon {
  flex: none;
  margin-left: auto;
  color: var(--muted);
}

.term-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.term-card-term {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.term-card-short {
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Teile nach Rolle (docs/teile_konzept.md, Punkt 5): „Du zu ihm“, „Heute“, „Noch offen“ */
.feel-line {
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.feel-label {
  font-weight: 600;
  color: var(--muted);
}

/* Leere Kernfelder: eine leise Zeile, Antippen öffnet das Formular */
.open-fields {
  display: block;
  width: 100%;
  min-height: var(--touch);
  margin: 0 0 4px;
  padding: 8px 0;
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}

.open-fields:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Rolle über dem Namen und Abzeichen führen zum Glossar, ohne wie Links zu schreien */
.glossary-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.glossary-link:hover,
a.badge:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

a.badge {
  text-decoration: none;
}

/* Formular: „Weitere Angaben“ enthält Eingabefelder */
form .more-fields > .stack {
  margin-top: 6px;
}

/* Neue Sitzung: Sitzungsarten nach Gruppen (Einstieg, Alltag, Vertiefen) */
.choice-group {
  display: grid;
  gap: 10px;
}

.choice-group + .choice-group {
  margin-top: 14px;
}

.choice-group > .group-title {
  margin: 0;
}

.new-session .choices {
  margin-top: 10px;
}

/* Benachrichtigungen (Profil → Einstellungen → Benachrichtigungen, Phase 2 P1) */
input[type="time"] {
  min-height: var(--touch);
  padding: 8px 12px;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.reminder-item + .reminder-item {
  border-top: 1px solid var(--border);
}

.reminder-details {
  display: grid;
  gap: 10px;
  padding: 0 0 14px 58px; /* unter dem Text des Schalters (Schalter 44 px + Abstand) */
}

.reminder-time {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 400;
}

/* Wochentage: sieben gleich breite Felder in einer Reihe (44 px hoch; auf dem Handy
   etwas schmaler als 44 px, damit die Woche zusammenbleibt) */
.day-pills {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  max-width: 360px;
}

.day-pill {
  justify-content: center;
  min-width: 0;
  padding: 0;
}

@media (max-width: 420px) {
  .reminder-details {
    padding-left: 0;
  }
}

.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.device-item + .device-item {
  border-top: 1px solid var(--border);
}

/* --- Gefühle (Phase 2, P3): Knopf, Rad, Chips ----------------------------- */

/* Kleines Farbrad mit Plus */
.emo-button {
  position: relative;
  flex: none;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: conic-gradient(
    from 0deg,
    var(--e-ueberraschung) 0deg 40deg,
    var(--e-freude) 40deg 80deg,
    var(--e-ruhe) 80deg 120deg,
    var(--e-leer) 120deg 160deg,
    var(--e-trauer) 160deg 200deg,
    var(--e-scham) 200deg 240deg,
    var(--e-abneigung) 240deg 280deg,
    var(--e-angst) 280deg 320deg,
    var(--e-wut) 320deg 360deg
  );
}

.emo-button::after {
  content: "+";
  position: absolute;
  inset: 9px;
  display: grid;
  place-items: center;
  font: 600 1.25rem/1 var(--font-display);
  color: var(--text);
  background: var(--surface);
  border-radius: 50%;
}

.emo-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Chips und Punkte in Familienfarbe */
.emo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: color-mix(in srgb, var(--emo) 20%, var(--surface));
  border: 1px solid var(--emo);
  border-radius: 999px;
}

button.emo-chip {
  cursor: pointer;
}

button.emo-chip[aria-pressed="false"] {
  background: var(--surface);
  border-color: var(--border);
}

button.emo-chip[aria-pressed="true"] {
  font-weight: 600;
}

button.emo-chip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.emo-dot {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--emo);
  border-radius: 50%;
}

.emo-dots {
  display: inline-flex;
  gap: 3px;
}

/* Overlay „Gefühl hinzufügen“ */
.emo-search {
  width: 100%;
  min-height: var(--touch);
  padding: 8px 16px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.emo-main {
  display: grid;
  min-height: 120px;
}

.emo-chosen {
  min-height: 36px;
}

.emo-chosen-empty {
  align-self: center;
  font-size: 0.9rem;
}

.emo-wheel {
  display: block;
  width: 100%;
  max-width: 340px;
  justify-self: center;
  overflow: visible;
  touch-action: manipulation;
}

.emo-wheel text {
  font-family: var(--font-display);
  pointer-events: none;
}

.emo-axis {
  fill: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.emo-seg {
  cursor: pointer;
  outline: none;
}

.emo-tint {
  fill: color-mix(in srgb, var(--emo) 34%, var(--surface));
  stroke: var(--surface);
  stroke-width: 2;
}

.emo-rim {
  fill: var(--emo);
}

.emo-seg:hover .emo-tint,
.emo-seg:focus-visible .emo-tint {
  fill: color-mix(in srgb, var(--emo) 50%, var(--surface));
}

.emo-seg:focus-visible .emo-tint,
.emo-seg:focus-visible rect,
.emo-seg:focus-visible circle {
  stroke: var(--accent);
  stroke-width: 3;
}

.emo-seg-label {
  fill: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}

.emo-seg-label.small {
  font-size: 10px;
}

.emo-count {
  fill: var(--text);
}

.emo-count-text {
  fill: var(--bg);
  font-size: 11px;
  font-weight: 600;
}

.emo-glow-inner {
  stop-color: var(--self);
}

.emo-glow-outer {
  stop-color: var(--self);
  stop-opacity: 0.35;
}

.emo-center-label {
  fill: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.emo-center-hint {
  fill: var(--muted);
  font-size: 10.5px;
}

/* Blüte */
.emo-petal rect {
  fill: var(--surface);
  stroke: var(--emo);
  stroke-width: 1.5;
}

.emo-petal text {
  fill: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}

.emo-petal.on rect {
  fill: color-mix(in srgb, var(--emo) 45%, var(--surface));
  stroke-width: 2.5;
}

.emo-petal.on text {
  font-weight: 700;
}

.emo-bloom-center circle {
  fill: color-mix(in srgb, var(--emo) 34%, var(--surface));
  stroke: var(--emo);
  stroke-width: 3;
}

.emo-bloom-center.is-self circle {
  fill: var(--self);
}

/* --- Home: „Wie geht es dir gerade?“ ---------------------------------------- */

.feeling-card {
  margin-bottom: var(--gap);
}

.feeling-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feeling-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: var(--touch);
  padding: 0;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.feeling-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}

.feeling-card .form-error:empty {
  display: none;
}

/* --- Tagebuch ------------------------------------------------------------- */

.journal-list {
  display: grid;
  gap: 10px;
  margin-top: var(--gap);
}

.journal-list .group-title {
  margin: 10px 0 0;
}

.journal-row {
  display: grid;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
}

.journal-row:hover {
  border-color: var(--muted);
}

.journal-row-date {
  font-size: 0.85rem;
}

.journal-row-emotions .emo-chip {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.85rem;
}

.journal-row-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.journal-row-parts {
  font-size: 0.85rem;
}

.journal-date {
  font-size: 1.4rem;
}

.journal-section {
  margin-top: 18px;
}

.journal-section > .overline {
  margin: 0;
}

.journal-emotions {
  align-items: center;
}

#journal-text {
  min-height: 180px;
  line-height: 1.6;
}

.journal-section .form-status:empty {
  display: none;
}

.sheet-body .form-error:empty {
  display: none;
}

/* --- Chat: Gefühle aus dem Rad (Phase 2, P4) ------------------------------ */

.composer-emotions {
  margin-bottom: 8px;
}

.composer-row .emo-button {
  align-self: flex-end;
}

.composer-row .emo-button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Gewählte Gefühle über dem Text der eigenen Nachricht */
.msg-emotions {
  justify-content: flex-end;
  margin-bottom: 6px;
}

.msg-emotions .emo-chip {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.85rem;
}

.msg-user .msg-body:empty {
  display: none;
}

/* ------------------------------------------------------------------------
   Symbole für Anteile (static/js/part-icons.js, Sprite icons/parts.svg).
   Ein Pfad je Symbol ohne eigene Farbe: Farbe = Rollenfarbe, Weiß ist durchsichtig.
   ------------------------------------------------------------------------ */
.part-icon {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Auf der Karte und in den Auswahlkreisen statt des Kerns */
.map-icon {
  fill: var(--role, var(--r-unknown));
}

/* Vor dem Namen (Liste, Tagebuch): Symbol in einem getönten Kreis */
.part-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.6em;
  height: 1.6em;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  color: var(--role, var(--r-unknown));
  background: color-mix(in srgb, var(--role, var(--r-unknown)) 16%, var(--surface));
}

.part-mark .part-icon {
  width: 76%;
  height: 76%;
}

/* Kopf der Detailseite: Symbol im Kreis vor dem Namen, antippen zum Ändern */
.part-title-row h1 {
  flex: 1;
  min-width: 0;
}

.part-avatar,
.icon-preview {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  color: var(--role, var(--r-unknown));
  background: color-mix(in srgb, var(--role, var(--r-unknown)) 16%, var(--surface));
  border: 2px solid var(--role, var(--r-unknown));
}

.part-avatar {
  width: 52px;
  height: 52px;
  padding: 0;
  cursor: pointer;
}

.part-avatar .part-icon {
  width: 70%;
  height: 70%;
}

.part-avatar.empty,
.icon-preview.empty {
  background: none;
  border-style: dashed;
  color: var(--muted);
  border-color: var(--line);
}

.part-avatar.empty svg,
.icon-preview.empty svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Feld „Symbol“ im Formular */
.icon-field-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 4px 14px 4px 4px;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  align-self: flex-start;
}

.icon-preview {
  width: 44px;
  height: 44px;
}

.icon-preview .part-icon {
  width: 70%;
  height: 70%;
}

/* Auswahl im Overlay */
.icon-sheet-top {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.icon-search {
  flex: 1;
  min-width: 0;
}

.icon-none {
  flex: none;
}

.icon-none[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 600;
}

.icon-group + .icon-group {
  margin-top: 16px;
}

.icon-group h3 {
  margin: 0 0 8px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

.icon-choice {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  color: var(--role, var(--r-unknown));
  background: color-mix(in srgb, var(--role, var(--r-unknown)) 12%, var(--surface));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-choice .part-icon {
  width: 66%;
  height: 66%;
}

.icon-choice[aria-pressed="true"] {
  border-color: var(--accent);
}

.icon-choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Layout-Feinschliff (06.11.2026) ---------------------------------------- */

/* Detailseite: Symbol, Name und Stift auf einer Mittellinie */
.part-title-row {
  align-items: center;
  margin-bottom: 8px;
}

.part-title-row h1 {
  margin: 0;
}

/* Neue Sitzung: Karten ohne sichtbares Optionsfeld, die gewählte ist hervorgehoben */
.type-choice {
  position: relative;
}

.type-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.type-choice:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Anteile wählen: direkt unter der gewählten Karte, eingerückt wie deren Text */
.focus-slot {
  margin: -4px 0 4px;
  padding: 0 4px 0 16px;
}

.focus-slot .field-hint {
  margin-top: 0;
}

/* Kurze Rückfrage (confirmSheet) */
.sheet-text {
  margin: 0;
}

.sheet-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-buttons .btn {
  flex: 1 1 auto;
}

@media (min-width: 640px) {
  .sheet-buttons .btn {
    flex: 0 0 auto;
  }
}

/* Home: „Wie geht es dir gerade?“ mittig neben dem Rad */
.feeling-text {
  justify-content: center;
}

/* Sitzungen mit einem Anteil (part-sessions.js): Detailseite und Kartenvorschau */
.part-sessions {
  margin: 10px 0 14px;
}

.part-sessions-row {
  display: flex;
  gap: 10px;
}

.part-sessions-row .btn {
  flex: 1 1 0;
}

.part-sessions .form-error:empty {
  display: none;
}

/* Plus rechts in der Kopfzeile einer einklappbaren Zeile (wie bei „Beziehungen“) */
.fold-row > summary .fold-action {
  flex: none;
  margin: 0 -6px 0 auto;
}

/* „Feedback geben“: Formular, eigene und (Entwickler) alle Rückmeldungen */
.app-feedback-thanks {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.app-feedback-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-feedback-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.app-feedback-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.app-feedback-top .app-feedback-head {
  flex: 1;
  min-width: 0;
}

.app-feedback-top .btn-icon {
  flex: none;
  margin: -10px -10px -10px 0;
}

.app-feedback-kind {
  padding: 2px 10px;
  font-size: 0.85rem;
  background: var(--accent-soft);
  border-radius: 999px;
}

.app-feedback-date {
  font-size: 0.85rem;
}

.app-feedback-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-feedback-meta {
  margin: 0;
  overflow-wrap: anywhere;
}

.app-feedback-item.status-done {
  opacity: 0.75;
}

.app-feedback-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-feedback-filter {
  flex: 1 1 140px;
}

.app-feedback-filter select {
  width: 100%;
}

/* Bilder an Rückmeldungen: Auswahl mit Vorschau, Anzeige in den Listen */
.app-feedback-attach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.app-feedback-attach .btn .icon {
  width: 20px;
  height: 20px;
  margin-right: 6px;
}

.app-feedback-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-feedback-thumb-box {
  position: relative;
}

.app-feedback-thumb,
.app-feedback-image img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.btn.btn-icon.app-feedback-thumb-remove {
  position: absolute;
  top: -14px;
  right: -14px;
  color: var(--text);
}

.app-feedback-thumb-remove .icon {
  width: 22px;
  height: 22px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.app-feedback-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-feedback-image {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: zoom-in;
}

.app-feedback-image:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.app-feedback-full {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
  border-radius: 10px;
}

/* Wer sieht was? und Hinweis „Passwort neu gesetzt“ */
.privacy-section h2,
.password-notice h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.privacy-section p {
  margin: 0 0 8px;
}

.privacy-section p:last-child {
  margin-bottom: 0;
}

.privacy-section + .group-title {
  margin-top: 24px;
}

.password-notice {
  border-left: 4px solid var(--accent);
}

.password-notice p {
  margin: 0 0 12px;
}

/* Bereich „Entwicklung“ (docs/entwicklung_konzept.md): eigener, dezenter Akzent */
:root {
  --dev-accent: #7a5c6e;
  --dev-soft: #efe6eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --dev-accent: #cfa9bd;
    --dev-soft: #2e2329;
  }
}

.dev-band {
  margin: 0 0 12px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--dev-soft);
  border-left: 4px solid var(--dev-accent);
  border-radius: 8px;
  font-size: 0.92rem;
}

.dev-hint-strong {
  color: var(--dev-accent);
  font-weight: 600;
}

.dev-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}

.dev-tabs {
  margin-bottom: 16px;
}

.dev-tabs .pill {
  text-decoration: none;
}

.dev-tabs .pill[aria-current="page"] {
  background: var(--dev-soft);
  border-color: var(--dev-accent);
}

.dev-list {
  margin: 0;
  padding-left: 20px;
}

.dev-list li + li {
  margin-top: 6px;
}

.dev-profile {
  margin: 0 0 16px;
}

.dev-profile dt {
  margin-top: 10px;
}

.dev-profile dt:first-child {
  margin-top: 0;
}

.dev-profile dd {
  margin: 2px 0 0;
}

.dev-part-head h1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-journal-entry > * + *,
.dev-finding > * + *,
.dev-rating-card > * + * {
  margin-top: 8px;
}

.dev-finding h3 {
  margin: 0;
  font-size: 1.02rem;
}

.dev-finding.priority-high {
  border-left: 4px solid var(--dev-accent);
}

.dev-usage-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.dev-rating-card.rating-down {
  border-left: 4px solid var(--dev-accent);
}

.dev-thumb {
  font-size: 1.1rem;
}

.dev-comment {
  font-style: italic;
}

.dev-private {
  margin: 0;
}

.dev-context > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent);
}

.dev-context-msg {
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--sunken);
  border-radius: 8px;
}

.dev-context-reply {
  background: var(--accent-soft);
}

.dev-quote {
  margin: 0;
  padding: 8px 12px;
  background: var(--sunken);
  border-radius: 8px;
}

.dev-rating {
  margin: 4px 0 0;
}

.dev-bars {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dev-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 0;
}

.dev-bar-name {
  overflow-wrap: anywhere;
}

.dev-bar {
  grid-row: 2;
  grid-column: 1 / -1;
  height: 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
}

.dev-bar-fill {
  display: block;
  height: 100%;
  background: var(--dev-accent);
}

.dev-bar-count {
  text-align: right;
  font-size: 0.85rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
}

.dev-bar-fill.w-0 {
  width: 0%;
}

.dev-bar-fill.w-5 {
  width: 5%;
}

.dev-bar-fill.w-10 {
  width: 10%;
}

.dev-bar-fill.w-15 {
  width: 15%;
}

.dev-bar-fill.w-20 {
  width: 20%;
}

.dev-bar-fill.w-25 {
  width: 25%;
}

.dev-bar-fill.w-30 {
  width: 30%;
}

.dev-bar-fill.w-35 {
  width: 35%;
}

.dev-bar-fill.w-40 {
  width: 40%;
}

.dev-bar-fill.w-45 {
  width: 45%;
}

.dev-bar-fill.w-50 {
  width: 50%;
}

.dev-bar-fill.w-55 {
  width: 55%;
}

.dev-bar-fill.w-60 {
  width: 60%;
}

.dev-bar-fill.w-65 {
  width: 65%;
}

.dev-bar-fill.w-70 {
  width: 70%;
}

.dev-bar-fill.w-75 {
  width: 75%;
}

.dev-bar-fill.w-80 {
  width: 80%;
}

.dev-bar-fill.w-85 {
  width: 85%;
}

.dev-bar-fill.w-90 {
  width: 90%;
}

.dev-bar-fill.w-95 {
  width: 95%;
}

.dev-bar-fill.w-100 {
  width: 100%;
}

.dev-transcript {
  margin-top: 16px;
}

/* Kleine Überschrift in Karten (Bereich „Entwicklung“): wie .overline, nicht wie h2 */
.card > h2.overline {
  margin: 0 0 8px;
  font-size: 0.72rem;
}

/* Nutzerverwaltung (#/admin) */
.admin-user > * + * {
  margin-top: 8px;
}

.admin-user-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-user.is-blocked {
  opacity: 0.75;
}

.badge.admin-role.role-admin,
.badge.admin-role.role-developer {
  color: var(--text);
  background: var(--dev-soft);
  border-color: var(--dev-accent);
}

.badge.admin-blocked {
  color: var(--danger);
  border-color: var(--danger);
}

.admin-password-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-password-row input {
  flex: 1 1 12rem;
  min-width: 0;
  font-family: var(--font-mono, monospace);
}

.admin-credentials dd {
  font-family: var(--font-mono, monospace);
  overflow-wrap: anywhere;
}

/* „Bevor es losgeht“ (#/hinweise) */
.consent-confirm {
  margin-top: 16px;
  border-left: 4px solid var(--accent);
}

.consent-check {
  font-weight: 600;
}

.consent-check input {
  width: 22px;
  height: 22px;
}

/* Neue Sitzung: Einführung für Neue (Schritte 1–4, geschaffte mit Haken) */
.intro-path {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.intro-path .choice {
  margin-bottom: 0;
}

.intro-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.intro-progress {
  font-size: 0.88rem;
}

.intro-path > .field-hint {
  margin: 0;
}

.intro-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-weight: 600;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}

.intro-mark.is-done {
  color: var(--surface);
  background: var(--accent);
}

.intro-mark .icon {
  width: 18px;
  height: 18px;
}

.badge.badge-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  background: transparent;
}

.badge.badge-done .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* Geschaffter Schritt, der nicht mehr startet (z. B. „Ersten Anteil entdecken“) */
.type-choice.is-locked {
  cursor: default;
  background: transparent;
}

.choice-note {
  font-size: 0.9rem;
}

.more-types {
  margin-top: 14px;
}

.more-types > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.more-types[open] > summary {
  margin-bottom: 10px;
}

/* Leere Teile-Seite: erster Anteil geführt oder von Hand */
.first-part-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.first-part-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.first-part .form-error:empty {
  display: none;
}

/* „…“-Menü: Symbol vor dem Text, „Löschen …“ rot nach einer Trennlinie (docs/loeschen_konzept.md) */
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-item .icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.menu-item-danger {
  color: var(--danger);
}

.menu-separator {
  margin: 6px 4px;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Beziehung und Beobachtung: „…“ rechts */
.relation-actions {
  display: flex;
  justify-content: flex-end;
}

.observation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.observation-head .btn-icon {
  margin: -10px -8px 0 0;
}

/* Sitzung: Titel und „…“ in einer Zeile */
.chat-title-row {
  flex-wrap: nowrap;
  align-items: flex-start;
  margin-bottom: 0;
}

/* Kurzer Hinweis unten („Gelöscht.“), über der Navigation */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 18px;
  transform: translateX(-50%);
  color: var(--surface);
  background: var(--text);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.18);
}

.relation-panel .relation-actions {
  margin: -6px 0 0;
}

.relation-panel .form-error:empty,
.observation-item .form-error:empty {
  display: none;
}

/* Einstellungen: „Konto löschen“ unter „Abmelden“, Seite #/konto-loeschen */
.account-delete-row .list-row-text > span:first-child {
  color: var(--danger);
}

.plain-list {
  margin: 0;
  padding-left: 1.2em;
}

.plain-list li + li {
  margin-top: 6px;
}

.account-delete-warning {
  font-weight: 600;
  color: var(--danger);
}
