/* Think Tank – Oberfläche. Ruhig und aufgeräumt: viel Fläche, wenig Rahmen, eine Akzentfarbe.
   Aufbau: Farben → Grundlagen → Bausteine (Knöpfe, Menüs, Fenster) → Login → Seitenleiste → Chat → Eingabe → Rest → Handy. */

/* Unbounded: die runde Schrift für Begrüßung und Überschriften im Standard-Design (lava.css) */
@font-face {
  font-family: "Unbounded";
  src: url("/vendor/unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
/* Bricolage Grotesque: die kräftige Schrift für Begrüßung und Überschriften im Thema „Riff“ (tank.css) */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/vendor/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
/* Newsreader: Serifen-Schrift, nur noch Ersatz, falls ein Thema keine eigene Überschriften-Schrift setzt */
@font-face {
  font-family: "Newsreader";
  src: url("/vendor/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Farben ---------- */
/* Standard-Design „Lavalampe“: warme Farbblasen hinter Milchglas. Hier stehen nur die Farben –
   Glas und Schrift regelt lava.css, die Blasen malt lava.js. Das Thema „Riff“ (tank.css) überschreibt alles. */
:root {
  --bg: #fff6f0;
  --sidebar: #fbeee7;
  --surface: #ffffff;
  --text: #2a1620;
  --muted: #67505b;
  --faint: #8b7480;
  --border: rgba(42, 22, 32, .1);
  --border-strong: rgba(42, 22, 32, .2);
  --hover: rgba(42, 22, 32, .055);
  --active: rgba(42, 22, 32, .09);
  --accent: #e0245c;
  --accent-strong: #b3123f;
  --accent-soft: rgba(224, 36, 92, .12);
  --on-accent: #ffffff;
  --bubble: rgba(224, 36, 92, .13);
  --code-bg: #f8ece6;
  --code-head: #f1dfd8;
  --notice: #86610f;
  --danger: #b3261e;
  --shadow-sm: 0 1px 2px rgba(42, 22, 32, .08);
  --shadow-composer: 0 1px 2px rgba(42, 22, 32, .04), 0 14px 40px -12px rgba(150, 50, 60, .3);
  --shadow-lg: 0 2px 8px rgba(42, 22, 32, .06), 0 16px 48px -10px rgba(90, 30, 45, .32);
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-display: "Unbounded", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --column: 760px;
  color-scheme: light;
}

/* Dunkel: wenn das Gerät dunkel ist (und nicht ausdrücklich „Hell“ gewählt wurde) … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100a12;
    --sidebar: #1a111c;
    --surface: #241826;
    --text: #fbeef2;
    --muted: #cdb3c0;
    --faint: #9c8292;
    --border: rgba(255, 220, 235, .11);
    --border-strong: rgba(255, 220, 235, .24);
    --hover: rgba(255, 220, 235, .07);
    --active: rgba(255, 220, 235, .12);
    --accent: #ff5c8a;
    --accent-strong: #ff9bb6;
    --accent-soft: rgba(255, 92, 138, .18);
    --on-accent: #2a0613;
    --bubble: rgba(255, 92, 138, .22);
    --code-bg: #0b070c;
    --code-head: #1c121e;
    --notice: #e0bd6a;
    --danger: #ff8a80;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-composer: 0 10px 32px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 16px 48px -8px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
/* … oder wenn „Dunkel“ im Konto-Menü gewählt ist. (Gleiche Werte wie oben.) */
:root[data-theme="dark"] {
  --bg: #100a12;
  --sidebar: #1a111c;
  --surface: #241826;
  --text: #fbeef2;
  --muted: #cdb3c0;
  --faint: #9c8292;
  --border: rgba(255, 220, 235, .11);
  --border-strong: rgba(255, 220, 235, .24);
  --hover: rgba(255, 220, 235, .07);
  --active: rgba(255, 220, 235, .12);
  --accent: #ff5c8a;
  --accent-strong: #ff9bb6;
  --accent-soft: rgba(255, 92, 138, .18);
  --on-accent: #2a0613;
  --bubble: rgba(255, 92, 138, .22);
  --code-bg: #0b070c;
  --code-head: #1c121e;
  --notice: #e0bd6a;
  --danger: #ff8a80;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-composer: 0 10px 32px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 16px 48px -8px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.55 var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
a { color: var(--accent-strong); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 13px; min-height: 1em; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Knöpfe ---------- */
button {
  cursor: pointer; border: 1px solid var(--border-strong); background: transparent; border-radius: 10px;
  padding: 7px 14px; font-weight: 500; font-size: 14px; line-height: 1.4;
  transition: background-color .12s, border-color .12s, color .12s, opacity .12s, transform .12s;
}
button:hover { background: var(--hover); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--text); color: var(--bg); border-color: transparent; }
button.primary:hover { opacity: .86; background: var(--text); }
button.primary.big { padding: 11px 16px; font-size: 15px; border-radius: 12px; }
button.ghost { background: transparent; }
button.danger { color: var(--danger); }
button.small { font-size: 13px; padding: 5px 11px; border-radius: 8px; }

/* Nur-Icon-Knopf (Kopfzeile, Fenster schließen …) */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; flex-shrink: 0;
  border: none; border-radius: 9px; color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; flex-shrink: 0;
  border-color: var(--border); border-radius: 999px; font-size: 13.5px; color: var(--muted);
}
.pill-btn:hover { color: var(--text); }
.pill-btn.on { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.pill-btn .icon { width: 16px; height: 16px; }

.count-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.icon-btn .count-badge { position: absolute; top: -2px; right: -4px; min-width: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
.spark { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.avatar {
  position: relative; width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-weight: 600; font-size: 11px; letter-spacing: .02em; color: #fff; background: var(--accent);
}

/* Auswahl aus zwei, drei Möglichkeiten nebeneinander */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--hover); border-radius: 10px; }
.segmented button, .segmented label > span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: transparent;
  padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: background-color .18s, color .18s, box-shadow .18s;
}
.segmented button:hover, .segmented label:hover > span { color: var(--text); background: transparent; }
.segmented button[aria-pressed="true"], .segmented label:has(input:checked) > span {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:focus-visible) > span { outline: 2px solid var(--accent); }
.segmented .icon { width: 15px; height: 15px; }

/* Schalter (an/aus) */
.switch { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--border-strong); transition: background-color .15s; flex-shrink: 0; }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .28s cubic-bezier(.3, 1.5, .5, 1);
}
[aria-checked="true"] .switch { background: var(--accent); }
[aria-checked="true"] .switch::after { transform: translateX(12px); }

/* ---------- Menüs (klappen an einem Knopf auf) ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: menu-in .14s ease-out;
}
.menu.right { left: auto; right: 0; }
.menu.up { top: auto; bottom: calc(100% + 6px); }
@keyframes menu-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px;
  text-align: left; font-weight: 400; color: var(--text);
}
.menu-item > span:not([class]) { flex: 1; min-width: 0; } /* die Beschriftung füllt die Zeile, Zähler/Schalter stehen rechts */
.menu-item .icon { color: var(--muted); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--faint); padding: 6px 10px 4px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 4px 10px; font-size: 14px; }

/* ---------- Fenster (Dialoge) ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); padding: 0;
  width: min(600px, calc(100% - 24px)); max-height: min(86dvh, 820px); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.narrow { width: min(460px, calc(100% - 24px)); }
dialog.wide, #files-dialog, #all-files-dialog { width: min(740px, calc(100% - 24px)); }
dialog[open] { display: flex; flex-direction: column; animation: dialog-in .2s cubic-bezier(.2, .8, .2, 1); }
dialog::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(3px); animation: fade-in .2s; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
.dialog-body {
  --pad-y: 20px; --pad-x: 24px;
  padding: var(--pad-y) var(--pad-x) 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0;
}
.dialog-body > * { flex-shrink: 0; }
.dialog-body p { margin: 0; }
/* Kopf bleibt beim Scrollen oben stehen. „sticky“ rechnet ab dem Innenabstand des Fensters, deshalb der negative Wert. */
.dialog-head {
  position: sticky; top: calc(-1 * var(--pad-y)); z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: calc(-1 * var(--pad-y)) calc(-1 * var(--pad-x)) 0; padding: 18px 14px 10px var(--pad-x); background: var(--surface);
}
.dialog-head h2, .dialog-body > h2 { margin: 0; font: 500 25px/1.2 var(--font-serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.dialog-body h3 { margin: 12px 0 0; font-size: 15px; }

/* Rückfragen und Hinweise (dialogs.js) – ersetzen alert/confirm/prompt des Browsers */
.ask-dialog { width: min(420px, calc(100% - 24px)); }
.ask-dialog .dialog-body { gap: 10px; padding-top: 22px; }
.ask-dialog h2 { font: 500 21px/1.3 var(--font-serif); letter-spacing: -.005em; overflow-wrap: anywhere; }
.ask-text { color: var(--muted); font-size: 14.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ask-dialog input {
  margin-top: 4px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; transition: border-color .12s, box-shadow .12s;
}
.ask-dialog input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
button.primary.danger-fill, button.primary.danger-fill:hover { background: var(--danger); color: var(--surface); }
.toasts {
  position: fixed; z-index: 60; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: min(520px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px 11px 13px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  font-weight: 400; font-size: 14px; line-height: 1.45; animation: toast-in .22s cubic-bezier(.2, .8, .2, 1);
}
.toast:hover { background: var(--surface); border-color: var(--text); }
.toast .icon { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; color: var(--accent); }
.toast span { overflow-wrap: anywhere; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Eingabefelder in Fenstern und beim Login */
.auth-card input, .admin-table input, .report-form input[name="title"], .report-form textarea, .template-form input, .template-form textarea {
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; resize: vertical; transition: border-color .12s, box-shadow .12s;
}
.auth-card input:focus, .admin-table input:focus, .report-form input[name="title"]:focus, .report-form textarea:focus,
.template-form input:focus, .template-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Logo & KI-Zeichen ---------- */
.logo-mark { display: inline-block; width: 24px; height: 24px; border-radius: 7px; background: url("/favicon.svg") center / contain no-repeat; flex-shrink: 0; }
.logo-mark.big { width: 44px; height: 44px; border-radius: 12px; }

/* Logos der Anbieter: Claude (Anthropic) und OpenAI. Die Formen stammen aus Simple Icons (CC0);
   die Marken gehören den jeweiligen Firmen und stehen hier nur dafür, von wem ein Modell kommt.
   Als Maske eingebunden, damit die Farbe aus --mark-color kommt. */
:root {
  --logo-claude: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z'/%3E%3C/svg%3E");
  --logo-openai: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z'/%3E%3C/svg%3E");
}
.ai-mark {
  --mark: var(--logo-claude);
  --mark-color: var(--accent);
  display: inline-block; width: 18px; height: 18px; flex-shrink: 0; background: var(--mark-color);
  -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat;
}
/* OpenAI-Familien: dasselbe Logo, jede Familie in ihrer Farbe */
.ai-luna, .ai-sol, .ai-terra, .ai-astra, .ai-gpt { --mark: var(--logo-openai); }
.ai-luna { --mark-color: #4a8fd0; }
.ai-sol { --mark-color: #e0a526; }
.ai-terra { --mark-color: #3f9e5a; }
.ai-astra { --mark-color: #8a5cd6; }
.ai-gpt { --mark-color: var(--text); }

/* ---------- Login ---------- */
.auth {
  height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(70% 55% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 32px 28px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg);
  animation: dialog-in .35s cubic-bezier(.2, .8, .2, 1);
}
.auth-card h1 { margin: 10px 0 0; font: 500 36px/1.1 var(--font-serif); letter-spacing: -.015em; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.auth-card input { font-size: 15px; padding: 10px 12px; }
.tabs { display: flex; gap: 2px; padding: 3px; margin-top: 6px; background: var(--hover); border-radius: 12px; }
.tab { flex: 1; border: none; background: transparent; color: var(--muted); border-radius: 9px; transition: background-color .18s, color .18s, box-shadow .18s; }
.tab:hover { background: transparent; color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Aufbau ---------- */
.app { display: flex; height: 100dvh; --sidebar-w: 272px; }
.sidebar {
  position: relative; z-index: 1; /* über dem Chat, damit der Griff zum Ziehen auf der Kante greifbar bleibt */
  width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--sidebar); border-right: 1px solid var(--border);
  transition: margin-left .24s cubic-bezier(.3, .7, .2, 1), transform .24s cubic-bezier(.3, .7, .2, 1);
}
.app.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.scrim { display: none; }

/* Breite ziehen (app.js): unsichtbarer Griff auf der Kante der Seitenleiste und der Leisten rechts.
   Die gezogene Breite steht als --sidebar-w, --files-w, --viewer-w, --board-w, --artifact-w an .app. */
.resizer { position: absolute; top: 0; bottom: 0; right: -5px; width: 10px; z-index: 6; cursor: col-resize; touch-action: none; outline: none; }
.resizer.left { right: auto; left: -5px; }
.resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; border-radius: 2px;
  background: var(--accent); opacity: 0; transition: opacity .15s;
}
.resizer:hover::after, .resizer:focus-visible::after, .resizer.dragging::after { opacity: .75; }
.app.collapsed .sidebar .resizer { display: none; }
body.resizing { cursor: col-resize; -webkit-user-select: none; user-select: none; }
body.resizing .sidebar { transition: none; }
.main { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Seitenleiste ---------- */
.sidebar-top { padding: 10px 8px 4px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 8px 2px; }
.brand {
  display: flex; align-items: center; gap: 9px; border: none; padding: 5px 8px 5px 6px;
  font: 500 19px/1.2 var(--font-serif); letter-spacing: -.01em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: none; border-radius: 9px;
  text-align: left; font-weight: 400; color: var(--text);
}
.nav-item .icon { color: var(--muted); }
.search-field { cursor: text; transition: background-color .12s, box-shadow .12s; }
.search-field:hover { background: var(--hover); }
.search-field:focus-within { background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.search-field input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 14px; }
.search-field input::placeholder { color: var(--text); opacity: 1; }
.search-field:focus-within input::placeholder { color: var(--faint); }

.chat-lists { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.chat-lists h2, .left-section summary { font-size: 12px; font-weight: 500; color: var(--faint); margin: 18px 10px 6px; }
.left-section summary { cursor: pointer; user-select: none; }
.left-section summary:hover { color: var(--muted); }
.left-section .chat-list li button { opacity: .7; }
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-list li button {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 10px; border: none; border-radius: 9px;
  text-align: left; font-weight: 400; color: var(--text); overflow: hidden;
}
.chat-list li button.active { background: var(--active); }
.chat-list .lead { display: inline-grid; place-items: center; color: var(--faint); flex-shrink: 0; }
.chat-list .lead .icon { width: 15px; height: 15px; }
.chat-list .lead.avatar { width: 18px; height: 18px; font-size: 8px; color: #fff; }
.chat-list .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .s { font-size: 11.5px; color: var(--faint); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.chat-list .placeholder { padding: 6px 10px; font-size: 13px; color: var(--faint); }
/* Ungelesen: fett, Punkt statt Uhrzeit */
.chat-list li button.unread .t { font-weight: 600; }
.chat-list li button.unread .s { display: none; }
.chat-list li button.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.sidebar-bottom { padding: 8px; border-top: 1px solid var(--border); }
#me-menu { left: 8px; right: 8px; bottom: calc(100% - 2px); }
.me {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: none; border-radius: 10px;
  text-align: left; font-weight: 400;
}
.me[aria-expanded="true"] { background: var(--hover); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.me-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--faint); white-space: nowrap; }
.me-budget { width: 30px; height: 4px; border-radius: 2px; background: var(--active); overflow: hidden; flex-shrink: 0; }
.me-budget i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .3s; }
.me-budget i.warn, .budget-fill.warn { background: var(--danger); }
.me .chevron { width: 16px; height: 16px; color: var(--faint); transform: rotate(180deg); transition: transform .15s; }
.me[aria-expanded="true"] .chevron { transform: none; }
/* Punkt am Avatar, solange es ungelesene Neuerungen gibt */
#me-wrap:has(#news-spark:not([hidden])) .me .avatar::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--sidebar);
}
.budget { padding: 8px 10px 6px; display: grid; gap: 10px; }
.budget-title { font-size: 11.5px; color: var(--faint); margin-bottom: -4px; }
.budget-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; white-space: nowrap; }
.budget-bar { height: 6px; background: var(--active); border-radius: 3px; overflow: hidden; }
.budget-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s; }

/* ---------- Kopfzeile des Chats ---------- */
.chat-header { display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 12px; flex-shrink: 0; }
/* Am großen Bildschirm nur nötig, wenn die Seitenleiste eingeklappt ist (am Handy immer da) */
@media (min-width: 761px) {
  .app:not(.collapsed) #menu-btn, .app:not(.collapsed) #new-chat-top { display: none; }
}
.chat-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding-left: 8px; overflow: hidden; white-space: nowrap; }
.chat-title-wrap h1 { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: 12px; font-weight: 500; padding: 2px 9px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong);
}
.badge .icon { width: 13px; height: 13px; }
.template-badge { background: var(--hover); color: var(--muted); }
.presence { display: flex; padding: 0 4px; }
.presence .avatar { width: 26px; height: 26px; font-size: 10px; margin-left: -6px; border: 2px solid var(--bg); box-sizing: content-box; }
/* Avatar pulsiert, solange die Person tippt */
.presence .avatar.typing { animation: pulse 1.2s infinite; z-index: 1; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--accent); } 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }

/* ---------- Nachrichten ---------- */
.messages {
  flex: 1; overflow-y: auto; padding: 12px 24px 40px; display: flex; flex-direction: column; gap: 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.messages > * { width: 100%; max-width: var(--column); margin-left: auto; margin-right: auto; flex-shrink: 0; }

.msg { display: flex; flex-direction: column; gap: 6px; animation: msg-in .22s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg.no-anim { animation: none; }
.msg .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--faint); min-height: 22px; }
.msg .meta strong { font-size: 14px; font-weight: 600; color: var(--text); }
.msg .meta .avatar { width: 22px; height: 22px; font-size: 9px; }
.msg .model-tag { font-size: 12px; }
.msg .model-tag::after { content: "·"; margin-left: 8px; }
.msg .bubble { overflow-wrap: anywhere; min-width: 0; }

/* Menschen schreiben in Blasen: eigene rechts, andere links */
.msg.user .bubble { padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; max-width: min(85%, 620px); }
.msg.user:not(.own) .bubble { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 6px; }
.msg.own { align-items: flex-end; gap: 4px; }
.msg.own .bubble { background: var(--bubble); border-bottom-right-radius: 6px; }
.msg.own .meta { order: 2; min-height: 0; font-size: 11.5px; opacity: 0; transition: opacity .15s; }
.msg.own .meta strong { display: none; }
.msg.own:hover .meta, .msg.own.no-ai .meta { opacity: 1; }
.msg.no-ai .meta::after { content: "· nur an die Gruppe"; }
.msg.own.no-ai .meta::after { content: "nur an die Gruppe"; order: -1; }

/* Die KI schreibt ohne Blase direkt auf die Fläche */
.msg.assistant .bubble { font-size: 16px; line-height: 1.7; }
.msg.notice { align-items: center; }
.msg.notice .bubble { font-size: 13px; color: var(--notice); text-align: center; padding: 5px 14px; border-radius: 999px; background: color-mix(in srgb, var(--notice) 10%, transparent); }
.msg.flash { border-radius: 14px; background: var(--accent-soft); box-shadow: 0 0 0 10px var(--accent-soft); transition: background-color 1.2s, box-shadow 1.2s; }

/* Solange die KI schreibt: Punkt am Textende, ihr Zeichen atmet */
.msg.streaming .bubble:not(.opinion-bubble) > :last-child:not(pre, ul, ol, table, .thinking)::after,
.msg.streaming .bubble:not(.opinion-bubble) > :is(ul, ol):last-child > li:last-child::after {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 5px; border-radius: 50%;
  background: var(--text); animation: breathe 1s ease-in-out infinite;
}
.msg.streaming .opinion.current .ai-mark, .msg.streaming:not(.compare) .ai-mark { animation: breathe 1.4s ease-in-out infinite; }

/* Zweite Meinung: frühere Antwort und zweite Meinung nebeneinander, auf schmalen Bildschirmen untereinander */
.messages > .msg.compare { max-width: min(1240px, 100%); }
.opinions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px 32px; }
.opinion { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Vergleich: zwei Modelle beantworten dieselbe Frage gleichzeitig – nebeneinander, bis eine Antwort gewählt ist */
.messages > .duel { max-width: min(1240px, 100%); }
.duel { display: flex; flex-direction: column; gap: 12px; }
.duel-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.duel-head .icon { width: 16px; height: 16px; flex-shrink: 0; }
.duel .opinions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.duel .opinions > .msg { min-width: 0; padding: 14px 18px 12px; border: 1px solid var(--border); border-radius: 18px; }
.duel .msg-actions { opacity: 1; margin: auto 0 0; padding-top: 6px; align-items: center; gap: 6px; }
.duel .msg.notice { align-items: flex-start; justify-content: center; }
.msg-actions .pick-btn {
  display: inline-flex; align-items: center; gap: 6px; width: auto; height: 32px; padding: 0 14px 0 10px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 500;
}
.msg-actions .pick-btn:hover { background: var(--text); color: var(--bg); opacity: .86; }
.msg-actions .pick-btn .icon { stroke-width: 2.4; }
@keyframes breathe { 0%, 100% { transform: scale(.72); opacity: .55; } 50% { transform: scale(1); opacity: 1; } }
.thinking-text {
  background: linear-gradient(90deg, var(--faint) 35%, var(--text) 50%, var(--faint) 65%) 0 0 / 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { from { background-position: 110% 0; } to { background-position: -110% 0; } }

/* Markdown in KI-Antworten */
.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble p { margin: .75em 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 1.4em 0 .5em; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; }
.bubble h1 { font-size: 1.45em; }
.bubble h2 { font-size: 1.25em; }
.bubble h3 { font-size: 1.1em; }
.bubble h4 { font-size: 1em; }
.bubble ul, .bubble ol { padding-left: 1.5em; margin: .75em 0; }
.bubble li { margin: .3em 0; }
.bubble li::marker { color: var(--faint); }
.bubble hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.bubble a { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.bubble a:hover { text-decoration-color: currentColor; }
.bubble img { max-width: 100%; border-radius: 12px; }
.bubble blockquote { margin: .9em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.bubble table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1em 0; font-size: .93em; }
.bubble th, .bubble td { border-bottom: 1px solid var(--border); padding: 8px 14px 8px 0; text-align: left; vertical-align: top; }
.bubble th { font-weight: 600; border-bottom-color: var(--border-strong); white-space: nowrap; }
.bubble code { font-family: var(--font-mono); font-size: .875em; }
.bubble :not(pre) > code { background: var(--hover); padding: 2px 6px; border-radius: 6px; }
.bubble pre {
  margin: 1em 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  font-size: 14px; line-height: 1.6; white-space: normal;
}
.bubble pre > code { display: block; padding: 12px 16px 14px; overflow-x: auto; white-space: pre; font-size: 13.5px; }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 16px;
  background: var(--code-head); border-bottom: 1px solid var(--border); font: 12px/1.4 var(--font-sans); color: var(--muted);
}
.copy-code { display: inline-flex; align-items: center; gap: 6px; border: none; padding: 4px 8px; border-radius: 7px; font-size: 12px; font-weight: 400; color: var(--muted); }
.copy-code:hover { color: var(--text); }
.copy-code .icon { width: 14px; height: 14px; }

/* Aktionen unter KI-Antworten */
.msg-actions { display: flex; gap: 2px; margin: 0 0 0 -7px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:last-child .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions button { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: none; border-radius: 8px; color: var(--faint); }
.msg-actions button:hover { color: var(--text); }
.msg-actions .icon { width: 16px; height: 16px; }
/* Ungefähre Kosten: bleiben sichtbar, die Knöpfe daneben erscheinen erst beim Drüberfahren. */
.msg-actions.has-cost { opacity: 1; }
.msg-actions.has-cost > :not(.msg-cost) { opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions.has-cost > *, .msg:last-child .msg-actions.has-cost > *, .msg-actions.has-cost:focus-within > *, .duel .msg-actions.has-cost > * { opacity: 1; }
.msg-cost { align-self: center; margin-left: 7px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg.own .msg-actions .msg-cost { order: -1; margin: 0 7px 0 0; }

/* Arbeitsschritte während einer Antwort: Notizen der KI und Zwischenstände */
.ai-steps { display: grid; gap: 3px; margin: 2px 0 8px; padding: 2px 0 2px 12px; border-left: 2px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.ai-step { color: var(--faint); overflow-wrap: anywhere; }
.ai-step.status { font-size: 12.5px; }
.ai-step.note { color: var(--muted); }
.ai-step.more { font-size: 12px; font-style: italic; }
.ai-step.current.status { animation: step-pulse 1.6s ease-in-out infinite; }
@keyframes step-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ai-step.current.status { animation: none; } }

/* Anhänge unter Nachrichten */
.attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.msg.own .attachments { justify-content: flex-end; }
.att {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px 6px 7px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13.5px;
  overflow-wrap: anywhere; transition: border-color .12s, transform .12s;
}
a.att:hover { border-color: var(--border-strong); }
.att.deleted { color: var(--faint); text-decoration: line-through; }
.att-image img { display: block; max-width: 240px; max-height: 200px; border-radius: 14px; border: 1px solid var(--border); object-fit: cover; }
/* Datei mit kleiner Vorschau: oben ein Ausschnitt wie ein Blatt Papier, darunter Symbol und Name */
.att-card {
  display: flex; flex-direction: column; width: 200px; max-width: 100%; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px;
  transition: border-color .12s, transform .12s;
}
.att-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.att-thumb { position: relative; display: grid; place-items: center; height: 124px; overflow: hidden; background: var(--active); border-bottom: 1px solid var(--border); }
.att-thumb.loaded { display: block; background: #fff; }
.att-meta { display: flex; align-items: center; gap: 8px; padding: 7px 10px 8px 8px; min-width: 0; }
.att-meta .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Der Inhalt wird doppelt so groß gezeichnet und auf die Hälfte verkleinert – wie eine verkleinerte Seite. */
.thumb-page { position: absolute; top: 0; left: 0; width: 400px; height: 248px; transform: scale(.5); transform-origin: 0 0; overflow: hidden; pointer-events: none; color: #24221d; background: #fff; }
.thumb-page iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.thumb-page.pdf iframe { width: calc(100% + 24px); } /* Bildlaufleiste des PDF-Betrachters rechts abschneiden */
.thumb-page.img { display: grid; place-items: center; }
.thumb-page.img img { max-width: 100%; max-height: 100%; }
.thumb-page pre { margin: 0; padding: 14px 16px; font: 13px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: #3a372f; background: #faf9f5; height: 100%; }
.thumb-page .doc-page { margin: 0; padding: 18px 22px; max-width: none; min-height: 100%; box-shadow: none; border: 0; font-size: 15px; }
.thumb-page table { border-collapse: collapse; font-size: 13px; }
.thumb-page td { border: 1px solid #dedbd2; padding: 3px 7px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-page tr:first-child td { background: #f1efe8; font-weight: 600; }
.slide-mini { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 22px 26px; background: linear-gradient(#fff, #f6f4ee); font-size: 15px; }
.slide-mini strong { font-size: 22px; line-height: 1.2; }
.slide-mini img { max-height: 90px; max-width: 60%; object-fit: contain; align-self: flex-start; margin-top: auto; }
.file-ext {
  display: inline-grid; place-items: center; min-width: 32px; height: 20px; padding: 0 5px; border-radius: 6px; flex-shrink: 0;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--ext, #807c72); text-decoration: none;
}
.ext-pdf { --ext: #d0483f; }
.ext-sheet { --ext: #2f9461; }
.ext-slides { --ext: #d9772b; }
.ext-doc { --ext: #3c7dcc; }
.ext-image { --ext: #8a5cd6; }
.ext-zip { --ext: #8b8678; }

/* ---------- Startseite / leerer Chat: Begrüßung, Eingabefeld in der Mitte ---------- */
.main:not(.is-empty) .empty { display: none; }
.main.is-empty .messages { flex: 1 1 0; justify-content: flex-end; padding-bottom: 30px; overflow: hidden; -webkit-mask-image: none; mask-image: none; }
.main.is-empty::after { content: ""; flex: 1.5 1 0; order: 9; }
@media (max-height: 620px) { .hero-mark { display: none; } }
.main.is-empty .footnote { order: 10; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; animation: hero-in .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes hero-in { from { opacity: 0; transform: translateY(10px); } }
.hero-mark { width: 42px; height: 42px; margin-bottom: 12px; }
.empty h2 { margin: 0; font: 400 clamp(30px, 4.6vw, 46px)/1.12 var(--font-serif); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.empty p { margin: 0; font-size: 16px; color: var(--muted); text-wrap: balance; }
.empty p:empty { display: none; }

.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: calc(100% - 48px); max-width: var(--column); margin: 16px auto 0; }
.main:not(.is-empty) .starters { display: none; }
.starter {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-color: var(--border); border-radius: 999px;
  font-weight: 400; color: var(--muted); max-width: 100%; animation: hero-in .5s cubic-bezier(.2, .8, .2, 1) backwards;
}
.starter:hover { color: var(--text); border-color: var(--border-strong); }
.starter .icon { width: 15px; height: 15px; }
.starter span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Wer gerade tippt ---------- */
.typing { width: calc(100% - 48px); max-width: var(--column); margin: 0 auto; }
.typing.active { padding-bottom: 10px; }
.typing-indicator {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; color: var(--muted);
  box-shadow: var(--shadow-sm); animation: menu-in .18s ease-out;
}
.typing-faces { display: inline-flex; }
.typing-faces .avatar { width: 22px; height: 22px; font-size: 9px; border: 2px solid var(--surface); box-sizing: content-box; }
.typing-faces .avatar + .avatar { margin-left: -8px; }
.dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: hop 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Zum Ende springen – schwebt über dem Eingabefeld, wenn man hochgescrollt hat */
.jump { position: relative; height: 0; z-index: 5; }
#jump-btn {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-composer); animation: menu-in .15s ease-out;
}
#jump-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

/* ---------- Eingabe ---------- */
.composer {
  position: relative; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 48px); max-width: var(--column); margin: 0 auto;
  padding: 12px 12px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow-composer); transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--border-strong); }
.composer textarea {
  border: none; outline: none; resize: none; background: transparent; padding: 4px 8px; max-height: 240px; min-height: 28px;
  font-size: 16px; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }
.main.is-empty .composer textarea { min-height: 56px; }
.composer-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.composer-row .menu-wrap { position: static; min-width: 0; }
.attach-btn { border: 1px solid var(--border); border-radius: 50%; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none;
  transition: background-color .12s, color .12s, border-color .12s, padding .22s ease, gap .22s ease;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.chip .icon { width: 16px; height: 16px; }
.chip:has(input:checked), .chip.on { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
button.chip { background: transparent; font-weight: 400; }
button.chip.on { background: var(--accent-soft); }
button.chip[hidden] { display: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Nur auf der Startseite stehen die Schalter ausgeschrieben da. Im laufenden Chat schrumpfen sie zu schlichten
   Symbolen ohne Rahmen (wie bei claude.ai); was sie tun, steht im Tooltip, an ist an der Farbe zu sehen. */
.chip .label { white-space: nowrap; overflow: hidden; max-width: 16em; transition: max-width .22s ease, opacity .15s; }
.main:not(.is-empty) :is(#web-wrap, #compare-btn, #ask-ai-wrap) { padding: 0 8px; gap: 0; border-color: transparent; }
.main:not(.is-empty) :is(#web-wrap, #compare-btn, #ask-ai-wrap) .label { max-width: 0; opacity: 0; }
.main:not(.is-empty) .attach-btn { border-color: transparent; }
@media (prefers-reduced-motion: reduce) { .chip, .chip .label { transition: none; } }

/* Modell + Denkaufwand: ein Knopf, ein Menü */
.picker-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; max-width: 100%; padding: 0 8px 0 12px; border: none; border-radius: 999px;
  font-size: 13.5px; font-weight: 400; color: var(--muted); white-space: nowrap;
}
.picker-btn:hover, .picker-btn[aria-expanded="true"] { color: var(--text); background: var(--hover); }
.picker-btn #picker-label { overflow: hidden; text-overflow: ellipsis; }
.picker-btn .ai-mark { width: 15px; height: 15px; }
.picker-effort { color: var(--faint); }
.picker-effort:not(:empty)::before { content: "· "; }
.picker-btn .chevron { width: 15px; height: 15px; transition: transform .2s; }
.picker-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
/* Modell-Menü: links die Anbieter (und Favoriten), in der Mitte Suche + Modelle, rechts der Denkaufwand.
   Klappt über dem Eingabefeld auf – oder darunter (.down), wenn dort mehr Platz ist (app.js: placePickerMenu). */
.menu.picker-menu {
  right: 8px; left: auto; bottom: calc(100% + 8px); width: min(640px, calc(100% - 16px)); height: 352px; padding: 0; overflow: hidden;
  display: grid; grid-template-columns: 50px minmax(0, 1fr) 208px; grid-template-rows: minmax(0, 1fr);
}
.menu.picker-menu.down { top: calc(100% + 8px); bottom: auto; }

.picker-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-right: 1px solid var(--border); }
.picker-rail button {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: none; border-radius: 9px; color: var(--faint);
}
.picker-rail button:hover { color: var(--text); }
.picker-rail button[aria-selected="true"] { color: var(--text); background: var(--hover); }
.picker-rail button[aria-selected="true"]::after {
  content: ""; position: absolute; right: -7px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent);
}
.picker-rail .ai-mark, .picker-rail .icon { width: 20px; height: 20px; }
.picker-rail .icon { fill: currentColor; }
.picker-rail button:not([aria-selected="true"]) .ai-mark { opacity: .6; }
.picker-rail button:hover .ai-mark { opacity: 1; }

.picker-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.picker-search {
  display: flex; align-items: center; gap: 9px; margin: 0 12px; padding: 13px 2px 11px; border-bottom: 1px solid var(--border);
  color: var(--faint); cursor: text; transition: border-color .12s;
}
.picker-search:focus-within { border-bottom-color: var(--accent); }
.picker-search .icon { width: 16px; height: 16px; }
.picker-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 14.5px; color: var(--text); }
.picker-search input::placeholder { color: var(--faint); }
.picker-search input::-webkit-search-cancel-button { display: none; }
.picker-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.picker-empty { margin: 0; padding: 28px 18px; text-align: center; color: var(--faint); font-size: 13.5px; text-wrap: balance; }

.model-row { display: flex; align-items: center; border-radius: 9px; }
.model-row:hover, .model-row:focus-within { background: var(--hover); }
.model-pick {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 10px; border: none; border-radius: 9px;
  text-align: left; font-size: 14.5px; font-weight: 400;
}
.model-pick:hover { background: transparent; }
.model-pick .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pick .check, .effort-item .check { width: 15px; height: 15px; color: var(--muted); visibility: hidden; }
.model-row.selected .check, .effort-item[aria-checked="true"] .check { visibility: visible; }
.model-pick .price { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
kbd {
  padding: 2px 6px; border-radius: 6px; background: var(--hover); color: var(--muted);
  font: 500 11px/1.5 var(--font-sans); white-space: nowrap;
}
/* Stern zum Merken: blass, beim Überfahren und bei Favoriten kräftig */
.fav-btn {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; margin-right: 3px; flex-shrink: 0;
  border: none; border-radius: 8px; color: var(--faint); opacity: .45;
}
.fav-btn .icon { width: 16px; height: 16px; }
.model-row:hover .fav-btn, .fav-btn:focus-visible, .fav-btn.on { opacity: 1; }
.fav-btn:hover { color: var(--text); }
.fav-btn.on, .fav-btn.on:hover { color: #e0a526; }
.fav-btn.on .icon { fill: currentColor; }

.picker-side { min-height: 0; overflow-y: auto; padding: 6px; border-left: 1px solid var(--border); }
.picker-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 6px 6px; padding: 7px 2px 10px;
  border-bottom: 1px solid var(--border); font-size: 14.5px; color: var(--muted);
}
.picker-head span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--faint); }
.effort-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; border-radius: 9px;
  text-align: left; font-size: 14.5px; font-weight: 400;
}
.effort-item > span:first-child { flex: 1; }
.effort-item .tag { font-size: 12px; color: var(--faint); }

.round-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%; flex-shrink: 0; overflow: hidden; }
.round-btn.send { background: var(--accent); color: var(--on-accent); }
.round-btn.send:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); transform: scale(1.05); }
.round-btn.send .icon { stroke-width: 2.2; }
.round-btn.stop { background: var(--text); color: var(--bg); }
.round-btn.stop:hover { background: var(--text); opacity: .85; }

.draft-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.draft-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 4px 5px 6px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border); font-size: 13.5px;
}
.draft-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-chip button { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%; color: var(--faint); }
.draft-chip button:hover { color: var(--text); }
.draft-chip button .icon { width: 13px; height: 13px; }
.draft-chip.busy { padding: 5px 12px; color: var(--muted); }

.footnote { margin: 8px auto 10px; min-height: 18px; padding: 0 24px; text-align: center; font-size: 12px; line-height: 18px; color: var(--faint); }
.footnote #status:not(:empty) { color: var(--muted); }
.footnote #status:not(:empty) + .hint { display: none; }

.left-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 48px); max-width: var(--column);
  margin: 0 auto; padding: 12px 12px 12px 20px; border: 1px dashed var(--border-strong); border-radius: 24px; color: var(--muted);
}

.drop-overlay {
  position: fixed; inset: 12px; z-index: 50; display: grid; place-items: center; padding: 24px; text-align: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(4px);
  border: 2px dashed var(--accent); border-radius: 24px; font: 500 26px/1.3 var(--font-serif);
}
.drop-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-overlay .icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 6px; }
.drop-overlay small { font: 14px/1.5 var(--font-sans); color: var(--muted); }

/* ---------- Suche ---------- */
.chat-lists.searching > h2, .chat-lists.searching > ul, .chat-lists.searching > details { display: none; }
.search-results { display: flex; flex-direction: column; gap: 1px; padding-top: 10px; }
.search-results .placeholder { padding: 6px 10px; font-size: 13px; color: var(--faint); margin: 0; }
.search-hit { width: 100%; text-align: left; border: none; padding: 8px 10px; border-radius: 9px; display: flex; flex-direction: column; gap: 2px; font-weight: 400; }
.search-results h2 { margin: 8px 10px 2px; }
.search-results h2:first-child { margin-top: 0; }
.search-hit mark { background: var(--accent-soft); color: inherit; border-radius: 3px; }
.search-hint { font: inherit; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.search-field:focus-within .search-hint { display: none; }
@media (max-width: 760px) { .search-hint { display: none; } }
.menu-head { margin: 4px 10px 6px; font-size: 12px; color: var(--faint); }
.menu-note { font-size: 12px; color: var(--faint); }
.menu-foot { max-width: 260px; margin: 8px 10px 4px; line-height: 1.45; }
.menu-scroll { overflow-y: auto; }
.row-menu { max-height: min(420px, calc(100vh - 16px)); overflow-y: auto; }
.search-hit .t { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit .s { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Ablage ---------- */
.files-list { display: flex; flex-direction: column; gap: 2px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background-color .12s; }
.file-row:hover { background: var(--hover); }
.file-icon { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--hover); overflow: hidden; }
.file-icon img { width: 100%; height: 100%; object-fit: cover; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.file-name { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.file-name:hover { text-decoration: underline; }
.file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.link-btn { border: none; background: transparent; padding: 0; color: var(--accent-strong); text-align: left; font-weight: 400; }
.link-btn:hover { background: transparent; text-decoration: underline; }

/* ---------- Was ist neu ---------- */
.news-list { display: flex; flex-direction: column; gap: 22px; }
.news-day h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--faint); }
.news-item { margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--border); }
.news-day:first-child .news-item { border-left-color: var(--accent); }
.news-item strong { display: block; font-weight: 600; }
.news-item p { margin: 2px 0 0; color: var(--muted); }

/* ---------- Fehler & Ideen ---------- */
.report-form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.report-form p { margin: 0; overflow-wrap: anywhere; }
.kind-choice { align-self: flex-start; }
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.report { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.report.done { opacity: .55; }
.report.done .report-title { text-decoration: line-through; }
.report-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.report-kind { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.report-title { font-weight: 600; }
.report-body { white-space: pre-wrap; margin: 4px 0; overflow-wrap: anywhere; }
.report-meta { font-size: 12px; color: var(--faint); }
.report-actions { display: flex; gap: 4px; margin-top: 8px; }
.report-actions button { font-size: 12.5px; padding: 3px 10px; border-radius: 8px; }
.reports-empty { color: var(--faint); text-align: center; padding: 20px 12px; margin: 0; }

/* ---------- Verwaltung & Vorlagen ---------- */
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; color: var(--faint); font-weight: 500; padding: 6px 8px 6px 0; white-space: nowrap; }
.admin-table td { padding: 8px 8px 8px 0; border-top: 1px solid var(--border); white-space: nowrap; }
.admin-table td:last-child { text-align: right; padding-right: 0; }
.admin-table input { width: 84px; padding: 5px 8px; font-size: 14px; border-radius: 8px; }
.admin-table .spent-sub { display: block; font-size: 11.5px; color: var(--faint); }
.admin-templates { display: flex; flex-direction: column; gap: 6px; }
.template-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: 12px; }
.template-row > div { flex: 1; min-width: 0; }
.template-row.archived { opacity: .55; }
.template-new summary { cursor: pointer; color: var(--accent-strong); font-size: 14px; font-weight: 500; }
.template-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* ---------- Freigeben ---------- */
.option { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .12s, background-color .12s; }
.option:hover { border-color: var(--border-strong); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin-top: 4px; }
.option > span { display: flex; flex-direction: column; }
.option strong { font-weight: 600; }
.option small { font-size: 13px; color: var(--muted); }
.share-users { display: flex; flex-direction: column; gap: 2px; max-height: 34vh; overflow-y: auto; }
.share-users label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px; cursor: pointer; }
.share-users label:hover { background: var(--hover); }
.share-users .avatar { width: 22px; height: 22px; font-size: 9px; }
.share-users.disabled { opacity: .4; pointer-events: none; }
.share-users p { margin: 0; padding: 4px 10px; }

/* ---------- Bewegung: kleine Extras ---------- */
/* Knöpfe geben beim Drücken leicht nach */
:is(.icon-btn, .round-btn, .pill-btn, .starter, .chip, .fav-btn, .copy-code, button.primary, .msg-actions button):active:not(:disabled) { transform: scale(.94); }
#jump-btn:active { transform: translateX(-50%) scale(.94); }
.round-btn.send:active:not(:disabled) { transform: scale(.92); }
.starter:hover, .artifact-card:hover, a.att:hover { transform: translateY(-1px); }

/* Fenster und Menüs blenden auch beim Schließen weich aus (statt schlagartig zu verschwinden).
   Braucht „allow-discrete“ – ältere Browser behalten die Einblend-Animation von oben. */
@supports (transition-behavior: allow-discrete) {
  dialog {
    opacity: 0; transform: translateY(8px) scale(.98);
    transition: opacity .16s ease-in, transform .16s ease-in, overlay .16s allow-discrete, display .16s allow-discrete;
  }
  dialog[open] { opacity: 1; transform: none; animation: none; transition-duration: .22s; transition-timing-function: cubic-bezier(.2, .8, .2, 1); }
  dialog::backdrop {
    animation: none; background: rgba(0, 0, 0, 0); backdrop-filter: blur(0);
    transition: background-color .2s, backdrop-filter .2s, overlay .2s allow-discrete, display .2s allow-discrete;
  }
  dialog[open]::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(3px); }
  .menu { animation: none; transition: opacity .13s ease-out, transform .13s ease-out, display .13s allow-discrete; }
  .menu[hidden] { opacity: 0; transform: translateY(4px) scale(.98); pointer-events: none; }
  @starting-style {
    dialog[open] { opacity: 0; transform: translateY(10px) scale(.98); }
    dialog[open]::backdrop { background: rgba(0, 0, 0, 0); backdrop-filter: blur(0); }
    .menu:not([hidden]) { opacity: 0; transform: translateY(4px) scale(.98); }
  }
}

/* Startseite: Das KI-Zeichen dreht sich herein */
.hero-mark { animation: mark-in .9s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes mark-in { from { opacity: 0; transform: rotate(-140deg) scale(.4); } }

/* Eigene Nachricht wächst aus der Ecke, in der das Eingabefeld sitzt */
.msg.own:not(.no-anim) .bubble { transform-origin: 100% 100%; animation: bubble-in .32s cubic-bezier(.2, .9, .3, 1.2) backwards; }
@keyframes bubble-in { from { transform: translateY(10px) scale(.9); } }

/* Senden: Der Pfeil fliegt nach oben weg und kommt von unten wieder (app.js setzt „sent“) */
.round-btn.send.sent .icon { animation: send-fly .5s cubic-bezier(.4, 0, .2, 1); }
@keyframes send-fly {
  45% { transform: translateY(-160%); opacity: 0; }
  46% { transform: translateY(160%); opacity: 0; }
}

/* Kopiert: Der Haken ploppt auf */
button[data-flash] .icon { animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Punkt bei „Was ist neu“ pulsiert ruhig */
.spark { animation: spark 2.4s ease-in-out infinite; }
@keyframes spark { 50% { box-shadow: 0 0 0 6px transparent; } }

/* Hell/Dunkel und Thema: Das neue Aussehen breitet sich als Kreis vom Klick aus (app.js: revealChange) */
.theme-reveal::view-transition-old(root), .theme-reveal::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .thinking-text { color: var(--muted); background: none; }
}

/* ---------- Geräte ohne Maus: nichts hinter „Hover“ verstecken ---------- */
@media (hover: none) {
  .msg-actions, .msg.own .meta, .fav-btn, .msg-actions.has-cost > * { opacity: 1; }
  .fp-actions { display: flex; }
}

/* ---------- Versionen und Bearbeiten ---------- */
.msg.own .msg-actions { justify-content: flex-end; margin: 0 -7px 0 0; order: 3; }
.msg.notice .msg-actions { justify-content: center; margin: 0; }
.versions { display: inline-flex; align-items: center; gap: 0; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.msg-actions .versions button { width: 24px; }
.versions-label { min-width: 26px; text-align: center; }
.edit-box { display: flex; flex-direction: column; gap: 8px; width: min(100%, 620px); align-self: flex-end; }
.msg:not(.own) .edit-box { align-self: flex-start; }
.edit-box textarea {
  width: 100%; resize: none; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 16px;
  background: var(--surface); outline: none; line-height: 1.5; box-shadow: var(--shadow-sm);
}
.edit-box textarea:focus { border-color: var(--accent); }
.edit-box .row .small.muted { margin-right: auto; }

/* ---------- Seitenleiste: Projekte, Angeheftet, Menü am Chat ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 4px 6px 0; }
.list-head h2 { margin: 0 10px !important; }
.icon-btn.tiny { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.tiny .icon { width: 15px; height: 15px; }
.chat-list li { position: relative; }
.chat-list li button.row-more {
  position: absolute; top: 3px; right: 4px; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: none; border-radius: 7px; color: var(--muted); background: var(--active); opacity: 0; transition: opacity .12s;
}
.chat-list li button.row-more .icon { width: 16px; height: 16px; }
.chat-list li:hover button.row-more, .chat-list li button.row-more:focus-visible { opacity: 1; }
.chat-list li button.row-more:hover { color: var(--text); background: var(--active); }
.chat-list li:hover button:has(+ .row-more) .s { visibility: hidden; }
.row-menu { position: fixed; top: 0; left: 0; min-width: 200px; }
#project-list .lead .icon { color: var(--muted); }
.project-badge { border: none; cursor: pointer; background: var(--hover); color: var(--muted); }
.project-badge:hover { color: var(--text); background: var(--active); }
.project-chats { margin-top: -4px; }
.title-input {
  flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 10px; padding: 2px 8px; margin-left: -8px; background: transparent;
  font: 500 25px/1.2 var(--font-serif); letter-spacing: -.01em; outline: none;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { border-color: var(--border-strong); background: var(--surface); }
#project-dialog textarea, #settings-dialog textarea, #memory-new {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); outline: none; resize: vertical; line-height: 1.5;
}
#memory-new { flex: 1; padding: 7px 12px; }
#project-dialog textarea:focus, #settings-dialog textarea:focus, #memory-new:focus { border-color: var(--accent); }
#project-dialog .icon, #settings-dialog .row .icon { width: 15px; height: 15px; }
#project-new-chat, #project-upload { display: inline-flex; align-items: center; gap: 7px; }
.move-options { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }

/* ---------- Einstellungen: Gedächtnis ---------- */
.inline-option { cursor: pointer; }
.memory-list { display: flex; flex-direction: column; gap: 2px; }
.memory-list.off { opacity: .55; }
.memory-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px 8px 10px; border-radius: 10px; }
.memory-row:hover { background: var(--hover); }
.memory-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Artefakte ---------- */
.artifact-card {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 460px; margin: .9em 0; padding: 10px 14px 10px 10px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); text-align: left; font-weight: 400;
  box-shadow: var(--shadow-sm); transition: border-color .12s, background-color .12s;
}
.artifact-card:hover { background: var(--surface); border-color: var(--accent); }
.artifact-card.active { border-color: var(--accent); background: var(--accent-soft); }
.artifact-tile { display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; background: var(--code-head); color: var(--muted); }
.artifact-tile .icon { width: 20px; height: 20px; }
.artifact-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.artifact-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-text small { font-size: 12.5px; color: var(--muted); }
.artifact-open { font-size: 13px; color: var(--muted); flex-shrink: 0; }

.artifact-panel {
  position: relative; display: flex; flex-direction: column; width: var(--artifact-w, min(46vw, 820px)); min-width: 360px; flex-shrink: 0;
  border-left: 1px solid var(--border); background: var(--surface); animation: panel-in .2s ease-out;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(16px); } }
.artifact-head { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.artifact-kind { display: inline-grid; place-items: center; color: var(--muted); margin-right: 6px; }
.artifact-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.artifact-title-wrap strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-title-wrap .small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-versions { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
#artifact-tabs { margin: 0 4px; flex-wrap: nowrap; }
#artifact-tabs button { padding: 4px 9px; }
.artifact-body { flex: 1; min-height: 0; display: flex; position: relative; }
#artifact-frame { flex: 1; width: 100%; border: none; background: #fff; }
#artifact-code {
  flex: 1; width: 100%; resize: none; border: none; outline: none; padding: 14px 16px; margin: 0; tab-size: 2;
  background: var(--code-bg); font: 13px/1.6 var(--font-mono); white-space: pre; overflow: auto;
}
.artifact-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* Mit offenem Artefakt wird der Chat schmaler – die Spalte passt sich an */
.app.with-artifact .messages, .app.files-viewing .messages { padding-left: 18px; padding-right: 18px; }

/* ---------- Whiteboard rechts (board.js) ---------- */
#board-btn[aria-pressed="true"] { color: var(--text); background: var(--active); }
#board-btn { position: relative; }
#board-btn.has-news::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg);
}
.board-panel {
  position: relative; display: flex; flex-direction: column; width: var(--board-w, min(58vw, 1100px)); min-width: 420px; flex-shrink: 1; min-height: 0;
  border-left: 1px solid var(--border); background: var(--surface); animation: panel-in .2s ease-out;
}
/* Der Chat bleibt lesbar – lieber wird das Board schmaler. */
.app.with-board .main { min-width: 340px; }
/* Zu wenig Platz für beides nebeneinander: Board über den ganzen Bildschirm (wie am Handy). */
@media (max-width: 1080px) {
  .board-panel { position: fixed; inset: 0; z-index: 46; width: auto; min-width: 0; border-left: none; }
  .app.with-board .main { min-width: 0; }
  #board-full, .board-panel .resizer { display: none; }
}
/* Vollbild: Das Board liegt über der ganzen Seite, Chat und Seitenleiste verschwinden dahinter. */
.app.board-full .board-panel { position: fixed; inset: 0; z-index: 46; width: auto; min-width: 0; border-left: none; animation: none; }
.app.board-full .board-panel .resizer { display: none; }
.board-panel .artifact-head { gap: 6px; }
#board-jump { flex-shrink: 0; }
.board-canvas { flex: 1; min-height: 0; position: relative; }
/* Excalidraw bringt eigene Schriften und Farben mit – nur die Ecken an die Seite anpassen. */
.board-canvas .excalidraw { --border-radius-lg: 10px; }
/* Knopf „Bibliothek“ (und Avatare) unter die Werkzeugleiste statt daneben – sonst ragen sie aus schmalen Boards heraus. */
.board-canvas .excalidraw:not(.excalidraw--mobile) .layer-ui__wrapper__top-right { position: absolute; top: 64px; right: 12px; }
/* „Bibliotheken durchsuchen“ führt zu excalidraw.com – was man dort hinzufügt, käme hier nicht an. */
.board-canvas .excalidraw .library-menu-browse-button { display: none; }
.app.with-board .messages { padding-left: 18px; padding-right: 18px; }
/* Neben dem Board ist der Chat schmal: Schalter nur als Symbol (Tooltip sagt, was sie tun), ohne Denkaufwand im Modell-Knopf. */
.app.with-board :is(#web-wrap, #compare-btn, #ask-ai-wrap) { padding: 0 8px; gap: 0; }
.app.with-board :is(#web-wrap, #compare-btn, #ask-ai-wrap) .label, .app.with-board #picker-effort { display: none; }

/* ---------- Dateien-Leiste rechts (viewer.js) ---------- */
#files-btn[aria-pressed="true"] { color: var(--text); background: var(--active); }
.files-panel {
  position: relative; display: flex; flex-direction: column; width: var(--files-w, 300px); flex-shrink: 0; min-height: 0;
  border-left: 1px solid var(--border); background: var(--sidebar); animation: panel-in .2s ease-out;
}
.app.files-viewing .files-panel { width: var(--viewer-w, min(48vw, 860px)); min-width: 380px; background: var(--surface); }
.fp-list-view, .fp-viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fp-head { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 8px 0 14px; flex-shrink: 0; }
.fp-viewer .fp-head { padding-left: 6px; border-bottom: 1px solid var(--border); }
.fp-head > strong { font-size: 14.5px; font-weight: 600; }
.fp-count { font-size: 12.5px; color: var(--faint); margin-left: 6px; font-variant-numeric: tabular-nums; }
.fp-hint { margin: -6px 14px 6px; font-size: 12.5px; }
.fp-items { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 16px; }
.fp-section { margin: 14px 8px 4px; font-size: 12px; font-weight: 500; color: var(--faint); letter-spacing: .01em; }
.fp-item { position: relative; display: flex; align-items: center; border-radius: 10px; transition: background-color .12s; }
.fp-item:hover { background: var(--hover); }
.fp-item.active { background: var(--active); }
.fp-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: none; border-radius: 10px;
  background: transparent; text-align: left; font-weight: 400; color: var(--text);
}
.fp-open:hover { background: transparent; }
.fp-tile { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--hover); overflow: hidden; }
.fp-tile img { width: 100%; height: 100%; object-fit: cover; }
.fp-tile .file-ext { min-width: 0; max-width: 34px; padding: 0 3px; font-size: 8.5px; overflow: hidden; }
.fp-tile.art { background: var(--code-head); color: var(--muted); }
.fp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.fp-text strong { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-actions { display: none; gap: 0; padding-right: 4px; flex-shrink: 0; }
.fp-item:hover .fp-actions, .fp-actions:focus-within { display: flex; }
.fp-actions .icon-btn.danger:hover { color: var(--danger); }
.fp-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center; color: var(--faint); }
.fp-empty > .icon { width: 28px; height: 28px; }
.fp-empty p { margin: 0; font-size: 13.5px; }
.fp-empty button { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.fp-empty button .icon { width: 15px; height: 15px; }

/* Betrachter */
.fv-kind { display: inline-grid; place-items: center; margin: 0 6px 0 2px; }
#fv-modes { margin: 0 4px; flex-wrap: nowrap; }
#fv-modes button { padding: 4px 9px; }
a.icon-btn { color: var(--muted); }
a.icon-btn:hover { color: var(--text); background: var(--hover); }
.fv-body { flex: 1; min-height: 0; overflow: auto; position: relative; background: var(--bg); }
.fv-body > iframe { display: block; width: 100%; height: 100%; border: none; background: #fff; }
.fv-body.kind-pdf { overflow: hidden; }
.fv-body.kind-image { display: grid; place-items: center; padding: 20px;
  background-color: var(--bg);
  background-image: linear-gradient(45deg, var(--hover) 25%, transparent 25%, transparent 75%, var(--hover) 75%), linear-gradient(45deg, var(--hover) 25%, transparent 25%, transparent 75%, var(--hover) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.fv-body.kind-image img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: var(--shadow-sm); }
.fv-note { margin: 0; padding: 18px; text-align: center; color: var(--faint); font-size: 13.5px; }
.fv-note.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: fv-spin .8s linear infinite;
}
@keyframes fv-spin { to { transform: rotate(360deg); } }
.fv-none { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 24px; text-align: center; color: var(--muted); }
.fv-none p { margin: 0; max-width: 340px; }
.fv-none a.pill-btn { text-decoration: none; }
.file-ext.big { min-width: 64px; height: 40px; font-size: 14px; border-radius: 10px; }
.fv-text { margin: 0; padding: 14px 16px; min-height: 100%; background: var(--code-bg); font: 13px/1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }

/* Word / Markdown: wie ein Blatt Papier */
.fv-body.kind-word, .fv-body.kind-markdown { padding: 20px; }
.doc-page {
  max-width: 780px; margin: 0 auto; padding: 44px 52px; background: #fff; color: #1a1a18; border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 30px -12px rgba(0, 0, 0, .2); font-size: 15px; line-height: 1.6; overflow-wrap: break-word;
}
.doc-page h1, .doc-page h2, .doc-page h3 { line-height: 1.25; margin: 1.2em 0 .5em; }
.doc-page h1:first-child, .doc-page h2:first-child, .doc-page h3:first-child { margin-top: 0; }
.doc-page img { max-width: 100%; height: auto; }
.doc-page table { border-collapse: collapse; margin: 12px 0; max-width: 100%; }
.doc-page td, .doc-page th { border: 1px solid #d6d3ca; padding: 5px 9px; vertical-align: top; }
.doc-page td p, .doc-page th p { margin: 0; }
.doc-page a { color: #a84a2b; }
.doc-page pre { background: #f4f2eb; padding: 12px 14px; border-radius: 8px; overflow: auto; }
.doc-page blockquote { margin: 0; padding-left: 14px; border-left: 3px solid #ddd; color: #555; }

/* Excel: Gitter mit Spaltenbuchstaben und Zeilennummern, Kopf und erste Spalte bleiben stehen */
.fv-body.kind-sheet { background: var(--surface); }
.sheet-wrap { min-width: max-content; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; table-layout: auto; }
table.sheet th, table.sheet td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3px 8px; height: 24px; white-space: pre; max-width: 480px; overflow: hidden; text-overflow: ellipsis; }
table.sheet td { background: var(--surface); }
table.sheet td.num { text-align: right; }
table.sheet td.err { color: var(--danger); }
table.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--code-head); color: var(--muted); font-weight: 500; font-size: 12px; text-align: center; }
table.sheet tbody th { position: sticky; left: 0; z-index: 1; background: var(--code-head); color: var(--muted); font-weight: 400; font-size: 12px; text-align: right; min-width: 40px; }
table.sheet thead th:first-child { left: 0; z-index: 3; }
.sheet-wrap .fv-note { text-align: left; }
.fv-tabs { display: flex; gap: 2px; padding: 6px 8px; overflow-x: auto; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.fv-tabs button { flex-shrink: 0; border: none; border-radius: 8px; padding: 4px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.fv-tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }

/* PowerPoint: Folien untereinander */
.slides { display: flex; flex-direction: column; gap: 16px; max-width: 820px; margin: 0 auto; padding: 20px; }
.slide {
  position: relative; aspect-ratio: 16 / 9; overflow: auto; padding: 28px 36px 24px; background: #fff; color: #1a1a18;
  border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 30px -12px rgba(0, 0, 0, .2);
}
.slide h2 { margin: 0 0 14px; font-size: 22px; line-height: 1.25; }
.slide p { margin: 0 0 6px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.slide-no { position: absolute; right: 12px; bottom: 8px; font-size: 11px; color: #99968c; }
.slide-pics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.slide-pics img { max-width: 100%; max-height: 240px; border-radius: 4px; object-fit: contain; }
.slide .fv-note { color: #99968c; }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  .sidebar, .app.collapsed .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw); margin-left: 0; border-right: none;
    transform: translateX(-102%); padding-bottom: env(safe-area-inset-bottom);
  }
  .resizer { display: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.open + .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .4); animation: fade-in .2s; }
  .chat-header { padding: 0 8px; gap: 2px; }
  .chat-title-wrap { padding-left: 4px; }
  #chat-owner { display: none; }
  .pill-btn { padding: 0 10px; }
  .pill-btn:not(.on) span { display: none; }
  .messages { padding: 8px 14px 36px; gap: 18px; }
  .composer, .typing, .left-banner, .starters { width: calc(100% - 20px); }
  .composer { border-radius: 22px; padding: 10px 10px 8px; }
  .footnote { margin: 4px auto calc(6px + env(safe-area-inset-bottom)); min-height: 0; }
  .footnote .hint { display: none; }
  #web-wrap, #compare-btn { padding: 0; width: 34px; justify-content: center; }
  #web-wrap .label, #compare-btn .label, .wide-only { display: none; }
  .picker-btn { padding: 0 4px 0 8px; }
  .picker-effort { display: none; }
  /* Geteilter Chat auf der Startseite: „… antwortet“ braucht den Platz – vom Modell bleibt nur das Zeichen
     (im laufenden Chat ist „… antwortet“ nur noch ein Symbol) */
  .main.is-empty .composer-row:has(#ask-ai-wrap:not([hidden])) #picker-label { display: none; }
  .menu.picker-menu { grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: 420px; }
  .picker-side { grid-column: 1 / -1; padding: 8px; border-left: none; border-top: 1px solid var(--border); overflow-x: auto; }
  .picker-head, .effort-item .tag, .effort-item .check, .model-pick kbd { display: none; }
  .picker-efforts { display: flex; gap: 6px; }
  .effort-item { width: auto; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; white-space: nowrap; color: var(--muted); }
  .effort-item[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
  .dialog-body { --pad-y: 18px; --pad-x: 16px; padding-bottom: 20px; }
  .dialog-head { padding: 14px 8px 8px var(--pad-x); }
  .file-row { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }
  .empty h2 { font-size: 30px; }
  /* Artefakt: am Handy über den ganzen Bildschirm */
  .artifact-panel { position: fixed; inset: 0; z-index: 45; width: auto; min-width: 0; border-left: none; padding-bottom: env(safe-area-inset-bottom); }
  .artifact-head { padding-left: 10px; }
  .artifact-kind, .artifact-versions #artifact-version-label { display: none; }
  /* Whiteboard am Handy über den ganzen Bildschirm */
  .board-panel { position: fixed; inset: 0; z-index: 46; width: auto; min-width: 0; border-left: none; padding-bottom: env(safe-area-inset-bottom); }
  /* Dateien-Leiste ebenfalls über den ganzen Bildschirm */
  .files-panel, .app.files-viewing .files-panel { position: fixed; inset: 0; z-index: 44; width: auto; min-width: 0; border-left: none; padding-bottom: env(safe-area-inset-bottom); }
  .fp-actions { display: flex; }
  .fv-kind { display: none; }
  .doc-page { padding: 24px 20px; }
  .fv-body.kind-word, .fv-body.kind-markdown { padding: 10px; }
  .slides { padding: 10px; }
  .slide { aspect-ratio: auto; min-height: 180px; padding: 20px; }
  .chat-list li button.row-more { opacity: 1; background: transparent; }
  .chat-list li button:has(+ .row-more) .s { display: none; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .app.with-artifact:not(.collapsed) .artifact-panel { width: var(--artifact-w, 50vw); min-width: 340px; }
  .app.files-viewing:not(.collapsed) .files-panel { width: var(--viewer-w, 50vw); min-width: 340px; }
}
