/* ============================================================
   responsive-overrides.css — Webapp Chat
   Correctifs responsive et safe-area pour la webapp chat.
   Chargé APRÈS styles.min.css pour surcharger les valeurs compilées.
   Cible : mobile (Samsung, iOS), safe-area, bottom nav, scroll.
   ============================================================ */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-safe-height: calc(var(--header-height) + var(--safe-top));
  --font-family: "Avenir Next", "Nunito Sans", "SF Pro Text", "Segoe UI", sans-serif;
  --ux-focus-ring: oklch(0.7 0.14 242 / 0.5);
  --ux-focus-outline: oklch(0.58 0.16 242);
  --ux-surface-elevated: oklch(0.995 0.003 250 / 0.94);
  --composer-toggle-size: 54px;
  --localo-wordmark-size: clamp(1.24rem, 2.1vw, 1.64rem);
}

/* Fallback theme aliases if backend sends environment only */
html[data-theme="mer"],
body[data-theme="mer"] {
  --localo-primary: oklch(0.57 0.15 248);
  --localo-bg: oklch(0.95 0.013 244);
  --localo-surface: oklch(0.99 0.006 242);
  --localo-accent: oklch(0.73 0.1 175);
}

html[data-theme="montagne"],
body[data-theme="montagne"] {
  --localo-primary: oklch(0.5 0.09 255);
  --localo-bg: oklch(0.95 0.012 250);
  --localo-surface: oklch(0.988 0.006 252);
  --localo-accent: oklch(0.74 0.09 220);
}

html[data-theme="campagne"],
body[data-theme="campagne"] {
  --localo-primary: oklch(0.53 0.12 130);
  --localo-bg: oklch(0.958 0.012 130);
  --localo-surface: oklch(0.987 0.007 125);
  --localo-accent: oklch(0.72 0.11 80);
}

.modern-spinner {
  background: linear-gradient(
    160deg,
    oklch(0.45 0.09 248) 0%,
    oklch(0.58 0.12 240) 52%,
    oklch(0.68 0.1 220) 100%
  );
}

.logo-mini {
  width: min(220px, 56vw);
  height: min(220px, 56vw);
  border-radius: 20px;
  background: transparent;
  padding: 0;
  box-shadow: none;
  margin-bottom: 0.8rem;
}

.logo-mini img {
  object-fit: contain;
}

.logo-mini.has-brand-logo {
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 14px 30px oklch(0.26 0.03 248 / 0.28);
}

.spinner-text p {
  margin-top: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.modern-header {
  background: linear-gradient(
    120deg,
    oklch(0.49 0.1 246) 0%,
    oklch(0.62 0.12 230) 65%,
    oklch(0.73 0.09 210) 100%
  );
}

.brand {
  gap: 0.5rem;
}

.brand-text {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.brand-text h1 {
  margin: 0;
  position: relative;
  font-family: "Avenir Next", "Nunito Sans", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: var(--localo-wordmark-size);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0.014em;
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.16), 0 5px 14px rgba(0, 0, 0, 0.2);
}

.brand-text h1::after {
  content: "";
  position: absolute;
  left: 0.02em;
  bottom: -0.16rem;
  width: 58%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.3) 100%
  );
}

.brand-subtitle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.97);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.brand-subtitle.hidden {
  display: none !important;
}

.header-dashboard-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(4px);
}

.header-dashboard-link:hover {
  background: rgba(255, 255, 255, 0.24);
}

.header-consent-reset {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
}


img,
video,
canvas {
  max-width: 100%;
  height: auto;
}

/* Desktop-first UX refinements */
#chatView,
#reservationView,
.main-view,
.main-changeable-zone {
  margin-top: var(--header-safe-height) !important;
}

#chatView,
#reservationView {
  max-width: min(1200px, calc(100vw - 2rem));
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  #chatView,
  #reservationView {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Unified main-view transitions for menu changes */
#chatView,
#reservationView {
  opacity: 1;
  transform: none;
}

body:not(.reduce-motion) #chatView,
body:not(.reduce-motion) #reservationView {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#chatView.ui-view-entering,
#reservationView.ui-view-entering {
  opacity: 0;
  transform: translateY(10px);
}

#chatView.ui-view-active,
#reservationView.ui-view-active {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  #chatView,
  #reservationView {
    transition: none !important;
    transform: none !important;
  }
}

.message-list {
  padding-inline: 0.3rem;
}

.message-list li {
  border-radius: 14px;
  box-shadow: 0 6px 18px oklch(0.26 0.03 248 / 0.12);
}

/* Messages partenaires: fond légèrement grisé pour ressortir dans la conversation */
.message-list li.role-partenaire {
  border-left-color: oklch(0.62 0.02 250);
  background: linear-gradient(
    135deg,
    oklch(0.995 0.001 250) 0%,
    oklch(0.95 0.003 250) 100%
  );
}

/* Messages par rôle (demande métier): */
.message-list li.role-vacancier {
  border-left-color: oklch(0.84 0.01 248);
  background: oklch(1 0 0);
}

.message-list li.role-employe,
.message-list li.role-employe-velo,
.message-list li.role-employe-navette {
  border-left-color: oklch(0.62 0.14 154);
  background: linear-gradient(
    135deg,
    oklch(0.985 0.01 150) 0%,
    oklch(0.94 0.03 150) 100%
  );
}

.message-list li.role-directeur,
.message-list li.role-adjoint,
.message-list li.role-admin {
  border-left-color: oklch(0.58 0.14 247);
  background: linear-gradient(
    135deg,
    oklch(0.985 0.012 245) 0%,
    oklch(0.93 0.05 245) 100%
  );
}

.message-list li.role-directeur-alert {
  border-left-color: oklch(0.62 0.2 28);
  background: linear-gradient(
    135deg,
    oklch(0.98 0.02 28) 0%,
    oklch(0.9 0.08 28) 100%
  );
}

.message-content {
  max-width: 78ch;
}

#writeZone,
#searchBar {
  width: min(1200px, calc(100vw - 2rem));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border-radius: 16px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--ux-surface-elevated);
  backdrop-filter: blur(14px);
}

#writeZone {
  transition: transform 0.09s cubic-bezier(0.2, 0, 0, 1), opacity 0.07s ease-out;
}

#writeZone.is-collapsed {
  transform: translate(-50%, calc(100% + 20px));
  opacity: 0;
  pointer-events: none;
}

.composer-toggle-button {
  position: fixed;
  right: max(14px, calc(env(safe-area-inset-right, 0px) + 10px));
  bottom: calc(var(--footer-height) + var(--safe-bottom) + 4px);
  width: var(--composer-toggle-size);
  height: var(--composer-toggle-size);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: var(--localo-primary);
  background: linear-gradient(
    135deg,
    color-mix(in oklch, var(--localo-primary) 82%, black 18%) 0%,
    var(--localo-primary) 100%
  );
  color: var(--localo-primary-contrast, #ffffff);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px oklch(0.22 0.05 250 / 0.28);
  z-index: calc(var(--z-write-zone) + 2);
}

.composer-toggle-button:active {
  transform: scale(0.97);
}

/* Masquer le FAB quand une zone commentaire est ouverte */
.comment-zone-open .composer-toggle-button {
  display: none !important;
}

.comments-container .modal-write-zone {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.65rem;
}

.comments-container .modal-write-zone textarea {
  width: 100%;
  min-height: 88px;
  max-height: 180px;
  resize: vertical;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1px solid oklch(0.84 0.02 242);
  background: oklch(0.997 0.002 250);
  line-height: 1.45;
}

.comments-container .modal-write-zone .button-container {
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.comments-container .modal-write-zone .button {
  flex: 0 0 auto;
  min-width: 150px;
}

.comments-list:empty::before {
  content: "Aucun commentaire pour l'instant.";
  display: block;
  padding: 0.65rem 0.2rem;
  color: oklch(0.55 0.02 246);
  font-size: 0.92rem;
}

.comment {
  border-left-width: 4px;
  border-left-color: oklch(0.66 0.13 242);
}

.comment-content {
  color: oklch(0.32 0.03 248);
}

.comment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  gap: 0.5rem;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.comment-time {
  font-size: 0.78rem;
  color: oklch(0.58 0.02 245);
}

/* like-icon est masqué par premium.css (.icon.like-icon { display:none !important })
   spécificité (0,2,0). On doit avoir (0,3,0) pour gagner */
.comment-actions .comment-action.comment-like,
.comment-actions .comment-action.comment-love {
  display: inline-flex !important;
}

/* .icon dans premium.css a background/border vert → on override avec spécificité (0,2,0) + !important */
.comment-actions .comment-action {
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: oklch(0.36 0.03 245) !important;
}

.comment-action {
  border: none;
  background: none;
  color: oklch(0.36 0.03 245);
  border-radius: 999px;
  min-height: unset;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}

.comment-action.active {
  background: none;
  color: oklch(0.36 0.09 152);
}

.comment-action.comment-report {
  border: none;
  background: none;
  color: oklch(0.58 0.02 245);
  opacity: 0.6;
  font-size: 0.72rem;
  padding: 0;
  min-height: unset;
}
.comment-action.comment-report:hover,
.comment-action.comment-report:active {
  opacity: 1;
}

button:focus-visible,
[role="button"]:focus-visible,
.bar-icon:focus-visible,
.icon:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ux-focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ux-focus-ring);
}

.modal-content {
  width: min(92vw, 760px);
  max-width: min(92vw, 760px);
  min-height: min(85vh, 920px);
  max-height: 88vh;
  overflow-y: auto;
}

#mainChangeableZone .main-content {
  width: 100%;
  max-width: 100%;
  min-height: min(85vh, 920px);
  margin: 0;
  box-sizing: border-box;
}

/* Desktop/tablette/mobile: la zone principale ne doit jamais rester bridée à 1200px à gauche */
.main-changeable-zone:not(.hidden) {
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  max-width: none !important;
  align-self: stretch !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
}

.main-changeable-zone[data-content="rules"] .rules-main-container {
  width: min(100%, 1080px);
  margin: 0 auto;
  display: grid;
  gap: 0.7rem;
}

.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
}

.pagination-label {
  font-size: 0.9rem;
  font-weight: 600;
}

#messageInput,
#searchInput,
input,
select,
textarea,
button {
  font-size: 16px;
}

@media (max-width: 1024px) {
  .header-content {
    gap: 0.6rem;
  }

  .slots-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .modern-header {
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    padding-bottom: 0.16rem;
    align-items: flex-end;
  }

  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .brand-text h1 {
    font-size: clamp(1.26rem, 6vw, 1.7rem);
    margin: 0;
    line-height: 1;
    letter-spacing: 0.012em;
  }

  .brand-text h1::after {
    width: 54%;
    bottom: -0.14rem;
  }

  .brand-access-code {
    display: block !important;
    margin-top: 0.06rem;
    font-size: 0.72rem;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    letter-spacing: 0.01em;
    max-width: min(58vw, 280px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-subtitle {
    font-size: 0.72rem;
    min-height: 20px;
    padding: 0.05rem 0.36rem;
  }

  .main-view {
    padding-bottom: calc(86px + var(--safe-bottom));
  }

  #writeZone {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    transform: none;
    bottom: calc(68px + var(--safe-bottom));
  }

  .button,
  .nav-button,
  .bar-icon {
    min-height: 44px;
  }

  .bottom-bar {
    padding-bottom: calc(0.4rem + var(--safe-bottom));
  }

  .bar-icon {
    min-width: 0;
    flex: 1;
  }

  .icon-label {
    font-size: 0.68rem;
  }

  #toast {
    left: 0.5rem;
    right: 0.5rem;
    top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
    min-width: 0;
    max-width: none;
    width: auto;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 92vw;
    max-width: 92vw;
    min-height: 85vh;
    border-radius: 12px;
  }

  #mainChangeableZone .main-content {
    width: 100%;
    max-width: 100%;
    min-height: 85vh;
  }

  .brand-text h1 {
    font-size: clamp(1.2rem, 7.1vw, 1.5rem);
    letter-spacing: 0.01em;
  }

  .brand-text h1::after {
    width: 50%;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-access-code {
    font-size: 0.68rem;
    max-width: min(64vw, 250px);
  }

  .spinner-text p {
    font-size: 0.9rem;
  }

  #messageList {
    padding-inline: 0.4rem;
  }
}

@media (max-width: 360px) {
  .brand-text h1 {
    font-size: 1.16rem;
    letter-spacing: 0.009em;
  }
}

/* Mobile UX hardening: touch targets + readability + less header noise */
@media (max-width: 768px) {
  .header-status {
    display: flex !important;
    align-items: center;
    gap: 0.35rem;
  }

  .header-status .connection-indicator {
    display: none !important;
  }

  .header-content {
    /* Le lien Dashboard (staff) doit rester à droite sur mobile */
    justify-content: space-between;
  }

  .main-view {
    padding-inline: 0.45rem;
  }
}

@media (max-width: 480px) {
  .bottom-bar {
    height: auto;
    min-height: 64px;
    padding: 0.35rem 0.35rem calc(0.4rem + var(--safe-bottom));
  }

  .bar-icon {
    min-height: 46px;
    min-width: 0;
    padding: 0.3rem;
    gap: 0.12rem;
  }

  .bar-icon span:first-child {
    font-size: 1.1rem !important;
  }

  .icon-label {
    font-size: 0.68rem !important;
    line-height: 1.1;
  }

  .message-list {
    padding: 0.45rem 0.35rem calc(190px + var(--safe-bottom)) !important;
  }

  .message-list li {
    padding: 0.7rem !important;
    border-radius: 12px !important;
  }

  .message-content {
    font-size: 0.94rem !important;
    line-height: 1.45 !important;
  }

  .message-footer {
    gap: 0.35rem;
  }

  .icons {
    gap: 0.35rem !important;
  }

  .icon {
    min-height: 36px !important;
    padding: 0.28rem 0.45rem !important;
    font-size: 0.85rem !important;
  }

  .icon-count {
    font-size: 0.78rem !important;
  }

  .date-time {
    font-size: 0.74rem !important;
  }

  #writeZone {
    bottom: calc(64px + var(--safe-bottom)) !important;
    padding: 0.55rem !important;
    min-height: 112px !important;
    max-height: none !important;
    border-radius: 14px 14px 0 0;
  }

  #messageInput {
    min-height: 44px !important;
    max-height: 110px !important;
    font-size: 16px !important;
    padding: 0.7rem 0.85rem !important;
  }

  .character-count {
    font-size: 0.72rem;
    right: 0.6rem;
  }

  .button-container {
    height: auto !important;
    gap: 0.45rem !important;
  }

  .button {
    min-height: 42px !important;
    height: 42px !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
  }

  .comments-container .modal-write-zone textarea {
    min-height: 74px;
  }

  .comments-container .modal-write-zone .button {
    min-width: 124px;
    width: calc(50% - 0.3rem);
  }

  .comment-action {
    min-height: unset;
    padding: 0;
    font-size: 0.78rem;
  }
}

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

/* Read-only mode UX: icones visibles; le consentement est verifie au clic. */

/* Startup/session recovery banner (non-blocking UX) */
.recovery-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(940px, calc(100vw - 1rem));
  background: oklch(0.98 0.01 240 / 0.98);
  border: 1px solid oklch(0.84 0.04 245 / 0.8);
  border-radius: 14px;
  box-shadow: 0 10px 26px oklch(0.22 0.03 248 / 0.2);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.8rem;
  z-index: 2200;
  backdrop-filter: blur(10px);
}

.recovery-banner.show {
  display: flex;
}

.recovery-banner .recovery-content {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.recovery-banner .recovery-title {
  font-size: 0.9rem;
  line-height: 1.2;
}

.recovery-banner .recovery-message {
  font-size: 0.83rem;
  color: oklch(0.42 0.03 245);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recovery-banner .recovery-action {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 0.42rem 0.74rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  color: oklch(0.99 0 0);
  background: oklch(0.61 0.13 242);
}

.recovery-banner.tone-error {
  border-color: oklch(0.69 0.13 28 / 0.85);
}

.recovery-banner.tone-error .recovery-action {
  background: oklch(0.62 0.19 28);
}

/* Chat density / hierarchy simplification */
body.chat-density-balanced .message-list li {
  padding: 0.72rem 0.85rem !important;
  margin-bottom: 0.52rem;
  border-radius: 13px !important;
}

body.chat-density-balanced .message-list li.role-partenaire {
  border-left-color: oklch(0.6 0.02 250);
  background: linear-gradient(
    135deg,
    oklch(0.988 0.001 250) 0%,
    oklch(0.945 0.004 250) 100%
  );
}

body.chat-density-balanced .message-list li.role-vacancier {
  border-left-color: oklch(0.84 0.01 248);
  background: oklch(1 0 0);
}

body.chat-density-balanced .message-list li.role-employe,
body.chat-density-balanced .message-list li.role-employe-velo,
body.chat-density-balanced .message-list li.role-employe-navette {
  border-left-color: oklch(0.62 0.14 154);
  background: linear-gradient(
    135deg,
    oklch(0.985 0.01 150) 0%,
    oklch(0.94 0.03 150) 100%
  );
}

body.chat-density-balanced .message-list li.role-directeur,
body.chat-density-balanced .message-list li.role-adjoint,
body.chat-density-balanced .message-list li.role-admin {
  border-left-color: oklch(0.58 0.14 247);
  background: linear-gradient(
    135deg,
    oklch(0.985 0.012 245) 0%,
    oklch(0.93 0.05 245) 100%
  );
}

body.chat-density-balanced .message-list li.role-directeur-alert {
  border-left-color: oklch(0.62 0.2 28);
  background: linear-gradient(
    135deg,
    oklch(0.98 0.02 28) 0%,
    oklch(0.9 0.08 28) 100%
  );
}

body.chat-density-balanced .message-content {
  margin-bottom: 0.3rem;
  line-height: 1.47 !important;
}

body.chat-density-balanced .message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

body.chat-density-balanced .message-footer .icons {
  display: flex;
  align-items: center;
  gap: 0.34rem !important;
  flex-wrap: wrap;
}

body.chat-density-balanced .message-footer .icon {
  min-height: 34px !important;
  padding: 0.22rem 0.44rem !important;
  border-radius: 999px;
  background: oklch(0.97 0.01 244 / 0.92);
  border: 1px solid oklch(0.87 0.02 244 / 0.9);
}

body.chat-density-balanced .message-footer .icon.secondary-icon {
  opacity: 0.64;
  transform: scale(0.95);
}

body.chat-density-balanced .message-list li:hover .icon.secondary-icon,
body.chat-density-balanced .message-list li:focus-within .icon.secondary-icon {
  opacity: 0.98;
  transform: scale(1);
}

body.chat-density-balanced .message-footer .icon.secondary-icon .icon-label {
  display: none;
}

body.chat-density-balanced .toast {
  width: min(560px, calc(100vw - 1rem));
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%);
  border-radius: 12px;
}

@media (max-width: 768px) {
  .recovery-banner {
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    width: calc(100vw - 0.7rem);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    gap: 0.55rem;
  }

  .recovery-banner .recovery-title {
    font-size: 0.86rem;
  }

  .recovery-banner .recovery-message {
    font-size: 0.78rem;
  }

  body.chat-density-balanced .message-footer .icon.secondary-icon {
    opacity: 0.78;
    transform: none;
  }

  .comment-actions {
    gap: 0.34rem;
  }

  .comment-action {
    min-height: unset;
    min-width: unset;
    padding: 0;
  }
}

@keyframes mobileMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile-first premium tuning: tap comfort + hierarchy + smoother perception */
@media (max-width: 768px) {
  body.chat-density-balanced .message-list li {
    contain: layout paint;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  body.chat-density-balanced .message-list li.message-entering {
    animation: mobileMessageIn 0.22s ease-out both;
  }

  body.chat-density-balanced .message-footer {
    align-items: center;
    gap: 0.5rem;
  }

  body.chat-density-balanced .message-footer .icons {
    gap: 0.44rem !important;
  }

  body.chat-density-balanced .message-footer .icon {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.3rem 0.55rem !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.87rem !important;
    font-weight: 650;
  }

  body.chat-density-balanced .message-footer .icon.primary-icon {
    background: oklch(0.95 0.03 243 / 0.95);
    border-color: oklch(0.79 0.06 242 / 0.8);
  }

  body.chat-density-balanced .message-footer .icon.secondary-icon {
    background: oklch(0.985 0.004 250 / 0.82);
    border-style: dashed;
    opacity: 0.58;
  }

  body.chat-density-balanced .message-footer .date-time {
    margin-inline-start: auto;
    white-space: nowrap;
    font-size: 0.72rem !important;
  }

  body.chat-density-balanced #writeZone {
    box-shadow: 0 -8px 24px oklch(0.22 0.03 248 / 0.16);
  }

  body.chat-density-balanced #toast,
  body.chat-density-balanced .toast {
    top: calc(env(safe-area-inset-top, 0px) + 0.4rem) !important;
    bottom: auto !important;
    width: calc(100vw - 0.85rem) !important;
    border-radius: 11px;
  }
}

/* Action icons: remove oversized circular chips and keep plain icons. */
.message-footer .icon,
body.chat-density-balanced .message-footer .icon,
body.chat-density-balanced .message-footer .icon.primary-icon,
body.chat-density-balanced .message-footer .icon.secondary-icon {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-width: auto !important;
  min-height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Ensure primary action icons (like, comment) are always visible */
.message-footer .icon.like-icon,
.message-footer .icon.comment-icon {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.message-footer .icons,
body.chat-density-balanced .message-footer .icons {
  gap: 0.95rem !important;
}

.message-footer .icon:hover,
body.chat-density-balanced .message-footer .icon:hover {
  background: transparent !important;
  transform: scale(1.06) !important;
}

.message-footer .pin-icon,
body.chat-density-balanced .message-footer .pin-icon {
  color: #9aa0a6 !important;
  filter: grayscale(1) saturate(0) opacity(0.6) !important;
}

.message-footer .pin-icon.pin-active,
body.chat-density-balanced .message-footer .pin-icon.pin-active {
  color: #d32f2f !important;
  filter: none !important;
  opacity: 1 !important;
}

/* Mobile composer UX: clear hierarchy (secondary cancel, compact attach, primary send) */
#writeZone .button-container .button .btn-icon,
#writeZone .button-container .button .btn-label {
  display: inline-flex;
  align-items: center;
}

#writeZone .button-container .button .btn-icon {
  line-height: 1;
  margin-right: 0.34rem;
}

#writeZone .button-container .attach-button .btn-icon {
  margin-right: 0;
}

#writeZone .button-container .cancel-button.is-muted {
  opacity: 0.56;
}

@media (max-width: 768px) {
  #messageInput {
    padding-right: 4.2rem !important;
  }

  #writeZone .button-container {
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
  }

  #writeZone .button-container .cancel-button {
    flex: 0 0 auto;
    min-width: 96px !important;
    padding-inline: 0.7rem !important;
    background: oklch(0.93 0.006 252) !important;
    color: oklch(0.42 0.02 247) !important;
    border: 1px solid oklch(0.84 0.02 248) !important;
    box-shadow: none !important;
  }

  #writeZone .button-container .attach-button {
    flex: 0 0 48px !important;
    width: 48px !important;
    min-width: 48px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    background: oklch(0.94 0.05 230) !important;
    color: oklch(0.39 0.1 238) !important;
    border: 1px solid oklch(0.82 0.04 236) !important;
    box-shadow: none !important;
  }

  #writeZone .button-container .attach-button .btn-label {
    display: none !important;
  }

  #writeZone .button-container .send-button {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #writeZone .button-container .send-button .btn-icon {
    display: none !important;
  }

  #writeZone .button-container .button:disabled {
    opacity: 0.52 !important;
    filter: saturate(0.78);
  }
}

@media (max-width: 380px) {
  #writeZone .button-container .cancel-button {
    min-width: 48px !important;
    width: 48px !important;
    padding-inline: 0 !important;
  }

  #writeZone .button-container .cancel-button .btn-label {
    display: none !important;
  }

  #writeZone .button-container .cancel-button .btn-icon {
    margin-right: 0 !important;
  }
}

.info-media-section {
  margin-bottom: 0.7rem;
}

/* ── Notices légales in-app ── */
.legal-page-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legal-back-btn {
  background: none;
  border: none;
  padding: 0;
  color: oklch(0.42 0.12 230);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  align-self: flex-start;
  margin-bottom: 0.15rem;
}

.legal-back-btn:hover {
  text-decoration: underline;
}

.legal-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: oklch(0.22 0.03 265);
}

.legal-page-body h1 {
  font-size: 1.2rem;
  margin: 0 0 0.75rem;
  color: oklch(0.22 0.03 265);
}

.legal-page-body h2 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
  color: oklch(0.3 0.04 260);
}

.legal-page-body section {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(9,22,43,0.06);
}

.legal-page-body p,
.legal-page-body li {
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0.3rem 0;
  color: oklch(0.28 0.02 260);
}

.legal-page-body ul {
  margin: 0.3rem 0 0.5rem 1.1rem;
}

.legal-page-body a {
  color: #0b7fab;
  text-decoration: none;
}

.legal-page-body a:hover {
  text-decoration: underline;
}

.legal-page-body .badge {
  display: inline-block;
  background: #e8f4fd;
  color: #0b7fab;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 6px;
}

.info-welcome-panel {
  margin-bottom: 0.75rem;
  padding: 0.6rem;
  border: 1px solid oklch(0.86 0.02 242);
  border-radius: 12px;
  background: oklch(0.99 0.008 245);
}

.info-wifi-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.95rem;
}

.info-wifi-line .info-welcome-value {
  font-size: 1.02rem;
  font-weight: 700;
  color: oklch(0.33 0.05 239);
  letter-spacing: 0.02em;
}

.info-welcome-grid {
  display: grid;
  gap: 0.55rem;
}

.info-welcome-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid oklch(0.85 0.02 240);
  border-radius: 10px;
  background: #fff;
  padding: 0.5rem;
}

.info-welcome-card-plan {
  grid-template-columns: 1fr;
}

.info-welcome-card-plan img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid oklch(0.86 0.02 242);
  margin-top: 0.35rem;
}

.info-welcome-icon {
  font-size: 1.1rem;
}

.info-welcome-title {
  font-size: 0.78rem;
  color: oklch(0.42 0.02 247);
}

.info-welcome-value {
  font-size: 1.02rem;
  font-weight: 700;
  color: oklch(0.33 0.05 239);
  letter-spacing: 0.02em;
}

.first-scan-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.info-media-section h4 {
  margin: 0 0 0.45rem;
}

.info-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.55rem;
  align-items: start;
}

.info-media-card {
  margin: 0;
  border: 1px solid oklch(0.86 0.02 242);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.info-media-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  display: block;
  background: oklch(0.96 0.01 240);
}

.info-media-card figcaption {
  padding: 0.35rem 0.45rem 0.45rem;
  font-size: 0.8rem;
  color: oklch(0.34 0.03 243);
}

.info-media-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0 0.45rem 0.45rem;
}

.info-media-card-actions .btn {
  min-height: 34px;
  padding: 0.35rem 0.45rem;
  font-size: 0.74rem;
  line-height: 1.2;
}

.info-media-editor {
  margin-bottom: 0.75rem;
  padding: 0.6rem;
  border: 1px solid oklch(0.87 0.02 245);
  border-radius: 12px;
  background: oklch(0.99 0.005 245);
}

.info-media-editor h4 {
  margin: 0 0 0.35rem;
  font-size: 0.96rem;
}

.info-media-form {
  display: grid;
  gap: 0.45rem;
}

.info-media-form input[type="text"],
.info-media-form input[type="file"] {
  width: 100%;
  min-height: 40px;
}

.info-media-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 420px) {
  .info-media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }
}

@media (min-width: 640px) {
  .info-welcome-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .first-scan-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Mobile floor sizing for startup and child windows (Règles/Infos/QRCode/Réservation). */
@media (max-width: 768px) {
  .modal-content {
    width: min(92vw, 760px) !important;
    max-width: min(92vw, 760px) !important;
    min-height: 85vh !important;
    min-height: 85dvh !important;
  }

  #reservationView.main-view,
  #reservationView,
  #mainChangeableZone .main-content {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .main-changeable-zone,
  #mainChangeableZone .main-content,
  #mainChangeableZone .main-content.main-content {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    overflow-x: hidden !important;
  }

  /* Polissage UI mobile: arrondis internes cohérents sans débordement */
  .info-welcome-panel,
  .info-media-editor {
    border-radius: 14px;
  }

  .info-welcome-card,
  .info-media-card {
    border-radius: 12px;
  }

  .info-media-card img {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
}

.reservation-hub-shell,
.service-reservation-shell {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 14px;
  box-sizing: border-box;
}

.reservation-hub-header,
.service-reservation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.reservation-hub-header h2,
.service-reservation-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.reservation-hub-header p,
.service-reservation-header p {
  margin: 4px 0 0;
  color: #4c5a73;
  font-size: 0.92rem;
  line-height: 1.35;
}

.reservation-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.reservation-service-card {
  border: 1px solid #dce6f8;
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 30, 70, 0.06);
  display: grid;
  gap: 8px;
}

.reservation-service-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reservation-service-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #c9d7f6;
  background: linear-gradient(135deg, #ecf2ff 0%, #f6f9ff 100%);
  color: #204085;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}

.reservation-service-card p {
  margin: 0;
  color: #4e5f7e;
  line-height: 1.35;
  font-size: 0.86rem;
  min-height: 38px;
}

.reservation-service-meta {
  display: grid;
  gap: 4px;
  color: #617090;
  font-size: 0.78rem;
}

.reservation-service-open {
  margin-top: 4px;
}

.reservation-service-empty,
.service-reservation-empty {
  border: 1px dashed #c8d5f0;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: #4f6184;
  background: #f7f9ff;
}

.service-reservation-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-reservation-date-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.service-reservation-date-label {
  text-align: center;
  font-weight: 600;
  color: #1d2f59;
}

.service-reservation-form-section,
.service-reservation-list-section {
  border: 1px solid #dce6f8;
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

.service-reservation-form-section h3,
.service-reservation-list-section h3 {
  margin: 0 0 10px;
  color: #213660;
}

.service-reservation-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.service-reservation-form-grid label,
.service-reservation-form-section > label {
  display: grid;
  gap: 4px;
  font-size: 0.84rem;
  color: #3f5072;
}

.service-reservation-form-grid input,
.service-reservation-form-section textarea {
  border: 1px solid #cbd8f2;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.92rem;
  background: #fff;
}

.service-period-row {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.service-period-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-period-btn.active {
  border-color: #2b6cff !important;
  color: #113f9f !important;
  background: #eaf1ff !important;
}

.service-reservation-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.service-reservation-item {
  border: 1px solid #d9e3f7;
  border-radius: 12px;
  padding: 10px;
  background: #fbfdff;
  display: grid;
  gap: 7px;
  margin-bottom: 9px;
}

.service-reservation-item.mine {
  border-color: #b8cff8;
  background: #f3f7ff;
}

.service-reservation-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.service-reservation-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #516183;
  font-size: 0.8rem;
}

.service-reservation-item-notes {
  margin: 0;
  color: #364763;
  font-size: 0.86rem;
}

.service-reservation-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* UX first: menu bas plus aéré et lisible avec 5 onglets (sans Règles). */
.bottom-bar {
  justify-content: space-evenly;
  gap: 0.2rem;
}

.bottom-bar .bar-icon {
  min-width: 0;
  flex: 1 1 0;
  color: oklch(0.43 0.02 248);
  padding: 0.38rem 0.34rem;
  gap: 0.18rem;
}

.bottom-bar .bar-icon span:first-child {
  font-size: 1.2rem;
  line-height: 1;
}

.bottom-bar .icon-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.08;
  opacity: 1;
}

/* 1er appui sur "+" : modal règles tchat compacte, sans scroll. */
.chat-rules-consent-modal {
  align-items: flex-start;
  padding: 0.25rem;
}

.chat-rules-consent-modal .chat-rules-consent-content {
  width: min(92vw, 560px);
  max-width: min(92vw, 560px);
  min-height: 85vh;
  min-height: 85dvh;
  max-height: 85vh;
  max-height: 85dvh;
  margin: calc(var(--header-height) + 4px) auto 0;
  padding: 0.95rem;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-rules-consent-header {
  margin-bottom: 0.45rem;
}

.chat-rules-consent-header h3 {
  font-size: clamp(1.05rem, 2.6vw, 1.24rem);
}

.chat-rules-consent-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow: hidden;
}

.chat-rules-consent-intro {
  font-size: 0.92rem;
  line-height: 1.32;
  color: #334865;
}

.chat-rules-consent-list {
  margin: 0;
  padding-left: 1.05rem;
  list-style: disc;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.28;
  color: #20324f;
}

.chat-rules-consent-list li {
  list-style: disc;
}

.chat-rules-consent-check {
  margin-top: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.52rem;
  padding: 0.55rem 0.62rem;
  border-radius: 12px;
  border: 1px solid #c7d5ef;
  background: #f5f8ff;
  font-size: 0.9rem;
  line-height: 1.24;
}

.chat-rules-consent-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--localo-primary, #2b6cff);
}

.chat-rules-consent-footer {
  margin-top: 0.52rem;
  text-align: center;
}

.chat-rules-consent-footer .button {
  width: 100%;
  min-height: 44px;
}

.chat-rules-consent-footer .button:disabled {
  opacity: 0.45;
}

.chat-rules-read-only-btn {
  background: none;
  border: none;
  color: var(--localo-text-muted, #888);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-rules-read-only-btn:hover {
  color: var(--localo-text, #444);
}

@media (max-width: 768px) {
  .bottom-bar .bar-icon {
    padding: 0.34rem 0.28rem;
  }

  .bottom-bar .bar-icon span:first-child {
    font-size: 1.16rem;
  }

  .bottom-bar .icon-label {
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  .bottom-bar {
    min-height: 68px;
    padding: 0.34rem 0.28rem calc(0.42rem + var(--safe-bottom));
  }

  .bottom-bar .bar-icon {
    min-height: 48px;
    padding: 0.28rem 0.2rem;
    gap: 0.14rem;
  }

  .bottom-bar .bar-icon span:first-child {
    font-size: 1.16rem !important;
  }

  .bottom-bar .icon-label {
    font-size: 0.72rem !important;
  }

  .chat-rules-consent-modal .chat-rules-consent-content {
    padding: 0.82rem;
    border-radius: 12px;
  }

  .chat-rules-consent-intro {
    font-size: 0.86rem;
  }

  .chat-rules-consent-list {
    font-size: 0.84rem;
    gap: 0.33rem;
    line-height: 1.24;
  }

  .chat-rules-consent-check {
    font-size: 0.84rem;
    padding: 0.5rem 0.55rem;
  }
}

@media (max-width: 360px) {
  .chat-rules-consent-list {
    font-size: 0.8rem;
  }
}

/* Prevent background bleed when QR/Infos overlays are active */
body.main-zone-open #chatView,
body.main-zone-open #reservationView {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.main-zone-open .main-changeable-zone:not(.hidden) {
  z-index: 1200 !important;
  background: #f3f8fc !important;
}

body.main-zone-open .bottom-bar {
  z-index: 1305 !important;
}


/* iOS bottom nav hardening */
@media (max-width: 768px) {
  .main-view,
  .main-changeable-zone,
  #chatView,
  #reservationView {
    margin-bottom: calc(92px + var(--safe-bottom)) !important;
  }

  .bottom-bar {
    height: auto !important;
    min-height: 70px;
    padding: 0.36rem 0.3rem calc(0.52rem + var(--safe-bottom)) !important;
    align-items: flex-end;
  }

  .bottom-bar .bar-icon {
    min-height: 50px;
    padding: 0.3rem 0.22rem;
    justify-content: flex-end;
  }

  .bottom-bar .bar-icon span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.28rem;
    line-height: 1.15;
    overflow: visible;
  }
}


/* Robust bottom-nav glyphs (SVG, no emoji dependency) */
.bottom-bar .bar-icon .bar-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.24rem;
  height: 1.24rem;
  line-height: 1;
}

.bottom-bar .bar-icon .bar-icon-glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* Prevent clipping/deformation of the Signaler icon on narrow mobile widths. */
.bottom-bar .bar-icon .bar-icon-glyph,
.bottom-bar .bar-icon .bar-icon-glyph svg {
  overflow: visible;
}

#issueIcon .bar-icon-glyph {
  width: 1.32rem;
  height: 1.32rem;
}

#issueIcon .bar-icon-glyph svg {
  width: 96%;
  height: 96%;
  stroke-width: 1.9;
}

/* Chat pinned banner: keep it in layout flow to prevent overlap/flashes */
#chatView {
  display: flex;
  flex-direction: column;
}

#chatView > .pinned-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 0.45rem 0 !important;
  padding: 0.45rem 0.5rem !important;
  z-index: 2 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-bottom: 0 !important;
  flex: 0 0 auto;
}

#chatView > #messageList {
  margin-top: 0 !important;
}

#chatView > .pinned-container .pinned-message {
  margin: 0 !important;
  padding: 8px 6px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

#chatView > .pinned-container .pinned-message .message-footer {
  padding-inline: 0 !important;
}

/* Chat footer alignment hardening (mobile):
   keep reaction/report/date on one line to avoid the warning icon jumping above time. */
@media (max-width: 480px) {
  .message-footer,
  body.chat-density-balanced .message-footer {
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
    gap: 0.32rem !important;
  }

  .message-footer .icons,
  body.chat-density-balanced .message-footer .icons {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap !important;
    gap: 0.62rem !important;
  }

  .message-footer .date-time,
  body.chat-density-balanced .message-footer .date-time {
    flex: 0 0 auto;
    margin-inline-start: 0 !important;
    white-space: nowrap;
    line-height: 1 !important;
    align-self: flex-end;
  }

  .message-footer .message-footer-meta,
  body.chat-density-balanced .message-footer .message-footer-meta {
    display: inline-flex !important;
    align-items: flex-end !important;
    gap: 0.34rem;
    margin-inline-start: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .message-footer .message-footer-report,
  body.chat-density-balanced .message-footer .message-footer-report {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1;
  }

  #chatView > .pinned-container .pinned-message {
    padding: 0.7rem !important;
    border-radius: 12px !important;
  }
}

/* iPhone 14/15 standard - 390px */
@media (max-width: 390px) {
  .message-list {
    padding: 8px 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PROFIL & RGPD MODAL
   ═══════════════════════════════════════════════════════════════ */

/* Bouton ouverture dans le header */
#openProfileRgpd {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px 10px;
  opacity: 0.75;
  transition: opacity 0.2s;
  color: inherit;
  line-height: 1;
}
#openProfileRgpd:hover { opacity: 1; }

/* Overlay modal */
.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-modal.hidden { display: none; }

.profile-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.profile-modal__box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}

.profile-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.profile-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a2e;
}

.profile-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.profile-modal__close:hover { background: #f3f4f6; }

/* Onglets */
.profile-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 16px 0;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.profile-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.profile-tab:hover { color: #374151; }
.profile-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  font-weight: 700;
}

/* Feedback */
.profile-feedback {
  margin: 10px 20px 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  min-height: 0;
  display: none;
}
.profile-feedback:not(:empty) { display: block; }
.profile-feedback--success { background: #d1fae5; color: #065f46; }
.profile-feedback--error   { background: #fee2e2; color: #991b1b; }

/* Panneaux */
.profile-panel {
  padding: 20px 24px;
  display: block;
}
.profile-panel.hidden { display: none; }

.profile-panel__desc {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 16px;
  line-height: 1.5;
}

.profile-panel__subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #1a1a2e;
}

/* Champs de formulaire */
.profile-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
}
.profile-field input {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
  background: #fff;
}
.profile-field input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
}

/* Boutons */
.profile-btn {
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.profile-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.profile-btn--primary { background: #4f46e5; color: #fff; }
.profile-btn--primary:hover:not(:disabled) { opacity: 0.9; }
.profile-btn--danger  { background: #ef4444; color: #fff; }
.profile-btn--danger:hover:not(:disabled)  { opacity: 0.85; }

/* RGPD */
.rgpd-rights {
  font-size: 0.84rem;
  color: #374151;
  padding-left: 20px;
  margin: 0 0 16px;
  line-height: 1.7;
  list-style: disc;
}
.rgpd-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.rgpd-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #4f46e5;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  transition: background 0.15s;
}
.rgpd-link:hover { background: #eef2ff; }
.rgpd-actions {
  border-top: 1px solid #fecaca;
  padding-top: 16px;
  margin-top: 4px;
}
.rgpd-actions h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #991b1b;
  margin: 0 0 6px;
}
.rgpd-actions p {
  font-size: 0.83rem;
  color: #6b7280;
  margin: 0 0 12px;
}

/* Responsive mobile */
@media (max-width: 480px) {
  .profile-modal__box {
    border-radius: 8px 8px 0 0;
    max-height: 85vh;
  }
  .profile-modal__overlay {
    align-items: flex-end;
    padding: 0;
  }
  .profile-tab {
    font-size: 0.75rem;
    padding: 8px 4px;
  }
}
