/* ------------------------------------------------------------------ v2 : avatars, chat, relief */

.avatar {
  position: relative;
  overflow: hidden;
  padding: 0;
  flex: none;
}
.avatar .ini {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar.hermy { border-color: rgba(249, 115, 22, 0.55); box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25); }

/* relief discret sur les cartes */
.feed-item,
.agent-card,
.event .body,
.month-card {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0));
  box-shadow: 0 10px 26px -18px rgba(0, 0, 0, 0.9);
}

.hero { position: relative; }
.hero::before {
  content: "";
  position: absolute;
  left: -50px;
  top: -40px;
  width: 300px;
  height: 220px;
  background: radial-gradient(60% 60% at 30% 40%, rgba(249, 115, 22, 0.17), transparent 72%);
  filter: blur(8px);
  pointer-events: none;
  z-index: -1;
}
.hero h1 { letter-spacing: -0.03em; }
.hero-chat { padding-bottom: 6px; }

/* bandeau d'agents */
.agent-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 14px;
  margin: 0 -4px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 94%, transparent 100%);
}
.agent-strip::-webkit-scrollbar { display: none; }

.agent-pick {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.agent-pick .avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid var(--line);
  filter: saturate(0.5) brightness(0.72);
  transition: filter 0.22s, box-shadow 0.22s, transform 0.22s;
}
.agent-pick.active { color: var(--text); font-weight: 600; }
.agent-pick.active .avatar {
  filter: none;
  box-shadow: 0 0 0 2px var(--orange), 0 10px 24px -10px rgba(249, 115, 22, 0.6);
  transform: translateY(-1px);
}
.agent-pick .pulse {
  position: absolute;
  top: 1px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { opacity: 0.35; } }

/* fil de conversation */
.chat-view { padding-bottom: 92px; }
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg .msg-av {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line);
}
.msg .bubble {
  position: relative;
  max-width: 82%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 6px;
  padding: 10px 13px 19px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg .bubble .t {
  position: absolute;
  right: 10px;
  bottom: 5px;
  font-size: 9.5px;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}
.msg.me { justify-content: flex-end; }
.msg.me .bubble {
  background: var(--orange);
  border-color: transparent;
  color: #1c1917;
  border-radius: 16px 16px 6px 16px;
  font-weight: 450;
}
.msg .bubble.err {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  font-size: 12.5px;
  padding: 9px 12px;
}
.msg .bubble.err .t { display: none; }

.dots3 { display: inline-flex; gap: 4px; align-items: center; margin-right: 8px; }
.dots3 i { width: 5px; height: 5px; border-radius: 50%; background: var(--orange); animation: dot-bounce 1.1s infinite; }
.dots3 i:nth-child(2) { animation-delay: 0.15s; }
.dots3 i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-3px); opacity: 1; } }

/* composeur */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 12px;
  background: linear-gradient(180deg, rgba(19, 16, 16, 0), rgba(19, 16, 16, 0.94) 38%);
}
.composer input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px 16px;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s;
}
.composer input:focus { border-color: rgba(249, 115, 22, 0.55); }
.composer input::placeholder { color: #6f6661; }
.composer .send {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--orange);
  color: #1c1917;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}
.composer .send:disabled { opacity: 0.4; }
.composer .send:active { transform: scale(0.94); }
.composer .send svg { width: 19px; height: 19px; }

@media (min-width: 900px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  .topbar { order: 0; }
  .tabbar {
    order: 1;
    position: static;
    margin: 4px auto 10px;
    bottom: auto;
  }
  main {
    order: 2;
    flex: 1;
    width: 100%;
  }
  .composer {
    bottom: 18px;
    max-width: 728px;
    margin: 0 auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(23, 19, 17, 0.94);
    backdrop-filter: blur(14px);
  }
  .chat-view { padding-bottom: 120px; }
}

/* cinq onglets : resserrer */
.tab { font-size: 10px; }
@media (min-width: 900px) { .tab { font-size: 12.5px; } }

/* écran d'accès */
#gate, #security {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(249, 115, 22, 0.12), transparent 60%), var(--bg);
}
#gate form, #security form {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 22px 18px;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
}
#gate h2, #security h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -0.02em;
}
#gate p, #security p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
#gate input {
  width: 100%;
  background: #161211;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
#gate input:focus { border-color: rgba(249, 115, 22, 0.6); }
.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--orange);
  color: #1c1917;
  font-size: 14px;
  font-weight: 620;
  padding: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.primary-btn:disabled { opacity: 0.55; }
.ghost-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  padding: 11px;
  cursor: pointer;
  margin-top: 8px;
}
.ghost-btn:hover { border-color: #4a423c; }
.gate-msg {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.gate-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.gate-sep::before, .gate-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
#captcha-slot { margin-bottom: 12px; display: flex; justify-content: center; min-height: 0; }
