/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface-hover: #23233a;
  --border: #2a2a3d;
  --text: #e4e4ef;
  --text-muted: #8888a0;
  --accent: #e8637a;
  --accent-glow: rgba(232, 99, 122, 0.25);
  --accent-soft: #f0a0b0;
  --user-bg: #1e2a3a;
  --agent-bg: #2a1a24;
  --danger: #ef4444;
  --radius: 12px;
  --sidebar-width: 300px;
}

html, body {
  height: 100%;
  height: 100dvh; /* dynamic viewport height – respects iOS Safari toolbar */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Login Overlay ───────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden { display: none; }

.login-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 380px;
  width: 90%;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  margin-top: 16px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 8px 0 32px;
}

.google-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: #fff;
  color: #333;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}
.google-login-btn:hover { box-shadow: 0 4px 16px rgba(255,255,255,0.15); }
.google-login-btn:active { transform: scale(0.97); }
.google-login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span { padding: 0 12px; }

.auth-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--text-muted); }

.auth-password-row {
  position: relative;
}
.auth-password-row .auth-input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.5;
  padding: 4px;
  margin-bottom: 10px;
}
.password-toggle:hover { opacity: 1; }
.password-toggle.active { opacity: 1; }

.auth-btn {
  display: block;
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.auth-btn:hover { opacity: 0.85; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-panel-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.auth-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.auth-links {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.auth-links a {
  color: var(--accent);
  text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }

.auth-message {
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
}
.auth-message.error { color: var(--danger); }
.auth-message.success { color: #4ade80; }

.login-copyright {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
}

.app-copyright {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.4;
  margin-top: 2px;
}

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
  min-height: 20px;
}

.show-welcome-btn {
  width: 100%;
  margin-top: 12px;
  padding: 6px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.show-welcome-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Onboarding ──────────────────────────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.onboarding-overlay.hidden { display: none; }

.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  padding: 36px 32px 24px;
  text-align: center;
}

.onboarding-lang {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 8px;
}
.lang-btn {
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.onboarding-step.hidden { display: none; }

.onboarding-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 12px 0;
  text-align: left;
}

.onboarding-features {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
}

.onboarding-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.onboarding-feature > span {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.onboarding-feature div {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.onboarding-feature strong {
  color: var(--text);
}

.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.onboarding-dot.active {
  background: var(--accent);
}

.onboarding-card .profile-label {
  text-align: left;
}

.onboarding-card .auth-btn {
  margin-top: 16px;
}

/* ── Admin Panel ──────────────────────────────────────────────────────── */
.admin-panel { padding: 0 16px 16px; }
.admin-panel.hidden { display: none; }

.admin-prompt-editor {
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.admin-prompt-editor:focus { border-color: var(--accent); }

.admin-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.modal-body h1 { font-size: 22px; margin: 0 0 12px; color: var(--accent); }
.modal-body h2 { font-size: 16px; margin: 20px 0 8px; color: var(--accent-soft); }
.modal-body ul, .modal-body ol { padding-left: 20px; margin: 8px 0; }
.modal-body li { margin: 4px 0; }
.modal-body p { margin: 8px 0; }
.modal-body strong { color: var(--text); }
.modal-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.modal-body em { color: var(--text-muted); }

.modal-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100dvh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.new-session-btn {
  margin: 16px 20px;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.new-session-btn:hover { opacity: 0.85; }

.session-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 12px;
}

.session-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 4px;
}
.session-item:hover { background: var(--surface-hover); }
.session-item.active {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.session-item.active .session-item-title {
  color: var(--accent-soft);
}

.session-item-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-item-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.session-item-title.untitled {
  font-style: italic;
  opacity: 0.7;
}

.session-item-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.session-item-summary {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  opacity: 0.7;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.session-archive-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 4px;
}
.session-item:hover .session-archive-btn { opacity: 0.6; }
.session-archive-btn:hover { opacity: 1 !important; }
.session-archive-btn.has-pitch { opacity: 0.8; }

/* Papierkorb */
.session-divider {
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.session-item.archived {
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 6px;
}
.session-item.archived .session-item-title {
  text-decoration: line-through;
}

.session-archive-actions {
  display: flex;
  gap: 4px;
}

.session-restore-btn, .session-perm-delete-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.session-restore-btn:hover { color: #4ade80; border-color: #4ade80; }
.session-perm-delete-btn:hover { color: var(--danger); border-color: var(--danger); }

/* ── Sidebar Sections (KB + Profile) ─────────────────────────────────── */
.sidebar-section {
  border-top: 1px solid var(--border);
}

.section-toggle {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.section-toggle:hover { color: var(--text); }

/* ── Knowledge Base ──────────────────────────────────────────────────── */
.kb-panel { padding: 0 16px 16px; }
.kb-panel.hidden { display: none; }

.kb-dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.kb-dropzone:hover, .kb-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.kb-dropzone-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.kb-url-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.kb-url-input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.kb-url-input:focus { border-color: var(--accent); }
.kb-url-input::placeholder { color: var(--text-muted); }

.kb-url-btn {
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.kb-url-btn:hover { opacity: 0.85; }
.kb-url-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.kb-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.kb-progress.hidden { display: none; }
.kb-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
  border-radius: 2px;
}

.kb-error {
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
}
.kb-error.hidden { display: none; }

.kb-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.kb-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.kb-item-info {
  flex: 1;
  min-width: 0;
}
.kb-item-name {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}
a.kb-item-name:hover { color: var(--accent); }
.kb-item-meta {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.kb-item-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 8px;
  white-space: nowrap;
}
.kb-item-status.ready { background: #1a3d2e; color: #4ade80; }
.kb-item-status.processing { background: #3d3a1a; color: #eab308; }
.kb-item-status.error { background: #3d1a1a; color: #ef4444; }

.kb-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  transition: color 0.2s;
}
.kb-item-delete:hover { color: var(--danger); }

.kb-reanalyze-btn {
  width: 100%;
  margin-top: 10px;
  padding: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.kb-reanalyze-btn:hover { color: var(--accent); border-color: var(--accent); }
.kb-reanalyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.kb-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  opacity: 0.7;
}

/* ── Sidebar Profile ─────────────────────────────────────────────────── */
.sidebar-profile {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-toggle {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.profile-toggle:hover { color: var(--text); }

.profile-chevron {
  font-size: 12px;
  transition: transform 0.2s;
}
.profile-chevron.open { transform: rotate(180deg); }

.profile-form {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-form.hidden { display: none; }

.profile-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.profile-input:focus { border-color: var(--accent); }

select.profile-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.profile-save-btn {
  padding: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.profile-save-btn:hover { opacity: 0.85; }

.profile-feedback {
  display: block;
  text-align: center;
  font-size: 12px;
  color: #4ade80;
  font-weight: 500;
  margin-top: 6px;
  animation: fadeIn 0.2s ease;
}
.profile-feedback.hidden { display: none; }

/* ── Learned Profile ──────────────────────────────────────────────────── */
.learned-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.learned-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.learned-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
  opacity: 0.7;
}


.learned-editor {
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
}
.learned-editor:focus { border-color: var(--accent); }
.learned-editor::placeholder { color: var(--text-muted); }

.learned-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.learned-analyze-btn, .learned-save-btn, .learned-reset-btn {
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.learned-analyze-btn:hover, .learned-save-btn:hover { color: var(--accent); border-color: var(--accent); }
.learned-analyze-btn:disabled, .learned-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.learned-reset-btn:hover { color: var(--danger); border-color: var(--danger); }

/* ── Main Area ───────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  display: none;
}

.session-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.lang-toggle {
  display: flex;
  gap: 2px;
}
.lang-btn-sm {
  padding: 2px 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn-sm.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.weather-display {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.logout-btn {
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
}
.status-dot.connected { background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
.status-dot.connecting { background: #eab308; animation: pulse 1s infinite; }
.status-dot.disconnected { background: #555; }
.status-dot.error { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Welcome Card ────────────────────────────────────────────────────── */
.welcome-card {
  align-self: center;
  text-align: center;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 420px;
}

.welcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.welcome-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Transcript ──────────────────────────────────────────────────────── */
.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius);
  animation: fadeIn 0.2s ease;
}

.bubble.user {
  align-self: flex-end;
  background: var(--user-bg);
  border: 1px solid #2a3a4d;
}

.bubble.agent {
  align-self: flex-start;
  background: var(--agent-bg);
  border: 1px solid #3d2a33;
}

.bubble-role {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.bubble-text {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-time {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

.source-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 6px;
  background: var(--accent-glow);
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}
.source-link:hover {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Controls ────────────────────────────────────────────────────────── */
.controls {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.controls-top-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.save-session-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.save-session-btn:hover { border-color: var(--accent); color: var(--text); }
.save-session-btn.saved {
  border-color: #4ade80;
  color: #4ade80;
}

.save-icon { font-size: 20px; }
.save-label { font-size: 11px; font-weight: 500; }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.hidden { display: none; }
.toast.success { border-color: #4ade80; color: #4ade80; }
.toast.error { border-color: var(--danger); color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.talk-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  color: var(--text);
  font-size: 32px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}
.talk-btn:hover:not(:disabled) { background: var(--surface-hover); }
.talk-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.talk-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
  animation: pulseRing 1.2s infinite;
}

.talk-label {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  70% { box-shadow: 0 0 0 20px rgba(124, 106, 239, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 106, 239, 0); }
}

.text-row {
  display: flex;
  width: 100%;
  max-width: 640px;
  gap: 8px;
}

.text-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--text-muted); }

.send-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.send-btn:hover { opacity: 0.85; }

.visualize-btn {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.visualize-btn:hover { border-color: var(--accent); }
.visualize-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Tool Activity Indicator ──────────────────────────────────────────── */
.tool-activity {
  background: var(--surface) !important;
  border-color: var(--accent) !important;
}

.tool-activity-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.tool-activity-icon {
  font-size: 20px;
  animation: pulse 1.5s infinite;
}

.tool-activity-text {
  font-size: 14px;
  color: var(--accent-soft);
  font-weight: 500;
}

.tool-activity-dots span {
  animation: dotBlink 1.4s infinite;
  font-size: 18px;
  font-weight: bold;
  color: var(--accent);
}
.tool-activity-dots span:nth-child(2) { animation-delay: 0.2s; }
.tool-activity-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBlink {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.image-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin-top: 8px;
}

.bubble-image {
  max-width: 100%;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  display: block;
}
.bubble-image:hover { transform: scale(1.02); }

.image-star-btn, .image-delete-btn {
  position: absolute;
  top: 8px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  opacity: 0;
}
.image-container:hover .image-star-btn,
.image-container:hover .image-delete-btn { opacity: 1; }

.image-star-btn {
  right: 40px;
  color: var(--text-muted);
}
.image-star-btn:hover { color: #fbbf24; }
.image-star-btn.starred {
  color: #fbbf24;
  opacity: 1;
}

.image-delete-btn {
  right: 8px;
  color: var(--text-muted);
  font-size: 18px;
}
.image-delete-btn:hover { color: var(--danger); }

.hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    width: 85vw;
    max-width: 340px;
    transform: translateX(-100%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .sidebar-toggle { display: block; }
  .sidebar-close { display: block; }

  .bubble { max-width: 95%; }

  /* Compact controls for mobile */
  .controls {
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .controls-top-row {
    gap: 16px;
  }
  .talk-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  .talk-label { font-size: 9px; }
  .save-session-btn {
    padding: 8px 12px;
  }
  .save-icon { font-size: 16px; }
  .save-label { font-size: 9px; }
  .text-row { gap: 6px; }
  .text-input { padding: 8px 12px; font-size: 14px; }
  .send-btn { padding: 8px 14px; font-size: 13px; }
  .hint { display: none; }

  /* Compact header for mobile */
  .header {
    padding: 10px 16px;
    gap: 8px;
  }
  .session-title { font-size: 14px; }
  .header-right { gap: 8px; }
  .weather-display { display: none; }
  .user-name { display: none; }
  .status span:last-child { font-size: 11px; }
  .logout-btn { font-size: 10px; padding: 3px 6px; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
