/**
 * ============================================================
 *  HELIOS AI — World-Class Global & Chat CSS (Gemini 2026 Dark UI)
 *  Lead Engineer: Helios Frontend Architecture
 * ============================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

/* ─── Color Tokens & Variables (Orijinal Vurgu Renkleri: Buz Mavisi & Mor) ── */
:root {
  /* Ana Zemin & Yüzeyler */
  --bg: #131314;
  --sidebar-bg: #1e1f20;
  --surface: #1e1f20;
  --surface-hover: #282a2c;
  --surface-active: #333537;
  --surface-2: #282a2c;

  /* Sınırlar ve Vurgular */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(168, 199, 250, 0.5);

  /* Metinler */
  --text: #e3e3e3;
  --text-muted: #9aa0a6;
  --text-2: #9aa0a6;
  --text-3: #5f6368;

  /* Eski Orijinal Vurgu Renkleri */
  --accent: #a8c7fa;
  --accent-rgb: 168, 199, 250;
  --accent-hover: #c2e7ff;
  --accent-bg: rgba(168, 199, 250, 0.1);
  --accent-purple: #c4b5fd;
  --accent-blue: #8ab4f8;

  /* Birleşik Gradyanlar */
  --gradient-helios: linear-gradient(135deg, #8ab4f8 0%, #c4b5fd 100%);
  --gradient-helios-hover: linear-gradient(135deg, #a8c7fa 0%, #ddd6fe 100%);

  /* Durum Renkleri */
  --danger: #f28b82;
  --danger-bg: rgba(242, 139, 130, 0.12);
  --success: #81c995;
  --success-bg: rgba(129, 201, 149, 0.12);
  --warning: #fdd663;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 272px;
  --topbar-height: 60px;
  --chat-max-width: 860px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.7);

  --font-main: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', Consolas, Monaco, monospace;
}

/* ─── Ekstra Temalar (Themes) ────────────────────────────────── */

/* 1. Saf Kırmızı (OLED Crimson) */
.theme-crimson {
  --bg: #000000;
  --sidebar-bg: #070709;
  --surface: #0e0e12;
  --surface-hover: #17171d;
  --surface-2: #121216;
  --border: rgba(220, 38, 38, 0.25);
  --border-hover: rgba(239, 68, 68, 0.5);
  --border-focus: rgba(239, 68, 68, 0.8);
  --accent: #ef4444;
  --accent-rgb: 239, 68, 68;
  --accent-hover: #f87171;
  --accent-bg: rgba(239, 68, 68, 0.15);
  --gradient-helios: linear-gradient(135deg, #991b1b 0%, #ef4444 100%);
  --gradient-helios-hover: linear-gradient(135deg, #b91c1c 0%, #f87171 100%);
}

/* 2. Saf Ela Altın (Hazel Gold) */
.theme-hazel {
  --bg: #000000;
  --sidebar-bg: #080705;
  --surface: #12100b;
  --surface-hover: #1c1810;
  --surface-2: #16130e;
  --border: rgba(245, 158, 11, 0.22);
  --border-hover: rgba(245, 158, 11, 0.45);
  --border-focus: rgba(245, 158, 11, 0.75);
  --accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  --accent-hover: #fbbf24;
  --accent-bg: rgba(245, 158, 11, 0.15);
  --gradient-helios: linear-gradient(135deg, #b45309 0%, #f59e0b 100%);
  --gradient-helios-hover: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
}

/* 3. Cyberpunk Neon */
.theme-cyberpunk {
  --bg: #050508;
  --sidebar-bg: #0a0a10;
  --surface: #0f0f18;
  --surface-hover: #181826;
  --surface-2: #131320;
  --border: rgba(255, 0, 60, 0.28);
  --border-hover: rgba(255, 179, 0, 0.5);
  --border-focus: rgba(255, 0, 60, 0.8);
  --accent: #ff003c;
  --accent-rgb: 255, 0, 60;
  --accent-hover: #ff3366;
  --accent-bg: rgba(255, 0, 60, 0.15);
  --gradient-helios: linear-gradient(135deg, #ff003c 0%, #ffb300 100%);
  --gradient-helios-hover: linear-gradient(135deg, #ff3366 0%, #ffc107 100%);
}

/* 4. Karanlık Zümrüt */
.theme-emerald {
  --bg: #030805;
  --sidebar-bg: #050e08;
  --surface: #09160d;
  --surface-hover: #102416;
  --surface-2: #0c1c11;
  --border: rgba(16, 185, 129, 0.2);
  --border-hover: rgba(16, 185, 129, 0.45);
  --border-focus: rgba(16, 185, 129, 0.7);
  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  --accent-hover: #34d399;
  --accent-bg: rgba(16, 185, 129, 0.12);
  --gradient-helios: linear-gradient(135deg, #065f46 0%, #10b981 100%);
  --gradient-helios-hover: linear-gradient(135deg, #047857 0%, #34d399 100%);
}

/* 5. Kraliyet Ametist */
.theme-amethyst {
  --bg: #07040a;
  --sidebar-bg: #0c0812;
  --surface: #140d1e;
  --surface-hover: #1f142e;
  --surface-2: #181024;
  --border: rgba(168, 85, 247, 0.22);
  --border-hover: rgba(168, 85, 247, 0.45);
  --border-focus: rgba(168, 85, 247, 0.7);
  --accent: #a855f7;
  --accent-rgb: 168, 85, 247;
  --accent-hover: #c084fc;
  --accent-bg: rgba(168, 85, 247, 0.14);
  --gradient-helios: linear-gradient(135deg, #7e22ce 0%, #a855f7 100%);
  --gradient-helios-hover: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
}

/* 6. Temiz Açık Tema (Helios Light) */
[data-theme="light"], .theme-light {
  --bg: #ffffff;
  --sidebar-bg: #f0f4f9;
  --surface: #f0f4f9;
  --surface-hover: #e3e8f0;
  --surface-active: #d6deeb;
  --surface-2: #e9eef6;
  --border: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.18);
  --border-focus: rgba(26, 115, 232, 0.5);
  --text: #1f1f1f;
  --text-muted: #5f6368;
  --text-2: #5f6368;
  --text-3: #80868b;
  --accent: #1a73e8;
  --accent-rgb: 26, 115, 232;
  --accent-hover: #1557b0;
  --accent-bg: rgba(26, 115, 232, 0.08);
  --accent-purple: #7c3aed;
  --gradient-helios: linear-gradient(135deg, #1a73e8 0%, #7c3aed 100%);
  --gradient-helios-hover: linear-gradient(135deg, #1557b0 0%, #6d28d9 100%);
}

/* 7. Saf Siyah OLED Modu */
.theme-oled {
  --bg: #000000;
  --sidebar-bg: #070709;
  --surface: #0e0e12;
  --surface-hover: #17171d;
  --surface-2: #121216;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(168, 199, 250, 0.35);
  --border-focus: rgba(168, 199, 250, 0.6);
  --accent: #a8c7fa;
  --accent-rgb: 168, 199, 250;
  --accent-hover: #c2e7ff;
  --accent-bg: rgba(168, 199, 250, 0.12);
  --accent-purple: #c4b5fd;
  --gradient-helios: linear-gradient(135deg, #8ab4f8 0%, #c4b5fd 100%);
  --gradient-helios-hover: linear-gradient(135deg, #a8c7fa 0%, #ddd6fe 100%);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(var(--accent-rgb), 0.28);
  color: #ffffff;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ─── Material Icons ────────────────────────────────────────── */
.material-icons-round {
  font-size: 20px;
  line-height: 1;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* ─── Standard Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-filled {
  background: var(--accent);
  color: #131314;
  font-weight: 600;
}

.btn-filled:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.35);
}

.btn-tonal {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.15);
}

.btn-tonal:hover {
  background: rgba(var(--accent-rgb), 0.18);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(242, 139, 130, 0.2);
}

.btn-danger:hover {
  background: rgba(242, 139, 130, 0.22);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 1rem;
}

/* ─── Cards & Surfaces ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ─── Landing Page ──────────────────────────────────────────── */
.landing {
  max-width: 1080px;
  margin: 0 auto;
  padding: 120px 24px 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.landing-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 12px 36px rgba(var(--accent-rgb), 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: landingFloat 4s ease-in-out infinite;
}

@keyframes landingFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.landing-title {
  font-size: 3.8rem;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 30%, #a8c7fa 70%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-sub {
  font-size: 1.25rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto 36px;
}

.landing-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 64px;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

/* ─── Secondary Page Layout ─────────────────────────────────── */
.page-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.page-content {
  flex: 1;
  padding: 40px 48px;
  max-width: 1100px;
  overflow-y: auto;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-bottom: 32px;
  line-height: 1.5;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

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

.btn-icon:active {
  transform: scale(0.92);
}

/* ─── Avatar ────────────────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  text-transform: uppercase;
}

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

.avatar-initials {
  background: linear-gradient(135deg, #4285f4, #9b72cb);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 1.75rem;
}

/* ─── Chat App Layout ───────────────────────────────────────── */
.chat-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.chat-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--transition-slow), margin-left var(--transition-slow), opacity var(--transition);
  z-index: 50;
  user-select: none;
}

body.sidebar-collapsed .chat-sidebar {
  width: 0;
  min-width: 0;
  margin-left: calc(-1 * var(--sidebar-width));
  opacity: 0;
  pointer-events: none;
  border-right: none;
}

.sidebar-header {
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.sidebar-logo img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.sidebar-logo-text {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sidebar-actions-wrap {
  padding: 8px 12px;
}

.sidebar-newchat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition: var(--transition);
}

.sidebar-newchat:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
}

.sidebar-newchat .material-icons-round {
  color: var(--accent);
  font-size: 19px;
}

.sidebar-search {
  padding: 0 12px 8px;
}

.sidebar-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.sidebar-search-box:focus-within {
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.35);
}

.sidebar-search-box .material-icons-round {
  color: var(--text-3);
  font-size: 17px;
}

.sidebar-search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-main);
  font-size: 0.82rem;
}

.sidebar-search input::placeholder {
  color: var(--text-3);
}

.sidebar-section-label {
  padding: 12px 18px 6px;
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-wrap {
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.history-item-wrap:hover {
  background: var(--surface-hover);
}

.history-item-wrap.active {
  background: rgba(var(--accent-rgb), 0.12);
}

.history-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: transparent;
  text-align: left;
  transition: var(--transition-fast);
}

.history-item-wrap.active .history-item {
  color: var(--accent);
  font-weight: 500;
}

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

.pin-icon {
  font-size: 14px !important;
  color: var(--accent);
  margin-right: 2px;
}

.hist-actions {
  display: none;
  align-items: center;
  gap: 2px;
  position: absolute;
  right: 6px;
  background: var(--surface-hover);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.history-item-wrap:hover .hist-actions {
  display: flex;
}

.hist-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.hist-action-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.hist-action-btn.btn-delete:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.sidebar-nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-nav-link .material-icons-round {
  font-size: 18px;
}

/* ─── Main Chat Column ──────────────────────────────────────── */
.chat-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  transition: flex var(--transition-slow);
}

/* ─── Topbar ────────────────────────────────────────────────── */
.chat-topbar {
  height: var(--topbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.model-badge-icon {
  font-size: 15px !important;
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.web-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: var(--transition);
}

.web-search-badge.active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.4);
  color: var(--accent);
}

.web-search-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

.web-search-badge.active .web-search-badge-dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ─── Profile Dropdown ──────────────────────────────────────── */
.profile-dropdown-wrap {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  animation: dropdownIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-dropdown.open {
  display: flex;
}

.profile-dropdown-user {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.profile-dropdown-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.profile-dropdown-email {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.profile-dropdown-item:hover {
  background: var(--surface-hover);
}

.profile-dropdown-item.danger {
  color: var(--danger);
}

.profile-dropdown-item.danger:hover {
  background: var(--danger-bg);
}

/* ─── Chat Scroll Container ─────────────────────────────────── */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
}

.chat-container {
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 24px 24px 32px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Welcome State ─────────────────────────────────────────── */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: var(--chat-max-width);
  margin: auto;
  padding: 40px 24px;
  animation: welcomeFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.welcome-greeting {
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(74deg, #4285f4 0%, #9b72cb 35%, #d96570 65%, #a8c7fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.welcome-subtitle {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 500;
  color: #444746;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
  line-height: 1.25;
}

.welcome-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  width: 100%;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.suggestion-card:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.suggestion-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-card-title {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.suggestion-card-sub {
  font-size: 0.78rem;
  color: var(--text-2);
}

/* ─── Message Rows ──────────────────────────────────────────── */
.message-row {
  display: flex;
  width: 100%;
  gap: 16px;
  animation: messageIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* User Message */
.message-row.user {
  justify-content: flex-end;
}

.message-row.user .user-bubble {
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 24px 24px 6px 24px;
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 82%;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-bubble-attachment {
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 320px;
  max-height: 240px;
}

.user-bubble-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-fast);
}

.user-bubble-attachment img:hover {
  opacity: 0.92;
}

/* Model (Helios) Message */
.message-row.model {
  justify-content: flex-start;
  align-items: flex-start;
}

.model-avatar-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.model-avatar-icon {
  font-size: 20px !important;
  color: var(--accent);
}

.model-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-content {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
  word-break: break-word;
}

.md-content > *:first-child {
  margin-top: 0 !important;
}

.md-content > *:last-child {
  margin-bottom: 0 !important;
}

/* Markdown Typography */
.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4 {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 20px 0 10px;
  line-height: 1.35;
}

.md-content h1 { font-size: 1.5rem; }
.md-content h2 { font-size: 1.25rem; }
.md-content h3 { font-size: 1.1rem; }
.md-content h4 { font-size: 1rem; }

.md-content p {
  margin: 10px 0;
}

.md-content ul,
.md-content ol {
  padding-left: 24px;
  margin: 10px 0;
}

.md-content li {
  margin: 4px 0;
}

.md-content strong {
  color: #ffffff;
  font-weight: 600;
}

.md-content em {
  font-style: italic;
}

.md-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
  transition: var(--transition-fast);
}

.md-content a:hover {
  border-bottom-color: var(--accent);
}

.md-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 14px 0;
  background: rgba(var(--accent-rgb), 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  font-style: italic;
}

/* Markdown Tables */
.md-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.md-content th {
  background: var(--surface-hover);
  color: #ffffff;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.md-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.md-content tr:last-child td {
  border-bottom: none;
}

/* Inline Code */
.md-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #c2e7ff;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Code Blocks */
.code-block-wrap {
  margin: 16px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #1e1f20;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #282a2c;
  border-bottom: 1px solid var(--border);
}

.code-block-lang {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-code-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  font-family: var(--font-main);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-code-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-code-action.btn-code-canvas {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.btn-code-action.btn-code-canvas:hover {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent-hover);
}

.btn-code-action .material-icons-round {
  font-size: 15px;
}

.btn-copy-code {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-2);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-copy-code:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-copy-code .material-icons-round {
  font-size: 15px;
}

.code-block-wrap pre {
  margin: 0 !important;
  padding: 16px !important;
  overflow-x: auto;
  background: transparent !important;
}

.code-block-wrap pre code {
  font-family: var(--font-mono) !important;
  font-size: 0.88rem !important;
  line-height: 1.6 !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Thinking Block (Accordion) */
.thinking-block {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  transition: var(--transition);
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  user-select: none;
  transition: var(--transition-fast);
}

.thinking-header:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.thinking-chevron {
  font-size: 18px !important;
  transition: transform var(--transition);
  color: var(--accent);
}

.thinking-block.open .thinking-chevron {
  transform: rotate(90deg);
}

.thinking-content {
  display: none;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: #c4c7c5;
  line-height: 1.65;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.15);
}

.thinking-block.open .thinking-content {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

/* Web Search Pill on Model Bubble */
.msg-web-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 500;
}

/* Web Research Sources Component */
.web-sources-container {
  margin: 6px 0 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  transition: var(--transition);
}

.web-sources-container:hover {
  border-color: rgba(var(--accent-rgb), 0.28);
}

.web-sources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  gap: 10px;
  transition: var(--transition-fast);
}

.web-sources-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.web-sources-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.web-sources-icon {
  font-size: 17px !important;
  color: var(--accent);
}

.web-sources-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.web-sources-favicon-list {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.web-source-mini-favicon {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  object-fit: contain;
  background: #202124;
  padding: 1px;
}

.web-sources-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 500;
}

.web-sources-chevron {
  font-size: 18px !important;
  transition: transform var(--transition);
  color: var(--accent);
}

.web-sources-container.open .web-sources-chevron {
  transform: rotate(180deg);
}

.web-sources-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.web-sources-container.open .web-sources-grid {
  display: grid;
  animation: fadeIn 0.2s ease-out;
}

.web-source-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.web-source-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-1px);
}

.web-source-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-2);
}

.web-source-card-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
  background: #202124;
}

.web-source-card-domain {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.web-source-card-open {
  font-size: 14px !important;
  color: var(--text-3);
  transition: var(--transition-fast);
  margin-left: auto;
}

.web-source-card:hover .web-source-card-open {
  color: var(--accent);
  transform: translate(1px, -1px);
}

.web-source-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.web-source-card-snippet {
  font-size: 0.72rem;
  color: var(--text-3);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 600px) {
  .web-sources-grid {
    grid-template-columns: 1fr;
  }
}

/* Message Bottom Action Bar */
.message-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.msg-action-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.msg-action-btn.active-liked {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(129, 201, 149, 0.3);
}

.msg-action-btn.active-disliked {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(242, 139, 130, 0.3);
}

.msg-action-btn.active-speaking {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(var(--accent-rgb), 0.35);
  animation: pulseSpeaking 1.5s infinite alternate;
}

@keyframes pulseSpeaking {
  0% { box-shadow: 0 0 4px rgba(var(--accent-rgb), 0.2); }
  100% { box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5); }
}

.msg-meta-info {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.msg-action-btn .material-icons-round {
  font-size: 15px;
}

/* Sidebar History Date Groups */
.history-group-label {
  padding: 10px 14px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ─── Typing / Pulse Indicator ──────────────────────────────── */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingPulse 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* ─── Floating Input Area ───────────────────────────────────── */
.chat-input-outer {
  padding: 8px 24px 20px;
  flex-shrink: 0;
  background: transparent;
  width: 100%;
}

.chat-input-wrapper {
  max-width: var(--chat-max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* File Attachment Preview Strip */
.attachment-preview-area {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 8px;
}

.attachment-preview-area.visible {
  display: flex;
}

.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.preview-chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  object-fit: cover;
}

.preview-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 180px;
}

.preview-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.preview-chip-size {
  font-size: 0.72rem;
  color: var(--text-3);
}

.preview-chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.preview-chip-remove:hover {
  background: var(--danger);
  color: #ffffff;
}

/* The Floating Input Pill */
.chat-input-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 10px 14px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.chat-input-box:focus-within {
  border-color: var(--border-focus);
  background: #232426;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12), var(--shadow);
}

.chat-input-main-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-main);
  font-size: 1rem;
  resize: none;
  min-height: 24px;
  max-height: 180px;
  line-height: 1.5;
  padding: 4px 0;
}

.chat-textarea::placeholder {
  color: var(--text-3);
}

.chat-input-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.input-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  font-family: inherit;
}

.tool-pill-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.tool-pill-btn.active {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.2);
}

/* Helios Artist button active state — purple */
#imageGenToggleBtn.active {
  background: rgba(196, 181, 253, 0.15);
  border-color: rgba(196, 181, 253, 0.55);
  color: #c4b5fd;
  box-shadow: 0 0 12px rgba(196, 181, 253, 0.25);
}

.tool-pill-btn .material-icons-round {
  font-size: 16px;
}

.input-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Circular Send / Stop Button */
.btn-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #131314;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.btn-send:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-3);
  cursor: not-allowed;
  transform: none;
}

.btn-send.stop-state {
  background: var(--danger) !important;
  color: #131314 !important;
  animation: pulseStop 1.5s infinite;
}

@keyframes pulseStop {
  0% { box-shadow: 0 0 0 0 rgba(242, 139, 130, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(242, 139, 130, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 139, 130, 0); }
}

.input-disclaimer {
  font-size: 0.72rem;
  color: var(--text-3);
  text-align: center;
  padding: 4px 0 0;
}

.input-disclaimer a {
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.input-disclaimer a:hover {
  color: var(--text-2);
  text-decoration: underline;
}

/* ─── Canvas Panel (Split Screen) ───────────────────────────── */
.canvas-panel {
  flex: 0 0 0%;
  width: 0;
  opacity: 0;
  pointer-events: none;
  height: 100vh;
  background: #1e1f20;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex var(--transition-slow), opacity var(--transition-slow);
  z-index: 60;
}

.canvas-panel.open {
  flex: 0 0 50%;
  width: auto;
  opacity: 1;
  pointer-events: auto;
}

.canvas-header {
  height: var(--topbar-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #282a2c;
  flex-shrink: 0;
}

.canvas-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.canvas-title .material-icons-round {
  color: var(--accent);
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.canvas-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* ─── Drag & Drop Overlay ───────────────────────────────────── */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(19, 19, 20, 0.88);
  backdrop-filter: blur(8px);
  border: 2px dashed var(--accent);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 600;
  pointer-events: none;
}

.drop-overlay.active {
  display: flex;
}

.drop-overlay .material-icons-round {
  font-size: 48px;
}

/* ─── Lightbox ──────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 20px;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

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

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kbd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-2);
}

.kbd-row:last-child {
  border-bottom: none;
}

.kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text);
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: toastFadeUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ─── Floating Scroll Button ────────────────────────────────── */
.scroll-btn {
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 40px;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 45;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.scroll-btn.visible {
  display: flex;
}

.scroll-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

/* ─── Non-Chat Page Styles (Profile, Settings, Admin, etc.) ──── */
.page-layout {
  display: flex;
  min-height: 100vh;
}

.page-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ─── Shared Sidebar / Navigation (used by navbar.ejs) ─────── */
.shared-sidebar-nav {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.shared-sidebar-logo {
  padding: 12px 8px 4px;
}

.shared-logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: var(--radius-md);
}

.shared-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.shared-logo-text {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.shared-sidebar-list {
  list-style: none;
  padding: 4px 8px;
  flex: 1;
  overflow-y: auto;
}

.shared-nav-li {
  margin-bottom: 2px;
}

.shared-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}

.shared-nav-link:hover,
.shared-nav-link.active {
  background: var(--surface-hover);
  color: var(--text);
}

.shared-sidebar-user {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.shared-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
}

.page-content {
  flex: 1;
  padding: 40px;
  max-width: 960px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-2);
  font-size: 0.92rem;
  margin-bottom: 32px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  margin-bottom: 20px;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin: 8px 0;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-weight: 600;
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody td {
  padding: 12px 16px;
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-green { background: var(--success-bg); color: var(--success); }
.badge-blue { background: var(--accent-bg); color: var(--accent); }
.badge-purple { background: rgba(196, 181, 253, 0.15); color: var(--accent-purple); }
.badge-red { background: var(--danger-bg); color: var(--danger); }

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.form-input::placeholder {
  color: var(--text-3);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Auth Cards */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.auth-logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 12px;
}

.auth-logo p {
  color: var(--text-2);
  font-size: 0.88rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.auth-tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form-container {
  display: none;
}

.auth-form-container.active {
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 12px;
}

.social-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Backdrop Base Style ───────────────────────────────────── */
.sidebar-backdrop {
  display: none;
}

/* ─── Responsive Media Queries (Mobile & Tablet) ────────────── */
@media (max-width: 900px) {
  .welcome-greeting {
    font-size: 2.2rem;
  }
  .welcome-subtitle {
    font-size: 1.4rem;
  }
  .welcome-chips-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  /* 1. Backdrop Overlay */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body:not(.sidebar-collapsed) .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* 2. Sliding Off-Canvas Sidebar */
  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    z-index: 999;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.65);
  }

  body.sidebar-collapsed .chat-sidebar {
    transform: translateX(-100%);
    width: min(300px, 85vw);
    margin-left: 0;
    box-shadow: none;
  }

  /* 3. Chat Layout & Main */
  .chat-layout {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .chat-main {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
  }

  /* 4. Topbar Header */
  .chat-topbar {
    height: 52px;
    padding: 0 10px;
    gap: 6px;
    background: rgba(19, 19, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .topbar-left {
    gap: 6px;
  }

  .model-badge {
    padding: 4px 10px;
    font-size: 0.8rem;
    gap: 5px;
    letter-spacing: 0.2px;
  }

  .model-badge-icon {
    font-size: 14px;
  }

  .topbar-right {
    gap: 4px;
  }

  .topbar-right .btn-icon {
    width: 36px;
    height: 36px;
  }

  .avatar-initials {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  /* 5. Scroll Area & Container */
  .chat-scroll-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-container {
    padding: 12px 10px 24px;
    max-width: 100%;
    width: 100%;
    gap: 16px;
  }

  /* 6. Welcome Screen */
  .chat-welcome {
    padding: 16px 12px;
    max-width: 480px;
    margin: 0 auto;
  }

  .welcome-greeting {
    font-size: 1.7rem;
    line-height: 1.25;
    margin-bottom: 6px;
    text-align: center;
  }

  .welcome-subtitle {
    font-size: 1rem;
    line-height: 1.35;
    margin-bottom: 22px;
    text-align: center;
  }

  .welcome-chips-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .suggestion-card {
    padding: 12px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-align: left;
    border-radius: var(--radius-md);
  }

  .suggestion-card-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    margin-bottom: 0;
  }

  .suggestion-card-title {
    font-size: 0.88rem;
    margin-bottom: 2px;
  }

  .suggestion-card-sub {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  /* 7. Message Rows & Bubbles */
  .message-row {
    gap: 10px;
  }

  .message-row.user {
    margin-left: auto;
    max-width: 90%;
  }

  .message-row.user .user-bubble {
    max-width: 100%;
    padding: 10px 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    border-radius: 18px 18px 4px 18px;
    word-break: break-word;
  }

  .message-row.model {
    max-width: 100%;
  }

  .model-avatar-wrap {
    width: 28px;
    height: 28px;
    min-width: 28px;
    margin-top: 2px;
  }

  .model-avatar-icon {
    font-size: 16px;
  }

  .model-content-wrap {
    max-width: calc(100% - 38px);
    font-size: 0.93rem;
    line-height: 1.6;
    word-break: break-word;
  }

  /* 8. Code Blocks on Mobile */
  .code-block-wrap {
    margin: 10px 0;
    border-radius: 10px;
    max-width: 100%;
    overflow: hidden;
  }

  .code-block-header {
    padding: 6px 12px;
    font-size: 0.74rem;
  }

  .code-block-wrap pre {
    padding: 12px;
    font-size: 0.8rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .code-block-wrap code {
    font-size: 0.8rem;
  }

  .md-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 10px 0;
  }

  .message-actions {
    gap: 6px;
    margin-top: 8px;
  }

  .msg-action-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
  }

  .msg-action-btn .material-icons-round {
    font-size: 15px;
  }

  /* 9. Floating Input Area */
  .chat-input-outer {
    padding: 6px 10px max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 85%, transparent);
  }

  .chat-input-box {
    border-radius: 20px;
    padding: 8px 12px;
    background: rgba(30, 31, 32, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .chat-textarea {
    font-size: 16px !important; /* CRITICAL: Prevents iOS auto-zoom on focus */
    line-height: 1.4;
    padding: 4px 0;
    max-height: 120px;
  }

  .chat-input-bottom-row {
    margin-top: 6px;
  }

  .tool-pill-btn {
    padding: 4px 10px;
    font-size: 0.76rem;
  }

  .btn-send {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .input-disclaimer {
    font-size: 0.68rem;
    margin-top: 4px;
    padding: 0 4px;
    text-align: center;
  }

  /* 10. Live Canvas Modal Sheet */
  .canvas-panel.open {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 2000;
    border-radius: 0;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    flex: none;
  }

  .canvas-header {
    height: 52px;
    padding: 0 12px;
    border-radius: 0;
  }

  /* 11. Shared Bottom Nav Bar (Settings, History, Security, etc.) */
  .page-layout {
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 74px; /* Space for bottom nav */
  }

  .page-sidebar {
    display: none;
  }

  .shared-sidebar-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    width: 100%;
    z-index: 1000;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: rgba(30, 31, 32, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    border-right: none;
    border-left: none;
    padding: 0 4px max(4px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .shared-sidebar-logo,
  .shared-sidebar-user {
    display: none;
  }

  .shared-sidebar-list {
    display: flex;
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    margin: 0;
    overflow: visible;
  }

  .shared-nav-li {
    flex: 1;
    margin: 0;
    text-align: center;
  }

  .shared-nav-link {
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    border-radius: var(--radius-md);
    font-size: 0.68rem;
    font-weight: 500;
  }

  .shared-nav-icon {
    font-size: 20px !important;
  }

  .page-content {
    padding: 20px 14px;
    max-width: 100%;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .page-subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .welcome-greeting {
    font-size: 1.5rem;
  }
  .welcome-subtitle {
    font-size: 0.92rem;
  }
  .tool-pill-btn span:not(.material-icons-round) {
    display: none; /* Hide text on ultra-narrow screens, keep search icon */
  }
  .tool-pill-btn {
    padding: 6px 8px;
  }
}
