.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-6);
  height: 100%;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.msg { display: flex; flex-direction: column; gap: var(--space-2); }

.msg-user { align-items: flex-end; }
.msg-user .bubble {
  background: var(--panel-raised);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  max-width: 72%;
  line-height: 1.55;
  font-size: 14px;
}

.msg-ai { align-items: flex-start; }

.agent-head {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 13px; color: var(--text-secondary);
}
.agent-head .a-avatar {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent-chat), var(--accent-violet));
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.agent-head .name { color: var(--text-primary); font-weight: 600; }
.agent-head .model { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }

.ai-text {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  max-width: 720px;
}
.ai-text h3 { font-family: var(--font-display); margin: var(--space-5) 0 var(--space-2); font-size: 19px; }
.ai-text p { margin: 0 0 var(--space-3); }
.ai-text ul { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
.ai-text li { margin-bottom: var(--space-1); }

/* Code block */
.code-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #080B14;
  width: 100%;
  box-shadow: var(--shadow-panel);
}
.code-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  background: #0C1120;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.code-head .fname { color: var(--text-primary); font-weight: 600; }
.code-head .lang { color: var(--accent-cyan); }
.code-head .actions { margin-left: auto; display: flex; gap: var(--space-2); }
.code-head .actions button {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 12px; padding: 3px 9px; border-radius: 5px;
  transition: color 120ms ease, border-color 120ms ease;
}
.code-head .actions button:hover { color: var(--text-primary); border-color: var(--border-lit); }
.code-block pre {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  color: #D6DEEB;
}

/* Image — groß, Hauptinhalt */
.chat-image {
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
  width: 100%;
  max-width: 760px;
}
.chat-image .img {
  width: 100%;
  aspect-ratio: 16/9;
  display: grid; place-items: center;
  position: relative;
  background:
    radial-gradient(700px 400px at 28% 18%, rgba(139,124,255,0.45), transparent 60%),
    radial-gradient(600px 360px at 72% 82%, rgba(62,198,224,0.38), transparent 60%),
    radial-gradient(500px 300px at 50% 50%, rgba(74,144,226,0.25), transparent 70%),
    linear-gradient(180deg, #0A0F1E, #131A30);
}
.chat-image .img .scene {
  text-align: center;
  color: rgba(232,236,244,0.75);
}
.chat-image .img .scene .t { font-family: var(--font-display); font-size: 22px; margin-bottom: 6px; }
.chat-image .img .scene .s { font-size: 12px; color: rgba(232,236,244,0.5); }
.chat-image .demo-badge {
  position: absolute;
  top: 12px; right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 3px 8px;
  border: 1px solid var(--border-lit);
  border-radius: 5px;
  background: rgba(10,14,26,0.6);
}
.chat-image .img-caption {
  padding: var(--space-2) var(--space-4);
  font-size: 12px; color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: #0C1120;
  display: flex; align-items: center; gap: var(--space-2);
}
.chat-image .img-caption .c-meta { font-family: var(--font-mono); color: var(--text-muted); }

/* Music player — groß, horizontal */
.player {
  display: flex; align-items: center; gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(400px 200px at 0% 0%, rgba(139,124,255,0.14), transparent 60%),
    linear-gradient(135deg, #141B30, #0E1424);
  box-shadow: var(--shadow-raised);
  width: 100%;
  max-width: 720px;
}
.player-cover {
  width: 96px; height: 96px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: var(--glow-violet);
}
.player-cover svg { width: 40px; height: 40px; color: #fff; }
.player-body { flex: 1; min-width: 0; }
.player-title { font-weight: 700; font-size: 16px; }
.player-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.player-wave {
  display: flex; align-items: center; gap: 3px; height: 40px; margin: var(--space-3) 0;
}
.player-wave span {
  width: 4px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-violet), var(--accent-blue));
  opacity: 0.75;
}
.player-controls { display: flex; align-items: center; gap: var(--space-4); flex-shrink: 0; }
.play-btn {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--border-lit);
  background: var(--panel-raised);
  color: var(--text-primary);
  display: grid; place-items: center;
  font-size: 18px;
  box-shadow: var(--glow-chat);
  transition: background 140ms ease;
}
.play-btn:hover { background: var(--panel-active); }
.player-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

/* Tool action cards — kompakt */
.tool-card {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  font-size: 13px;
  max-width: 560px;
}
.tool-card .t-icon { color: var(--accent-cyan); display: grid; place-items: center; }
.tool-card .t-icon svg { width: 15px; height: 15px; }
.tool-card .t-label { font-weight: 600; }
.tool-card .t-meta { color: var(--text-muted); font-size: 12px; }
.tool-card .t-open { margin-left: auto; color: var(--text-muted); font-size: 12px; }

/* Activity indicator */
.activity {
  display: flex; align-items: center; gap: var(--space-2);
  color: var(--text-secondary); font-size: 13px;
}

/* Composer */
.composer {
  position: sticky;
  bottom: 0;
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--panel-raised);
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}
.composer textarea {
  width: 100%;
  background: transparent;
  border: none;
  resize: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  outline: none;
  min-height: 56px;
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer-bar {
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-3);
}
.composer-bar .spacer { flex: 1; }
.icon-btn {
  background: none; border: none; color: var(--text-secondary);
  display: grid; place-items: center; padding: 8px; border-radius: 8px;
  transition: color 120ms ease, background 120ms ease;
}
.icon-btn:hover { color: var(--text-primary); background: var(--panel-active); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.voice { color: var(--accent-cyan); }

/* Context panel */
.context {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.context-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: #0C1120;
}
.context-head .title { font-weight: 600; font-size: 14px; }
.context-close { background: none; border: none; color: var(--text-secondary); font-size: 18px; }
.context-section { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.context-section:last-child { border-bottom: none; }
.context-section h4 {
  margin: 0 0 var(--space-2);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.context-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) 0; font-size: 13px;
}
.context-row .c-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

@media (max-width: 1100px) {
  .chat-layout { grid-template-columns: 1fr; }
  .context { display: none; }
}
