:root {
  --bg: #0e0b1e;
  --bg-2: #15112b;
  --bg-3: #1d1838;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1ecf7;
  --muted: #a99fbf;
  --gold: #e3b86a;
  --gold-2: #f3d79c;
  --rose: #e38aa8;
  --green: #5fd49a;
  --red: #ef7a7a;
  --bubble-advisor: #231c44;
  --bubble-visitor: #e3b86a;
  --bubble-visitor-text: #1a1230;
  --radius: 18px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(227, 184, 106, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(227, 138, 168, 0.10), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: 0.01em; }

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: 100dvh;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Chat ===== */
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 11, 30, 0.75);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 2;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--bg);
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold) 60%, #b98a3c);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold);
}
.who { flex: 1; min-width: 0; }
.name { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.1; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status .dot { flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(239,122,122,.18); }
body[data-online="1"] .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(95,212,154,.18); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(95,212,154,.18); } 50% { box-shadow: 0 0 0 6px rgba(95,212,154,.06); } }

.meter {
  text-align: right; line-height: 1.1;
  padding: 6px 12px; border-radius: 12px;
  background: var(--bg-3); border: 1px solid var(--line);
}
.meter-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.meter-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 17px; color: var(--gold-2); }
.meter.low .meter-time { color: var(--rose); }
.meter.paused { opacity: .55; }

.offline-banner {
  margin: 12px 18px 0; padding: 10px 14px; border-radius: 12px;
  background: rgba(239,122,122,.10); border: 1px solid rgba(239,122,122,.35);
  font-size: 14px; color: #ffd6d6;
}

.messages {
  flex: 1; overflow-y: auto; padding: 18px 18px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.msg { display: flex; flex-direction: column; max-width: 78%; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .bubble {
  padding: 11px 15px; border-radius: var(--radius);
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 16px;
}
.msg .time { font-size: 11px; color: var(--muted); margin: 4px 8px 0; }
.msg.advisor { align-self: flex-start; }
.msg.advisor .bubble { background: var(--bubble-advisor); border-bottom-left-radius: 6px; border: 1px solid var(--line); }
.msg.advisor.first .bubble { font-family: var(--serif); font-size: 21px; line-height: 1.3; border-color: rgba(227,184,106,.35); }
.msg.visitor { align-self: flex-end; align-items: flex-end; }
.msg.visitor .bubble { background: var(--bubble-visitor); color: var(--bubble-visitor-text); border-bottom-right-radius: 6px; }
.msg.visitor.pending { opacity: .6; }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .bubble { background: transparent; color: var(--muted); font-size: 13px; text-align: center; padding: 4px 10px; }

.typing { display: flex; gap: 5px; padding: 0 24px 10px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

.packs-inline {
  margin: 0 18px 10px; padding: 14px; border-radius: var(--radius);
  background: var(--bg-3); border: 1px solid rgba(227,184,106,.35);
}
.packs-inline p { margin: 0 0 10px; font-size: 15px; }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 18px 6px; border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px;
  padding: 12px 16px; border-radius: 22px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  font: inherit; line-height: 1.4; outline: none;
}
.composer textarea:focus { border-color: rgba(227,184,106,.5); }
.composer button {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: var(--bg); display: grid; place-items: center;
}
.composer button:disabled { opacity: .4; cursor: default; }
.composer.locked textarea { opacity: .5; }
.legal-line { margin: 0; padding: 0 18px 10px; font-size: 11px; color: var(--muted); }
.legal-line a { color: var(--muted); }

/* ===== Panneau latéral ===== */
.side { overflow-y: auto; padding: 22px 22px 40px; display: flex; flex-direction: column; gap: 22px; background: var(--bg-2); }
.side-block h2 { font-size: 22px; margin-bottom: 10px; color: var(--gold-2); }
.hero h1 { font-size: 34px; line-height: 1.05; color: var(--gold-2); }
.lead { margin: 10px 0 12px; color: var(--text); font-size: 15px; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.facts li::before { content: "✦ "; color: var(--gold); }
.facts b { color: var(--text); font-weight: 600; }

.how { margin: 0 0 12px; padding-left: 20px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.how b { color: var(--text); font-weight: 600; }
.verify {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 16px; border-radius: 14px; cursor: pointer; border: 1px solid var(--gold);
  background: linear-gradient(135deg, rgba(227,184,106,.22), rgba(227,184,106,.08)); color: var(--gold-2);
  font: inherit; font-weight: 600; font-size: 16px; transition: transform .15s;
}
.verify:hover { transform: translateY(-1px); }
.verify:disabled { opacity: .5; cursor: default; }
.verify .vs { font-size: 12px; font-weight: 400; color: var(--muted); }
.packs { display: flex; flex-direction: column; gap: 8px; }
.pack {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text); font: inherit;
  transition: border-color .15s, transform .15s;
}
.pack:hover { border-color: rgba(227,184,106,.5); transform: translateY(-1px); }
.pack.featured { border-color: var(--gold); background: linear-gradient(135deg, rgba(227,184,106,.14), rgba(227,184,106,.04)); }
.pack .pl { font-weight: 600; }
.pack .pm { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.pack .pp { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--gold-2); white-space: nowrap; }
.pack:disabled { opacity: .5; cursor: default; }

.proofs { display: flex; flex-direction: column; gap: 10px; }
.proof { padding: 12px 14px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); }
.proof p { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; line-height: 1.3; font-style: italic; }
.proof small { color: var(--muted); }
.legal p { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.tiny { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--gold-2); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.only-mobile { display: none; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9; }

/* ===== Mobile : chat plein écran, panneau en tiroir ===== */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .chat { border-right: 0; }
  .only-mobile { display: inline-block; }
  .meter { padding: 4px 10px; }
  .msg { max-width: 86%; }
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    max-height: 88dvh; border-radius: 22px 22px 0 0;
    transform: translateY(100%); transition: transform .28s ease;
    box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  }
  .side.open { transform: none; }
  .close-sheet { position: absolute; top: 12px; right: 12px; }
  .hero h1 { font-size: 28px; }
  .status .ext { display: none; }
  .name { font-size: 19px; }
  .chat-head { padding: 10px 14px; gap: 10px; }
  .composer textarea { font-size: 16px; }
}
