/* SamAgent — Marexsoft Corporation | Créé par Kouassi Marius */
:root {
  
  --bg:        #000000;
  --bg2:       #080808;
  --bg3:       #0f0f0f;
  --bg4:       #141414;
  --bg5:       #1a1a1a;
  --border:    rgba(118,185,0,0.1);
  --border2:   rgba(118,185,0,0.2);
  --border3:   rgba(118,185,0,0.35);
  --accent:    #76b900;
  --accent2:   #8fd400;
  --accent3:   #aaee00;
  --accent-rgb: 118,185,0;
  --teal:      #76b900;
  --teal2:     #aaee00;
  --teal-rgb:  118,185,0;
  --text:      #ffffff;
  --text2:     #a0a0a0;
  --text3:     #505050;
  --danger:    #ff4444;
  --success:   #76b900;
  --warning:   #ffaa00;
  --user-glow: rgba(118,185,0,0.18);
  --ai-glow:   rgba(118,185,0,0.09);
  --r:         6px;
  --r2:        10px;
  --r3:        14px;
  --shadow:    0 8px 40px rgba(0,0,0,0.9);
  --shadow2:   0 24px 80px rgba(0,0,0,0.95);
  --glow-accent: 0 0 20px rgba(118,185,0,0.6), 0 0 80px rgba(118,185,0,0.25);
  --glow-teal:   0 0 20px rgba(118,185,0,0.5), 0 0 80px rgba(118,185,0,0.2);
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --mono:      'Geist Mono', 'Fira Code', monospace, 'JetBrains Mono', monospace;
  --trans:     opacity 0.2s cubic-bezier(0.4,0,0.2,1), transform 0.2s cubic-bezier(0.4,0,0.2,1);
  --trans-slow: opacity 0.45s cubic-bezier(0.4,0,0.2,1), transform 0.45s cubic-bezier(0.4,0,0.2,1);
  --trans-spring: opacity 0.4s cubic-bezier(0.34,1.56,0.64,1), transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  --trans-fast: all 0.12s cubic-bezier(0.4,0,0.2,1);
  --blur:      blur(16px) saturate(220%);
  --blur2:     blur(24px) saturate(250%);
  --surface:      rgba(14,14,26,0.9);
  --surface2:     rgba(12,12,22,0.95);
  --surface3:     rgba(10,10,18,0.92);
  --surface4:     rgba(14,14,26,0.75);
  --surface5:     rgba(14,14,26,0.85);
  --surface6:     rgba(14,14,26,0.88);
  --surface7:     rgba(17,17,24,0.75);
  --overlay-bg:   #07070e;
  --split-bg:     #06060f;
  --auth-overlay: rgba(0,0,0,0.88);
  --chat-bg-img: url('/static/img/back.jpg');
  --scanline: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(118,185,0,0.015) 2px,
    rgba(118,185,0,0.015) 4px
  );
}
.light {
  --bg:      #eef0f4;
  --bg2:     #ffffff;
  --bg3:     #f0f1f5;
  --bg4:     #e6e7ed;
  --bg5:     #dcdde5;
  --border:  rgba(0,0,0,0.06);
  --border2: rgba(0,0,0,0.10);
  --border3: rgba(0,0,0,0.18);
  --text:    #1a1a2e;
  --text2:   #6b7280;
  --text3:   #2a2a3a;
  --user-glow: rgba(118,185,0,0.08);
  --ai-glow:   rgba(118,185,0,0.05);
  --shadow:  0 8px 32px rgba(0,0,0,0.06);
  --shadow2: 0 12px 48px rgba(0,0,0,0.08);
  --surface:      rgba(255,255,255,0.92);
  --surface2:     rgba(255,255,255,0.97);
  --surface3:     rgba(255,255,255,0.95);
  --surface4:     rgba(255,255,255,0.90);
  --surface5:     rgba(255,255,255,0.94);
  --surface6:     rgba(255,255,255,0.92);
  --surface7:     rgba(255,255,255,0.96);
  --overlay-bg:   #f8f9fb;
  --split-bg:     #ffffff;
  --auth-overlay: rgba(255,255,255,0.75);
  --chat-bg-img: url('/static/img/back_clair.jpg');
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-size: 17px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}


::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ══════════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════════ */
#login-screen { display: none; }
#login-screen.visible {
  display: flex; align-items: center; justify-content: center;
  height: 100dvh; position: relative; overflow: hidden;
  background: var(--overlay-bg) url('/static/img/back.jpg') center/cover no-repeat;
}
#login-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.92) 100%);
}
.login-grid {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(118,185,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118,185,0,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 100%);
  animation: gridPulse 6s ease-in-out infinite alternate;
}
@keyframes gridPulse { from { opacity:.4; } to { opacity:1; } }
.login-particles { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.lp { position: absolute; border-radius: 50%; animation: lpFloat linear infinite; }
.lp1 { width:3px;height:3px;background:var(--accent2);left:15%;top:20%;opacity:.6;animation-duration:8s;animation-delay:0s; }
.lp2 { width:2px;height:2px;background:var(--teal2);left:75%;top:60%;opacity:.5;animation-duration:11s;animation-delay:-3s; }
.lp3 { width:4px;height:4px;background:var(--accent3);left:55%;top:15%;opacity:.4;animation-duration:14s;animation-delay:-6s; }
.lp4 { width:2px;height:2px;background:var(--teal);left:30%;top:75%;opacity:.5;animation-duration:9s;animation-delay:-2s; }
.lp5 { width:3px;height:3px;background:var(--accent);left:85%;top:30%;opacity:.4;animation-duration:12s;animation-delay:-5s; }
.lp6 { width:2px;height:2px;background:var(--teal2);left:45%;top:85%;opacity:.6;animation-duration:10s;animation-delay:-1s; }
@keyframes lpFloat {
  0%   { transform: translateY(0) scale(1); opacity:.6; }
  50%  { transform: translateY(-40px) scale(1.4); opacity:1; }
  100% { transform: translateY(0) scale(1); opacity:.6; }
}
@keyframes ambientShift {
  from { opacity: 0.8; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.05); }
}
.login-box {
  position: relative; z-index: 2;
  background: rgba(8,8,18,0.78);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 0 0 36px;
  width: 440px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset,
              0 40px 100px rgba(0,0,0,0.85),
              0 0 80px rgba(118,185,0,0.1);
  animation: loginIn 0.7s cubic-bezier(0.34,1.15,0.64,1);
  overflow: hidden;
}
@keyframes loginIn {
  from { opacity:0; transform: translateY(48px) scale(0.93); filter: blur(16px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.login-top-bar {
  height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--teal), var(--accent2), var(--accent));
  background-size: 300% 100%;
  animation: barShimmer 4s ease infinite;
}
@keyframes barShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.login-box > *:not(.login-top-bar):not(.login-logo-wrap) { padding-left: 44px; padding-right: 44px; }
.login-logo-wrap {
  position: relative; width: 92px; height: 92px;
  margin: 36px auto 20px; display: flex; align-items: center; justify-content: center;
}
.login-logo-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--accent); border-right-color: rgba(124,106,247,0.3);
  animation: nvSpin 2.5s linear infinite;
}
.login-logo-ring::before {
  content: ''; position: absolute; inset: 5px; border-radius: 50%;
  border: 1px solid transparent;
  border-bottom-color: var(--teal); border-left-color: rgba(45,212,191,0.3);
  animation: nvSpin 1.8s linear infinite reverse;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(118,185,0,0.1); border: 1px solid rgba(118,185,0,0.22);
  filter: drop-shadow(0 0 20px rgba(118,185,0,0.6));
  animation: logoPulse 4s ease-in-out infinite;
  position: relative; z-index: 1; margin: 0;
}
@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 20px rgba(118,185,0,0.6)); }
  50%      { filter: drop-shadow(0 0 36px rgba(124,106,247,0.95)) drop-shadow(0 0 12px rgba(45,212,191,0.5)); }
}
.login-logo img { width: 44px; height: 44px; object-fit: contain; }
.login-badge {
  text-align: center; font-size: .6rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent2); margin-bottom: 16px; opacity: 0.75;
}
.login-box h1 {
  text-align: center; font-size: 1.75rem; font-weight: 700;
  margin-bottom: 8px; letter-spacing: -0.04em;
  background: linear-gradient(135deg, #fff 0%, var(--accent3) 60%, var(--teal2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-box p {
  text-align: center; color: var(--text2); font-size: .85rem;
  margin-bottom: 28px; line-height: 1.6;
}
.login-footer {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 20px;
  font-size: .68rem; color: var(--text3); letter-spacing: 0.02em;
}
.input-group svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text3); pointer-events: none; width: 16px; height: 16px;
}
/* Cache icône cadenas natif Chrome/Firefox */
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-strong-password-auto-fill-button,
input[type="password"]::-webkit-contacts-auto-fill-button { display: none !important; visibility: hidden; }
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }

.input-group input {
  width: 100%; padding: 13px 16px;
  border-radius: 10px; border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text);
  font-size: .9rem; font-family: var(--font);
  outline: none; transition: var(--trans);
}
.input-group input:focus {
  border-color: var(--accent); background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(118,185,0,0.15);
}
.btn-primary {
  width: 100%; padding: 14px; border-radius: 14px; border: none;
  background: transparent;
  color: #fff; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: var(--trans);
  margin-top: 8px; letter-spacing: 0.02em;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 24px rgba(118,185,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #5a9200 50%, var(--teal) 100%);
  background-size: 200% 200%;
  animation: btnGradient 4s ease infinite;
  transition: var(--trans);
}
@keyframes btnGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.btn-primary span { position: relative; z-index: 1; }
.btn-primary svg  { position: relative; z-index: 1; }
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.12) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  z-index: 1;
}
.btn-primary:hover::after { transform: translateX(100%); }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(118,185,0,0.55), 0 0 60px rgba(118,185,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 4px 16px rgba(118,185,0,0.4); }
.retry-btn {
  display: inline-block; margin-top: 6px; padding: 4px 14px;
  border-radius: 6px; border: 1px solid var(--border2);
  background: var(--bg3); color: var(--accent2);
  font-size: .78rem; font-family: var(--font); cursor: pointer;
  transition: var(--trans);
}
.retry-btn:hover { background: var(--bg4); border-color: var(--accent); color: var(--accent3); }
.login-error {
  color: var(--danger); font-size: .8rem; margin-top: 10px;
  text-align: center; min-height: 18px;
}

/* ══════════════════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════════════════ */
#app {
  display: none; flex: 1; flex-direction: row;
  height: 100dvh; overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */
#sidebar {
  width: 272px; min-width: 272px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 1px 0 0 rgba(255,255,255,0.03);
}
.sidebar-header {
  padding: 20px 14px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(118,185,0,0.04) 0%, transparent 100%);
  color: var(--text);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.brand-icon {
  width: 34px; height: 34px;
  background: transparent;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--trans-spring);
  filter: drop-shadow(0 0 10px rgba(118,185,0,0.7));
}
.brand-icon:hover {
  filter: drop-shadow(0 0 18px rgba(118,185,0,1.0));
  transform: scale(1.1) rotate(-4deg);
}
.brand-icon img { width: 34px; height: 34px; object-fit: contain; }
.brand-text { font-size: .78rem; font-weight: 700; letter-spacing: 0.06em; color: var(--text); text-transform: uppercase; }
.btn-new {
  width: 100%; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--border2);
  background: linear-gradient(135deg, rgba(118,185,0,0.08), rgba(118,185,0,0.04));
  color: var(--text);
  cursor: pointer; font-size: .82rem; font-family: var(--font); font-weight: 500;
  transition: var(--trans);
  display: flex; align-items: center; gap: 9px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.2);
  position: relative; overflow: hidden;
}
.btn-new::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.06) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.btn-new:hover::after { transform: translateX(100%); }
.btn-new:hover {
  border-color: rgba(118,185,0,0.5); color: var(--text);
  background: rgba(118,185,0,0.12);
  box-shadow: 0 4px 20px rgba(118,185,0,0.2), inset 0 1px 0 rgba(255,255,255,0.08);
  transform: translateY(-1px);
}
.btn-new:active { transform: translateY(0); }
.btn-new svg { width: 15px; height: 15px; flex-shrink: 0; }
.conv-list { flex: 1; overflow-y: auto; padding: 8px 6px; content-visibility: auto; contain-intrinsic-size: 0 80px; }
.conv-section-label {
  font-size: .65rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text2); text-transform: uppercase;
  padding: 10px 10px 4px; margin-top: 4px;
}
.conv-item {
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  margin-bottom: 1px; display: flex; align-items: center; gap: 8px;
  transition: var(--trans); position: relative; overflow: hidden;
  border: 1px solid transparent;
}
.conv-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}
.conv-item.active {
  background: linear-gradient(135deg, rgba(118,185,0,0.14), rgba(118,185,0,0.07));
  border-color: rgba(118,185,0,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 12px rgba(118,185,0,0.1);
}
.conv-item.active::before {
  content: ''; position: absolute; left: 0; top: 15%; bottom: 15%;
  width: 2.5px;
  background: linear-gradient(180deg, var(--accent3), var(--accent));
  border-radius: 99px;
  box-shadow: 0 0 8px var(--accent);
}
.conv-item.active::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.03) 50%, transparent 60%);
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  60%,100% { transform: translateX(100%); }
}
.conv-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text3); flex-shrink: 0;
  transition: var(--trans);
}
.conv-dot.fav {
  background: #ffbb00;
  box-shadow: 0 0 6px rgba(255,187,0,0.6), 0 0 12px rgba(255,187,0,0.3);
}
.conv-item.active .conv-dot {
  background: var(--accent2);
  box-shadow: 0 0 6px var(--accent), 0 0 12px rgba(118,185,0,0.4);
}
.conv-title {
  font-size: .82rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1;
  color: var(--text2); transition: var(--trans);
}
.conv-item:hover .conv-title { color: var(--text); }
.conv-item.active .conv-title { color: var(--text); font-weight: 500; }

.conv-menu-wrap {
  position: relative; flex-shrink: 0;
}
.conv-menu-btn {
  opacity: 0; transition: var(--trans);
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  display: flex; align-items: center;
}
.conv-item:hover .conv-menu-btn { opacity: 1; }
.conv-menu-btn:hover {
  background: rgba(255,255,255,0.08); color: var(--text);
}
.conv-menu-btn svg { width: 14px; height: 14px; }
.conv-menu-dropdown {
  display: none; position: absolute; z-index: 9999;
  right: 0; bottom: 100%;
  min-width: 170px; padding: 4px;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.12);
  border-top: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: menuIn 0.15s cubic-bezier(0.34,1.2,0.64,1);
}
.conv-menu-dropdown.open { display: block; }
@keyframes menuIn {
  from { opacity:0; transform: translateY(-6px) scale(0.93); filter: blur(3px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.conv-menu-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; background: none; border: none; color: var(--text2);
  font-size: .82rem; font-family: var(--font); cursor: pointer;
  border-radius: 8px; transition: var(--trans); text-align: left;
}
.conv-menu-dropdown button:hover {
  background: rgba(118,185,0,0.1); color: var(--text);
}
.conv-menu-dropdown button.danger:hover {
  background: rgba(248,113,113,0.12); color: var(--danger);
}
.conv-menu-dropdown button svg {
  width: 14px; height: 14px; flex-shrink: 0;
}
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(118,185,0,0.03) 0%, transparent 100%);
}
.footer-row {
  display: flex; gap: 2px; align-items: center;
  padding: 2px 0;
}
.btn-icon {
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 8px; border-radius: 10px;
  font-size: 1rem; transition: var(--trans);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.btn-icon svg { width: 17px; height: 17px; transition: var(--trans); }
.btn-icon:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  transform: translateY(-1px);
}
.btn-icon:active { transform: translateY(0); box-shadow: none; }
.btn-icon.active { color: var(--accent); background: rgba(118,185,0,0.12); box-shadow: 0 0 12px rgba(118,185,0,0.15); }
.btn-icon[title]:hover::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg5); color: var(--text);
  font-size: .68rem; font-family: var(--font);
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border3);
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 100;
  animation: tooltipIn 0.15s cubic-bezier(0.4,0,0.2,1);
}
@keyframes tooltipIn {
  from { opacity:0; transform: translateX(-50%) translateY(4px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   MAIN
══════════════════════════════════════════════════════════ */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }


#config-bar {
  padding: 10px 20px;
  background: var(--surface6);
  border-bottom: 1px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06),
    0 4px 24px rgba(0,0,0,0.5),
    inset 0 -1px 0 rgba(255,255,255,0.03);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  min-height: 60px;
  position: sticky; top: 0; z-index: 10;
}
.light #config-bar {
  box-shadow:
    0 1px 0 rgba(0,0,0,0.03),
    0 4px 16px rgba(0,0,0,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.02);
}
#config-bar::before {
  content: '';
  position: absolute; inset-inline: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--accent-rgb),0.35) 30%,
    rgba(var(--accent-rgb),0.2) 70%,
    transparent 100%);
  pointer-events: none;
}
.select-wrap { display: flex; flex-direction: column; gap: 3px; }
.select-wrap label {
  font-size: .65rem; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em;
}
.custom-select {
  position: relative; display: inline-block;
}
.custom-select select {
  padding: 7px 32px 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: .82rem; font-family: var(--font);
  cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  transition: var(--trans);
  min-width: 150px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.2);
}
.custom-select select:hover {
  border-color: rgba(118,185,0,0.45);
  background: rgba(118,185,0,0.07);
  box-shadow: 0 0 0 1px rgba(118,185,0,0.15), inset 0 1px 0 rgba(255,255,255,0.07);
}
.custom-select select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(118,185,0,0.15), inset 0 1px 0 rgba(255,255,255,0.07);
}
.custom-select::after {
  content: '';
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text3);
  pointer-events: none;
  transition: var(--trans);
}
.custom-select:hover::after { border-top-color: var(--accent2); }

.custom-select select { display: none; }
.cs-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04);
  color: var(--text); font-size: .82rem; font-family: var(--font);
  cursor: pointer; min-width: 150px; gap: 8px;
  transition: var(--trans);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.2);
  user-select: none;
}
.cs-trigger:hover {
  border-color: rgba(118,185,0,0.45);
  background: rgba(118,185,0,0.07);
  box-shadow: 0 0 0 1px rgba(118,185,0,0.15), inset 0 1px 0 rgba(255,255,255,0.07);
}
.cs-trigger svg {
  width: 12px; height: 12px; flex-shrink: 0; color: var(--text3);
  transition: transform 0.2s ease;
}
.cs-trigger.open { border-color: rgba(118,185,0,0.5); background: rgba(118,185,0,0.08); }
.cs-trigger.open svg { transform: rotate(180deg); color: var(--accent2); }
.cs-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px; padding: 6px;
  z-index: 500;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: csDropIn 0.18s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 260px; overflow-y: auto;
}
@keyframes csDropIn {
  from { opacity:0; transform: translateY(-8px) scale(0.97); filter: blur(4px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.cs-option {
  padding: 8px 12px; border-radius: 8px; font-size: .82rem;
  color: var(--text2); cursor: pointer; transition: var(--trans);
  white-space: nowrap;
}
.cs-option:hover { background: rgba(118,185,0,0.1); color: var(--text); }
.cs-option.selected {
  background: rgba(118,185,0,0.15); color: var(--accent2);
  font-weight: 500;
}
.cs-option.selected::before {
  content: '✓ '; font-size: .7rem; opacity: 0.7;
}
#local-url-wrap { display: none; align-items: flex-end; gap: 8px; }
#local-url-wrap input {
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04); color: var(--text); font-size: .82rem;
  font-family: var(--font); outline: none; width: 190px; transition: var(--trans);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
#local-url-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(118,185,0,0.15), inset 0 1px 0 rgba(255,255,255,0.07);
}
.btn-detect {
  padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04); color: var(--text2); font-size: .78rem;
  font-family: var(--font); cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.btn-detect:hover {
  border-color: rgba(118,185,0,0.4); color: var(--teal);
  background: rgba(118,185,0,0.07);
  box-shadow: 0 0 0 1px rgba(118,185,0,0.1), 0 4px 14px rgba(118,185,0,0.12);
  transform: translateY(-1px);
}
.btn-detect:active { transform: translateY(0); }
.btn-detect svg { width: 13px; height: 13px; }


#config-dropdown {
  display: none;
  position: fixed; z-index: 9999;
  width: 280px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  animation: cdPopIn 0.15s cubic-bezier(0.34,1.2,0.64,1);
}
.dark #config-dropdown,
#config-dropdown.dark {
  background: #1a1a2a;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}
#config-dropdown.open { display: block; }
@keyframes cdPopIn {
  from { opacity:0; transform: translateY(6px) scale(0.95); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.cd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13.5px;
  color: #2d2d2d; line-height: 1.3;
  transition: background 0.12s ease;
}
.dark .cd-item { color: #d4d4e0; }
.cd-item:hover { background: #f2f2f5; }
.dark .cd-item:hover { background: rgba(255,255,255,0.06); }
.cd-item svg {
  width: 18px; height: 18px; flex-shrink: 0;
  color: #8a8a92; stroke-width: 1.8;
}
.dark .cd-item svg { color: #7878a0; }
.cd-item span { flex: 1; }
.cd-item .cd-right {
  flex: none; font-size: 12px; color: #9a9aa2;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
}
.cd-chevron { color: #b0b0b8 !important; flex: none !important; width: 16px !important; }
.cd-check { display: none; color: #3b82f6 !important; stroke-width: 2.5 !important; flex: none !important; width: 18px !important; }
.dark .cd-check { color: #60a5fa !important; }
.cd-toggle-item.active .cd-check { display: block; }

/* Thinking mode toggle switch */
.cd-toggle-wrap { cursor: pointer; display: flex; align-items: center; flex-shrink: 0; margin-left: auto; }
.cd-toggle-wrap input { display: none; }
.cd-toggle-track {
  width: 34px; height: 18px; border-radius: 10px;
  background: var(--bg4); border: 1px solid var(--border2);
  position: relative; transition: all .2s ease; cursor: pointer;
}
.cd-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text3); transition: all .2s ease;
}
.cd-toggle-wrap input:checked + .cd-toggle-track {
  background: rgba(var(--accent-rgb),0.2);
  border-color: var(--accent);
}
.cd-toggle-wrap input:checked + .cd-toggle-track::after {
  background: var(--accent);
  transform: translateX(16px);
  box-shadow: 0 0 8px rgba(var(--accent-rgb),0.6);
}
#cd-thinking-item.active { color: var(--accent2); }

/* Submenu flyout */
.cd-sub-wrap { position: relative; }
.cd-submenu {
  display: none;
  position: fixed; z-index: 10000;
  min-width: 190px;
  max-height: 400px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  animation: cdSubIn 0.12s cubic-bezier(0.34,1.2,0.64,1);
}
.dark .cd-submenu { background: #1a1a2a; border-color: rgba(255,255,255,0.10); box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.cd-submenu.open { display: block; }
@keyframes cdSubIn { from { opacity:0; transform: translateX(-4px) scale(0.95); } to { opacity:1; transform: none; } }
.cd-submenu .cs-option {
  padding: 6px 10px; border-radius: 6px; font-size: 13px;
  color: #2d2d2d; cursor: pointer; transition: background 0.1s;
}
.dark .cd-submenu .cs-option { color: #d4d4e0; }
.cd-submenu .cs-option:hover { background: #f2f2f5; }
.dark .cd-submenu .cs-option:hover { background: rgba(255,255,255,0.06); }
.cd-submenu .cs-option[data-selected] { color: #3b82f6; font-weight: 500; }
.dark .cd-submenu .cs-option[data-selected] { color: #60a5fa; }

.cd-sep { height: 1px; margin: 4px 8px; background: #e8e8ec; }
.dark .cd-sep { background: rgba(255,255,255,0.06); }


#config-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border2); background: var(--bg4);
  color: var(--text2); font-size: 18px; line-height: 1;
  cursor: pointer; flex-shrink: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; margin-bottom: 0;
  font-family: var(--font); font-weight: 400;
}
#config-btn:hover { background: var(--bg5); color: var(--text); }
#config-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#credit-badge {
  margin-left: auto;
  font-size: .75rem; color: var(--teal2);
  background: rgba(118,185,0,0.07);
  padding: 7px 14px; border-radius: 12px;
  border: 1px solid rgba(118,185,0,0.18);
  cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; gap: 7px; font-weight: 500;
  box-shadow: 0 2px 12px rgba(118,185,0,0.1), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: badgePulse 4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%,100% { box-shadow: 0 2px 12px rgba(118,185,0,0.1), inset 0 1px 0 rgba(255,255,255,0.06); }
  50%      { box-shadow: 0 2px 20px rgba(118,185,0,0.22), inset 0 1px 0 rgba(255,255,255,0.08); }
}
#credit-badge:hover {
  background: rgba(118,185,0,0.13);
  border-color: var(--teal);
  box-shadow: 0 4px 20px rgba(118,185,0,0.25), 0 0 0 1px rgba(118,185,0,0.15);
  transform: translateY(-1px);
  animation: none;
}
#credit-badge:active { transform: translateY(0); }
#credit-badge svg { width: 14px; height: 14px; }


#chat-area {
  flex: 1; overflow-y: auto;
  padding: 32px 0 16px;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.92) 100%),
    var(--chat-bg-img) center/cover no-repeat;
}
.light #chat-area {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(var(--accent-rgb),0.20) 0%, rgba(255,255,255,0.85) 55%, #ffffff 100%);
}
#chat-area > iframe {
  max-width: none !important;
}
#chat-area > * {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}


.welcome {
  align-self: center; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  margin: auto; padding: 40px 20px;
  animation: fadeUp 0.5s cubic-bezier(0.4,0,0.2,1);
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(24px) scale(0.97); filter: blur(6px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.welcome-orb {
  width: 88px; height: 88px;
  background: transparent;
  border-radius: 24px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 24px rgba(118,185,0,0.6)) drop-shadow(0 0 8px rgba(118,185,0,0.3));
  animation: pulse 3s ease-in-out infinite;
}
.welcome-orb img { width: 80px; height: 80px; object-fit: contain; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 40px rgba(118,185,0,0.15); }
  50%      { box-shadow: 0 0 60px rgba(118,185,0,0.3); }
}
.welcome h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.02em; color: var(--text); }
.welcome p  { font-size: .9rem; color: var(--text); max-width: 360px; line-height: 1.6; }
.welcome-pills {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 24px;
}
.welcome-pill {
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border2); background: var(--bg3);
  font-size: .78rem; color: var(--text2); cursor: pointer;
  transition: var(--trans);
}
.welcome-pill:hover { border-color: var(--accent); color: var(--accent); background: rgba(118,185,0,0.06); }


.msg-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; width: 100%; max-width: min(960px, 100%); margin-left: auto; margin-right: auto; }
.msg {
  display: flex; gap: 10px;
  max-width: 100%;
  animation: msgIn 0.3s cubic-bezier(0.34,1.1,0.64,1);
  padding: 2px 0;
}
@keyframes msgIn {
  from { opacity:0; transform: translateY(16px) scale(0.97); filter: blur(6px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.msg.user  { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }
.msg.assistant { align-self: flex-start; max-width: 85%; }

.avatar {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0; font-weight: 600;
  align-self: flex-end; margin-bottom: 2px;
  position: relative;
}
.msg.user .avatar {
  background: linear-gradient(135deg, var(--accent), #3d7a00);
  color: #fff;
  box-shadow: 0 2px 16px rgba(118,185,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.msg.assistant .avatar {
  background: linear-gradient(135deg, rgba(118,185,0,0.18), rgba(118,185,0,0.08));
  border: 1px solid rgba(118,185,0,0.28);
  color: var(--teal);
  box-shadow: 0 2px 12px rgba(118,185,0,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
}
.avatar svg { width: 15px; height: 15px; }

.bubble {
  padding: 14px 20px; line-height: 1.75; font-size: .95rem;
  position: relative; max-width: calc(100% - 44px);
  transition: box-shadow 0.2s ease;
}
.msg.user .bubble {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.20), rgba(var(--accent-rgb),0.08));
  border: 1px solid rgba(var(--accent-rgb),0.25);
  border-top-color: rgba(var(--accent-rgb),0.35);
  border-radius: var(--r) var(--r) 4px var(--r);
  color: var(--text);
  box-shadow: 0 4px 24px var(--user-glow), inset 0 1px 0 rgba(255,255,255,0.07);
}
.msg.user .bubble:hover {
  box-shadow: 0 6px 32px rgba(var(--accent-rgb),0.28), inset 0 1px 0 rgba(255,255,255,0.09);
}
.msg.assistant .bubble {
  background: transparent;
  border: none;
  border-radius: var(--r) var(--r) var(--r) 4px;
  box-shadow: none;
  color: var(--text);
}
.msg.assistant .bubble:hover {
  /* transparent - no hover effect */
}

/* Markdown */
.bubble h1,.bubble h2,.bubble h3,.bubble h4 {
  margin: .9em 0 .4em; color: var(--accent3); font-weight: 600; letter-spacing: -0.01em;
}
.bubble h1 { font-size: 1.2rem; } .bubble h2 { font-size: 1.05rem; } .bubble h3 { font-size: .95rem; }
.bubble p  { margin: .4em 0; }
.bubble ul,.bubble ol { margin: .4em 0 .4em 1.4em; }
.bubble li { margin: .25em 0; }
.bubble pre {
  background: rgba(5,5,12,0.9);
  border: 1px solid var(--border2);
  border-top: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px; padding: 16px; overflow-x: auto;
  margin: .7em 0; position: relative;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
}
.bubble code {
  font-family: var(--mono); font-size: .82rem;
}
.bubble :not(pre) > code {
  background: rgba(118,185,0,0.13); color: var(--accent3);
  padding: 2px 7px; border-radius: 5px; font-size: .82rem;
  border: 1px solid rgba(118,185,0,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.bubble blockquote {
  border-left: 2px solid var(--accent); padding-left: 14px;
  color: var(--text2); margin: .5em 0; font-style: italic;
  background: rgba(118,185,0,0.04); border-radius: 0 8px 8px 0;
  padding: 8px 14px;
}
.bubble table { border-collapse: collapse; width: 100%; margin: .7em 0; font-size: .85rem; }
.bubble th,.bubble td { border: 1px solid var(--border2); padding: 7px 11px; }
.bubble th {
  background: rgba(118,185,0,0.08); color: var(--accent3);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.bubble tr:hover td { background: rgba(255,255,255,0.02); }
.bubble a { color: var(--teal2); text-decoration: none; border-bottom: 1px solid rgba(105,255,158,0.3); transition: var(--trans); }
.bubble a:hover { color: var(--teal); border-color: var(--teal2); }
.bubble strong { color: var(--text); font-weight: 600; }
.bubble hr { border: none; border-top: 1px solid var(--border2); margin: 1em 0; }

/* Copy button on code blocks */
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border2);
  color: var(--text3); font-size: .72rem; font-family: var(--font);
  padding: 4px 9px; border-radius: 6px; cursor: pointer;
  opacity: 0; transition: var(--trans); display: flex; align-items: center; gap: 4px;
}
.copy-btn svg { width: 11px; height: 11px; }
.bubble pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover {
  color: var(--text); border-color: var(--accent);
  background: rgba(118,185,0,0.12);
  box-shadow: 0 2px 8px rgba(118,185,0,0.2);
}


.nv-spinner {
  position: relative;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  margin: 6px 0;
}
.nv-spinner-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(124,106,247,0.3);
  animation: nvSpin 1.1s cubic-bezier(0.4,0,0.2,1) infinite;
  box-shadow: 0 0 12px rgba(124,106,247,0.4), inset 0 0 8px rgba(124,106,247,0.1);
}
.nv-spinner-ring::before {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-bottom-color: var(--teal);
  border-left-color: rgba(45,212,191,0.3);
  animation: nvSpin 0.8s cubic-bezier(0.4,0,0.2,1) infinite reverse;
}
.nv-spinner-logo {
  width: 22px; height: 22px;
  color: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  animation: nvPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(124,106,247,0.7));
}
.nv-spinner-logo svg { width: 18px; height: 18px; }
@keyframes nvSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes nvPulse {
  0%,100% { opacity: 0.7; transform: scale(0.92); filter: drop-shadow(0 0 4px rgba(124,106,247,0.5)); }
  50%      { opacity: 1;   transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(124,106,247,0.9)); }
}

/* Typing indicator */
.typing-dots {
  display: inline-flex; gap: 5px; align-items: center; padding: 4px 0;
}
.typing-dots span {
  display: inline-block; width: 6px; height: 6px;
  background: var(--teal); border-radius: 50%;
  animation: dot 1.4s infinite cubic-bezier(0.4,0,0.6,1);
  box-shadow: 0 0 6px rgba(118,185,0,0.5);
}
.typing-dots span:nth-child(2) { animation-delay: .16s; }
.typing-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes dot {
  0%,60%,100% { transform: scale(.7); opacity: .3; box-shadow: 0 0 4px rgba(118,185,0,0.3); }
  30%          { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px rgba(118,185,0,0.7); }
}


#input-bar {
  padding: 14px 20px 16px;
  background: var(--surface3);
  border-top: 1px solid transparent;
  box-shadow:
    0 -1px 0 rgba(255,255,255,0.06),
    0 -4px 24px rgba(0,0,0,0.4);
  position: relative;
}
.light #input-bar {
  box-shadow:
    0 -1px 0 rgba(0,0,0,0.03),
    0 -4px 16px rgba(0,0,0,0.05);
}
#input-bar::before {
  content: '';
  position: absolute; inset-inline: 0; top: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(118,185,0,0.3) 30%,
    rgba(118,185,0,0.18) 70%,
    transparent 100%);
  pointer-events: none;
}
.input-wrapper {
  display: flex; gap: 8px; align-items: flex-end;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  border-top-color: rgba(255,255,255,0.09);
  border-radius: var(--r2);
  padding: 10px 10px 10px 16px;
  transition: var(--trans);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 4px 20px rgba(0,0,0,0.25);
}
.input-wrapper:focus-within {
  border-color: rgba(118,185,0,0.45);
  border-top-color: rgba(118,185,0,0.6);
  background: rgba(118,185,0,0.05);
  box-shadow:
    0 0 0 3px rgba(118,185,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 4px 24px rgba(118,185,0,0.12);
}
#user-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: .9rem; font-family: var(--font);
  resize: none; max-height: 120px; min-height: 44px;
  line-height: 1.5; padding: 3px 0;
}
#user-input::placeholder { color: var(--text3); }
#send-btn {
  width: 38px; height: 38px; border-radius: 12px; border: none;
  background: var(--accent);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans-spring); flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(118,185,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative; overflow: hidden;
}
#send-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
  opacity: 0; transition: var(--trans);
}
#send-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
#send-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 32px rgba(118,185,0,0.65), inset 0 1px 0 rgba(255,255,255,0.25);
}
#send-btn:hover::before { opacity: 1; }
#send-btn:hover::after { transform: translateX(100%); }
#send-btn:active { transform: translateY(0) scale(0.97); box-shadow: 0 2px 8px rgba(118,185,0,0.4); }
#send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
#send-btn svg { width: 16px; height: 16px; position: relative; }
.input-hint {
  text-align: center; font-size: .7rem; color: var(--text3);
  margin-top: 8px; letter-spacing: 0.01em;
}


.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; animation: overlayIn 0.2s ease; }
@keyframes overlayIn {
  from { opacity:0; }
  to   { opacity:1; }
}
.modal {
  background: var(--surface5);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--r2); padding: 32px 36px; min-width: 340px;
  box-shadow: var(--shadow2), inset 0 1px 0 rgba(255,255,255,0.07);
  animation: modalIn 0.3s cubic-bezier(0.34,1.2,0.64,1);
  position: relative; overflow: hidden;
}
.modal::before {
  content: '';
  position: absolute; inset-inline: 0; top: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(118,185,0,0.4) 40%,
    rgba(118,185,0,0.25) 70%,
    transparent 100%);
  pointer-events: none;
}
@keyframes modalIn {
  from { opacity:0; transform: scale(0.93) translateY(16px); filter: blur(8px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.modal-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.modal-header svg { width: 18px; height: 18px; color: var(--teal); }
.modal h3 { font-size: 1rem; font-weight: 600; }
.credit-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: .85rem; transition: var(--trans);
}
.credit-row:last-child { border-bottom: none; }
.credit-row:hover { padding-left: 4px; }
.credit-label { color: var(--text2); }
.credit-val {
  font-weight: 600; color: var(--text); font-family: var(--mono); font-size: .82rem;
  background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--border);
}
.close-btn {
  margin-top: 20px; width: 100%; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.03); color: var(--text2);
  cursor: pointer; font-family: var(--font); font-size: .85rem;
  transition: var(--trans);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.close-btn:hover {
  background: rgba(255,255,255,0.07); color: var(--text);
  border-color: var(--border3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.07);
}


.modal-settings {
  width: min(700px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 60px));
  padding: 20px 0 0 0 !important; display: flex; flex-direction: column;
}
.modal-settings .modal-header {
  padding: 0 24px 16px; margin: 0; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-settings .modal-header h3 { flex: 1; }
.modal-close {
  background: none; border: none; color: var(--text3); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex; align-items: center;
  transition: var(--trans); margin-left: auto;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.settings-body {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}
.settings-nav {
  width: 160px; flex-shrink: 0; padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.s-nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 8px; border: none;
  background: none; color: var(--text2); font-size: .8rem;
  font-family: var(--font); cursor: pointer; transition: var(--trans);
  text-align: left;
}
.s-nav-item:hover { background: var(--bg3); color: var(--text); }
.s-nav-item.active { background: rgba(var(--accent-rgb),0.1); color: var(--accent2); font-weight: 500; }
.s-nav-item svg { flex-shrink: 0; }
.settings-content {
  flex: 1; padding: 16px 20px; overflow-y: auto;
}
.s-section { display: none; }
.s-section.active { display: block; }
.s-section h4 {
  font-size: .95rem; font-weight: 600; margin-bottom: 14px;
  color: var(--text);
}
.s-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px;
}
.s-card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.s-card-row strong { font-size: .85rem; font-weight: 500; }
.s-desc { font-size: .75rem; color: var(--text3); margin-top: 3px; line-height: 1.4; }
.s-badge {
  font-size: .75rem; color: var(--accent2);
  background: rgba(var(--accent-rgb),0.08); padding: 4px 10px;
  border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.s-btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--bg4); color: var(--text2); font-size: .78rem;
  font-family: var(--font); cursor: pointer; transition: var(--trans);
  white-space: nowrap; flex-shrink: 0;
}
.s-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb),0.06); }
.s-btn-danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(248,113,113,0.06); }
.s-local-status { font-size: .78rem; margin-left: 10px; transition: var(--trans); }
.s-local-status.ok { color: #22c55e; }
.s-local-status.err { color: #ef4444; }
.s-shortcut-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: .82rem;
}
.s-shortcut-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.s-shortcut-row kbd {
  font-family: var(--mono); font-size: .72rem; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border2);
  padding: 3px 8px; border-radius: 6px;
}
.s-toggle { cursor: pointer; display: flex; align-items: center; flex-shrink: 0; }
.s-toggle input { display: none; }
.s-toggle-track {
  width: 36px; height: 20px; border-radius: 12px;
  background: var(--bg4); border: 1px solid var(--border2);
  position: relative; transition: var(--trans);
}
.s-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text3); transition: var(--trans);
}
.s-toggle input:checked + .s-toggle-track { background: rgba(var(--accent-rgb),0.2); border-color: var(--accent); }
.s-toggle input:checked + .s-toggle-track::after { background: var(--accent); transform: translateX(16px); box-shadow: 0 0 6px rgba(var(--accent-rgb),0.5); }
#s-providers-list .s-provider-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: var(--trans);
}
#s-providers-list .s-provider-item:hover { background: var(--bg3); }
#s-providers-list .s-provider-item input[type=checkbox] { accent-color: var(--accent); }
#s-providers-list .s-provider-item label { font-size: .82rem; cursor: pointer; }


.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px; padding: 11px 16px;
  font-size: .83rem; color: var(--text2);
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: toastIn 0.3s cubic-bezier(0.34,1.2,0.64,1);
}
.toast svg { width: 15px; height: 15px; color: var(--success); filter: drop-shadow(0 0 6px rgba(74,222,128,0.5)); }
@keyframes toastIn {
  from { opacity:0; transform: translateY(16px) scale(0.95); filter: blur(4px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}


.token-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px 10px; font-size: .7rem; color: var(--text3);
}
.token-pill {
  background: var(--bg3); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 20px; display: flex; align-items: center; gap: 5px;
}
.token-pill svg { width: 11px; height: 11px; }


.msg-actions {
  display: flex; gap: 2px; align-items: center;
  margin-top: 4px; padding-left: 2px;
}
.msg-action-btn {
  background: none; border: none;
  border-radius: 6px; padding: 5px 7px;
  color: var(--text3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.msg-action-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.msg-action-btn:hover { background: var(--bg4); color: var(--text2); }
.msg-action-btn.liked  { color: var(--success); }
.msg-action-btn.disliked { color: var(--danger); }
.msg-action-btn.active { color: var(--accent2); }
.msg-bubble-wrap { display: flex; flex-direction: column; max-width: calc(100% - 44px); }


.model-attribution {
  font-size: .65rem; color: var(--text3); opacity: .55;
  padding: 4px 2px 0; margin-top: 0;
  line-height: 1.2;
  font-family: var(--mono);
}


.hljs { background: transparent !important; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE MOBILE
══════════════════════════════════════════════════════════ */


@media (max-width: 900px) {
  #sidebar { width: 240px; min-width: 240px; }
  .custom-select select { min-width: 120px; }
  #config-bar { gap: 8px; padding: 8px 12px; }
}


@media (max-width: 680px) {
  /* Layout & overflow protection */
  html, body { overflow-x: hidden; width: 100%; max-width: 100%; }
  body { height: 100dvh; }
  #app { flex-direction: row; width: 100%; max-width: 100vw; }
  #main { width: 100%; min-height: 0; flex: 1; max-width: 100vw; overflow-x: hidden; }
  #chat-area { max-width: 100vw; }
  #chat-area * { max-width: 100vw; }

  /* Sidebar drawer */
  #sidebar { display: none; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; width: 280px !important; min-width: 280px !important; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); box-shadow: 4px 0 32px rgba(0,0,0,0.5); overflow-y:auto }
  #sidebar.open { display: flex; transform: translateX(0); }
  #sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 99; background: rgba(0,0,0,0.55); }
  #sidebar-overlay.open { display: block; }
  body.sb-open { overflow: hidden }
  #burger-btn { display: flex !important; }

  /* Config bar */
  #config-bar { padding: 6px 10px; gap: 6px; flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; min-height: 48px; align-items: center; }
  #config-bar .select-wrap label { display: none; }
  #config-bar .select-wrap { gap: 0; }
  #config-bar::-webkit-scrollbar { display: none; }
  .custom-select select { min-width: 100px !important; font-size: .78rem; padding: 6px 24px 6px 8px; }
  #credit-badge { font-size: .68rem; padding: 4px 8px; white-space: nowrap; flex-shrink: 0; }
  #theme-picker-wrap { flex-shrink: 0; }

  /* Chat area full width */
  #chat-area {
    align-items: stretch !important;
    padding: 8px 6px 4px;
    gap: 0;
    position: relative;
  }
  #chat-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://img.magnific.com/vecteurs-libre/modele-sans-couture-contact-social-vecteur-blanc-bleu_1284-41919.jpg?semt=ais_hybrid&w=740&q=80') center/cover no-repeat;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
  }
  #chat-area > * {
    position: relative;
    z-index: 1;
  }
  #chat-area > * {
    max-width: 100% !important;
    padding-left: 4px;
    padding-right: 4px;
    box-sizing: border-box;
  }

  /* WhatsApp-style messages */
  .msg-group {
    max-width: 100% !important;
    align-self: stretch;
    margin-bottom: 2px;
    gap: 1px;
    width: 100%;
  }
  .msg {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    margin-bottom: 1px;
    clear: both;
  }
  .msg.user {
    justify-content: flex-end !important;
    flex-direction: row !important;
  }
  .msg.assistant {
    justify-content: flex-start !important;
    flex-direction: row !important;
  }
  .msg .avatar { display: none; }

  /* Bubble wrapper */
  .msg-bubble-wrap {
    min-width: 0;
    width: auto !important;
    flex-shrink: 0 !important;
  }
  .msg.user .msg-bubble-wrap {
    margin-left: auto !important;
    max-width: 75% !important;
  }
  .msg.assistant .msg-bubble-wrap {
    max-width: 92% !important;
    width: 100% !important;
  }

  /* WhatsApp bubbles */
  .bubble {
    max-width: 100% !important;
    word-break: break-word;
    padding: 8px 10px !important;
    font-size: .9rem !important;
    line-height: 1.45 !important;
    position: relative;
    display: block;
  }
  .msg.user .bubble {
    width: fit-content !important;
  }
  .msg.assistant .bubble {
    width: 100% !important;
  }
  .msg.user .bubble {
    border-radius: 10px 3px 10px 10px !important;
    background: var(--accent) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: none !important;
  }
  .msg.assistant .bubble {
    border-radius: 3px 10px 10px 10px !important;
    background: transparent !important;
    border: none !important;
    color: var(--text) !important;
    box-shadow: none !important;
  }
  .bubble p { margin: .1em 0 !important; }
  .bubble pre { max-width: 100% !important; overflow-x: auto; font-size: .78rem !important; border-radius: 6px !important; padding: 8px !important; }
  .bubble code { font-size: .78rem !important; }

  /* Action buttons - smaller */
  .msg-actions { gap: 2px; margin-top: 2px; }
  .msg-action-btn { width: 26px; height: 26px; padding: 2px; }
  .msg-action-btn svg { width: 12px; height: 12px; }
  .msg.assistant .bubble { width: 100%; box-sizing: border-box; }
  .bubble { font-size: .88rem; padding: 10px 13px; width: 100%; box-sizing: border-box; }
  .bubble pre { padding: 10px; font-size: .78rem; overflow-x: auto; max-width: 100%; }
  .welcome h2 { font-size: 1.3rem; }
  .welcome-orb { width: 56px; height: 56px; font-size: 22px; }
  .welcome-pills { flex-wrap: nowrap !important; overflow-x: auto; justify-content: flex-start !important; padding-bottom: 4px; scrollbar-width: none; gap: 6px; }
  .welcome-pills::-webkit-scrollbar { display: none; }
  .welcome-pill { font-size: .72rem; padding: 5px 10px; flex-shrink: 0; }

  /* Input bar WhatsApp-style */
  #input-bar { padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); }
  .input-wrapper {
    border-radius: 24px;
    padding: 4px 4px 4px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
  }
  #user-input { flex: 1; font-size: .9rem; min-height: 24px; max-height: 100px; padding: 4px 0; }
  #config-btn { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
  #send-btn { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
  .input-hint { font-size: .65rem; display: none; }

  /* Config dropdown mobile */
  #config-dropdown {
    left: 10px !important; right: 10px !important;
    min-width: unset; max-width: unset;
    width: auto; max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
  .modal-settings {
    max-height: calc(100vh - 20px);
    width: 100%;
    min-width: 0;
  }
  .modal-settings .modal-header {
    padding-left: 20px; padding-right: 20px;
  }
  .settings-nav { width: 120px; padding: 10px 4px; }
  .s-nav-item { font-size: .75rem; padding: 6px 8px; }
  .settings-body { flex-direction: column; min-height: 0; }
  .settings-content { overflow-x: hidden; overflow-y: auto; min-height: 0; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 10px; gap: 4px; flex-shrink: 0; }
  .s-nav-item { white-space: nowrap; flex-shrink: 0; }
  .modal-settings .modal-header { padding: 0 16px 14px; }
  .s-card-row { flex-wrap: wrap; gap: 8px; }
  .s-card-row .s-btn { flex-shrink: 0; }
  .s-account-card { gap: 10px; }
  .s-account-avatar { width: 36px; height: 36px; font-size: .95rem; }
  .cp-credits { padding: 6px 10px; font-size: .7rem; }
  .cp-actions { flex-wrap: wrap; gap: 6px; }
  .cp-switch-label { font-size: .72rem; }
  .cp-file-btn { font-size: .7rem; padding: 5px 10px; }
  /* Mobile: always show 3-dot menu */
  .conv-menu-btn { opacity: 1; }

  /* Modal bottom-sheet */
  .modal-overlay { align-items: flex-end; }
  .modal { border-radius: var(--r2) var(--r2) 0 0; margin: 0; width: 100%; padding: 0; }
  .modal-settings { border-radius: var(--r2) var(--r2) 0 0; }

  /* Toast */
  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); font-size: .8rem; }

  /* Auth / login split screen */
  .split-left { width: 100%; min-width: unset; }
  .split-right { display: none; }
  #login-screen { flex-direction: column; }
  #auth-screen { flex-direction: column; }
  .split-form-wrap { padding: 0 20px; }
}


@media (max-width: 380px) {
  .custom-select select { min-width: 95px; font-size: .75rem; }
  #config-bar { gap: 6px; }
  .bubble { padding: 9px 11px; font-size: .84rem; }
  .modal { padding: 0 14px; }
  .modal-settings {
    max-height: calc(100vh - 10px);
    padding: 14px 0 0 0 !important;
    width: 100%;
  }
  .modal-settings .modal-header { padding: 0 12px 12px; }
  .modal-settings .modal-header h3 { font-size: .9rem; }
  .settings-body { max-height: calc(100vh - 120px); }
  .settings-content { padding: 12px 12px; }
  .s-card { padding: 10px 12px; }
  .s-stats-grid { grid-template-columns: repeat(2,1fr); }
  .s-mode-btn { padding: 6px 8px; font-size: .72rem; }
  .palette-grid { gap: 4px; }
  .palette-item { padding: 6px 8px; font-size: .75rem; gap: 6px; }
  .welcome-orb { width: 48px; height: 48px; }
  .welcome-orb img { width: 40px; height: 40px; }
  .welcome h2 { font-size: 1.1rem; }
  #input-bar { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .input-wrapper { padding: 8px 8px 8px 12px; }
  .sf-eye { right: 4px; }
}


@media (max-width: 680px) {
  #theme-palette { right: 0; min-width: 180px; }
}


#theme-picker-wrap {
  position: relative;
}
#theme-picker-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text2);
  font-size: .75rem; font-family: var(--font); font-weight: 500;
  cursor: pointer; transition: var(--trans);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.04);
}
#theme-picker-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(118,185,0,0.08);
  box-shadow: 0 4px 16px rgba(118,185,0,0.15);
  transform: translateY(-1px);
}
#theme-picker-btn:active { transform: translateY(0); }
#theme-picker-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.theme-dot-preview {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent);
  transition: background 0.3s, box-shadow 0.3s;
}
#theme-palette {
  display: none;
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--surface7);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 14px 16px;
  z-index: 200;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.07);
  min-width: 200px;
  animation: paletteIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
#theme-palette.open { display: block; }
@keyframes paletteIn {
  from { opacity:0; transform: translateY(-10px) scale(0.94); filter: blur(4px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.palette-title {
  font-size: .65rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text3); text-transform: uppercase; margin-bottom: 10px;
}
.palette-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.palette-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 9px;
  cursor: pointer; transition: var(--trans);
  border: 1px solid transparent;
  font-size: .8rem; color: var(--text2);
}
.palette-item:hover { background: var(--bg3); color: var(--text); }
.palette-item.active { border-color: var(--accent); background: rgba(var(--accent-rgb),0.08); color: var(--text); }
.palette-swatch {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  position: relative;
}
.palette-swatch::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: 50%; border: 2px solid transparent;
  transition: var(--trans);
}
.palette-item.active .palette-swatch::after { border-color: var(--accent); }


@media (hover: none) and (pointer: coarse) {
  .btn-icon, .btn-new, .conv-item, .welcome-pill,
  .cd-item, .cs-option, .s-nav-item, .s-mode-btn,
  .palette-item, #send-btn, #config-btn,
  .cs-trigger, .btn-detect, .sf-btn,
  .modal-close, .close-btn, .retry-btn,
  input, select, textarea, button, label, a { touch-action: manipulation; }
  .btn-icon { padding: 10px; }
  .btn-new  { padding: 11px 12px; }
  .conv-item { padding: 11px 10px; }
  .conv-menu-btn { opacity: 1; padding: 6px 8px; }
  .welcome-pill { padding: 9px 14px; }
  #send-btn { width: 42px; height: 42px; }
  .custom-select select { padding: 9px 28px 9px 10px; }
}


#auth-screen {
  background: var(--overlay-bg) url('/static/img/back.jpg') center/cover no-repeat;
}
#auth-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: var(--auth-overlay);
  z-index: 0;
}
#auth-screen > * { position: relative; z-index: 1; }

/* ══ SPLIT LOGIN ══════════════════════════════════════════════ */
#login-screen {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  flex-direction: row;
}
#login-screen.visible { display: flex; }
#auth-screen { display: none; flex-direction: row; }
#auth-screen.visible { display: flex !important; }

.split-left {
  width: 480px; min-width: 380px; flex-shrink: 0;
  background: var(--split-bg);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 2;
  box-shadow: 4px 0 60px rgba(0,0,0,0.8);
  overflow: hidden;
}
.split-left::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(118,185,0,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(118,185,0,0.04) 0%, transparent 70%);
}
.split-left::after {
  content: '';
  position: absolute; top: 0; right: 0; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(118,185,0,0.4) 30%, rgba(118,185,0,0.6) 50%, rgba(118,185,0,0.4) 70%, transparent);
}

.split-right {
  flex: 1; position: relative; overflow: hidden;
}
.split-right-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transform: scale(1.05);
  animation: imgBreath 12s ease-in-out infinite alternate;
  filter: brightness(0.25) saturate(0.6);
}
@keyframes imgBreath {
  from { transform: scale(1.05); }
  to   { transform: scale(1.12); }
}
.split-right-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(270deg, transparent 40%, rgba(6,6,15,0.85) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.5) 100%);
}
.split-right-text {
  position: absolute; bottom: 60px; left: 60px; z-index: 2;
}
.srt-badge {
  font-size: .6rem; font-weight: 700; letter-spacing: .2em;
  color: var(--accent); opacity: .8; margin-bottom: 16px;
  font-family: var(--font-mono, monospace);
}
.srt-headline {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800; line-height: 1.05;
  color: #fff; letter-spacing: -0.04em;
  text-shadow: 0 0 80px rgba(118,185,0,0.3);
  animation: headlineIn 1.2s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes headlineIn {
  from { opacity:0; transform: translateY(30px); filter: blur(8px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.srt-line {
  width: 48px; height: 3px; margin-top: 24px;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: lineIn 1.4s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes lineIn {
  from { width: 0; opacity: 0; }
  to   { width: 48px; opacity: 1; }
}


.split-form-wrap {
  width: 100%; max-width: 360px; padding: 0 32px;
  animation: formIn 0.8s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes formIn {
  from { opacity:0; transform: translateX(-24px); filter: blur(6px); }
  to   { opacity:1; transform: none; filter: blur(0); }
}
.sf-logo {
  margin-bottom: 32px;
}
.sf-logo img {
  width: 48px; height: 48px; object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(118,185,0,0.5));
  animation: logoPulse2 4s ease-in-out infinite;
}
@keyframes logoPulse2 {
  0%,100% { filter: drop-shadow(0 0 16px rgba(118,185,0,0.5)); }
  50%      { filter: drop-shadow(0 0 28px rgba(118,185,0,0.9)); }
}
.sf-eyebrow {
  font-size: .55rem; font-weight: 700; letter-spacing: .18em;
  color: var(--accent); opacity: .75; margin-bottom: 10px;
  font-family: var(--font-mono, monospace);
}
.sf-title {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.04em;
  color: #fff; margin-bottom: 8px; line-height: 1.1;
}
.sf-sub {
  font-size: .82rem; color: var(--text2); margin-bottom: 32px;
  line-height: 1.6;
}
.sf-field {
  position: relative; margin-bottom: 14px;
}
.sf-field svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text3); pointer-events: none;
  transition: color 0.2s;
}
.sf-field input {
  width: 100%; padding: 13px 16px 13px 42px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; color: #fff;
  font-size: .88rem; font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.sf-field input::placeholder { color: var(--text3); }
.sf-field input:focus {
  border-color: var(--accent);
  background: rgba(118,185,0,0.06);
  box-shadow: 0 0 0 3px rgba(118,185,0,0.12), 0 0 20px rgba(118,185,0,0.08);
}
.sf-field input:focus + svg,
.sf-field:focus-within svg { color: var(--accent); }

.sf-btn {
  width: 100%; padding: 14px 20px; margin-top: 8px;
  border: none; border-radius: 12px;
  background: transparent; cursor: pointer;
  color: #fff; font-size: .9rem; font-weight: 700;
  letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 32px rgba(118,185,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.sf-btn-glow {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #76b900 0%, #4a7a00 50%, #8fd400 100%);
  background-size: 200% 200%;
  animation: sfGrad 4s ease infinite;
}
@keyframes sfGrad {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.sf-btn-text, .sf-btn svg {
  position: relative; z-index: 1;
}
.sf-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.sf-btn::after {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.sf-btn:hover::after { transform: translateX(100%); }
.sf-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(118,185,0,0.55), 0 0 60px rgba(118,185,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}
.sf-btn:active { transform: translateY(0); }

.sf-switch {
  text-align: center; margin-top: 18px;
  font-size: .78rem; color: var(--text3);
}
.sf-switch a {
  color: var(--accent); text-decoration: none; font-weight: 600;
  transition: opacity 0.2s;
}
.sf-switch a:hover { opacity: 0.75; }

.sf-error {
  min-height: 18px; margin-top: 12px;
  font-size: .78rem; color: #f87171; text-align: center;
}
.sf-footer {
  margin-top: 40px; font-size: .65rem;
  color: var(--text3); opacity: .5; text-align: center;
}
.sf-footer span { color: var(--accent); opacity: .8; }

/* Shake */
@keyframes sfShake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.sf-shake { animation: sfShake 0.4s ease; }

/* Responsive */
@media (max-width: 700px) {
  .split-right { display: none; }
  .split-left { width: 100%; min-width: unset; }
  .split-form-wrap { padding: 0 24px; }
}


.verify-envelope-wrap {
  position: relative;
  width: 110px;
  height: 90px;
  margin: 24px auto 16px;
}
.verify-envelope {
  width: 110px;
  height: 80px;
  position: relative;
  animation: verifyFloat 3s ease-in-out infinite;
}
.verify-envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, #5a9200 100%);
  clip-path: polygon(0 0, 50% 60%, 100% 0);
  border-radius: 6px 6px 0 0;
  z-index: 2;
  animation: verifyFlapOpen 2.5s ease-in-out infinite;
  transform-origin: top center;
}
.verify-envelope-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg4);
  border: 1px solid rgba(118,185,0,0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.verify-letter {
  width: 60px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: verifyLetterRise 2.5s ease-in-out infinite;
}
.verify-letter-line {
  height: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--teal));
  border-radius: 2px;
  opacity: 0.8;
}
.verify-letter-line.short { width: 60%; }

.verify-dot {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: verifyDotPop 2.5s ease-in-out infinite;
}
.verify-dot1 { width:6px; height:6px; top:10px; right:0px;  animation-delay: 0s; }
.verify-dot2 { width:4px; height:4px; top:30px; left:-8px;  animation-delay: 0.4s; }
.verify-dot3 { width:5px; height:5px; bottom:0; right:-6px; animation-delay: 0.8s; }

@keyframes verifyFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes verifyFlapOpen {
  0%,30%,100% { transform: rotateX(0deg); }
  50%,80%     { transform: rotateX(-140deg); }
}
@keyframes verifyLetterRise {
  0%,30%,100% { transform: translateY(10px); opacity:0; }
  50%,80%     { transform: translateY(-8px); opacity:1; }
}
@keyframes verifyDotPop {
  0%,40%  { opacity:0; transform: scale(0); }
  60%     { opacity:1; transform: scale(1); }
  100%    { opacity:0; transform: scale(0); }
}

.verify-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(118,185,0,0.08);
  border: 1px solid rgba(118,185,0,0.25);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--accent2);
  margin: 6px auto 20px;
}

.verify-status-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 10px;
  position: relative;
}
.verify-pulse-ring {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: verifyPulseRing 1.5s ease-out infinite;
  position: absolute;
  left: calc(50% - 110px);
}
.verify-pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: calc(50% - 107px);
  animation: verifyPulseDot 1.5s ease-in-out infinite;
}
.verify-status-text {
  font-size: 13px;
  color: var(--text2);
  margin-left: 20px;
}
@keyframes verifyPulseRing {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes verifyPulseDot {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

.verify-hint {
  font-size: 11px;
  color: var(--text2);
  opacity: 0.5;
  margin-bottom: 12px;
  text-align: center;
}


.sf-field-float { position: relative; }

.sf-float-label {
  position: absolute;
  left: 42px; top: 50%; transform: translateY(-50%);
  font-size: .88rem; color: var(--text3);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
  background: transparent;
  padding: 0 4px;
}
.sf-field-float input:focus ~ .sf-float-label,
.sf-field-float input:not(:placeholder-shown) ~ .sf-float-label {
  top: 0; font-size: .65rem; color: var(--accent);
  background: var(--bg3); border-radius: 4px;
  letter-spacing: .05em;
}

.sf-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 4px;
  transition: color 0.2s;
  z-index: 2;
}
.sf-field-float { overflow: hidden; border-radius: 12px; }
.sf-eye:hover { color: var(--accent); }

.sf-strength-wrap {
  display: flex; align-items: center; gap: 10px;
  margin: -6px 0 10px;
}
.sf-strength-bar {
  flex: 1; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.sf-strength-fill {
  height: 100%; width: 0%;
  border-radius: 2px;
  transition: width 0.4s ease, background 0.4s ease;
}
.sf-strength-label {
  font-size: .65rem; font-weight: 600;
  letter-spacing: .06em; min-width: 48px;
  text-align: right; color: var(--text3);
  transition: color 0.3s;
}

/* Fix code overflow */
.bubble pre { overflow-x: auto; max-width: 100%; }
.bubble code { word-break: break-word; }
pre code { word-break: normal; white-space: pre; }


.s-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  transition: var(--trans);
}
.s-card:hover { border-color: var(--border2); }
.s-card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.s-card-row strong { font-size: .85rem; font-weight: 500; }
.s-desc { font-size: .75rem; color: var(--text3); margin-top: 3px; line-height: 1.4; }
.s-badge {
  font-size: .72rem; color: var(--accent2);
  background: rgba(var(--accent-rgb),0.1); padding: 4px 10px;
  border-radius: 20px; white-space: nowrap; flex-shrink: 0;
  font-weight: 500;
}
.s-btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--bg4); color: var(--text2); font-size: .78rem;
  font-family: var(--font); cursor: pointer; transition: var(--trans);
  white-space: nowrap; flex-shrink: 0; font-weight: 500;
}
.s-btn:hover { border-color: var(--accent); color: var(--accent2); background: rgba(var(--accent-rgb),0.08); transform: translateY(-1px); }
.s-btn:active { transform: translateY(0); }
.s-btn-danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(248,113,113,0.08); }

/* Compte */
.s-account-card { display: flex; align-items: center; gap: 14px; }
.s-account-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #3d7a00);
  color: #fff; font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb),0.4);
}
.s-account-info { flex: 1; min-width: 0; }
.s-account-email { font-size: .88rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-account-status { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--text3); margin-top: 3px; }

.s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.s-dot.ok { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.s-dot.err { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }

/* Inputs */
.s-input {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border2); background: var(--bg4);
  color: var(--text); font-size: .82rem; font-family: var(--font);
  outline: none; transition: var(--trans); margin-top: 8px;
}
.s-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12); }
.s-textarea {
  width: 100%; min-height: 90px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border2); background: var(--bg4);
  color: var(--text); font-size: .82rem; font-family: var(--font);
  outline: none; resize: vertical; margin-top: 10px; line-height: 1.5;
  transition: var(--trans);
}
.s-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12); }
.s-card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.s-char-count { font-size: .7rem; color: var(--text3); }

/* Slider */
.s-slider {
  width: 100%; margin-top: 10px; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; background: var(--bg5); outline: none; cursor: pointer;
}
.s-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(var(--accent-rgb),0.5);
  transition: var(--trans);
}
.s-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.s-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: none;
  background: var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(var(--accent-rgb),0.5);
}

/* Mode switch (segmented control) */
.s-mode-switch {
  display: flex; gap: 4px; background: var(--bg4); border-radius: 10px; padding: 3px;
}
.s-mode-btn {
  flex: 1; padding: 8px 12px; border-radius: 8px; border: none;
  background: none; color: var(--text3); font-size: .78rem; font-weight: 500;
  font-family: var(--font); cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.s-mode-btn:hover { color: var(--text2); }
.s-mode-btn.active {
  background: var(--bg2); color: var(--accent2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Toggle */
.s-toggle { cursor: pointer; display: flex; align-items: center; flex-shrink: 0; }
.s-toggle input { display: none; }
.s-toggle-track {
  width: 38px; height: 22px; border-radius: 12px;
  background: var(--bg5); border: 1px solid var(--border2);
  position: relative; transition: var(--trans);
}
.s-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text3); transition: var(--trans-spring);
}
.s-toggle input:checked + .s-toggle-track { background: rgba(var(--accent-rgb),0.25); border-color: var(--accent); }
.s-toggle input:checked + .s-toggle-track::after { background: var(--accent); transform: translateX(16px); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.6); }

/* Providers list */
#s-providers-list .s-provider-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg3); border: 1px solid var(--border);
  margin-bottom: 6px; transition: var(--trans);
}
#s-providers-list .s-provider-item:hover { border-color: var(--border2); }
.s-provider-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.s-provider-dot.ok { background: var(--accent2); box-shadow: 0 0 6px rgba(var(--accent-rgb),0.5); }
.s-provider-name { flex: 1; font-size: .82rem; cursor: pointer; }

.s-local-status-box {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--bg4); font-size: .78rem; color: var(--text2);
}

/* Stats grid */
.s-stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.s-stat-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 10px; text-align: center;
}
.s-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--accent2); }
.s-stat-label { font-size: .68rem; color: var(--text3); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Memory preview */
.s-memory-preview {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--bg4); font-size: .78rem; color: var(--text2);
  line-height: 1.5; max-height: 120px; overflow-y: auto;
}

/* Shortcuts */
.s-shortcut-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px; font-size: .82rem;
}
.s-shortcut-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.s-shortcut-row kbd {
  font-family: var(--mono); font-size: .72rem; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border2);
  padding: 3px 8px; border-radius: 6px;
}

/* Density compact mode */
body.density-compact .msg-group { margin-bottom: 10px; }
body.density-compact .bubble { padding: 9px 14px; }

/* Settings nav polish */
.s-nav-item { position: relative; }
.s-nav-item.active::before {
  content:''; position:absolute; left:-8px; top:20%; bottom:20%; width:3px;
  background: var(--accent); border-radius: 99px; box-shadow: 0 0 8px var(--accent);
}


/* Hover thematique sub-wrap */
.cd-sub-wrap:hover {
  background: rgba(var(--accent-rgb),0.08);
}
.cd-sub-wrap:hover .cd-right {
  color: var(--accent2);
}
.cd-sub-wrap:hover svg:not(.cd-chevron) {
  color: var(--accent);
}
.cd-chevron {
  transition: transform 0.15s ease, color 0.15s ease;
}
.cd-sub-wrap:hover .cd-chevron {
  color: var(--accent2) !important;
}

#scroll-bottom-btn {
  display: none;
  position: fixed; bottom: 100px; right: 32px; z-index: 50;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: var(--trans);
}
#scroll-bottom-btn.show { display: flex; }
#scroll-bottom-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }


.bubble pre { padding-top: 40px; }
.code-toolbar {
  position: absolute; top: 0; left: 0; right: 0; height: 34px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}
.code-lang-label {
  font-size: .68rem; color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.06em; font-family: var(--mono);
}
.code-actions { display: flex; gap: 4px; }
.code-actions .copy-btn {
  position: static; opacity: 1; padding: 5px; border-radius: 6px;
}
.code-actions .copy-btn svg { width: 13px; height: 13px; }


.bubble blockquote.callout {
  border-left-width: 3px; border-radius: 0 12px 12px 0;
  padding: 12px 16px 12px 14px; font-style: normal;
  display: flex; align-items: flex-start; gap: 10px;
  position: relative; overflow: hidden;
}
.bubble blockquote.callout::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.03; border-radius: inherit;
}
.callout-icon {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 0 6px currentColor);
}
.bubble blockquote.callout-warning {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245,158,11,0.07), rgba(245,158,11,0.02));
  color: #fbbf24;
}
.bubble blockquote.callout-warning .callout-icon { color: #f59e0b; }
.bubble blockquote.callout-success {
  border-left-color: #22c55e;
  background: linear-gradient(135deg, rgba(34,197,94,0.07), rgba(34,197,94,0.02));
  color: #4ade80;
}
.bubble blockquote.callout-success .callout-icon { color: #22c55e; }
.bubble blockquote.callout-lock {
  border-left-color: #ef4444;
  background: linear-gradient(135deg, rgba(239,68,68,0.07), rgba(239,68,68,0.02));
  color: #f87171;
}
.bubble blockquote.callout-lock .callout-icon { color: #ef4444; }
.bubble blockquote.callout-info {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59,130,246,0.07), rgba(59,130,246,0.02));
  color: #60a5fa;
}
.bubble blockquote.callout-info .callout-icon { color: #3b82f6; }


.bubble li.md-task-item { list-style: none; margin-left: -1.4em; display: flex; align-items: flex-start; gap: 8px; }
.md-checkbox {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
  border: 1.5px solid var(--border3); margin-top: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; font-weight: 700;
}
.md-checkbox.checked { background: var(--accent); border-color: var(--accent); }

/* ── Search indicator animé ──────────────────── */
@keyframes search-spin {
  to { transform: rotate(360deg); }
}
.search-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
  color: var(--text2);
  font-size: .85rem;
}
.search-indicator span {
  font-style: italic;
  opacity: .7;
}
.search-ring {
  transform-origin: 10px 10px;
  animation: search-spin 1s linear infinite;
}
