:root{
  --bg: #0b1020;
  --panel: #111827;
  --panel2: #0f172a;
  --text: #e5e7eb;
  --muted:#94a3b8;
  --border: rgba(148,163,184,.20);
  --primary:#22c55e;
  --primary2:#16a34a;
  --danger:#ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(1000px 600px at 20% 0%, rgba(34,197,94,.08), transparent 60%),
              radial-gradient(800px 500px at 90% 20%, rgba(59,130,246,.08), transparent 60%),
              var(--bg);
  color:var(--text);
  font-family:var(--sans);
}
a{color:#93c5fd;text-decoration:none}
a:hover{text-decoration:underline}
.hidden{display:none!important}
.mono{font-family:var(--mono)}
.small{font-size:12px;color:var(--muted)}

.btn{display:inline-flex;align-items:center;justify-content:center}

/* Pages statiques (FAQ / Conditions / Paiement / Contact) */
.chat__inner.static-page{
  max-width:1100px;
  padding-left:10px;
  padding-right:10px;
  position:relative;
}
.static-page__close{
  position:fixed;
  top:14px;
  right:14px;
  z-index:100;
  text-decoration:none;
}
@media (max-width: 520px){
  .static-page__close{
    top:10px;
    right:10px;
  }
}
.static-page .panel__title{font-size:14px;text-align:center}
.static-page .static-content{
  max-width:920px;
  margin:0 auto;
  line-height:1.05;
  font-size:14px;
}
.static-page .static-content b{
  display:block;
  margin:10px 0 4px;
  font-size:14px;
  color: var(--text);
}
.static-page .static-content b:first-child{
  margin-top:0;
  text-align:center;
  font-size:16px;
  letter-spacing:.2px;
}
.static-page .page-actions{
  display:flex;
  justify-content:center;
  margin-top:14px;
}

/* Paiement */
.pay-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.pay-page .pay-shell{max-width: 980px; margin: 0 auto}
.pay-paypalTitle{font-weight:950;font-size:13px;margin-bottom:8px}
.pay-alert{
  max-width:980px;
  margin:0 auto 10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  text-align:center;
  font-weight:950;
  letter-spacing:.2px;
}
.pay-alert--danger{
  border-color: rgba(239,68,68,.45);
  background: rgba(239,68,68,.10);
  color:#fecaca;
  font-size:14px;
}

.pay-page .static-content{max-width:none}
.pay-box{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background: rgba(255,255,255,.02);
}
.pay-page .pay-box{line-height:1.05}
.pay-row{display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap}
.pay-row--kpi{margin-top:6px}
.pay-page .pay-row{gap:4px}
.pay-page .pay-row--kpi{margin-top:4px}
.pay-page .pay-kpi{font-weight:900;font-size:16px; line-height:1}
.pay-page .pay-sub{color:var(--muted);font-size:12px; line-height:1}
.pay-page .pay-bonus{color: rgba(34,197,94,.9); font-weight:800; font-size:12px; margin-top:2px; line-height:1}
.pay-page .pay-list{line-height:1}

@media (max-width: 520px){
  .chat__inner.static-page{
    padding-left:6px;
    padding-right:6px;
  }
  .static-page .panel{
    padding:10px;
    border-radius:12px;
  }
}

.qty{
  display:flex;
  align-items:center;
  gap:8px;
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:14px;
  padding:4px 6px;
}
.qty--inline{margin-top:6px; justify-content:flex-end; background:transparent; border-color:transparent; padding:0}
.qty--inline .qty__btn{background: rgba(255,255,255,.03)}
.pay-page .qty{padding:2px 4px; gap:6px}
.qty__btn{
  width:30px;height:30px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
  font-weight:900;
  font-size:18px;
  line-height:1;
}
.pay-page .qty__btn{width:28px;height:28px;font-size:16px}
.qty__btn:hover{background: rgba(255,255,255,.06)}
.qty__btn:disabled{opacity:.45;cursor:not-allowed}
.qty__value{
  min-width:28px;
  text-align:center;
  font-weight:900;
  font-size:14px;
  padding:0 4px;
}
.pay-select{
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  outline:none;
  font-weight:800;
}
.pay-list{margin:10px 0 0 0;padding-left:18px;color:var(--text)}
.pay-list li{margin:0}
.pay-page .pay-list{margin-top:6px}

.pay-page .pay-list{padding-left:0; list-style:none}
.pay-page .pay-list li{
  position:relative;
  padding-left:18px;
}
.pay-page .pay-list li::before{
  content:"";
  position:absolute;
  left:0;
  top:4px;
  width:10px;height:10px;
  border-radius:4px;
  background: rgba(34,197,94,.35);
  border:1px solid rgba(34,197,94,.55);
}

@media (min-width: 980px){
  .pay-grid{grid-template-columns: 1.2fr .8fr; align-items:start}
}

.app{
  height:100%;
  display:flex;
  overflow:hidden;
}

.sidebar{
  width:340px;
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-right:1px solid var(--border);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.brand__title{
  font-weight:800;
  letter-spacing:.2px;
  font-size:16px;
}

.panel{
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  box-shadow: var(--shadow);
}
.panel__title{
  font-weight:700;
  font-size:13px;
  color:var(--muted);
  margin-bottom:10px;
}
.panel__row{
  display:flex;
  gap:8px;
}
.panel__meta{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.token{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:8px;
}
.token__label{font-size:12px;color:var(--muted)}
.token__value{font-weight:800}

.links{display:flex;flex-wrap:wrap;gap:10px;font-size:13px}

.conv-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height: calc(100vh - 360px);
  overflow:auto;
}
.conv{
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  padding:10px;
  border-radius:12px;
  cursor:pointer;
  position: relative;
}
.conv:hover{background: rgba(255,255,255,.05)}
.conv--active{border-color: rgba(34,197,94,.6)}
.conv__title{font-weight:700;font-size:13px;margin-bottom:4px}
.conv__meta{font-size:12px;color:var(--muted);display:flex;justify-content:space-between;gap:8px}
.conv__date{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.conv__menuBtn{
  width:30px;height:30px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
  font-size:18px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.conv__menuBtn:hover{background: rgba(255,255,255,.06)}

.conv__menu{
  position:absolute;
  right:10px;
  top:44px;
  min-width:160px;
  padding:6px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(17,24,39,.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 24px rgba(0,0,0,.35);
  display:none;
  z-index:30;
}
.conv__menu--open{display:block}

.conv__menuItem{
  width:100%;
  text-align:left;
  padding:9px 10px;
  border:0;
  border-radius:10px;
  background: transparent;
  color: var(--text);
  cursor:pointer;
  font-weight:700;
  font-size:13px;
}
.conv__menuItem:hover{background: rgba(255,255,255,.06)}
.conv__menuItem--danger{color:#fca5a5}

.conv__rename{
  display:flex;
  gap:6px;
  align-items:center;
}
.conv__renameInput{
  flex:1;
  min-width:0;
  padding:7px 9px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight:700;
  font-size:13px;
  outline:none;
}
.conv__renameBtn{
  width:32px;height:32px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
  font-weight:900;
}
.conv__renameBtn:hover{background: rgba(255,255,255,.06)}

.main{
  flex:1;
  display:flex;
  flex-direction:column;
  min-width:0;
}

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background: rgba(17,24,39,.72);
  backdrop-filter: blur(8px);
}
.topbar__title{
  font-weight:800;
  font-size:14px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  padding:0 10px;
}
.topbar__right{display:flex;align-items:center;gap:10px}

.chat{
  flex:1;
  overflow:auto;
}
.chat__inner{
  max-width:980px;
  margin:0 auto;
  padding:18px 14px 24px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.msg{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.msg__avatar{
  width:34px;height:34px;border-radius:10px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  font-weight:800;color:var(--muted);
  flex:0 0 auto;
}
.msg__bubble{
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  max-width: calc(100% - 50px);
  white-space:pre-wrap;
  line-height:1.4;
}
.msg--user .msg__avatar{color:#93c5fd}
.msg--user .msg__bubble{
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.25);
}
.msg--assistant .msg__avatar{color:#34d399}
.msg--assistant .msg__bubble{
  background: rgba(34,197,94,.06);
  border-color: rgba(34,197,94,.18);
}
.msg__bubble img{
  max-width:100%;
  border-radius:12px;
  border:1px solid var(--border);
}
.msg__meta{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.composer{
  border-top:1px solid var(--border);
  background: rgba(17,24,39,.72);
  backdrop-filter: blur(8px);
  padding:10px 12px 12px;
}
.composer__row{
  display:flex;
  gap:10px;
  align-items:center;
}
.composer__row + .composer__row{margin-top:10px}
.composer__file{
  color:var(--muted);
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.composer__hint{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
}

textarea{
  width:100%;
  resize:none;
  min-height:44px;
  max-height:180px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
  font-family:var(--sans);
  line-height:1.4;
}
textarea:focus{border-color: rgba(34,197,94,.45)}

.btn{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  color:var(--text);
  background: rgba(255,255,255,.03);
  cursor:pointer;
  font-weight:700;
}
.btn:hover{background: rgba(255,255,255,.06)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  border-color: rgba(34,197,94,.55);
}
.btn-primary:hover{filter:brightness(1.03)}
.btn-ghost{
  background: transparent;
}

.icon-btn{
  width:40px;height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  font-size:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  line-height:1;
}
.icon-btn:hover{background: rgba(255,255,255,.06)}

.select{
  display:flex;
  align-items:center;
  gap:10px;
  position:relative;
}
.select__label{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
}
select{
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
  font-weight:700;
  cursor:pointer;
}
select:hover{background: rgba(255,255,255,.06)}
select:focus{border-color: rgba(34,197,94,.45)}
select option{
  background: var(--panel);
  color: var(--text);
  padding:10px;
  line-height:1.6;
  min-height:48px;
  white-space:pre-line;
  font-size:13px;
}

/* Select personnalisé */
.custom-select{
  position:relative;
  min-width:180px;
  z-index:10;
}
.custom-select__trigger{
  padding:10px 32px 10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  font-weight:700;
  font-size:13px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  transition:background .15s;
  user-select:none;
  -webkit-user-select:none;
  position:relative;
}
.custom-select__trigger:hover{
  background: rgba(255,255,255,.06);
}
.custom-select__trigger::after{
  content:"▼";
  font-size:10px;
  color:var(--muted);
  margin-left:auto;
  padding-left:8px;
  transition:transform .15s;
  flex-shrink:0;
}
.custom-select--open .custom-select__trigger::after{
  transform:rotate(180deg);
}
.custom-select__dropdown{
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  right:0;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,.4);
  z-index:1000;
  max-height:300px;
  overflow-y:auto;
  display:none;
  margin-top:4px;
}
.custom-select--open .custom-select__dropdown{
  display:block;
}
.custom-select__option{
  padding:12px 10px;
  cursor:pointer;
  transition:background .1s;
  border-bottom:1px solid rgba(255,255,255,.03);
  user-select:none;
  -webkit-user-select:none;
}
.custom-select__option:last-child{
  border-bottom:none;
}
.custom-select__option:hover{
  background: rgba(255,255,255,.06);
}
.custom-select__option--selected{
  background: rgba(34,197,94,.1);
}
.custom-select__option-label{
  font-weight:700;
  font-size:13px;
  color:var(--text);
  margin-bottom:4px;
  line-height:1.4;
}
.custom-select__option-price{
  font-size:11px;
  color:var(--muted);
  font-weight:400;
  line-height:1.3;
}

/* Responsive */
@media (max-width: 980px){
  .sidebar{
    position:fixed;
    inset:0 auto 0 0;
    width:min(340px, 92vw);
    transform: translateX(-110%);
    transition: transform .18s ease;
    z-index:20;
  }
  .sidebar.sidebar--open{
    transform: translateX(0);
  }
  #btnSidebarClose{display:inline-flex}
}
@media (min-width: 981px){
  #btnSidebarClose{display:none}
  #btnSidebarOpen{display:none}
}


