/* SilverTiger Support — interface épurée, chat plein écran, police normale */
:root {
  --paper: #FAF7F2;
  --cloud: #F1ECE4;
  --hair:  #E7E0D6;
  --ink:   #1C1A17;
  --slate: #6B665E;
  --mist:  #9A938A;
  --accent:#2E2B52;
  --danger:#A6403A;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(28, 26, 23, 0.06);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
a { color: var(--accent); }

/* ---------------- En-tête ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}
.hd-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.brand {
  font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink);
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); flex: none; }
.hd-logo, .hd-emoji { width: 38px; height: 38px; border-radius: 10px; flex: none; object-fit: cover; }
.hd-emoji { display: grid; place-items: center; font-size: 20px; background: var(--cloud); }
.hd-text { min-width: 0; }
.hd-title { font-weight: 700; font-size: 1.02rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-sub { color: var(--slate); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-right { display: flex; align-items: center; gap: 10px; flex: none; }
#humanBtn { white-space: nowrap; }
.back { color: var(--slate); text-decoration: none; font-size: .88rem; }
.back:hover { color: var(--accent); }

/* ---------------- Zone de chat plein écran ---------------- */
.chat-area { flex: 1; display: flex; justify-content: center; min-height: 0; }
.messages {
  flex: 1; max-width: 760px; width: 100%;
  overflow-y: auto; padding: 26px 20px;
  display: flex; flex-direction: column; gap: 14px;
}

.msg { max-width: 86%; padding: 11px 15px; border-radius: 16px; word-wrap: break-word; font-size: .96rem; }
.msg.bot  { background: var(--cloud); color: var(--ink); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg.user { background: var(--accent); color: #F4F1EA; border-bottom-right-radius: 5px; align-self: flex-end; }
.msg.user a { color: #fff; }
.msg-who { font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .6; margin-bottom: 4px; }

.msg p { margin: 0 0 .5em; }
.msg p:last-child { margin-bottom: 0; }
.msg strong { font-weight: 700; }
.msg em { font-style: italic; }
.msg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: rgba(28,26,23,.07); padding: 1px 5px; border-radius: 5px; }
.msg.user code { background: rgba(255,255,255,.18); }
.msg ul, .msg ol { margin: .35em 0; padding-left: 1.25em; }
.msg li { margin: .15em 0; }
.msg blockquote { margin: .4em 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--hair); color: var(--slate); }
.msg.user blockquote { border-left-color: rgba(255,255,255,.4); color: #E9E4DA; }
.msg a { text-decoration: underline; }

.refund-link {
  display: inline-block; margin-top: 8px;
  background: var(--accent); color: #F4F1EA !important;
  padding: 9px 15px; border-radius: 11px; font-weight: 600; text-decoration: none !important;
}
.msg.user .refund-link { background: #fff; color: var(--accent) !important; }

.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--mist); animation: blink 1.2s infinite both; }
.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} }

.msg-system {
  align-self: center; text-align: center; max-width: 92%;
  font-size: .82rem; color: var(--slate); background: var(--cloud);
  padding: 8px 14px; border-radius: 12px;
}

/* Sélecteur d'app */
.app-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.app-choice {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); border: 1px solid var(--hair); border-radius: 13px;
  padding: 11px; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  transition: border-color .12s ease, transform .12s ease;
}
.app-choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.app-choice img, .app-choice .emoji { width: 40px; height: 40px; border-radius: 10px; flex: none; object-fit: cover; }
.app-choice .emoji { display: grid; place-items: center; font-size: 21px; background: var(--cloud); }
.app-choice .nm { font-weight: 650; font-size: .95rem; }
.app-choice .tg { color: var(--slate); font-size: .78rem; }
@media (max-width: 520px) { .app-picker { grid-template-columns: 1fr; } }

/* Dock bas : actions rapides + saisie */
.dock { border-top: 1px solid var(--hair); background: var(--paper); }
.dock-inner { max-width: 760px; margin: 0 auto; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick button { background: #fff; border: 1px solid var(--hair); color: var(--ink); padding: 7px 13px; border-radius: 20px; font-size: .85rem; cursor: pointer; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--hair); border-radius: 13px;
  padding: 11px 14px; font: inherit; background: #fff; color: var(--ink); max-height: 120px;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer textarea:disabled { background: var(--cloud); color: var(--mist); }

.btn {
  background: var(--accent); color: #F4F1EA; border: none; border-radius: 13px;
  padding: 11px 20px; font-weight: 600; cursor: pointer; font-size: .95rem; font-family: var(--sans);
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--hair); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { display: block; width: 100%; padding: 13px; }
.btn.small { padding: 8px 14px; font-size: .85rem; }

/* ---------------- Admin ---------------- */
.container { max-width: 760px; margin: 0 auto; padding: 26px 20px 48px; width: 100%; }
.panel { background: #fff; border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-bottom: 20px; }
.panel h2 { margin-top: 0; font-weight: 700; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field .hint { color: var(--slate); font-size: .82rem; margin-top: 4px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--hair); border-radius: 11px; padding: 10px 12px; font: inherit; background: var(--paper); color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 160px; resize: vertical; }
.field code, .hint code { background: var(--cloud); padding: 1px 5px; border-radius: 5px; font-size: .85em; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; }

.alert { padding: 12px 16px; border-radius: 11px; margin-bottom: 18px; font-size: .92rem; }
.alert.ok  { background: #EAF0E6; color: #3D6B2E; }
.alert.err { background: #F6E5E4; color: var(--danger); }

.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--hair); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.admin-list .app-logo, .admin-list .app-emoji { width: 40px; height: 40px; border-radius: 10px; flex: none; object-fit: cover; }
.admin-list .app-emoji { display: grid; place-items: center; font-size: 21px; background: var(--cloud); }
.admin-list .meta { flex: 1; }
.admin-list .meta strong { display: block; }
.admin-list .meta span { color: var(--slate); font-size: .85rem; }
.badge { font-size: .72rem; padding: 3px 8px; border-radius: 20px; background: var(--cloud); color: var(--slate); }
.badge.on { background: #EAF0E6; color: #3D6B2E; }

/* Bandeau légal très discret (bas du chat) */
.legal-strip { text-align: center; margin-top: 9px; font-size: .72rem; }
.legal-strip a { color: var(--mist); text-decoration: none; }
.legal-strip a:hover { color: var(--slate); text-decoration: underline; }

/* Pages légales */
.legal { max-width: 720px; margin: 0 auto; padding: 30px 20px 60px; width: 100%; }
.legal h1 { font-size: 1.7rem; margin: 0 0 4px; }
.legal .updated { color: var(--slate); font-size: .85rem; margin: 0 0 26px; }
.legal h2 { font-size: 1.15rem; margin: 34px 0 10px; padding-top: 14px; border-top: 1px solid var(--hair); }
.legal h3 { font-size: 1rem; margin: 20px 0 6px; }
.legal p, .legal li { color: var(--ink); font-size: .95rem; }
.legal p { margin: 0 0 12px; }
.legal ul, .legal ol { margin: 0 0 12px; padding-left: 1.3em; }
.legal li { margin: 5px 0; }
.legal .toc { background: var(--cloud); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 18px; margin-bottom: 8px; }
.legal .toc a { display: inline-block; margin-right: 14px; font-size: .9rem; }
.legal .warn { background: #F6EFE1; border: 1px solid #E7D8BC; border-radius: 12px; padding: 12px 16px; margin: 0 0 12px; }
.legal hr { border: none; border-top: 1px solid var(--hair); margin: 30px 0 14px; }
.legal .fine { color: var(--mist); font-size: .82rem; }
.legal .addr { background: var(--cloud); border-radius: 10px; padding: 12px 16px; }

.auth-box { max-width: 400px; margin: 8vh auto 0; width: 100%; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.center { text-align: center; }
.muted { color: var(--slate); }

/* ---------------- Mobile ---------------- */
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 8px; }
  .hd-logo, .hd-emoji { width: 34px; height: 34px; }
  .hd-title { font-size: .95rem; }
  .hd-sub { font-size: .76rem; }
  .brand { font-size: 1rem; }
  .hd-right { gap: 8px; }
  .btn.small { padding: 7px 11px; font-size: .8rem; }
  .messages { padding: 18px 14px; }
  .dock-inner { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
  .msg { max-width: 90%; }
  .container { padding: 20px 14px 40px; }
  .panel { padding: 20px; }
  .legal { padding: 24px 16px 48px; }
}
