/* ============================================================
   Prometix v2 — style.css
   by Atimos AI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600&family=Geist+Mono:wght@300;400;500&display=swap');

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-font-smoothing: antialiased; }
button { cursor: pointer; font-family: inherit; }
textarea { font-family: inherit; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 99px; }

/* ============================================================
   TOKENS — Dark
   ============================================================ */
:root,
[data-theme="dark"] {
  --bg-canvas:   #08080B;
  --bg-sidebar:  #0D0D12;
  --bg-main:     #08080B;
  --bg-raised:   #121218;
  --bg-elevated: #1A1A22;
  --bg-hover:    #20202A;
  --bg-input:    #121218;

  --border:      #1E1E28;
  --border-mid:  #2A2A36;
  --border-input:#343442;

  --text:        #EEEEF2;
  --text2:       #86869A;
  --text3:       #42424E;

  --accent:      #7C5CFC;
  --accent-dim:  rgba(124,92,252,0.12);
  --accent-glow: rgba(124,92,252,0.22);
  --accent2:     #9B82FE;

  --error-text:  #FF6B6B;
  --error-bg:    rgba(255,107,107,0.08);
  --error-border:rgba(255,107,107,0.25);

  --user-bg:     #0F0F24;
  --user-border: #232358;
  --logo-bg:     #140F2A;

  --mesh-1: rgba(124,92,252,0.07);
  --mesh-2: rgba(80,60,200,0.05);
  --mesh-3: rgba(50,30,160,0.04);

  --sidebar-width: 260px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px;
  --font-ui:   'Geist', system-ui, sans-serif;
  --font-serif:'Instrument Serif', Georgia, serif;
  --font-mono: 'Geist Mono', monospace;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 40px var(--accent-glow);
}

/* ── Light theme ────────────────────────────────────────── */
[data-theme="light"] {
  --bg-canvas:   #F4F3EF;
  --bg-sidebar:  #EBEBЕ8;
  --bg-main:     #F4F3EF;
  --bg-raised:   #FFFFFF;
  --bg-elevated: #ECEAE6;
  --bg-hover:    #E3E1DC;
  --bg-input:    #FFFFFF;
  --border:      #DCDAD4;
  --border-mid:  #CECCC6;
  --border-input:#C2C0BA;
  --text:        #18181E;
  --text2:       #60606A;
  --text3:       #A0A0AA;
  --accent:      #6644E8;
  --accent-dim:  rgba(102,68,232,0.10);
  --accent-glow: rgba(102,68,232,0.18);
  --accent2:     #8866FF;
  --error-text:  #D32F2F;
  --error-bg:    rgba(211,47,47,0.06);
  --error-border:rgba(211,47,47,0.22);
  --user-bg:     #EEEBFF;
  --user-border: #C4B8FF;
  --logo-bg:     #EAE6FF;
  --mesh-1: rgba(102,68,232,0.05);
  --mesh-2: rgba(80,60,200,0.04);
  --mesh-3: rgba(50,30,160,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes splashLogoIn {
  0%   { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  65%  { opacity: 1; transform: scale(1.06) rotate(1.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes splashWordIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes splashOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.05); pointer-events: none; }
}
@keyframes ringPulse {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes appIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes meshDrift1 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(4%,6%) scale(1.07); }
}
@keyframes meshDrift2 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(-5%,3%) scale(1.09); }
}
@keyframes meshDrift3 {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(6%,-4%) scale(1.05); }
  66%      { transform: translate(-3%,5%) scale(1.08); }
}
@keyframes logoIn {
  from { opacity: 0; transform: scale(1.28) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes sidebarSlide {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes dotPulse {
  0%,80%,100% { opacity: 0.2; transform: scale(0.7); }
  40%          { opacity: 1;   transform: scale(1); }
}
@keyframes statusGlow {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
@keyframes btnPress {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes orbBreathe {
  0%,100% { box-shadow: 0 0 24px var(--accent-glow); }
  50%      { box-shadow: 0 0 52px var(--accent-glow), 0 0 90px rgba(124,92,252,0.10); }
}
@keyframes inputUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   SPLASH
   ============================================================ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}
.splash-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.splash-logo-wrap {
  position: relative;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  animation: splashLogoIn 0.75s cubic-bezier(0.34,1.56,0.64,1) both;
}
.splash-logo-svg {
  position: relative; z-index: 2;
  filter: drop-shadow(0 0 16px var(--accent));
}
.ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
}
.ring1 { animation: ringPulse 2s ease-out 0.4s infinite; }
.ring2 { animation: ringPulse 2s ease-out 0.85s infinite; }
.ring3 { animation: ringPulse 2s ease-out 1.3s infinite; }
.splash-wordmark {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--text);
  animation: splashWordIn 0.5s ease 0.55s both;
}
.splash-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 6px;
  animation: splashWordIn 0.5s ease 0.75s both;
}
.splash.hide { animation: splashOut 0.5s cubic-bezier(0.4,0,0.6,1) 0.15s both; pointer-events: none; }

/* ============================================================
   MESH BACKGROUND
   ============================================================ */
html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  background: var(--bg-canvas);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  width: 650px; height: 650px;
  top: -180px; left: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mesh-1) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
  animation: meshDrift1 24s ease-in-out infinite;
}
body::after {
  content: '';
  position: fixed;
  width: 550px; height: 550px;
  bottom: -100px; right: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mesh-2) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
  animation: meshDrift2 20s ease-in-out infinite;
}
html::before {
  content: '';
  position: fixed;
  width: 460px; height: 460px;
  top: 42%; left: 42%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mesh-3) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
  animation: meshDrift3 30s ease-in-out infinite;
}

.sidebar, .main { position: relative; z-index: 1; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1),
              width 0.32s cubic-bezier(0.4,0,0.2,1),
              min-width 0.32s cubic-bezier(0.4,0,0.2,1),
              background 0.3s, border-color 0.3s;
  animation: sidebarSlide 0.55s cubic-bezier(0.16,1,0.3,1) 1.8s both;
}
.sidebar.hidden {
  transform: translateX(-100%);
  min-width: 0; width: 0;
  border-right: none;
  pointer-events: none;
  overflow: hidden;
}

/* Sidebar top */
.sidebar-top {
  padding: 18px 14px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Logo */
.logo {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px; margin-bottom: 14px;
  animation: logoIn 0.6s cubic-bezier(0.16,1,0.3,1) 1.9s both;
}
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.25s, transform 0.2s;
}
.logo:hover .logo-mark { transform: scale(1.07); box-shadow: var(--shadow-glow); }
.logo-name {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.logo-version {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(124,92,252,0.22);
  border-radius: 99px;
  padding: 1px 7px; margin-left: 2px;
  letter-spacing: 0.03em;
}

.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  margin-left: auto; margin-bottom: 2px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text3); cursor: pointer;
  transition: all 0.15s;
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text2); border-color: var(--border-mid); }

.new-chat-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text2); font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}
.new-chat-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-mid);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.new-chat-btn:active { transform: translateY(0); }

/* History search */
.history-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 8px 10px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.history-search-wrap:focus-within {
  border-color: rgba(124,92,252,0.4);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.history-search {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-ui); font-size: 12px;
  color: var(--text); caret-color: var(--accent);
}
.history-search::placeholder { color: var(--text3); }

/* History list */
.sidebar-section-label {
  padding: 12px 18px 5px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text3); flex-shrink: 0;
}
.history-list {
  flex: 1; overflow-y: auto; padding: 2px 8px;
}
.history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text2); font-size: 12.5px;
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 1px;
  border: 1px solid transparent;
  animation: fadeUp 0.22s ease both;
}
.history-item:hover { background: var(--bg-hover); color: var(--text); }
.history-item.active {
  background: var(--accent-dim);
  border-color: rgba(124,92,252,0.22);
  color: var(--text);
}
.hi-icon { flex-shrink: 0; opacity: 0.4; }
.hi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.hi-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  flex-shrink: 0;
}
.history-empty {
  padding: 20px 16px;
  font-size: 12px; color: var(--text3);
  font-style: italic; line-height: 1.6; text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}

/* User profile */
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-bottom: 10px;
  cursor: default;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.user-profile:hover { background: var(--bg-hover); border-color: var(--border); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 15px; font-weight: 400;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 0 10px var(--accent-glow);
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email {
  font-size: 11px; color: var(--text3);
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-menu-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: transparent; border: none;
  color: var(--text3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.user-menu-btn:hover { background: var(--bg-elevated); color: var(--text2); }

/* User dropdown */
.user-dropdown {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 10px;
  display: none;
  animation: fadeUp 0.2s ease both;
  box-shadow: var(--shadow-md);
}
.user-dropdown.open { display: block; }
.user-dd-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 12px;
  background: transparent; border: none;
  border-radius: var(--r-sm);
  color: var(--text2); font-size: 13px;
  text-align: left; cursor: pointer;
  transition: all 0.12s;
}
.user-dd-item:hover { background: var(--bg-hover); color: var(--text); }
.user-dd-item.danger { color: #FF6B6B; }
.user-dd-item.danger:hover { background: rgba(255,107,107,0.08); color: #FF6B6B; }
.user-dd-divider { height: 1px; background: var(--border); margin: 4px 6px; }

.model-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; color: var(--text3);
}
.model-select {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text2); outline: none; cursor: pointer;
  transition: all 0.15s; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.model-select:hover, .model-select:focus { border-color: var(--border-mid); color: var(--text); }
.model-select option { background: var(--bg-elevated); }

.theme-row {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.theme-btn {
  flex: 1; padding: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.theme-btn:hover { background: var(--bg-hover); color: var(--text2); border-color: var(--border-mid); }
.theme-btn.active {
  background: var(--accent-dim);
  border-color: rgba(124,92,252,0.3);
  color: var(--accent);
}

.sidebar-brand {
  font-size: 11px; color: var(--text3);
  text-align: center; letter-spacing: 0.02em;
}
.sidebar-brand strong { color: var(--accent); font-weight: 500; font-family: var(--font-mono); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,11,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0; gap: 10px;
  position: relative; z-index: 10;
  animation: appIn 0.4s ease both;
}
[data-theme="light"] .topbar { background: rgba(244,243,239,0.88); }

.topbar-center {
  display: flex; align-items: center; gap: 7px;
  position: absolute; left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.topbar-logo-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.topbar-title {
  font-size: 13px; font-weight: 500;
  color: var(--text2); font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-mid); }

/* ============================================================
   MAIN / CHAT
   ============================================================ */
.main {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; min-width: 0; overflow: hidden;
  background: transparent;
  animation: appIn 0.4s ease 1.8s both;
}

.chat-viewport {
  flex: 1; overflow-y: auto;
  scroll-behavior: smooth; padding: 28px 0;
  position: relative;
}
.chat-inner { max-width: 700px; margin: 0 auto; padding: 0 20px; }

/* Welcome */
.welcome {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 60px 0 40px; min-height: 55vh;
  justify-content: center;
}
.welcome-orb {
  width: 80px; height: 80px;
  border-radius: 24px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
  box-shadow: 0 0 30px var(--accent-glow);
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) 0.1s both,
             orbBreathe 4s ease-in-out 1s infinite;
}
.welcome-title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 400;
  letter-spacing: -0.03em; line-height: 1.1;
  color: var(--text); margin-bottom: 14px;
  animation: fadeUp 0.55s cubic-bezier(0.16,1,0.3,1) 0.2s both;
}
.welcome-title em { font-style: italic; color: var(--accent); }
.welcome-sub {
  color: var(--text2); font-size: 15px; font-weight: 300;
  max-width: 440px; margin-bottom: 44px; line-height: 1.7;
  animation: fadeUp 0.55s cubic-bezier(0.16,1,0.3,1) 0.3s both;
}
.starter-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%; max-width: 520px;
  animation: fadeUp 0.55s cubic-bezier(0.16,1,0.3,1) 0.4s both;
}
.starter-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px; text-align: left;
  transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; gap: 5px;
  position: relative; overflow: hidden;
}
.starter-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.22s;
  border-radius: inherit;
}
.starter-card:hover {
  border-color: rgba(124,92,252,0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}
.starter-card:hover::after { opacity: 1; }
.starter-card:active { transform: translateY(0); }
.sc-eyebrow {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--accent); position: relative; z-index: 1;
}
.sc-text {
  font-size: 13px; color: var(--text2);
  line-height: 1.45; position: relative; z-index: 1;
}
.welcome-badge {
  margin-top: 36px; font-size: 11px;
  color: var(--text3); font-family: var(--font-mono);
  letter-spacing: 0.06em;
  animation: fadeUp 0.55s ease 0.55s both;
}
.welcome-badge strong { color: var(--accent); font-weight: 500; }

/* Messages */
.message-group {
  margin-bottom: 6px;
  animation: msgIn 0.38s cubic-bezier(0.16,1,0.3,1) both;
}
.msg-row { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; }
.msg-row.user { justify-content: flex-end; }
.msg-row.user .bubble {
  max-width: 76%;
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  color: var(--text); font-size: 14px; line-height: 1.65;
  word-break: break-word;
}
.raw-label {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text3); font-family: var(--font-mono);
  margin-bottom: 5px; opacity: 0.7; text-align: right;
}
.ai-avatar {
  width: 30px; height: 30px;
  border-radius: 8px; background: var(--logo-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
  box-shadow: 0 0 10px var(--accent-glow);
}
.sender-name {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--accent); margin-bottom: 6px;
  font-family: var(--font-mono);
}

/* Prompt card */
.prompt-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; margin-top: 4px;
  animation: cardIn 0.4s cubic-bezier(0.16,1,0.3,1) both;
}
.prompt-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.prompt-card-label {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text3);
}
.prompt-card-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  animation: statusGlow 2s ease-in-out 3;
}
.prompt-card-body {
  padding: 20px; font-size: 14px; line-height: 1.8;
  color: var(--text); word-break: break-word; letter-spacing: 0.01em;
}

.copy-prompt-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 10px;
  font-size: 11px; font-family: var(--font-ui);
  color: var(--text3); cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 4px;
}
.copy-prompt-btn:hover { background: var(--bg-hover); color: var(--text2); border-color: var(--border-mid); }
.copy-prompt-btn.copied { color: var(--accent); border-color: rgba(124,92,252,0.3); }

.msg-actions {
  display: flex; gap: 6px; margin-top: 8px;
  opacity: 0; transition: opacity 0.15s;
}
.message-group:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 9px;
  font-size: 11px; color: var(--text3);
  display: flex; align-items: center; gap: 4px;
  transition: all 0.15s; font-family: var(--font-ui); cursor: pointer;
}
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text2); border-color: var(--border-mid); }
.msg-action-btn.copied { color: var(--accent); }

.error-bubble {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  background: var(--error-bg); border: 1px solid var(--error-border);
  border-radius: var(--r-md); color: var(--error-text);
  font-size: 13px; line-height: 1.5; margin: 4px 0 4px 42px;
}

.thinking-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 0; animation: msgIn 0.3s ease both;
}
.thinking-dots {
  display: flex; gap: 5px; padding: 12px 16px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 18px;
}
.thinking-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text3);
  animation: dotPulse 1.3s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================================
   INPUT AREA
   ============================================================ */
.input-area {
  padding: 10px 20px 18px; flex-shrink: 0;
  background: linear-gradient(to top, var(--bg-canvas) 65%, transparent);
  animation: inputUp 0.5s cubic-bezier(0.16,1,0.3,1) 2.0s both;
}
.input-wrap { max-width: 700px; margin: 0 auto; }
.status-bar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; font-size: 11px;
  color: var(--text3); font-family: var(--font-mono);
  padding: 0 2px; height: 18px;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text3); flex-shrink: 0; transition: background 0.3s;
}
.status-dot.online  { background: #4ADE80; animation: statusGlow 2.5s ease-in-out infinite; }
.status-dot.offline { background: var(--error-text); }
.status-dot.busy    { background: var(--accent); animation: statusGlow 0.7s ease-in-out infinite; }

.input-row { display: flex; gap: 10px; align-items: flex-end; }
.textarea-wrap {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--r-lg);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.textarea-wrap:focus-within {
  border-color: rgba(124,92,252,0.5);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 24px var(--accent-glow);
}
.textarea-wrap textarea {
  width: 100%; background: transparent;
  border: none; outline: none; resize: none;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.6;
  max-height: 200px; overflow-y: auto; min-height: 52px;
  display: block;
  writing-mode: horizontal-tb;
  word-break: break-word; white-space: pre-wrap;
}
.textarea-wrap textarea::placeholder { color: var(--text3); }

.send-btn {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--accent); border: none;
  color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 16px var(--accent-glow);
}
.send-btn:hover:not(:disabled) {
  background: var(--accent2); transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 30px var(--accent-glow);
}
.send-btn:active:not(:disabled) { animation: btnPress 0.18s ease; transform: translateY(0); }
.send-btn:disabled {
  background: var(--bg-elevated); color: var(--text3);
  cursor: not-allowed; transform: none; box-shadow: none;
}

.input-disclaimer {
  text-align: center; font-size: 11px;
  color: var(--text3); margin-top: 10px;
  font-family: var(--font-mono);
}
.input-disclaimer strong { color: var(--accent); font-weight: 500; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 150;
  backdrop-filter: blur(3px);
  animation: appIn 0.2s ease both;
}
.sidebar-overlay.visible { display: block; }

/* ============================================================
   SETTINGS MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.settings-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  width: 480px; max-width: 90vw;
  max-height: 80vh;
  display: flex; flex-direction: column;
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1) both;
  overflow: hidden;
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-head h2 {
  font-family: var(--font-serif);
  font-size: 18px; font-weight: 400;
  letter-spacing: -0.01em; color: var(--text);
}
.modal-close-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text2); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close-btn:hover { background: var(--bg-elevated); color: var(--text); }

.settings-body { overflow-y: auto; padding: 16px 24px 24px; }
.settings-section { margin-bottom: 24px; }
.settings-section-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text3); margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 0;
}
.settings-row-title { font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.settings-row-sub { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* Toggle switch */
.toggle-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--bg-hover); border: 1px solid var(--border-mid);
  border-radius: 99px; cursor: pointer; transition: all 0.25s;
}
.toggle-track::before {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%; background: var(--text3);
  top: 2px; left: 2px; transition: all 0.25s;
}
.toggle-switch input:checked + .toggle-track {
  background: var(--accent); border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track::before {
  background: #fff; transform: translateX(16px);
}

.settings-danger-btn {
  padding: 6px 14px;
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.3);
  border-radius: 7px; font-size: 12px;
  color: var(--error-text); cursor: pointer;
  font-family: var(--font-ui); transition: all 0.15s;
  white-space: nowrap;
}
.settings-danger-btn:hover { background: rgba(255,107,107,0.18); }
.settings-secondary-btn {
  padding: 6px 14px;
  background: var(--bg-hover); border: 1px solid var(--border-mid);
  border-radius: 7px; font-size: 12px;
  color: var(--text2); cursor: pointer;
  font-family: var(--font-ui); transition: all 0.15s;
  white-space: nowrap;
}
.settings-secondary-btn:hover { background: var(--bg-elevated); color: var(--text); }

/* ============================================================
   CONSENT TOAST
   ============================================================ */
.consent-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 18px 20px;
  max-width: 460px; width: calc(100% - 48px);
  box-shadow: var(--shadow-lg);
  display: flex; gap: 14px; align-items: flex-start;
  opacity: 0; pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
  z-index: 400;
}
.consent-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}
.ct-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ct-body { flex: 1; }
.ct-body strong { display: block; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.ct-body p { font-size: 12px; color: var(--text2); line-height: 1.55; }
.ct-actions { display: flex; gap: 8px; margin-top: 12px; }
.ct-btn {
  padding: 7px 14px; border-radius: 7px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  font-family: var(--font-ui);
  border: 1px solid var(--border-mid);
  background: transparent; color: var(--text2);
  transition: all 0.15s;
}
.ct-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.ct-btn:hover { opacity: 0.85; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 680px) {
  .sidebar {
    position: fixed !important; top: 0; left: 0;
    transform: translateX(-100%) !important;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    min-width: var(--sidebar-width) !important;
    width: var(--sidebar-width) !important;
  }
  .sidebar.open { transform: translateX(0) !important; pointer-events: all; }
  .chat-inner { padding: 0 14px; }
  .starter-grid { grid-template-columns: 1fr; }
  .msg-row.user .bubble { max-width: 90%; }
  .input-area { padding: 8px 14px 14px; }
}
@media (min-width: 681px) {
  .sidebar { position: relative; pointer-events: all; }
}
