/* Cloudhives Chat. Nur Systemschriften und eigene Zeichen, keine Anfragen an Dritte. */

:root {
  /* Hell (Standard): luftig, warmes Weiß, Honig als Akzent und für die Hauptknöpfe. */
  --bg: #fbf9f4;
  --surface: #ffffff;
  --ink: #24211b;
  --muted: #6c665a;
  --line: #ebe5d8;
  --bubble: #fcefd4;
  --accent: #dc9a22;
  --accent-ink: #8c5a05;
  --primary: #e9a730;
  --primary-ink: #241904;
  --error: #b3261e;
  --shadow: 0 1px 2px rgb(120 90 30 / 0.06), 0 10px 30px rgb(120 90 30 / 0.09);
  color-scheme: light;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --column: 760px;
  --gutter: max(16px, calc((100% - var(--column)) / 2));
}

/* Dunkel: über den Schalter oben, gespeichert im Browser. */
:root[data-theme="dark"] {
  --bg: #14130f;
  --surface: #1e1c16;
  --ink: #f2eee4;
  --muted: #a59f90;
  --line: #2f2c24;
  --bubble: #2a271f;
  --accent: #e2a93d;
  --accent-ink: #e9b95c;
  --primary: #e2a93d;
  --primary-ink: #1a1508;
  --error: #ff8f85;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Knöpfe ---------- */

.primary {
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.45;
}

.primary.small {
  padding: 7px 14px;
  font-size: 0.875rem;
}

.ghost {
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  transition: background 0.12s ease, color 0.12s ease;
}

/* Symbole in der Kopfzeile erscheinen nur auf schmalen Bildschirmen, dort ohne Text. */
.ghost svg {
  display: none;
  width: 20px;
  height: 20px;
}

/* Schalter für das Design: immer nur als Symbol, Mond im hellen, Sonne im dunklen Design. */
.ghost.icon-only {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

.ghost.icon-only svg {
  display: block;
}

:root[data-theme="dark"] .ghost.icon-only .icon-moon,
:root:not([data-theme="dark"]) .ghost.icon-only .icon-sun {
  display: none;
}

.login-theme {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
}

.ghost:hover {
  background: var(--bubble);
  color: var(--ink);
}

/* ---------- Aufbau ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--gutter);
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

/* ---------- Neuigkeiten (Glocke) ---------- */

/* Glocke rechts außen in der Kopfzeile; das Fenster „Neu im Chat“ hängt darunter am rechten Rand. */
.neu {
  position: relative;
  flex-shrink: 0;
}

.neu .neu-count {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.625rem;
}

.neu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 21;
  /* Flex-Spalte: die Kopfzeile ist ein normales erstes Kind, nur die Liste darunter scrollt. */
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 2 * var(--gutter)));
  max-height: min(calc(100vh - 110px), 680px);
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}

.neu-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.neu-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.neu-info {
  margin: 0;
  padding: 14px 18px 16px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Die Liste scrollt allein, und nur wenn sie nicht ganz hineinpasst (genau ein Scrollbalken). */
.neu-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 4px 18px 10px;
  list-style: none;
}

.neu-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.neu-item:first-child {
  border-top: 0;
}

.neu-datum {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.neu-item h3 {
  margin: 2px 0 4px;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.35;
}

.neu-item p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Beispielsatz unter dem Eintrag, nur Text. */
.neu-item .neu-beispiel {
  margin-top: 6px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Seitenblock ---------- */

/* Zweite Spalte rechts neben der Seitenleiste, aufgeklappt von einer Karte (heute „Zusätzliche Elemente“).
   Gleiche Optik wie die Seitenleiste: Kopfzeile auf Höhe von „Deine Website“ mit Schließkreuz, darunter scrollt nur
   der Inhalt. Geschlossen 0 px breit; Breite und Deckkraft gleiten in 200 ms, der Inhalt behält dabei seine Breite
   (feste Breite auf .seitenblock-inner, der Rand schneidet ab). Der Gesprächsbereich rückt entsprechend. */
.seitenblock {
  --seitenblock-width: clamp(320px, 30vw, 380px);
  flex: 0 0 auto;
  width: 0;
  overflow: hidden;
  background: var(--surface);
  opacity: 0;
  visibility: hidden;
  transition: width 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
}

.seitenblock.is-open {
  width: var(--seitenblock-width);
  opacity: 1;
  visibility: visible;
  transition: width 0.2s ease, opacity 0.2s ease, visibility 0s;
}

.seitenblock-inner {
  display: flex;
  flex-direction: column;
  width: var(--seitenblock-width);
  height: 100%;
  border-right: 1px solid var(--line);
}

.seitenblock-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 8px 8px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.seitenblock-head .sb-heading {
  color: var(--ink);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.seitenblock-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.seitenblock-body .neu-info {
  padding: 14px 18px 4px;
}

.seitenblock-body .neu-list {
  overflow: visible;
}

.seitenblock .neu-item h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.seitenblock .neu-item h3 .badge {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
}

.rand-status {
  margin-top: 4px;
  color: var(--muted);
}

/* ---------- Leiste „Veröffentlichen“ ---------- */

.publish-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 12px var(--gutter) 0;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  animation: rise 0.25s ease both;
}

.publish-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.publish-text {
  flex: 1;
  min-width: 180px;
}

.publish-bar a {
  color: var(--accent-ink);
  text-underline-offset: 3px;
}

.publish-bar.warning {
  border-color: color-mix(in srgb, var(--error) 45%, var(--line));
}

.publish-bar.warning .dot {
  background: var(--error);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 20%, transparent);
}

/* ---------- Seitenleiste ---------- */

/* Unter der Kopfzeile: Seitenleiste links, Leiste, Gespräch und Eingabe in der Mitte. */
.shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

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

/* Das Sprite der Symbole bleibt unsichtbar; gezeichnet wird nur über <use>. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sidebar {
  --sidebar-width: 280px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: var(--sidebar-width);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
  transition: width 0.18s ease;
}

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 8px 8px 8px 16px;
}

.sb-heading {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sb-toggle svg {
  transition: transform 0.18s ease;
}

/* Ausgeklappt zeigt der Pfeil nach links (einklappen), eingeklappt nach rechts. */
.sb-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.sb-nav {
  flex: 1;
  min-height: 0;
  padding: 0 8px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sb-info {
  margin: 4px 8px 8px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.sb-cat {
  margin: 12px 10px 3px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sb-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin-bottom: 2px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s ease;
}

.sb-item:is(button, a):hover {
  background: var(--bubble);
}

.sb-item:focus-visible {
  outline-offset: -2px;
}

/* Karte, deren Seitenblock offen ist: gefüllt, Akzentstrich am linken Rand. */
.sb-item[aria-expanded="true"] {
  background: var(--bubble);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sb-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--accent);
}

.sb-icon svg {
  width: 22px;
  height: 22px;
}

.sb-item.is-unused .sb-icon {
  color: var(--muted);
}

.sb-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.4;
}

.sb-title,
.sb-figure {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.sb-figure {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Kennzahl links, Badge rechts daneben; etwas Luft unter der Überschrift. */
.sb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 5px;
}

.sb-meta .sb-figure {
  flex: 1;
}

.sb-item .badge {
  flex-shrink: 0;
  padding: 0 7px;
  font-size: 0.625rem;
  line-height: 1.6;
}

/* Zahl der offenen Änderungen. */
.sb-count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
}

/* Zustand der Live-Seite als Punkt am Symbol: Akzent = aktuell, Umriss = wird gebaut, Rot = Fehler. */
.sb-state {
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.sb-state.running {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.sb-state.failed {
  background: var(--error);
}

/* Punkt am Symbol für „noch nicht genutzt“, nur eingeklappt sichtbar. */
.sb-dot {
  display: none;
  position: absolute;
  top: -2px;
  right: -3px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--muted);
}

/* Der Menüknopf in der Kopfzeile öffnet die Schublade nur auf schmalen Bildschirmen. */
.brand .menu-open {
  position: relative;
  display: none;
}

.menu-open .sb-count {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.625rem;
}

.sb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgb(20 16 6 / 0.45);
  backdrop-filter: blur(3px);
}

/* Eingeklappt (nur Desktop): 56 px, nur Symbole; Text, Badges und Überschriften bleiben für
   Screenreader erhalten, Kategorien werden zu Trennlinien. */
@media (min-width: 860px) {
  .sidebar.is-collapsed {
    --sidebar-width: 56px;
  }

  .sidebar.is-collapsed .sb-head {
    justify-content: center;
    padding: 8px;
  }

  .sidebar.is-collapsed .sb-heading,
  .sidebar.is-collapsed .sb-cat,
  .sidebar.is-collapsed .sb-info,
  .sidebar.is-collapsed .sb-text,
  .sidebar.is-collapsed .sb-item .badge {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sidebar.is-collapsed .sb-section + .sb-section,
  .sidebar.is-collapsed #sb-funktionen > .sb-section + .sb-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
  }

  .sidebar.is-collapsed .sb-section:first-child {
    margin-top: 6px;
  }

  .sidebar.is-collapsed .sb-item {
    justify-content: center;
    width: 40px;
    margin: 0 auto;
    padding: 8px 0;
  }

  .sidebar.is-collapsed .sb-dot {
    display: block;
  }

  .sidebar.is-collapsed .sb-count {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.625rem;
  }

  /* Sichtbarer Tooltip beim Fokus: fest zum Fenster, damit ihn die scrollende Leiste nicht abschneidet;
     ohne top steht er auf Höhe des Eintrags (statische Position im Flex-Container). */
  .sidebar.is-collapsed .sb-item:focus-visible::after {
    content: attr(data-tip);
    position: fixed;
    left: 64px;
    z-index: 30;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--bg);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow);
  }
}

/* Schmal: Seitenleiste als Schublade von links, geöffnet über den Menüknopf in der Kopfzeile. */
@media (max-width: 859px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: min(300px, 85vw);
    padding-top: env(safe-area-inset-top);
    border-right: 0;
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    visibility: hidden;
    /* Beim Schließen erst nach dem Hinausgleiten unsichtbar, beim Öffnen sofort sichtbar (Fokus). */
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease, visibility 0s;
  }

  /* In der Schublade zeigt der Pfeil immer nach links: Schließen. */
  .sb-toggle svg {
    transform: rotate(180deg);
  }

  /* Der Seitenblock liegt in der Schublade im Listeneintrag unter seiner Karte (app.js verschiebt ihn) und klappt
     dort in der Höhe auf (Raster 0fr → 1fr); außerhalb der Schublade nimmt er auf schmalen Bildschirmen keinen Platz. */
  .shell > .seitenblock {
    display: none;
  }

  .sb-list li > .seitenblock {
    display: grid;
    grid-template-rows: 0fr;
    width: auto;
    margin: 0;
    border-radius: 12px;
    background: var(--bg);
    transition: grid-template-rows 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
  }

  .sb-list li > .seitenblock.is-open {
    grid-template-rows: 1fr;
    margin: 4px 0 8px;
    transition: grid-template-rows 0.2s ease, opacity 0.2s ease, visibility 0s;
  }

  .sb-list li > .seitenblock .seitenblock-inner {
    width: auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    border-right: 0;
  }

  .sb-list li > .seitenblock .seitenblock-head {
    min-height: 48px;
    padding: 4px 4px 4px 14px;
  }

  .sb-list li > .seitenblock .seitenblock-body {
    overflow: visible;
  }

  .sb-list li > .seitenblock .neu-info {
    padding: 12px 14px 2px;
  }

  .sb-list li > .seitenblock .neu-list {
    padding: 4px 14px 8px;
  }

  .brand .menu-open {
    display: grid;
  }
}

/* ---------- Nachrichten ---------- */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px var(--gutter) 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.welcome {
  margin: auto 0;
  padding: 24px 0 32px;
  animation: rise 0.4s ease both;
}

.welcome h2 {
  margin: 0 0 12px;
  max-width: 16em;
  font: 500 clamp(1.7rem, 4.6vw, 2.5rem) / 1.12 var(--serif);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.welcome p {
  margin: 0 0 24px;
  max-width: 34em;
  color: var(--muted);
}

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

.chip {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9375rem;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.row {
  display: flex;
  gap: 12px;
  animation: rise 0.22s ease both;
}

.row.user {
  justify-content: flex-end;
}

.row .avatar {
  width: 26px;
  height: 26px;
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--accent);
}

.bubble {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.row.user .bubble {
  max-width: min(85%, 560px);
  padding: 10px 16px;
  border-radius: 20px 20px 6px 20px;
  background: var(--bubble);
}

/* Zeitstempel der Kundennachricht: eigene Zeile unten rechts, klein und gedämpft; `time` ist ein
   Block, damit er nie neben dem Text steht und die Blase nicht breiter macht als der Text. */
.row.user .msg-zeit {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.row.assistant .bubble {
  flex: 1;
  padding-top: 1px;
}

.row.error .bubble {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--error) 40%, var(--line));
  border-radius: 14px;
  color: var(--error);
}

.row.pending .bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.photo {
  margin: 0;
  max-width: min(85%, 320px);
  overflow: hidden;
  border-radius: 20px 20px 6px 20px;
  background: var(--bubble);
}

.photo img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.photo figcaption {
  padding: 8px 14px 10px;
  font-size: 0.875rem;
}

.photo figcaption span {
  display: block;
  color: var(--muted);
}

/* Beschreibung des Fotos: auf etwa zwei Zeilen gekürzt, der volle Text steht im title. */
.photo figcaption .description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  color: inherit;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

.composer {
  padding: 8px var(--gutter) 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}

.composer-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 180px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  resize: none;
  line-height: 1.5;
}

.composer textarea:focus {
  outline: none;
}

.composer textarea::placeholder {
  color: var(--muted);
}

.icon-button,
.send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
}

.icon-button svg,
.send svg {
  width: 22px;
  height: 22px;
}

.icon-button {
  background: transparent;
  color: var(--muted);
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-button:hover:not(:disabled) {
  background: var(--bubble);
  color: var(--ink);
}

.send {
  background: var(--primary);
  color: var(--primary-ink);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.send:hover:not(:disabled) {
  transform: translateY(-1px);
}

.send:disabled,
.icon-button:disabled {
  opacity: 0.4;
}

.composer-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

/* ---------- Ablegen von Fotos ---------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(420px, 100%);
  padding: 40px 24px;
  border: 2px dashed var(--accent);
  border-radius: 28px;
  background: var(--surface);
  text-align: center;
  /* Sonst flackert die Fläche, wenn der Zeiger über den Text fährt. */
  pointer-events: none;
}

.drop-card svg {
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  color: var(--accent);
}

.drop-card strong {
  font: 500 1.5rem/1.2 var(--serif);
}

.drop-card span {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Fenster ---------- */

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgb(20 16 6 / 0.45);
  backdrop-filter: blur(3px);
}

.dialog h2 {
  margin: 0 0 8px;
  font: 500 1.5rem/1.2 var(--serif);
}

.dialog p {
  margin: 0 0 10px;
  color: var(--muted);
}

.dialog p:empty {
  display: none;
}

.dialog p.dialog-error {
  color: var(--error);
}

.dialog-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.dialog-textarea {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  resize: vertical;
  line-height: 1.5;
}

.dialog-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.plain-list {
  max-height: 46vh;
  margin: 0 0 18px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.plain-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.plain-list li:last-child {
  border-bottom: 0;
}

.badge {
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.badge.live {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.dialog p.dialog-warning {
  color: var(--accent-ink);
  font-weight: 600;
}

.outline {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.outline:hover {
  border-color: var(--accent);
  background: var(--bubble);
}

.outline.small {
  padding: 5px 12px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* ---------- Fenster „Änderungen und Stände“ ---------- */

.dialog.wide {
  width: min(980px, calc(100vw - 32px));
  height: min(700px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
}

.dialog.wide[open] {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 28px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
}

.segmented {
  display: none;
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 28px 8px;
}

.pane + .pane {
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 45%, var(--surface));
}

.pane h3 {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dialog .pane-lead {
  margin: 0 0 14px;
  font-size: 0.875rem;
}

.dialog .pane-info {
  margin: 8px 0;
}

.pane .plain-list {
  flex: 1;
  max-height: none;
  margin: 0 -8px;
  padding: 0 8px 16px;
}

.entry-text {
  overflow-wrap: anywhere;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Änderungen als Zeitleiste: gefüllter Punkt = live, offener Punkt = nur in der Vorschau. */
.changes-list li {
  position: relative;
  padding: 0 0 18px 26px;
  border-bottom: 0;
}

.changes-list li::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.changes-list li.is-live::before {
  background: var(--accent);
}

.changes-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 2px;
  left: 7px;
  width: 1px;
  background: var(--line);
}

.changes-list li.is-preview .entry-text {
  font-weight: 600;
}

/* Stände: Text links, Knopf oder Hinweis rechts. */
.releases-list li {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.releases-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.releases-list li.is-current {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.entry-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* ---------- Anmeldung ---------- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login {
  width: min(400px, 100%);
  padding: 36px 28px 30px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.login .mark {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
}

.login h1 {
  margin: 0 0 6px;
  font: 500 2rem/1.1 var(--serif);
  letter-spacing: -0.015em;
}

.login-lead {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-form label {
  margin: 12px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.login-form input {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.login-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.login-form .primary {
  margin-top: 22px;
  padding: 13px 18px;
}

.login-error {
  margin: 14px 0 0;
  color: var(--error);
  font-size: 0.9375rem;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner {
    animation-duration: 3s !important;
  }

  /* Der Seitenblock klappt ohne Bewegung auf und zu (auch keine verzögerte Unsichtbarkeit). */
  .seitenblock {
    transition: none !important;
  }
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 760px) {
  .dialog.wide {
    height: calc(100dvh - 32px);
  }

  .segmented {
    display: flex;
    gap: 4px;
    margin: 12px 16px 0;
    padding: 4px;
    border-radius: 999px;
    background: var(--bubble);
  }

  .segmented button {
    flex: 1;
    padding: 7px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
  }

  .segmented button[aria-selected="true"] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgb(40 32 12 / 0.12);
  }

  .panes {
    grid-template-columns: 1fr;
  }

  .pane {
    padding: 16px 16px 4px;
  }

  .pane + .pane {
    border-left: 0;
    background: none;
  }

  .dialog-head {
    padding: 14px 10px 12px 18px;
  }

  .dialog.wide[data-pane="changes"] .pane[data-pane="releases"],
  .dialog.wide[data-pane="releases"] .pane[data-pane="changes"] {
    display: none;
  }

  /* Knopf und Hinweis unter den Text, damit der Text die volle Breite behält. */
  .releases-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .entry-body {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand p {
    display: none;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .topbar-actions .ghost {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
  }

  .topbar-actions .ghost svg {
    display: block;
  }

  .topbar-actions .ghost span:not(.sb-count) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .messages {
    padding-top: 16px;
  }

  .composer-hint {
    display: none;
  }
}
