/* ============================================================
   Voxera AI — thème dark cyber (violet → cyan, glassmorphism)
   Conserve tous les hooks de l'ancien thème + nouveaux (hero,
   tiers, packages, credits, chip, msg-notice, copy-btn...)
   ============================================================ */
:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --panel-solid: #0d1322;
  --glass: rgba(13, 19, 34, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #8b5cf6;
  --primary-2: #a855f7;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 24px rgba(0, 0, 0, 0.3);
  --grad: linear-gradient(135deg, var(--violet), var(--cyan));
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: rgba(139, 92, 246, 0.4) rgba(255, 255, 255, 0.04); }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(1000px 500px at -10% 20%, rgba(34, 211, 238, 0.09), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
h1, h2, h3 { line-height: 1.25; }
::selection { background: rgba(139, 92, 246, 0.35); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.35); border-radius: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap; background: transparent; color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover { filter: brightness(1.1); text-decoration: none; box-shadow: 0 6px 26px rgba(139, 92, 246, 0.5); }
.btn-ghost { border-color: var(--border-2); color: var(--text); background: rgba(255, 255, 255, 0.04); }
.btn-ghost:hover { border-color: rgba(139, 92, 246, 0.6); background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-oauth {
  border-color: var(--border-2); background: rgba(255, 255, 255, 0.05); color: var(--text);
  width: 100%; padding: 11px 14px; font-weight: 500;
}
.btn-oauth:hover { border-color: rgba(34, 211, 238, 0.55); background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.send-btn { padding: 10px 14px; border-radius: 10px; }

/* ---------- nav ---------- */
.nav {
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 22, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 30px; height: 30px; flex-shrink: 0; filter: drop-shadow(0 2px 8px rgba(139, 92, 246, 0.45)); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad);
  color: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 3px 14px rgba(139, 92, 246, 0.5);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.brand-beta {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.5); color: var(--cyan); text-transform: uppercase;
}
.brand-center { justify-content: center; margin-bottom: 6px; }
.nav-links { display: flex; gap: 10px; align-items: center; }

/* ---------- hero / landing ---------- */
.hero { position: relative; overflow: hidden; padding: 90px 20px 70px; text-align: center; }
.hero-glow {
  position: absolute; inset: -20% -10% auto; height: 75%;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(139, 92, 246, 0.28), transparent 55%),
    radial-gradient(ellipse at 75% 0%, rgba(34, 211, 238, 0.16), transparent 55%);
  pointer-events: none;
}
.hero-grid-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.12) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at top, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at top, #000 30%, transparent 75%);
}
.hero-inner { position: relative; max-width: 820px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, 0.05);
  color: var(--muted); font-size: 13px; margin-bottom: 22px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); display: inline-block; }
.hero h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 800; margin: 0 0 18px; letter-spacing: -0.5px; }
.grad { background: linear-gradient(90deg, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.hero-oauth { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; max-width: 520px; margin: 0 auto; }
.hero-oauth .btn-oauth { width: auto; flex: 1 1 220px; }
.hero-tiers { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px; }
.tier-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, 0.05);
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.tier-dot { width: 8px; height: 8px; border-radius: 50%; }
.tier-dot.eco { background: var(--green); box-shadow: 0 0 8px var(--green); }
.tier-dot.std { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.tier-dot.pro { background: var(--violet); box-shadow: 0 0 8px var(--violet); }

.features { padding: 30px 20px 70px; }
.features-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.feature {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.feature:hover { border-color: rgba(139, 92, 246, 0.45); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.feature-icon { font-size: 26px; margin-bottom: 10px; }
.feature h3 { margin: 0 0 8px; font-size: 16.5px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

.how { padding: 30px 20px 70px; }
.how-inner { max-width: 1000px; margin: 0 auto; text-align: center; }
.how-inner > h2 { font-size: 28px; margin: 0 0 28px; }
.how-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 34px; }
.how-step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 20px; backdrop-filter: blur(10px); }
.how-step h3 { margin: 12px 0 8px; font-size: 16px; }
.how-step p { margin: 0; color: var(--muted); font-size: 14px; }
.how-num {
  width: 40px; height: 40px; margin: 0 auto; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}
.how-cta { display: flex; justify-content: center; }

.footer { border-top: 1px solid var(--border); padding: 22px 20px; background: rgba(7, 11, 22, 0.6); }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.footer-muted { opacity: .7; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; }
.auth-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at top, rgba(139, 92, 246, 0.18), transparent 60%); pointer-events: none; }
.auth-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 34px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.auth-title { font-size: 24px; margin: 8px 0 4px; text-align: center; }
.auth-sub { color: var(--muted); text-align: center; margin: 0 0 22px; font-size: 14px; }
.auth-oauth { display: flex; flex-direction: column; gap: 10px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-2); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.field input, .field select, .field textarea {
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-2); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font-size: 14.5px; font-family: var(--font); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.field-wide { grid-column: 1 / -1; }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.auth-actions { display: flex; justify-content: center; margin-top: 18px; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.alert-error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); color: var(--red); }
.alert-success { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.35); color: var(--green); }
.alert-warning { background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.35); color: var(--amber); }

/* ---------- chat ---------- */
.chat-body { overflow: hidden; }
.chat-layout { display: flex; height: 100vh; }
.sidebar {
  width: 270px; min-width: 270px;
  background: rgba(7, 11, 22, 0.85);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column; padding: 14px;
}
.sidebar-top { display: flex; flex-direction: column; gap: 12px; }
.sidebar-section-label { margin: 22px 8px 6px; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.sidebar-section-heading { display: flex; align-items: center; justify-content: space-between; }
.sidebar-section-heading .sidebar-section-label { margin-bottom: 6px; }
.project-add, .project-new-chat { border: 0; color: var(--cyan); background: transparent; cursor: pointer; font-size: 19px; line-height: 1; border-radius: 7px; }
.project-add { margin: 18px 8px 2px; width: 25px; height: 25px; }
.project-add:hover, .project-new-chat:hover { background: rgba(34, 211, 238, .13); color: #fff; }
.project-list { display: flex; flex-direction: column; gap: 4px; margin: 0 4px 2px; max-height: 155px; overflow-y: auto; }
.project-row { display: flex; align-items: center; gap: 7px; min-height: 31px; padding: 4px 5px 4px 9px; border-radius: 8px; background: rgba(139, 92, 246, .07); color: var(--text); }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: 12px; font-weight: 650; }
.project-count { color: var(--muted); font-size: 11px; }
.project-new-chat { width: 23px; height: 23px; flex: 0 0 23px; }
.project-empty { color: var(--muted); padding: 4px 8px; font-size: 11.5px; line-height: 1.35; }
.conv-list { flex: 1; overflow-y: auto; margin: 4px -4px 14px; padding: 0 4px; display: flex; flex-direction: column; gap: 5px; }
.conv-row { position: relative; border-radius: 10px; }
.conv-item {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  min-height: 58px; transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.conv-item:hover, .conv-row:hover .conv-item { background: var(--panel); text-decoration: none; transform: translateX(2px); }
.conv-row.active .conv-item { background: linear-gradient(110deg, rgba(139, 92, 246, 0.19), rgba(34, 211, 238, 0.08)); border-color: rgba(139, 92, 246, 0.48); box-shadow: inset 3px 0 0 var(--cyan); }
.conv-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.conv-item .conv-date { color: var(--muted); font-size: 11.5px; }
.conv-actions { position: absolute; right: 7px; top: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.conv-row:hover .conv-actions, .conv-row:focus-within .conv-actions { opacity: 1; }
.conv-action { width: 25px; height: 25px; border: 0; border-radius: 7px; cursor: pointer; color: var(--muted); background: rgba(8, 13, 25, .78); font-size: 16px; line-height: 1; }
.conv-action:hover { color: #fff; background: rgba(139, 92, 246, .5); }
.conv-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}
.user-meta { min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-credits { font-size: 12px; color: var(--muted); }
.sidebar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 22, 0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.chat-title { font-weight: 600; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-right { display: flex; align-items: center; gap: 10px; }
.audit-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.audit-toggle:hover { border-color: var(--border-2); color: var(--text); }
.audit-toggle.on {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(34, 211, 238, 0.14));
  border-color: rgba(139, 92, 246, 0.6); color: var(--text);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.25);
}
.audit-toggle.on .audit-toggle-icon { filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.8)); }
.model-select { display: flex; align-items: center; gap: 8px; }
.model-label { color: var(--muted); font-size: 12.5px; }
.model-select select {
  background: var(--panel-solid); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 7px 10px; font-size: 13.5px;
}
.model-select select:focus { outline: none; border-color: var(--primary); }
.sidebar-toggle { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 30px 24px 44px; display: flex; flex-direction: column; gap: 30px; }
.messages::before { content: ""; display: block; height: 2px; flex: 0 0 2px; }
.welcome { text-align: center; max-width: 560px; margin: 40px auto 0; }
.welcome-mark {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: #fff;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.45);
}
.welcome h2 { margin: 0 0 8px; font-size: 22px; }
.welcome p { color: var(--muted); margin: 0 0 20px; }
.welcome-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.chip:hover { border-color: var(--primary); background: var(--panel-2); box-shadow: 0 0 14px rgba(139, 92, 246, 0.2); }

.msg { display: flex; gap: 14px; max-width: 820px; width: 100%; margin: 0 auto; }
.msg { animation: message-in .28s cubic-bezier(.2,.8,.2,1) both; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.msg-user .msg-avatar { background: linear-gradient(135deg, #3b82f6, var(--cyan)); }
.msg-assistant .msg-avatar { background: var(--grad); box-shadow: 0 2px 10px rgba(139, 92, 246, 0.35); }
.msg-body { flex: 1; min-width: 0; }
.msg-role { font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 700; letter-spacing: .01em; }
.msg-model { color: var(--cyan); font-weight: 500; }
.msg-content {
  color: #e8edf7; font-size: 15px; line-height: 1.72; overflow-wrap: break-word;
}
.msg-assistant .msg-content { padding: 1px 0; }
.msg-user { flex-direction: row-reverse; align-items: flex-start; }
.msg-user .msg-body { flex: 0 1 auto; max-width: min(78%, 640px); }
.msg-user .msg-role { text-align: right; }
.msg-user .msg-content {
  background: rgba(255, 255, 255, 0.075); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px 4px 18px 18px; padding: 11px 14px; line-height: 1.58;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
}
.msg-content p { margin: 0 0 14px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content pre {
  background: #0a1020; border: 1px solid rgba(255, 255, 255, 0.11); border-radius: 12px;
  padding: 15px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 16px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.16);
}
.msg-content code { background: rgba(139, 92, 246, 0.16); padding: 2px 5px; border-radius: 5px; font-size: .9em; color: #ddd6fe; }
.msg-content pre code { background: none; padding: 0; color: #e2e8f0; }
.msg-content table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.msg-content th, .msg-content td { border: 1px solid var(--border-2); padding: 6px 10px; font-size: 13.5px; }
.msg-content th { background: var(--panel-2); }
.msg-content ul, .msg-content ol { padding-left: 22px; margin: 8px 0; }
.msg-content blockquote { border-left: 3px solid var(--primary); margin: 10px 0; padding: 4px 12px; color: var(--muted); background: rgba(139, 92, 246, 0.06); border-radius: 0 8px 8px 0; }
.msg-content h1, .msg-content h2, .msg-content h3 { margin: 22px 0 10px; color: #f5f7fb; letter-spacing: -.015em; }
.msg-content h1:first-child, .msg-content h2:first-child, .msg-content h3:first-child { margin-top: 0; }
.msg-content a { color: var(--cyan); }
.msg-content hr { border: none; height: 1px; background: var(--border-2); margin: 14px 0; }

.msg-actions { display: flex; gap: 8px; margin: 12px 0 1px; opacity: .55; transition: opacity .18s ease; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  color: var(--muted); background: transparent; border: 1px solid var(--border-2);
  border-radius: 7px; padding: 3px 9px; cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}
.copy-btn:hover { color: var(--cyan); border-color: rgba(34, 211, 238, 0.5); background: rgba(34, 211, 238, 0.08); }
.copy-btn:active { transform: translateY(1px); }

.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-2); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
.msg-notice {
  font-size: 12px; color: var(--muted); margin: 6px 0 10px 44px;
  padding: 6px 12px; background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.22); border-radius: 8px;
}
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes message-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float-glow { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(0, -12px, 0) scale(1.04); } }
.hero-glow, .credits-hero-glow { animation: float-glow 9s ease-in-out infinite; }
.feature, .how-step, .package { animation: surface-in .5s ease both; }
.feature:nth-child(2), .how-step:nth-child(2), .package:nth-child(2) { animation-delay: .08s; }
.feature:nth-child(3), .how-step:nth-child(3), .package:nth-child(3) { animation-delay: .16s; }
.feature:nth-child(4) { animation-delay: .24s; }
.feature:nth-child(5) { animation-delay: .32s; }
.feature:nth-child(6) { animation-delay: .40s; }
@keyframes surface-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.composer { padding: 16px 18px 18px; border-top: 1px solid var(--border); background: linear-gradient(180deg, rgba(7, 11, 22, .1), rgba(7, 11, 22, .92) 30%); backdrop-filter: blur(12px); }
.composer-box {
  max-width: 820px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end;
  background: rgba(18, 25, 42, .94); border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px; padding: 8px 9px 8px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .24); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.composer-box:focus-within { border-color: rgba(139, 92, 246, .8); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16), 0 14px 42px rgba(0, 0, 0, .28); }
.composer-box textarea {
  flex: 1; background: transparent; border: none; color: var(--text); font-family: var(--font);
  font-size: 14.5px; padding: 8px 10px; resize: none; max-height: 180px; min-height: 24px;
}
.composer-box textarea:focus { outline: none; }
.composer-box textarea:disabled { opacity: .55; }
.composer-hint { max-width: 820px; margin: 8px auto 0; text-align: center; color: var(--muted); font-size: 12px; }
.sidebar-backdrop { display: none; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--glass); border: 1px solid var(--border-2); border-radius: 10px;
  padding: 11px 16px; font-size: 13.5px; box-shadow: var(--shadow-sm);
  animation: slidein .2s ease; max-width: 340px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.toast-error { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }
.toast-success { border-color: rgba(52, 211, 153, 0.45); color: var(--green); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- admin ---------- */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 30px 20px 60px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; backdrop-filter: blur(10px); }
.stat-num {
  font-size: 30px; font-weight: 800;
  background: linear-gradient(90deg, var(--primary-2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--muted); font-size: 13px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab {
  background: var(--panel); border: 1px solid var(--border-2); color: var(--muted);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .12s, color .12s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.on { background: var(--grad); color: #fff; border-color: transparent; }
.admin-panel {
  display: none; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; backdrop-filter: blur(10px);
}
.admin-panel.on { display: block; }
.admin-panel h2 { margin: 0 0 16px; font-size: 17px; }
.admin-panel h2:not(:first-child) { margin-top: 26px; }
.admin-hint { font-size: 13px; color: var(--muted); margin: -6px 0 14px; max-width: 720px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: 4px; }
.amount-input {
  width: 80px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 12.5px;
}
.badge { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.badge-red { background: rgba(248, 113, 113, 0.14); color: var(--red); }

/* ---------- credits / packages Stripe ---------- */
.credits-wrap { max-width: 780px; margin: 0 auto; padding: 50px 20px; }
.account-wrap { max-width: 960px; margin: 0 auto; padding: 52px 20px 70px; }
.account-heading { max-width: 650px; margin: 0 auto 28px; text-align: center; }
.account-heading .hero-badge { margin-bottom: 12px; }
.account-heading h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 38px); }
.account-heading p { margin: 0; color: var(--muted); }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.account-card { display: flex; flex-direction: column; gap: 15px; padding: 26px; border: 1px solid var(--border); border-radius: 16px; background: var(--glass); box-shadow: var(--shadow-sm); backdrop-filter: blur(14px); }
.account-card h2 { margin: 0; font-size: 18px; }
.account-card > p { margin: -8px 0 2px; min-height: 42px; color: var(--muted); font-size: 13.5px; }
.account-card .btn { margin-top: auto; min-height: 42px; }
.credits-hero {
  position: relative; overflow: hidden;
  background: var(--glass); border: 1px solid var(--border); border-radius: 18px;
  padding: 40px 30px; text-align: center; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.credits-hero-glow {
  position: absolute; top: -60%; left: 50%; transform: translateX(-50%);
  width: 420px; height: 420px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 65%);
}
.credits-hero-inner { position: relative; }
.credits-hero-label {
  font-family: var(--font-display); font-size: 13px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.credits-hero-sub { color: var(--muted); font-size: 14px; margin: 4px 0 18px; }
.credits-hero-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.credits-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: 18px;
  padding: 36px; text-align: center; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.credits-balance {
  font-size: 56px; font-weight: 800;
  background: linear-gradient(90deg, var(--primary-2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.credits-sub { color: var(--muted); margin: 0 0 20px; }
.credits-info { text-align: left; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.packages { margin-top: 34px; }
.packages > h2 { text-align: center; font-size: 26px; margin: 0 0 8px; }
.packages-sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.packages-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.package {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 26px 22px 22px; text-align: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.package:hover { transform: translateY(-3px); }
.package-popular {
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.12), var(--panel));
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.18);
}
.package-popular:hover { box-shadow: 0 0 38px rgba(139, 92, 246, 0.28); }
.package-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--grad); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.6px;
  padding: 4px 12px; border-radius: 999px; text-transform: uppercase; box-shadow: 0 3px 12px rgba(139, 92, 246, 0.4);
}
.package h3 { margin: 6px 0 0; font-size: 16px; }
.package-credits { font-size: 30px; font-weight: 800; color: var(--text); }
.package-credits span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.package-price { font-size: 22px; font-weight: 700; background: linear-gradient(90deg, var(--primary-2), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.package p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.package .buy-btn { margin-top: auto; }
.buy-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.packages-foot {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--muted); font-size: 12.5px; text-align: center;
}
.packages-foot svg { flex-shrink: 0; color: var(--green); }

/* ---------- admin : jeton API ---------- */
.api-token-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-top: 6px;
}
.api-token-value {
  font-family: var(--mono); font-size: 13.5px; word-break: break-all;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px; color: var(--cyan);
}
.api-token-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; z-index: 29; inset: 0; border: 0; padding: 0; background: rgba(2, 6, 15, 0); pointer-events: none; transition: background .2s ease; }
  .sidebar-backdrop.show { background: rgba(2, 6, 15, .62); pointer-events: auto; }
  .conv-actions { opacity: 1; }
  .sidebar-toggle { display: inline-flex; }
  .chat-header { padding: 10px 12px; }
  .model-label { display: none; }
  .model-select select { max-width: 130px; }
  .messages { padding: 20px 14px 28px; gap: 24px; }
  .composer { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer-box { gap: 6px; border-radius: 12px; }
  .composer-box textarea { font-size: 16px; } /* évite le zoom iOS */
  .msg-content { font-size: 14.5px; }
  .msg-user .msg-body { max-width: 86%; }
  .msg-user .msg-content { padding: 10px 12px; }
  .msg-actions { flex-wrap: wrap; }
  .copy-btn { min-height: 36px; display: inline-flex; align-items: center; }
  .credits-wrap { padding: 26px 12px; }
  .account-wrap { padding: 30px 12px 50px; }
  .account-grid { grid-template-columns: 1fr; }
  .account-card { padding: 20px; }
  .packages-grid { grid-template-columns: 1fr; }
  .hero { padding: 60px 16px 50px; }
  .footer-inner { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (max-width: 480px) {
  .nav-inner { padding: 10px 12px; gap: 8px; }
  .brand { gap: 7px; min-width: 0; }
  .brand-logo { width: 25px; height: 25px; }
  .brand-name { font-size: 15px; }
  .brand-beta { display: none; }
  .nav-links { flex: 1; justify-content: flex-end; gap: 6px; }
  .nav-links .btn { min-height: 42px; padding: 8px 9px; font-size: 12.5px; }
  .hero { padding: 42px 14px 38px; }
  .hero-badge { font-size: 11.5px; padding: 6px 10px; }
  .hero-sub { font-size: 15px; }
  .hero-cta { gap: 9px; }
  .hero-cta .btn { width: 100%; min-height: 48px; }
  .hero-tiers { gap: 7px; }
  .tier-pill { padding: 6px 10px; font-size: 11.5px; }
  .auth-wrap { align-items: flex-start; padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 24px 18px; border-radius: 14px; }
  .auth-title { font-size: 22px; }
  .field input, .field select, .field textarea { min-height: 46px; font-size: 16px; }
  .auth-form .btn { min-height: 48px; }
}
