/* Burnout-Coach – schlichte Palette, abgeleitet aus dem Logo
   (helles Blau + Salbei-Grün auf warmem Off-White). */

:root {
  --bg: #fbf9f4;
  --surface: #ffffff;
  --fg: #2a2a2a;
  --muted: #6e6e6e;

  --blue: #9DCEDB;
  --blue-deep: #6FB0C2;
  --green: #B0C975;
  --green-deep: #8FAA56;

  --user-bg: #eaf3f6;
  --coach-bg: #ffffff;
  --border: #e4e0d6;
  --danger: #9b4a3a;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04);

  --radius: 14px;
  --max-w: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1e1f23;
    --fg: #ebe9e3;
    --muted: #9d9b95;

    --blue: #9DCEDB;
    --blue-deep: #c6e3ec;
    --green: #B0C975;
    --green-deep: #cde0a0;

    --user-bg: #23323a;
    --coach-bg: #1e1f23;
    --border: #2c2e34;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 'Futura', 'Century Gothic', sans-serif;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  min-height: 100dvh;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px max(env(safe-area-inset-left, 16px), 16px) max(env(safe-area-inset-bottom, 16px), 16px);
  gap: 12px;
}

/* --- Error-Bar (oben, nur sichtbar bei Fehler) --------------------------- */

#errbar {
  position: sticky;
  top: 0;
  margin: -16px -16px 8px;
  padding: 8px 14px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  z-index: 10;
}

/* --- Header -------------------------------------------------------------- */

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  /* damit der Sticky-Header beim Scrollen nicht plötzlich kleiner wirkt */
  margin: -16px -16px 0;
  padding-left: 16px;
  padding-right: 16px;
}
@supports not (backdrop-filter: blur(8px)) {
  header { background: var(--bg); }
}
header .tagline {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
  font-style: italic;
}
header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
header .brand-logo {
  width: 38px; height: 38px;
  flex: 0 0 38px;
}
header .brand-text { display: flex; flex-direction: column; min-width: 0; }
header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--blue-deep);
}
header .subtitle {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-pill {
  margin-top: 2px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
}
.user-pill:hover { border-color: var(--blue-deep); color: var(--fg); }
.user-pill .caret { font-size: 10px; opacity: 0.7; }

/* Identität + Abmelden statt Mandanten-Wechsel */
.identity-row { display: inline-flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.user-ident { font-size: 12px; color: var(--muted); }
.user-ident .user-pill-label { font-weight: 600; color: var(--fg); }
.logout-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 11px 3px 9px;
  font: inherit; font-size: 11.5px; color: var(--fg);
  cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }
.ident-link {
  background: transparent; border: none; padding: 0;
  font: inherit; font-size: 11.5px; color: var(--blue-deep);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.ident-link:hover { color: var(--fg); }
header .toolbar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
/* Werkzeug-Buttons: rundes Icon oben, Mini-Label darunter (Option A). */
header button.icon {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
header button.icon .icon-glyph {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s;
}
header button.icon .icon-glyph svg { width: 18px; height: 18px; display: block; }
header button.icon .icon-label {
  font-size: 10.5px;
  line-height: 1.15;
  text-align: center;
  max-width: 72px;
  opacity: .85;
  letter-spacing: .01em;
}
header button.icon:hover .icon-glyph { border-color: var(--blue-deep); }
header button.icon[aria-pressed="true"] .icon-glyph {
  background: var(--blue);
  color: #1a3a44;
  border-color: var(--blue);
}

/* --- Memory-Panel -------------------------------------------------------- */

aside#memory-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.memory-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.memory-head h2 { font-size: 14px; margin: 0; color: var(--muted); font-weight: 600; }
.memory-actions { display: flex; gap: 6px; }
.memory-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.memory-actions .danger { color: var(--danger); border-color: var(--danger); }
#memory-content {
  max-height: 320px;
  overflow: auto;
  font-size: 13px;
  background: transparent;
  margin: 8px 0 0;
  color: var(--fg);
}
.memory-readable { line-height: 1.6; }
.memory-readable h4 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-deep);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.memory-readable h4:first-child { margin-top: 0; }
.memory-readable ul {
  margin: 0 0 4px;
  padding-left: 18px;
}
.memory-readable li {
  margin: 3px 0;
  color: var(--fg);
}
.memory-readable li .meta {
  color: var(--muted);
  font-size: 12px;
}
.memory-readable .empty {
  color: var(--muted);
  font-style: italic;
}

#theory-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
#theory-form textarea {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  resize: vertical;
  min-height: 160px;
  -webkit-appearance: none;
}
#theory-form textarea:focus {
  outline: 2px solid var(--blue);
  border-color: var(--blue);
}
#theory-form button {
  align-self: flex-start;
  background: var(--blue-deep);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}
#theory-status {
  font-size: 12.5px;
  color: var(--green-deep);
}
.memory-intro {
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 0 4px;
  line-height: 1.55;
}
.memory-intro code {
  background: var(--bg);
  padding: 0 4px;
  border-radius: 4px;
  font-size: 11.5px;
}
aside#memory-panel details {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
aside#memory-panel details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  padding: 4px 0;
  user-select: none;
}
aside#memory-panel details[open] summary { margin-bottom: 4px; }

#memory-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}
#memory-form .cat-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#memory-form .cat-select > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
#memory-form fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
#memory-form fieldset[hidden] { display: none; }
#memory-form .hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 2px;
}
#memory-form .hint strong { color: var(--fg); }
#memory-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}
#memory-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
#memory-form input:not([type="checkbox"]):not([type="radio"]),
#memory-form textarea,
#memory-form select {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  -webkit-appearance: none;
}
#memory-form input:focus:not([type="checkbox"]):not([type="radio"]),
#memory-form textarea:focus,
#memory-form select:focus {
  outline: 2px solid var(--blue);
  outline-offset: 0;
  border-color: var(--blue);
}
#memory-form input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
#memory-form .form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
#memory-form button[type="submit"] {
  padding: 8px 16px;
  background: var(--blue-deep);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
#memory-form #memory-form-status {
  font-size: 12.5px;
  color: var(--green-deep);
  min-height: 1em;
}
#memory-form .footnote {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* --- Chat ---------------------------------------------------------------- */

main#chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 200px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: 92%;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow);
}
.msg.user {
  background: var(--user-bg);
  border: 1px solid transparent;
  align-self: flex-end;
}
.msg.coach {
  background: var(--coach-bg);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.msg.coach.pending { opacity: 0.7; font-style: italic; }
/* Markdown-Output im Chat */
.msg.coach p { margin: 0 0 8px; }
.msg.coach p:last-child { margin-bottom: 0; }
.msg.coach strong { font-weight: 600; color: var(--fg); }
.msg.coach em { font-style: italic; }
.msg.coach ul, .msg.coach ol { margin: 6px 0 8px; padding-left: 22px; }
.msg.coach li { margin: 2px 0; }
.msg.coach blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid var(--green);
  color: var(--muted);
  font-style: italic;
}
.msg.coach code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.msg.coach a {
  color: var(--blue-deep);
  text-decoration: underline;
}

/* --- Tages-Gruppen (kollabierte frühere Gespräche) ----------------- */
/* Die `day-block` sind eine schmale, einzeilige Akkordeon-Zeile, die
   sich beim Klick aufklappt. Bewusst kompakt – sie sollen den Beginn
   der Konversation nicht erdrücken. */

.day-block + .day-block { border-top: 1px solid var(--border); }
.day-block:first-child { border-top: 1px solid var(--border); }
.day-block:last-of-type { border-bottom: 1px solid var(--border); }

.day-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 6px 4px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
}
.day-header:hover { color: var(--fg); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.day-header .day-date { font-weight: 600; color: var(--fg); }
.day-header .day-count { font-size: 12px; opacity: 0.85; }
.day-header .day-toggle {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.5;
  transition: transform 0.15s ease;
}
.day-header[aria-expanded="true"] .day-toggle { transform: rotate(180deg); }

/* Wichtig: höhere Spezifität als .day-body { display: flex }, damit das
   HTML-hidden-Attribut respektiert wird. */
.day-body[hidden] { display: none; }
.day-body {
  padding: 4px 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-summary {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border-left: 2px solid var(--green);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg);
  line-height: 1.5;
}
.day-summary.is-loading { color: var(--muted); font-style: italic; }
.day-show-full {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font: inherit;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.day-show-full:hover { border-color: var(--blue-deep); color: var(--fg); }

.msg.coach .remembered {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--green);
  font-size: 12px;
  color: var(--green-deep);
}
.msg.error {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  align-self: stretch;
}

/* --- Eingabe ------------------------------------------------------------- */

form#input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#input {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  max-height: 200px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  -webkit-appearance: none;
}
#input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
#mic, #send {
  height: 48px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
#mic {
  width: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 20px;
  position: relative;
  transition: transform 0.15s ease;
}
#mic[aria-pressed="true"] {
  background: var(--blue);
  color: #1a3a44;
  border-color: var(--blue);
}
#mic[data-listening="true"] {
  animation: pulse 1.4s ease-in-out infinite;
}
#mic:hover:not([aria-pressed="true"]) { color: var(--blue-deep); }
#mic svg { width: 20px; height: 20px; display: block; }
#mic[hidden] { display: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(157, 206, 219, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(157, 206, 219, 0); }
}
#send {
  padding: 0 18px;
  background: var(--blue-deep);
  color: white;
}
#send[disabled] { opacity: 0.6; cursor: not-allowed; }

/* --- Footer -------------------------------------------------------------- */

footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
footer .crisis {
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  line-height: 1.5;
}
footer .crisis strong { color: var(--fg); font-weight: 600; }
footer .crisis a { color: var(--blue-deep); text-decoration: none; }
footer .crisis a:hover { text-decoration: underline; }
footer .legal-links {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
footer .legal-links a { color: var(--muted); text-decoration: none; }
footer .legal-links a:hover { color: var(--blue-deep); text-decoration: underline; }
footer .legal-links span { opacity: 0.5; }
footer .foot-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}
footer #voice-indicator {
  text-align: left;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}
footer #voice-indicator:hover {
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-underline-offset: 3px;
  color: var(--blue-deep);
}
footer .foot-copy {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
}
footer .foot-copy a { color: var(--muted); text-decoration: none; }
footer .foot-copy a:hover { color: var(--blue-deep); text-decoration: underline; }
footer .foot-copy .sep { opacity: 0.5; margin: 0 4px; }
footer #usage {
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  opacity: 0.6;
}

/* --- Mandanten-Modal ----------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  color: var(--fg);
  width: min(440px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-card h2 {
  margin: 0;
  font-size: 18px;
  color: var(--blue-deep);
  font-weight: 600;
}
.modal-intro {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-list li {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.user-list li .user-pick {
  flex: 1;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-list li .user-pick:hover { border-color: var(--blue-deep); }
.user-list li .user-pick .meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}
.user-list li .user-pick .lock {
  color: var(--blue-deep);
  font-size: 13px;
}
.user-list li .user-edit {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  flex: 0 0 auto;
}
.user-list li .user-edit:hover {
  border-color: var(--blue-deep);
  color: var(--fg);
}
.user-list .empty {
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 2px;
}
.user-create {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.user-create label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.user-create input:not([type="checkbox"]):not([type="radio"]) {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  -webkit-appearance: none;
}
.user-create input:focus:not([type="checkbox"]):not([type="radio"]) {
  outline: 2px solid var(--blue);
  border-color: var(--blue);
}
.user-create input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  -webkit-appearance: checkbox;
  appearance: checkbox;
  margin: 0;
}
.user-create button[type="submit"] {
  align-self: flex-start;
  background: var(--blue-deep);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.user-create .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.user-create .form-actions button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.user-create .form-actions button[type="submit"] {
  background: var(--blue-deep);
  color: white;
  border-color: transparent;
}
.user-create .form-actions button.danger {
  border-color: var(--danger);
  color: var(--danger);
}
.user-create label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.user-create label.checkbox input { width: auto; }
.user-create .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.modal-foot {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
  min-height: 1em;
}
.consent-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.consent-body p {
  margin: 0 0 8px;
}
.consent-body strong { font-weight: 600; }
.consent-link {
  font-size: 12.5px;
  color: var(--muted);
}
.consent-link a { color: var(--green-deep); }
#consent-form .checkbox {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.4;
  margin: 8px 0 12px;
}
#consent-form .checkbox input {
  margin-top: 3px;
  flex-shrink: 0;
}
#consent-form .form-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px;
}
#consent-accept {
  background: var(--blue-deep); color: #fff; border: none;
  border-radius: 999px; padding: 10px 20px;
  font: inherit; font-weight: 500; cursor: pointer; transition: background .2s;
}
#consent-accept:hover:not([disabled]) { background: #2e5068; }
#consent-accept[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
#consent-decline {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 18px;
  font: inherit; cursor: pointer; transition: border-color .2s, color .2s;
}
#consent-decline:hover { border-color: var(--blue-deep); color: var(--blue-deep); }
.voice-name { display: inline-flex; align-items: center; gap: 6px; }
.voice-star { color: var(--green-deep); font-size: 13px; }
.voice-cloud { color: var(--muted); font-size: 12px; }
.voice-source {
  font-size: 10.5px;
  color: var(--muted);
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 2px;
}
li.voice-group {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 2px 4px;
  list-style: none;
  pointer-events: none;
}

.export-rationale {
  background: color-mix(in srgb, var(--green) 22%, transparent);
  border-left: 3px solid var(--green);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--fg);
}
.export-rationale em {
  color: var(--green-deep);
  font-style: italic;
}
.export-rationale strong { color: var(--blue-deep); }

/* --- Mobile-Feintuning --------------------------------------------------- */

@media (max-width: 480px) {
  body { padding: 12px; gap: 10px; }
  header { margin: -12px -12px 0; padding-left: 12px; padding-right: 12px; }
  header h1 { font-size: 16px; }
  header .subtitle { display: none; }
  header .tagline { display: none; }
  #send { padding: 0 14px; }
}

/* ── Rücklink zur Hauptseite ───────────────────────────────────────────── */

.site-back {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.7;
  margin-top: 3px;
  transition: opacity .15s;
}
.site-back:hover { opacity: 1; }

/* ── MZG-Design-Override für Chat-App ─────────────────────────────────── */
/* mzg-design.css (geladen davor) setzt body auf Blau – hier zurücksetzen */
body {
  background: var(--bg);
  color: var(--fg);
}

/* ── Öffentlicher Login-Screen ────────────────────────────────────────── */

.public-overlay {
  position: fixed; inset: 0;
  background: rgba(46, 80, 104, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.public-overlay[hidden] { display: none; }

.public-card {
  position: relative;
  background: #ffffff;
  border: none;
  color: #2b2622;
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(20,20,20,.22);
}
.public-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #8a8a8a; text-decoration: none;
  transition: background .2s, color .2s;
}
.public-close svg { width: 18px; height: 18px; }
.public-close:hover { background: rgba(0,0,0,.06); color: #2b2622; }

.public-logo {
  width: 48px; height: 48px;
  display: block;
  margin-bottom: 20px;
}

.public-card h1 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: -.01em;
}

.public-intro {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.pl-field { margin-bottom: 14px; }

.pl-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.pl-field input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  transition: border-color .15s;
}

.pl-field input:focus {
  border-color: var(--blue-deep);
  box-shadow: 0 0 0 3px rgba(111,176,194,.15);
}

.pl-error {
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 12px;
}
.pl-error[hidden] { display: none; }

#pl-submit {
  width: 100%;
  padding: 11px;
  background: var(--fg);
  color: var(--surface);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 6px;
}
#pl-submit:hover { opacity: .82; }
#pl-submit:disabled { opacity: .4; cursor: not-allowed; }

.public-foot {
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.public-foot a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.public-foot a:hover { border-color: var(--fg); }

/* ═══════════════════════════════════════════════════════════════════════
   .org-Identität – Coach an meyerzugellenbeck.org angeglichen
   (Blaue Seite, weiße/​helle Karten, Oliv/Hellblau/Button-Red-Akzente,
   Futura, helle Chrome-Texte auf Blau). Liegt bewusst am Dateiende, damit
   diese Tokens auch den prefers-color-scheme:dark-Block überschreiben –
   die .org hat keinen Dark-Mode, der Coach soll durchgehend blau wirken.
   ═══════════════════════════════════════════════════════════════════════ */
:root, :root[data-x] {        /* :root[data-x] hebt die Spezifität minimal an */
  --page:        #4d7fa3;     /* Seiten-Hintergrund (mzg-Blau)        */
  --blue:        #4d7fa3;     /* Akzent / Fokus                       */
  --blue-deep:   #3a6480;     /* Senden-Button, Links, Hover          */
  --green:       #8b9e5a;     /* Oliv-Akzent (Zitate)                 */
  --green-deep:  #8b9e5a;
  --bg:          #eef3f6;     /* HELLE Füllung: Inputs, Code, Panels  */
  --surface:     #ffffff;     /* weiße Karten                         */
  --fg:          #2b2622;     /* dunkler Ink-Text (in Karten)         */
  --muted:       #5b6b74;     /* gedämpft, auf Hell lesbar            */
  --user-bg:     #e3edf2;     /* User-Sprechblase (Hellblau-Tint)     */
  --coach-bg:    #ffffff;     /* Coach-Sprechblase weiß               */
  --border:      #d7e0e6;
  --danger:      #c05c6a;     /* button-red                           */
}

/* Seite & Chrome auf Blau ------------------------------------------------ */
html { background: var(--page); }
body { background: var(--page); }

header {
  background: color-mix(in srgb, var(--page) 86%, transparent) !important;
  border-bottom-color: rgba(255,255,255,0.18);
}
header h1            { color: #ffffff; }
header .tagline      { color: rgba(255,255,255,0.82); }
.site-back {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
}
.site-back:hover     { color: #ffffff; text-decoration: underline; }
.user-pill           { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.35); }
.user-pill:hover     { color: #ffffff; border-color: #ffffff; }
.user-ident          { color: rgba(255,255,255,0.8); }
.user-ident .user-pill-label { color: #ffffff; }
.logout-btn          { color: #ffffff; border-color: rgba(255,255,255,0.4); }
.logout-btn:hover    { background: var(--button-red); border-color: var(--button-red); color: #ffffff; }
.ident-link          { color: rgba(255,255,255,0.82); }
.ident-link:hover    { color: #ffffff; }
header button.icon                  { color: #ffffff; }
header button.icon .icon-glyph      { border-color: rgba(255,255,255,0.32); }
header button.icon .icon-label      { color: rgba(255,255,255,0.85); opacity: 1; }
header button.icon:hover .icon-glyph { border-color: #ffffff; }
header button.icon[aria-pressed="true"] .icon-glyph {
  background: rgba(255,255,255,0.92); color: var(--blue-deep); border-color: #ffffff;
}

/* Chat-Sprechblasen auf Blau – etwas mehr Tiefe ------------------------- */
.msg.coach { box-shadow: 0 6px 18px rgba(0,0,0,0.10); border-color: rgba(0,0,0,0.04); }
.msg.user  { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Composer: Senden als Pille im mzg-Look ------------------------------- */
#send { background: var(--blue-deep); border-radius: 999px; padding: 0 22px; }
#send:hover:not([disabled]) { background: #2e5068; }
#mic  { border-radius: 999px; }

/* Footer auf Blau ------------------------------------------------------- */
footer                       { border-top-color: rgba(255,255,255,0.18); }
footer .crisis               { color: rgba(255,255,255,0.82); }
footer .crisis strong        { color: #ffffff; }
footer .crisis a             { color: #cfe0e8; }
footer .legal-links a        { color: rgba(255,255,255,0.78); }
footer .legal-links a:hover  { color: #ffffff; }
footer .legal-links span     { color: rgba(255,255,255,0.4); }
footer #voice-indicator      { color: #ffffff; }
footer #voice-indicator:hover { color: #ffffff; }
footer .foot-copy            { color: rgba(255,255,255,0.65); }
footer .foot-copy a          { color: rgba(255,255,255,0.8); }
footer .foot-copy a:hover    { color: #ffffff; }
footer .foot-copy .sep       { color: rgba(255,255,255,0.4); }
footer #usage                { color: rgba(255,255,255,0.55); }

/* Error-Bar randlos an die blaue Seite anschließen --------------------- */
#errbar { border-radius: 0; }
