:root {
  --xp-blue: #1c72d2;
  --xp-blue-deep: #0751ad;
  --xp-blue-soft: #d9edff;
  --xp-green: #43a047;
  --xp-green-soft: #dff6d5;
  --xp-red: #c43d3d;
  --xp-orange: #f7a928;
  --xp-ink: #182033;
  --xp-muted: #5b687c;
  --xp-panel: #f2f5fa;
  --xp-silver: #d4d9e3;
  --xp-border: #7b8da8;
  --xp-white: #ffffff;
  --shadow: 0 22px 55px rgba(0, 33, 88, 0.24);
  --font-ui: Tahoma, Verdana, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--xp-ink);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 0;
  background: linear-gradient(180deg, #dceeff 0%, #eaf3fb 45%, #dfe7f2 100%);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
select {
  touch-action: manipulation;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.desktop {
  min-height: 100vh;
  padding: 16px;
  position: relative;
}

.screen {
  position: relative;
  z-index: 1;
}

.home-screen {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 450px);
  align-items: center;
  gap: 38px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.brand-panel {
  max-width: 590px;
  color: #062d62;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 16px;
  box-shadow: 0 10px 24px -10px rgba(0, 191, 255, 0.45);
}

.overline {
  margin: 0 0 4px;
  color: #1b5fae;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-panel h1 {
  margin: 0;
  font-size: 48px;
  line-height: 0.95;
  letter-spacing: 0;
}

.tagline {
  position: relative;
  margin: 16px 0 0;
  padding-top: 14px;
  font-size: 22px;
  font-weight: 700;
}

.tagline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #00bfff, #7bed4f);
}

.intro {
  max-width: 520px;
  margin: 18px 0 0;
  color: #19395c;
  font-size: 16px;
  line-height: 1.55;
}

.home-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.home-stats div {
  min-width: 138px;
  padding: 12px 14px;
  border: 1px solid rgba(7, 81, 173, 0.38);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.home-stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.home-stats span {
  color: #34516b;
  font-size: 12px;
  text-transform: uppercase;
}

.xp-window {
  border: 1px solid #0d3d8b;
  border-radius: 7px 7px 5px 5px;
  background: var(--xp-panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.xp-titlebar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  color: var(--xp-white);
  font-weight: 700;
  background:
    linear-gradient(180deg, #4ea1ff 0%, var(--xp-blue) 46%, var(--xp-blue-deep) 100%);
  border-bottom: 1px solid #073b83;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.window-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: block;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.window-controls {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.window-controls span,
.titlebar-button {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(180deg, #7eb7ff, #1d61bd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-size: 11px;
  line-height: 1;
}

.window-controls span:nth-child(3),
.titlebar-button {
  background: linear-gradient(180deg, #ff9b73, #c43720);
}

.titlebar-button {
  margin-left: auto;
  padding: 0;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.titlebar-button:hover {
  filter: brightness(1.08);
}

.xp-content {
  padding: 18px;
}

.auth-window {
  width: min(450px, 100%);
  justify-self: end;
}

.auth-content {
  background:
    linear-gradient(180deg, #ffffff 0%, #edf5ff 56%, #dcecff 100%);
}

.mini-profile {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: center;
}

.mini-profile h2,
.profile-form h2,
.room-header h2,
.admin-head h1 {
  margin: 0;
  color: #123c77;
  font-size: 22px;
  line-height: 1.15;
}

.mini-profile p,
.profile-form p {
  margin: 7px 0 0;
  color: var(--xp-muted);
  line-height: 1.45;
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-form {
  display: grid;
  gap: 4px;
}

.xp-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid #6f7f93;
  border-radius: 5px;
  color: #162236;
  background: linear-gradient(180deg, #ffffff, #d8deea);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.92), inset -1px -1px 0 rgba(92, 105, 126, 0.24);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.xp-button:hover {
  border-color: #2e75cf;
  background: linear-gradient(180deg, #ffffff, #cfe7ff);
}

.xp-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.xp-button.primary {
  border-color: #0f5aa7;
  color: #fff;
  background: linear-gradient(180deg, #4ca9ff, #1768cb 48%, #0a4da2);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.link-button {
  text-decoration: none;
}

.auth-note {
  margin: 14px 0 0;
  color: #49627c;
  font-size: 12px;
}

.safety-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid #e0b84a;
  border-radius: 6px;
  background: #fff8e0;
  color: #6b4e00;
  font-size: 11px;
  line-height: 1.45;
}

.auth-switch {
  margin-top: 2px;
}

.legal-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 14px 0 4px;
  font-size: 11px;
}

.legal-footer a {
  color: #2b4c73;
  text-decoration: underline;
}

.legal-footer a:hover {
  color: #123c77;
}

.chat-screen {
  min-height: calc(100vh - 32px);
  display: grid;
  place-items: center;
}

.messenger-window {
  width: min(1320px, 100%);
  min-height: 620px;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.messenger-window.wizz-shake {
  animation: wizz-shake 0.55s ease-in-out;
}

@keyframes wizz-shake {
  0%, 100% {
    transform: translateX(0);
  }

  10%, 30%, 50%, 70% {
    transform: translateX(-10px);
  }

  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }

  90% {
    transform: translateX(-4px);
  }
}

.messenger-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  background: #d8e9fb;
}

/*
|--------------------------------------------------------------------------
| BARRE D'OUTILS (toolbar messenger, sous la titlebar)
|--------------------------------------------------------------------------
*/

.app-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 4px 8px;
  background: linear-gradient(180deg, #eef5ff 0%, #dbe8fa 100%);
  border-bottom: 1px solid #9eb7d0;
}

.toolbar-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #23425f;
  font-size: 11px;
  cursor: pointer;
}

.toolbar-button:hover {
  border-color: #a9c3e0;
  background: rgba(255, 255, 255, 0.7);
}

.toolbar-icon {
  font-size: 18px;
  line-height: 1;
}

.toolbar-label {
  white-space: nowrap;
}

.toolbar-status {
  min-width: 108px;
  cursor: default;
}

.toolbar-select {
  width: 100%;
  min-height: 22px;
  padding: 1px 2px;
  border: 1px solid #8fa6c0;
  border-radius: 3px;
  color: #172033;
  background: #fff;
  font-size: 11px;
}

/*
|--------------------------------------------------------------------------
| BARRE DE STATUT (bas de fenêtre)
|--------------------------------------------------------------------------
*/

.window-status-bar {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-top: 1px solid #9eb7d0;
  background: linear-gradient(180deg, #eef5ff, #dde9f9);
  color: #3a5978;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-column {
  min-width: 0;
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid #8aa4c2;
  background:
    linear-gradient(180deg, #f9fdff 0%, #e6f2ff 45%, #d8e9fb 100%);
}

.profile-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #9bb2c8;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.avatar-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.avatar-frame {
  position: relative;
  width: 58px;
  height: 58px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #8094ad;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #cddbeb);
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(0, 0, 0, 0.12);
}

.avatar-frame.large {
  width: 78px;
  height: 78px;
}

.avatar-frame.huge {
  width: 92px;
  height: 92px;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-frame.small {
  width: 36px;
  height: 36px;
  border-radius: 5px;
}

.avatar-frame .presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.avatar-initials {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #0a4da2;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(180deg, #fff, #d7e9ff);
}

.profile-lines {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-lines strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-lines span:last-child {
  color: var(--xp-muted);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  width: fit-content;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid #93a4b8;
  border-radius: 10px;
  color: #213047;
  font-size: 11px;
  font-weight: 700;
  background: #e9edf4;
}

.role-badge.owner {
  border-color: #b88013;
  background: #fff1b8;
}

.role-badge.admin {
  border-color: #a23434;
  background: #ffd9d9;
}

.role-badge.moderator {
  border-color: #6b5fb1;
  background: #e2defd;
}

.field-label {
  display: block;
  margin: 4px 0 -5px;
  color: #284566;
  font-size: 12px;
  font-weight: 700;
}

.xp-input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #7f93ad;
  border-radius: 4px;
  color: #172033;
  background: #fff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.12);
}

.buddy-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid #94abc2;
  border-radius: 5px;
  color: #123c77;
  font-weight: 700;
  background: linear-gradient(180deg, #ffffff, #d8e8f9);
}

.buddy-list {
  min-height: 180px;
  flex: 1 1 auto;
  overflow: auto;
  border: 1px solid #96abc2;
  border-radius: 5px;
  background: #fff;
}

.buddy-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #edf1f5;
}

.buddy-item.me {
  background: #f1f8ff;
}

.buddy-item.clickable {
  cursor: pointer;
}

.buddy-item.clickable:hover,
.buddy-item.clickable:focus-visible {
  background: #eef6ff;
}

.buddy-info-button {
  width: 20px;
  height: 20px;
  border: 1px solid #9aa7b9;
  border-radius: 50%;
  background: #fff;
  color: #5b687c;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.buddy-info-button:hover {
  border-color: #2e75cf;
  color: #0d4da2;
}

.buddy-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.buddy-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #123c77;
  font-size: 12px;
}

.buddy-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--xp-muted);
  font-size: 11px;
}

.presence {
  border-radius: 50%;
}

.presence.online {
  position: absolute;
  background: #26bd52;
}

.presence.online::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(38, 189, 82, 0.65);
  animation: presence-pulse 2s ease-out infinite;
}

@keyframes presence-pulse {
  0% {
    transform: scale(0.75);
    opacity: 0.9;
  }

  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.presence.away {
  background: #f0b429;
}

.presence.busy {
  background: #d93d3d;
}

.presence.invisible {
  background: #8792a0;
}

.side-actions {
  display: grid;
  gap: 8px;
}

.chat-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  background: #eff6ff;
}

/*
 * Positions explicites : quand .announcement-banner est masquee
 * (display:none), elle sort de la grille et l'auto-placement decalerait
 * chaque element suivant d'une ligne — .messages heriterait d'une ligne
 * "auto" (donc grandirait sans limite) et .composer-panel serait ecrase
 * dans la ligne flexible. Fixer chaque enfant a sa ligne evite ce decalage.
 */
.chat-column > .room-header {
  grid-row: 1;
}

.chat-column > .announcement-banner {
  grid-row: 2;
}

.chat-column > .conversation-tabs {
  grid-row: 3;
}

.chat-column > .messages {
  grid-row: 4;
}

.chat-column > .composer-panel {
  grid-row: 5;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #9eb7d0;
  background:
    linear-gradient(180deg, #ffffff 0%, #e9f5ff 100%);
}

.room-header h2 {
  font-size: 24px;
}

.room-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #c7a94f;
  border-radius: 999px;
  color: #6b4e00;
  font-size: 12px;
  font-weight: 700;
  background: #fff3b0;
}

.room-pill.connected {
  border: 1px solid #8ca4bd;
  color: #1b5d2d;
  background: #e2f6df;
}

/*
|--------------------------------------------------------------------------
| SOUVENIR EPINGLE (annonce admin)
|--------------------------------------------------------------------------
*/

.announcement-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #d8c473;
  background: linear-gradient(180deg, #fff8d9, #fdf0b0);
}

.announcement-icon {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1.4;
}

.announcement-body {
  min-width: 0;
  flex: 1 1 auto;
}

.announcement-body p {
  margin: 0;
  color: #5a4400;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.announcement-link {
  display: inline-block;
  margin-top: 4px;
  color: #0d4da2;
  font-size: 11px;
  font-weight: 700;
}

.announcement-video {
  margin-top: 8px;
  max-width: 360px;
  aspect-ratio: 16 / 9;
}

.announcement-video iframe {
  width: 100%;
  height: 100%;
  border: 1px solid #d8c473;
  border-radius: 4px;
}

.announcement-dismiss {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid #d8c473;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  color: #5a4400;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.announcement-dismiss:hover {
  background: #fff;
}

/*
|--------------------------------------------------------------------------
| ONGLETS DE CONVERSATION
|--------------------------------------------------------------------------
*/

.conversation-tabs {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 6px 8px 0;
  overflow-x: auto;
  background: linear-gradient(180deg, #ffffff 0%, #e9f5ff 100%);
  border-bottom: 1px solid #9eb7d0;
}

.conversation-tab,
.conversation-tab-wrapper {
  flex: 0 0 auto;
}

.conversation-tab {
  min-width: 64px;
  max-width: 140px;
  padding: 6px 10px;
  border: 1px solid #9eb7d0;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: #dce9f7;
  color: #34506e;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-tab.active {
  background: #eff6ff;
  color: #123c77;
  box-shadow: inset 0 2px 0 var(--xp-blue);
}

.conversation-tab.unread {
  background: #fff3b0;
  color: #6b4e00;
  animation: tab-glow 1.1s ease-in-out infinite alternate;
}

@keyframes tab-glow {
  from {
    box-shadow: inset 0 0 0 rgba(247, 169, 40, 0);
  }

  to {
    box-shadow: inset 0 0 0 2px rgba(247, 169, 40, 0.9);
  }
}

.conversation-tab-wrapper {
  display: flex;
  align-items: stretch;
  border: 1px solid #9eb7d0;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  overflow: hidden;
  background: #dce9f7;
}

.conversation-tab-wrapper .conversation-tab {
  border: 0;
  border-radius: 0;
  max-width: 110px;
}

.conversation-tab-close {
  padding: 0 7px;
  border: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  color: #5b687c;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.conversation-tab-close:hover {
  color: #a22e2e;
  background: rgba(162, 46, 46, 0.08);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 255, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(125, 166, 207, 0.07) 31px 32px);
}

.chat-message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
  align-items: start;
}

.message-body {
  min-width: 0;
  padding: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.message-header strong {
  color: #123c77;
  font-weight: 700;
}

.message-header strong::after {
  content: " dit :";
  color: var(--xp-muted);
  font-weight: 400;
  font-size: 11px;
}

.message-header time {
  color: var(--xp-muted);
  font-size: 11px;
}

.message-body p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.message-actions {
  margin-top: 6px;
}

.report-button,
.admin-mini-button {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #9aa7b9;
  border-radius: 4px;
  color: #31445b;
  background: linear-gradient(180deg, #fff, #e0e6ef);
  cursor: pointer;
  font-size: 11px;
}

.chat-message.deleted .message-body {
  opacity: 0.65;
  font-style: italic;
}

.chat-message.system-message {
  display: block;
  max-width: 80%;
  margin: 10px auto 14px;
  padding: 8px 14px;
  border: 1px solid #b9c983;
  border-radius: 999px;
  color: #42520e;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: #f7ffd9;
}

.chat-message.system-message .avatar-frame,
.chat-message.system-message .message-header {
  display: none;
}

.composer-panel {
  padding: 12px;
  border-top: 1px solid #9eb7d0;
  background: linear-gradient(180deg, #e5f0fb, #cadcef);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.emoji-picker {
  position: relative;
}

.composer-icon-button {
  min-width: 34px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #8194aa;
  border-radius: 4px;
  background: linear-gradient(180deg, #fff, #dfe6ef);
  cursor: pointer;
  font-size: 16px;
}

.composer-icon-button[aria-expanded="true"] {
  border-color: #0d64c8;
  background: linear-gradient(180deg, #dfeeff, #c7e2ff);
}

.emoji-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: 250px;
  padding: 8px;
  border: 1px solid #7f93ad;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.emoji-popover button {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
}

.emoji-popover button:hover {
  border-color: #a9c3e0;
  background: #eef5ff;
}

.wizz-button {
  border-color: #d98a3d;
  background: linear-gradient(180deg, #ffe3c2, #ffcb8a);
}

.wizz-button:hover {
  background: linear-gradient(180deg, #ffd8a8, #ffbd6f);
}

.wizz-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.composer-image-preview {
  position: relative;
  display: inline-flex;
  margin-bottom: 8px;
}

.composer-image-preview img {
  max-width: 120px;
  max-height: 90px;
  border: 1px solid #8194aa;
  border-radius: 5px;
  object-fit: cover;
}

.composer-image-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border: 1px solid #8194aa;
  border-radius: 50%;
  background: #fff;
  color: #a22e2e;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.message-image {
  display: block;
  max-width: 220px;
  max-height: 220px;
  margin-top: 6px;
  border: 1px solid #9fb1c5;
  border-radius: 6px;
  object-fit: cover;
  cursor: zoom-in;
}

.message-image.large {
  max-width: 320px;
  max-height: 320px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.message-textarea {
  resize: none;
  min-height: 34px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
  font-family: inherit;
}

.send-button {
  min-width: 104px;
}

.form-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: #a22e2e;
  font-size: 12px;
  font-weight: 700;
}

.profile-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 0;
  border: 1px solid #0d3d8b;
}

.profile-dialog::backdrop {
  background: rgba(0, 35, 83, 0.35);
}

.member-dialog {
  width: min(420px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid #0d3d8b;
}

.member-dialog::backdrop {
  background: rgba(0, 35, 83, 0.35);
}

.member-dialog-content {
  display: grid;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff, #edf5ff);
}

.member-dialog-content h2 {
  margin: 0;
  color: #123c77;
  font-size: 18px;
}

.member-dialog-content p {
  margin: 6px 0 0;
  color: var(--xp-muted);
  font-size: 12px;
  line-height: 1.4;
}

.profile-form {
  display: grid;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff, #edf5ff);
}

.password-section {
  display: grid;
  gap: 12px;
  background: linear-gradient(180deg, #edf5ff, #dcecff);
  border-top: 1px solid #b9cbe3;
}

.password-section h2 {
  margin: 0;
  color: #123c77;
  font-size: 18px;
}

.password-section p {
  margin: 0;
  color: var(--xp-muted);
  line-height: 1.4;
}

.profile-edit-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.avatar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-button {
  cursor: pointer;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.avatar-preset {
  height: 78px;
  padding: 5px;
  border: 1px solid #8799ad;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #dfe8f5);
  cursor: pointer;
}

.avatar-preset.selected {
  border-color: #0d64c8;
  box-shadow: 0 0 0 2px rgba(13, 100, 200, 0.18);
}

.avatar-preset img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.action-dialog {
  width: min(420px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid #0d3d8b;
}

.action-dialog::backdrop {
  background: rgba(0, 35, 83, 0.35);
}

.action-dialog-content {
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, #ffffff, #edf5ff);
}

.action-dialog-content p {
  margin: 0;
  color: var(--xp-ink);
  line-height: 1.45;
}

/*
|--------------------------------------------------------------------------
| NOTIFICATIONS
|--------------------------------------------------------------------------
*/

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(320px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  padding: 10px 12px;
  border: 1px solid #0d3d8b;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #e6f2ff);
  box-shadow: var(--shadow);
  color: #123c77;
  font-size: 12px;
  line-height: 1.4;
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/*
|--------------------------------------------------------------------------
| ADMIN
|--------------------------------------------------------------------------
*/

.admin-desktop {
  display: grid;
  place-items: start center;
}

.admin-window {
  width: min(1180px, 100%);
}

.admin-content {
  background: linear-gradient(180deg, #fff, #edf5ff);
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.announcement-panel {
  margin-bottom: 14px;
}

.stat-tile {
  padding: 12px;
  border: 1px solid #9cafc5;
  border-radius: 6px;
  background: #fff;
}

.stat-tile strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.stat-tile span {
  color: var(--xp-muted);
  font-size: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-panel {
  min-width: 0;
  border: 1px solid #9cafc5;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.admin-panel.wide {
  grid-column: 1 / -1;
}

.admin-panel h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #b9c7d7;
  color: #123c77;
  font-size: 16px;
  background: linear-gradient(180deg, #fdfefe, #e0edf9);
}

.admin-list {
  max-height: 330px;
  overflow: auto;
}

.admin-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f5;
}

.admin-row-line {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.admin-row-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/*
|--------------------------------------------------------------------------
| PAGES LEGALES
|--------------------------------------------------------------------------
*/

.legal-desktop {
  display: grid;
  place-items: start center;
  padding-top: 24px;
}

.legal-window {
  width: min(760px, 100%);
}

.legal-content {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  color: var(--xp-ink);
  line-height: 1.55;
}

.legal-disclaimer {
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid #c7a94f;
  border-radius: 6px;
  background: #fff8e0;
  color: #6b4e00;
  font-size: 12px;
}

.legal-content h1 {
  margin: 0 0 14px;
  color: #123c77;
  font-size: 26px;
}

.legal-content h2 {
  margin: 22px 0 8px;
  color: #123c77;
  font-size: 16px;
}

.legal-content p {
  margin: 0 0 10px;
  font-size: 13px;
}

.legal-content ul {
  margin: 0 0 10px;
  padding-left: 20px;
  font-size: 13px;
}

.legal-content li {
  margin-bottom: 4px;
}

.legal-content a {
  color: #0d4da2;
  text-decoration: underline;
}

.legal-table {
  width: 100%;
  margin: 8px 0 16px;
  border-collapse: collapse;
  font-size: 12px;
}

.legal-table th,
.legal-table td {
  padding: 8px;
  border: 1px solid #c8d3e2;
  text-align: left;
  vertical-align: top;
}

.legal-table th {
  background: #e9f1fb;
  color: #123c77;
}

.legal-content > .xp-button {
  margin-top: 12px;
}

/*
|--------------------------------------------------------------------------
| MOUVEMENT REDUIT
|--------------------------------------------------------------------------
*/

@media (prefers-reduced-motion: reduce) {
  .presence.online::after,
  .conversation-tab.unread,
  .messenger-window.wizz-shake,
  .toast {
    animation: none;
  }
}

/*
|--------------------------------------------------------------------------
| RESPONSIVE
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {
  .desktop {
    padding: 14px;
  }

  .home-screen {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    align-content: start;
    padding-top: 16px;
  }

  .brand-panel h1 {
    font-size: 38px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }

  .tagline {
    font-size: 18px;
  }

  .intro {
    font-size: 14px;
  }

  .auth-window {
    order: 1;
    justify-self: stretch;
  }

  .brand-panel {
    order: 2;
  }

  .chat-screen {
    min-height: calc(100vh - 28px);
    place-items: stretch;
  }

  .messenger-window {
    min-height: 0;
    height: calc(100vh - 28px);
  }

  .messenger-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    position: relative;
  }

  .mobile-only {
    display: flex !important;
  }

  .app-toolbar {
    padding: 3px 4px;
  }

  .toolbar-button {
    min-width: 48px;
    font-size: 10px;
  }

  .toolbar-status {
    min-width: 82px;
  }

  .window-status-bar {
    font-size: 10px;
  }

  .profile-column {
    border-right: 0;
    border-bottom: 1px solid #8aa4c2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 142px;
    align-items: start;
  }

  .profile-card {
    grid-column: 1 / -1;
  }

  .buddy-header,
  .buddy-list {
    display: none;
  }

  .profile-column.members-open {
    grid-template-columns: 1fr;
    position: absolute;
    inset: 0;
    z-index: 30;
    overflow: auto;
  }

  .profile-column.members-open .buddy-header,
  .profile-column.members-open .buddy-list {
    display: flex;
  }

  .profile-column.members-open .buddy-header {
    display: flex;
  }

  .profile-column.members-open .buddy-list {
    display: block;
    max-height: none;
  }

  .side-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-header {
    padding: 10px 12px;
  }

  .room-header h2 {
    font-size: 18px;
  }

  .messages {
    padding: 10px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }

  .admin-stats,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-panel.wide {
    grid-column: auto;
  }

  .admin-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13px;
  }

  .desktop {
    padding: 8px;
  }

  .home-screen {
    gap: 12px;
  }

  .brand-panel h1 {
    font-size: 32px;
  }

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

  .intro {
    display: none;
  }

  .home-stats {
    gap: 8px;
  }

  .home-stats div {
    min-width: calc(50% - 4px);
  }

  .xp-titlebar {
    min-height: 32px;
    font-size: 12px;
  }

  .mini-profile,
  .profile-edit-head {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .profile-column {
    grid-template-columns: 1fr;
  }

  .side-actions {
    grid-template-columns: 1fr;
  }

  .profile-card {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .profile-card .avatar-frame {
    width: 52px;
    height: 52px;
  }

  .room-pill {
    display: none;
  }

  .chat-message {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .chat-message .avatar-frame {
    width: 34px;
    height: 34px;
  }

  .emoji-popover {
    width: min(220px, calc(100vw - 24px));
    grid-template-columns: repeat(6, 1fr);
  }

  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toast-stack {
    left: 8px;
    right: 8px;
    max-width: none;
  }
}
