/* ============================================================================
   FleiTec Chat — styles.css
   Claude.ai-artige Chat-Web-App. Reines, modernes CSS (kein Build-Schritt).
   Custom Properties, Flexbox, Grid. Voll responsive (Desktop + Mobil).
   Zwei DUNKLE Themes via html[data-theme="..."].
   ============================================================================ */

/* ============================================================================
   1. THEME-SYSTEM (CSS Custom Properties)
   ---------------------------------------------------------------------------
   Alle Farben sind Variablen auf :root. Themes ueberschreiben sie via
   Attribut-Selektor am <html>-Element. Beide Themes sind dunkel.
   ============================================================================ */

:root {
  /* Fallback = FleiTec (Standard-Theme) */
  --bg-app: #0c0e1f;
  --bg-sidebar: #0a0b18;
  --bg-elevated: #15172b;
  --bg-hover: rgba(255, 255, 255, 0.06);

  --text: #e9ebf5;
  --text-muted: #9aa0bb;
  --border: rgba(255, 255, 255, 0.08);

  --user-bubble: #1b2142;
  --accent: #2f86ff;
  --accent-grad: linear-gradient(135deg, #2f80ff, #36c5ff);
  --accent-text: #fff;

  --code-bg: #0b0d1c;
  --code-head: #11132a;
  --ring: rgba(54, 150, 255, 0.5);

  /* App-Hintergrund (dezenter Verlauf, ahmt Unity-Splash nach) */
  --app-bg-image:
    radial-gradient(900px 500px at 25% 12%, rgba(60, 55, 140, 0.30), transparent 60%),
    radial-gradient(800px 600px at 85% 88%, rgba(30, 60, 140, 0.25), transparent 60%),
    linear-gradient(160deg, #0a0a1c, #0c0e22);

  /* Gemeinsame Design-Tokens */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;          /* Buttons/Inputs */
  --radius-card: 16px;     /* Karten */
  --radius-composer: 24px; /* Composer */
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);

  --sidebar-w: 260px;
  --content-max: min(100% - 2.5rem, 1700px); /* Nachrichten + Composer: möglichst breit */

  --t-fast: 0.15s ease;
  --t: 0.2s ease;
}

/* THEME: FleiTec (dunkles Navy + blauer Gradient-Akzent) */
html[data-theme="fleitec"] {
  --bg-app: #0c0e1f;
  --bg-sidebar: #0a0b18;
  --bg-elevated: #15172b;
  --bg-hover: rgba(255, 255, 255, 0.06);

  --text: #e9ebf5;
  --text-muted: #9aa0bb;
  --border: rgba(255, 255, 255, 0.08);

  --user-bubble: #1b2142;
  --accent: #2f86ff;
  --accent-grad: linear-gradient(135deg, #2f80ff, #36c5ff);
  --accent-text: #fff;

  --code-bg: #0b0d1c;
  --code-head: #11132a;
  --ring: rgba(54, 150, 255, 0.5);

  --app-bg-image:
    radial-gradient(900px 500px at 25% 12%, rgba(60, 55, 140, 0.30), transparent 60%),
    radial-gradient(800px 600px at 85% 88%, rgba(30, 60, 140, 0.25), transparent 60%),
    linear-gradient(160deg, #0a0a1c, #0c0e22);
}

/* THEME: Claude (warmes Anthrazit + Clay/Rust-Akzent) */
html[data-theme="claude"] {
  --bg-app: #262624;
  --bg-sidebar: #1f1e1d;
  --bg-elevated: #30302e;
  --bg-hover: rgba(255, 255, 255, 0.055);

  --text: #ecebe4;
  --text-muted: #9b9a92;
  --border: rgba(255, 255, 255, 0.09);

  --user-bubble: #393937;
  --accent: #c96442;
  --accent-grad: #c96442;
  --accent-text: #fff;

  --code-bg: #1c1c1a;
  --code-head: #262624;
  --ring: rgba(201, 100, 66, 0.5);

  /* Einfarbiger Hintergrund (kein Verlauf) */
  --app-bg-image: none;
}

/* ============================================================================
   2. RESET & BASIS
   ============================================================================ */

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

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

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg-app);
  background-image: var(--app-bg-image);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================================
   3. GLOBALE HELFER
   ============================================================================ */

.hidden {
  display: none !important;
}

[hidden] {
  display: none;
}

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

/* Fokus-Ringe (Tastatur-Navigation) */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ============================================================================
   4. SCROLLBARS (dezent dunkel)
   ============================================================================ */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  background-clip: content-box;
}

/* ============================================================================
   5. BUTTONS (gemeinsame Varianten)
   ============================================================================ */

/* Primaer-Button (Akzent-Gradient) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent-grad);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: filter var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

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

/* Ghost-Button (transparent, dezenter Rahmen) */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Icon-Button (rund/quadratisch, nur Icon) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.icon-btn svg {
  display: block;
}

/* ============================================================================
   6. AUTH-SCREEN
   ============================================================================ */

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--bg-app);
  background-image: var(--app-bg-image);
  z-index: 100;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2.25rem 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 1.25rem;
}

.auth-brand svg,
.auth-brand img {
  height: 92px;
  width: auto;
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.auth-sub {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

/* Feld: Label ueber Input gestapelt */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field > span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.auth-error {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(229, 84, 84, 0.12);
  border: 1px solid rgba(229, 84, 84, 0.35);
  color: #ff9b9b;
  font-size: 0.88rem;
}

.auth-switch {
  margin: 1.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-switch a {
  font-weight: 600;
}

/* ============================================================================
   7. APP-LAYOUT (Grid: Sidebar | Main | optional Artifact)
   ============================================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: 100%;
  height: 100vh;
  height: 100dvh; /* schrumpft bei offener Tastatur via interactive-widget=resizes-content */
  width: 100%;
  overflow: hidden;
}

/* Wenn Artifact-Panel offen ist: rechte Spalte ergaenzen */
.app.with-artifact {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) min(46%, 560px);
}

/* Scrim (Overlay hinter Off-Canvas-Sidebar auf Mobil) */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--t);
}

/* ============================================================================
   8. SIDEBAR
   ============================================================================ */

.sidebar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 0.75rem;
  gap: 0.75rem;
  z-index: 50;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  min-height: 32px;
}

.brand svg,
.brand img {
  height: 40px;
  width: auto;
}

/* Auffaelliger "Neuer Chat"-Button */
.new-chat {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.new-chat:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.new-chat:active {
  transform: translateY(1px);
}

.new-chat svg {
  flex: none;
  color: var(--accent);
}

/* Konversationsliste */
.conv-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

/* Datums-Gruppen-Header */
.conv-group {
  padding: 0.85rem 0.6rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.conv-group:first-child {
  padding-top: 0.35rem;
}

/* Einzelner Eintrag */
.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast);
}

.conv-item:hover {
  background: var(--bg-hover);
}

.conv-item.active {
  background: var(--bg-elevated);
}

/* Titel: einzeilig, abgeschnitten */
.conv-item .conv-title,
.conv-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

/* Hover-Aktionen-Button (z.B. ... Menue) */
.conv-actions {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.conv-item:hover .conv-actions,
.conv-item.active .conv-actions,
.conv-actions:focus-visible {
  opacity: 1;
}

.conv-actions:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Sidebar unten (User-Bereich) */
.sidebar-bottom {
  position: relative;
  flex: none;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--t-fast);
}

.user-btn:hover {
  background: var(--bg-hover);
}

/* Runder Avatar-Kreis */
.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
}

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

.user-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
}

.user-btn svg {
  flex: none;
  color: var(--text-muted);
}

/* ============================================================================
   9. POPOVER-MENUES (.menu)
   ---------------------------------------------------------------------------
   Genutzt fuer User-Menue (unten) und Modell-Menue (Topbar).
   ============================================================================ */

.menu {
  position: absolute;
  z-index: 60;
  min-width: 200px;
  padding: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  animation: menu-in 0.12s ease;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User-Menue oeffnet nach oben, ueber dem User-Button */
#userMenu {
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
}

.menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.9rem;
  transition: background var(--t-fast);
}

.menu button:hover {
  background: var(--bg-hover);
}

.menu button svg {
  flex: none;
  color: var(--text-muted);
}

/* ============================================================================
   10. MAIN
   ============================================================================ */

.main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  min-height: 56px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-app) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
}

.topbar-spacer {
  flex: 1 1 auto;
}

/* Modell-Auswahl */
.model-select {
  position: relative;
}

.model-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  transition: background var(--t-fast);
}

.model-btn:hover {
  background: var(--bg-hover);
}

.model-btn svg {
  color: var(--text-muted);
}

/* Modell-Menue (oeffnet nach unten) */
#modelMenu {
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
}

.model-option {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  padding-right: 2rem;
  position: relative;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--t-fast);
}

.model-option:hover {
  background: var(--bg-hover);
}

.model-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.model-blurb {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Haekchen fuer aktives Modell */
.model-option.active::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.75rem;
  width: 6px;
  height: 11px;
  margin-top: -7px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ============================================================================
   11. SCROLLER + MESSAGES
   ============================================================================ */

.scroller {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  /* Composer ist jetzt in-flow -> nur wenig Luft unten nötig */
  padding-bottom: 0.75rem;
}

/* Zentrierte Spalte */
.messages {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Einzelne Nachricht */
.msg {
  display: flex;
  gap: 0.85rem;
  position: relative;
}

/* User: rechtsbündige Bubble, hugt den rechten Rand */
.msg.user {
  justify-content: flex-end;
}

.msg.user .msg-main {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Bubble + Bilder rechtsbündig */
  max-width: 80%;
  margin-left: auto; /* nach ganz rechts schieben */
}

.msg.user .msg-body {
  max-width: 100%;
  width: fit-content;
  margin-left: auto;
  padding: 0.7rem 1rem;
  background: var(--user-bubble);
  border-radius: 18px;
  border-bottom-right-radius: 6px;
}

/* Assistant: volle Breite, kein Bubble */
.msg.assistant {
  justify-content: flex-start;
}

.msg.assistant .msg-body {
  flex: 1 1 auto;
  min-width: 0;
}

/* Kleiner Spark/Logo-Avatar beim Assistant */
.msg-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

.msg-avatar svg,
.msg-avatar img {
  width: 18px;
  height: 18px;
}

.msg.user .msg-avatar {
  display: none;
}

.msg-body {
  min-width: 0;
}

/* Bild-Thumbnails in Nachricht */
.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.msg-images img {
  max-width: 320px;
  width: auto;
  height: auto;
  max-height: 240px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Nachricht-Aktionen (Kopier-Button), erscheint on hover */
.msg-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.4rem;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.msg:hover .msg-actions,
.msg.show-actions .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.msg-actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: background var(--t-fast), color var(--t-fast);
}

.msg-actions button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Tool-Status-Zeile (Spinner + Text, z.B. "Suche im Web …") */
.tool-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.tool-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* Blinkender Streaming-Cursor */
.blink-cursor {
  display: inline-block;
  width: 3px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--text);
  border-radius: 1px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ============================================================================
   12. MARKDOWN-INHALT (.md)
   ============================================================================ */

.md {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.md > *:first-child { margin-top: 0; }
.md > *:last-child  { margin-bottom: 0; }

.md h1,
.md h2,
.md h3,
.md h4 {
  margin: 1.5rem 0 0.75rem;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.md h1 { font-size: 1.55rem; }
.md h2 { font-size: 1.3rem; }
.md h3 { font-size: 1.12rem; }
.md h4 { font-size: 1rem; }

.md p {
  margin: 0.5rem 0;
}

.md ul,
.md ol {
  margin: 0.5rem 0;
  padding-left: 1.4rem;
}

.md li {
  margin: 0.18rem 0;
}

.md li > ul,
.md li > ol {
  margin: 0.18rem 0;
}

.md a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.md strong {
  font-weight: 650;
  color: var(--text);
}

.md em {
  font-style: italic;
}

.md hr {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

.md blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.md blockquote p {
  margin: 0.4rem 0;
}

/* Inline-Code */
.md :not(pre) > code {
  padding: 0.15em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* Tabellen */
.md table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.md th,
.md td {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.md th {
  background: var(--bg-elevated);
  font-weight: 650;
}

.md tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

/* ============================================================================
   13. CODEBLOECKE (.code-wrap, .code-head, pre code)
   ---------------------------------------------------------------------------
   Sieht aus wie claude.ai: abgesetzter Header (Sprach-Label + Buttons),
   abgerundeter Container.
   ============================================================================ */

.code-wrap {
  margin: 1rem 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}

/* Leiste oben: Sprach-Label links, Buttons rechts */
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--code-head);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.code-head .lang {
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.code-head > div {
  display: flex;
  gap: 0.25rem;
}

.code-copy,
.code-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  transition: background var(--t-fast), color var(--t-fast);
}

.code-copy:hover,
.code-preview:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.code-copy svg,
.code-preview svg {
  width: 14px;
  height: 14px;
}

/* Eigentlicher Codeblock */
.code-wrap pre {
  margin: 0;
  overflow-x: auto;
  background: var(--code-bg);
}

.code-wrap pre code,
.md pre code {
  display: block;
  padding: 0.9rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--code-bg);
  color: var(--text);
  white-space: pre;
  tab-size: 2;
}

/* Fallback fuer reine <pre> ohne .code-wrap */
.md pre {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--code-bg);
}

/* ============================================================================
   14. ARTIFACT-KARTE in Nachricht (.artifact-card)
   ============================================================================ */

.artifact-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0.85rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-elevated);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.artifact-card:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.artifact-card .art-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--accent-grad);
  color: var(--accent-text);
}

.artifact-card .art-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.artifact-card .art-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-card .art-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================================
   15. WELCOME / EMPTY STATE
   ============================================================================ */

.welcome {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1.25rem;
  text-align: center;
}

.welcome-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.welcome-brand svg,
.welcome-brand img {
  height: 108px;
  width: auto;
}

/* Grosse, elegante Serif-Ueberschrift (wie claude.ai) */
.greeting {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ============================================================================
   16. COMPOSER (fixiert unten, zentriert)
   ============================================================================ */

.composer-wrap {
  /* Festes Element unten im Flex-Layout -> scrollt NICHT mit den Nachrichten */
  flex: none;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.4rem 1.25rem 0.5rem;
  background: var(--bg-app);
}

/* Grosse abgerundete Eingabe-Box */
.composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-composer);
  box-shadow: var(--shadow);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-lg);
}

/* Anhang-Vorschauen (Reihe von Thumbnails) */
.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}

.attach-preview .thumb {
  position: relative;
}

.attach-preview img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}

/* Entfernen-X auf Thumbnail */
.attach-preview .remove,
.attach-preview button {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-app);
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: background var(--t-fast);
}

.attach-preview .remove:hover,
.attach-preview button:hover {
  background: var(--bg-hover);
}

/* Eingabe-Textarea (auto-grow, transparent, kein Rahmen) */
.composer-input {
  width: 100%;
  min-height: 1.6rem;
  max-height: 240px;
  padding: 0.35rem 0.4rem;
  border: none;
  background: transparent;
  color: var(--text);
  line-height: 1.5;
  font-size: 1rem;
  overflow-y: auto;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Platzhalter für das contenteditable-Feld */
.composer-input.empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
/* eingefügte Bilder nicht im Textfeld anzeigen (werden als Anhang extrahiert) */
.composer-input img {
  display: none;
}

.composer-input:focus,
.composer-input:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Untere Zeile: Tools links, Senden rechts */
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Tool-Button (rundlich) */
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tool-btn svg {
  flex: none;
}

/* Aktiver Zustand (z.B. Websuche an) — Akzentfarbe */
.tool-btn.active {
  background: var(--accent-grad);
  color: var(--accent-text);
  border-color: transparent;
}

.tool-btn.active:hover {
  filter: brightness(1.08);
}

/* Web-Label nur auf breiten Screens */
.web-label {
  display: inline;
}

/* Senden-Button (rund, Akzent) */
.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
  transition: filter var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
}

.send-btn:hover {
  filter: brightness(1.08);
}

.send-btn:active {
  transform: scale(0.94);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* Stop-Zustand (roetlich) */
.send-btn.stop {
  background: #d6453f;
  color: #fff;
}

.send-btn.stop:hover {
  filter: brightness(1.1);
}

/* Kleiner Hinweis unter dem Composer */
.composer-hint {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================================
   17. ARTIFACT-PANEL (#artifact)
   ============================================================================ */

.artifact {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

.artifact-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  min-height: 56px;
  border-bottom: 1px solid var(--border);
}

.artifact-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* Tabs (Vorschau / Code) */
.artifact-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.atab {
  padding: 0.3rem 0.75rem;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}

.atab:hover {
  color: var(--text);
}

.atab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.artifact-actions {
  display: flex;
  gap: 0.2rem;
}

/* Body fuellt restliche Flaeche */
.artifact-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

/* iframe (HTML-Vorschau, weisser Hintergrund) */
.art-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

/* Code-Ansicht (toggelbar via .hidden) */
.art-code {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  background: var(--code-bg);
}

.art-code code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre;
  color: var(--text);
}

/* ============================================================================
   18. SETTINGS-MODAL (.modal)
   ============================================================================ */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  animation: fade-in 0.15s ease;
}

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

.modal-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Einzelne Einstellung: Label links, Wert rechts */
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.setting > label:first-child {
  font-weight: 500;
  flex: 0 0 auto;
}

/* Gestapelte Variante */
.setting.col {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.setting.col > label:first-child {
  font-weight: 500;
}

/* Segmented-Control */
.seg {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.seg button {
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}

.seg button:hover {
  color: var(--text);
}

.seg button.active {
  background: var(--accent-grad);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

/* Formularelemente im Modal */
.modal select,
.modal textarea,
.modal input[type="text"],
.modal input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

/* Select bekommt feste, kompakte Breite in einer Zeilen-Einstellung */
.setting:not(.col) select {
  width: auto;
  min-width: 180px;
}

.modal select:focus,
.modal textarea:focus,
.modal input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.modal textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.modal small.muted {
  font-size: 0.8rem;
}

/* Toggle-Switch (checkbox + span) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: background var(--t-fast), border-color var(--t-fast);
}

.switch span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--t-fast), background var(--t-fast);
}

.switch input:checked + span {
  background: var(--accent-grad);
  border-color: transparent;
}

.switch input:checked + span::before {
  transform: translateX(20px);
  background: #fff;
}

.switch input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--ring);
}

/* Nutzungs-Box */
.usage-box {
  padding: 0.75rem 0.85rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================================
   19. SICHTBARKEITS-HELFER (Desktop vs. Mobil)
   ---------------------------------------------------------------------------
   .only-mobile nur < 860px sichtbar. Auf Desktop ausgeblendet.
   ============================================================================ */

.only-mobile {
  display: none;
}

/* ============================================================================
   20. RESPONSIVE — < 860px (Tablet / Mobil)
   ---------------------------------------------------------------------------
   Sidebar wird zum Off-Canvas-Drawer. Artifact wird Vollbild-Overlay.
   ============================================================================ */

@media (max-width: 860px) {
  /* App wird einspaltig */
  .app,
  .app.with-artifact {
    grid-template-columns: 1fr;
  }

  /* .only-mobile sichtbar */
  .only-mobile {
    display: inline-flex;
  }

  /* Sidebar als Off-Canvas-Drawer */
  .sidebar {
    grid-column: 1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Scrim sichtbar, wenn Sidebar offen */
  .sidebar.open ~ .scrim,
  .scrim.show {
    display: block;
    opacity: 1;
  }

  /* Main fuellt volle Breite */
  .main {
    grid-column: 1;
  }

  /* Artifact als Vollbild-Overlay */
  .artifact {
    position: fixed;
    inset: 0;
    grid-column: 1;
    z-index: 80;
    border-left: none;
  }

  /* Composer und Nachrichten haben weniger Seitenrand */
  .messages {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .composer-wrap {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  /* User-Nachricht-Bubble darf auf Mobil breiter werden */
  .msg.user .msg-main {
    max-width: 92%;
  }
}

/* Web-Label ausblenden auf schmalen Screens (kompakter Tool-Button) */
@media (max-width: 520px) {
  .web-label {
    display: none;
  }

  .greeting {
    font-size: 1.65rem;
  }

  .modal {
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  /* In-Zeilen-Selects duerfen schrumpfen */
  .setting:not(.col) select {
    min-width: 130px;
  }
}

/* ============================================================================
   21. DESKTOP — >= 861px
   ---------------------------------------------------------------------------
   .scrim und Mobil-Buttons sind ausgeblendet (durch .only-mobile geregelt).
   Scrim explizit aus.
   ============================================================================ */

@media (min-width: 861px) {
  .scrim {
    display: none !important;
  }

  /* Sidebar im normalen Grid-Fluss (kein Transform) */
  .sidebar {
    transform: none;
  }
}

/* ============================================================================
   22. REDUCED MOTION
   ============================================================================ */

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

  .blink-cursor {
    animation: none;
    opacity: 1;
  }
}

/* ============================================================================
   21. CHAT-DROPDOWN (⋯) + INLINE-UMBENENNEN
   ============================================================================ */
.conv-menu {
  position: fixed;
  z-index: 200;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.conv-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.conv-menu button:hover {
  background: var(--bg-hover);
}
.conv-menu button.danger {
  color: #ff6b6b;
}
.conv-menu-label {
  padding: 0.45rem 0.6rem 0.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.conv-rename-input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg-app);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.25rem 0.45rem;
  outline: none;
}

/* ============================================================================
   22. USAGE-BALKEN (Plan-Auslastung wie im Claude-Panel)
   ============================================================================ */
.usage-tokens {
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}
.usage-block {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}
.usage-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
.usage-item-head .pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.usage-track {
  height: 8px;
  border-radius: 6px;
  background: var(--bg-hover);
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--accent-grad);
  transition: width 0.4s ease;
}
.usage-reset {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ============================================================================
   23. ASSISTANT-PROFILBILD AUSBLENDEN (Antworten nutzen volle Breite)
   ============================================================================ */
.msg-avatar {
  display: none !important;
}
/* Kein linker Abstand mehr durch den (entfernten) Avatar */
.msg.assistant {
  gap: 0;
}

/* Usage: Status-Pill + Hinweis */
.status-pill {
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
}
.status-pill.status-allowed_warning {
  background: rgba(255, 180, 0, 0.18);
  color: #e0a83e;
}
.status-pill.status-rejected {
  background: rgba(255, 80, 80, 0.18);
  color: #ff6b6b;
}
.usage-note {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  line-height: 1.5;
}
.usage-note a {
  color: var(--accent);
}

/* ============================================================================
   24. CODE-OVERFLOW (Mobil) + ARTIFACT-PANEL (resize / Vollbild / Reload)
   ============================================================================ */
/* Assistant-Spalte darf schrumpfen -> Codeblöcke scrollen intern statt überlaufen */
.msg-main {
  min-width: 0;
}
.msg.assistant .msg-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.code-wrap {
  overflow: hidden;
}
.code-wrap pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Artifact-Panel: Breite per Variable (Desktop resizable) */
.app.with-artifact {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--artifact-w, min(46%, 620px));
}
.artifact {
  position: relative;
}
.art-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 5;
  background: transparent;
}
.art-resize:hover {
  background: var(--accent);
  opacity: 0.4;
}
.art-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.art-code {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
}

@media (max-width: 860px) {
  /* Artifact als echtes Vollbild-Overlay; Resize-Griff aus */
  .artifact {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    z-index: 90;
  }
  .art-resize {
    display: none;
  }
}
