/* ==================================================================
   BarJ — feuille de style
   Les couleurs sont des variables CSS ; admin/site.php peut les
   modifier (elles sont injectées en inline dans includes/header.php).
================================================================== */

:root {
  --bg: #14110D;
  --panel: #1C1814;
  --panel-light: #262019;
  --sidebar-bg: #15110B;
  --border: #3A2F23;
  --text: #EDE6DA;
  --text-muted: #A39C8E;
  --text-dim: #6B6255;
  --rust: #D9591C;
  --toxic: #7C9A3D;
  --steel: #5E6B73;
  --danger: #B23A2E;
  --action-btn: #D9591C;
  --mention: #D9591C;
  --chat-own-bg: #D9591C;
  --chat-other-bg: #262019;
  --chat-bg: #1C1814;
  --chat-bubble: #D9591C;
  --back-btn-bg: #262019;
  --on-accent: #15110B;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: 'Rajdhani', sans-serif; margin: 0; }
img { max-width: 100%; }

.bg-image-layer {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
}
.bg-overlay-layer {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg); opacity: 0.85;
}

/* ---------- Layout ---------- */
.app-shell { position: relative; z-index: 25; display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 30;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-brand-text { min-width: 0; overflow: hidden; }
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rust), var(--toxic));
  color: var(--on-accent); font-weight: 700;
}
.sidebar-brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-tagline { font-size: 12px; color: var(--text-muted); white-space: pre-line; overflow-wrap: break-word; line-height: 1.4; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; min-height: 0; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); border-left: 3px solid transparent;
  margin-bottom: 4px; background: none; border-top: none; border-right: none; border-bottom: none;
  text-align: left; cursor: pointer;
}
.sidebar-link.active { background: var(--panel-light); color: var(--text); border-left-color: var(--rust); }
.sidebar-link:hover { color: var(--text); }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-icon { display: inline-flex; align-items: center; }
.nav-icon svg { display: block; }
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; color: currentColor; }
.sidebar-admin { padding: 8px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sidebar-presence { padding: 14px 20px; border-top: 1px solid var(--border); position: relative; flex-shrink: 0; }

.main-col { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; margin-left: 260px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.main-content { flex: 1; padding: 24px 32px; }
.main-content-full { padding: 16px !important; max-width: none; }

.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 8px; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 14px;
}
.popup-panel { display: none; }
.popup-panel.open { display: block; }
.user-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 220px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; z-index: 40;
}
.user-menu-dropdown a, .user-menu-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px;
  font-size: 14px; background: none; border: none; text-align: left; cursor: pointer; color: var(--text);
}
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: var(--panel-light); }
.user-menu-dropdown .danger { color: var(--danger); border-top: 1px solid var(--border); }

/* ---------- Présence en ligne (dans la barre latérale) ---------- */
.sidebar-presence-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 0;
  background: none; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; text-align: left;
}
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--toxic); display: inline-block; animation: online-pulse 2s infinite; flex-shrink: 0; }
@keyframes online-pulse {
  0% { box-shadow: 0 0 0 0 rgba(124,154,61,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(124,154,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,154,61,0); }
}
.online-panel {
  position: absolute; left: 20px; bottom: calc(100% + 4px); width: 220px; max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); z-index: 46;
}
.online-panel-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }

/* ---------- Avatars / badges ---------- */
.avatar { border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-light); color: var(--text-muted); font-weight: 700;
}
.rank-badge { display: inline-flex; align-items: center; gap: 6px; }
.rank-dot { display: inline-block; border-radius: 50%; border: 1px solid; flex-shrink: 0; }
.rank-label { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; font-family: 'Rajdhani', sans-serif; }

/* ---------- Panels / cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.empty-state { padding: 24px 0; text-align: center; color: var(--text-dim); font-size: 14px; }
.row-line { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.row-line:last-child { border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600; border: none; cursor: pointer;
  font-family: inherit;
}
.btn-rust { background: var(--rust); color: var(--on-accent); }
.btn-action { background: var(--action-btn); color: var(--on-accent); }
.btn-toxic { background: var(--toxic); color: var(--on-accent); }
.btn-steel { background: var(--steel); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-back { background: var(--back-btn-bg, var(--panel-light)); color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.icon-btn { background: none; border: none; padding: 6px; border-radius: 6px; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel-light); }
.icon-btn.danger { color: var(--danger); }
.power-stepper { display: inline-flex; align-items: center; gap: 8px; }
.power-btn {
  width: 24px; height: 24px; border-radius: 6px; background: var(--panel-light); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.power-btn:hover { background: var(--rust); color: #fff; }
.power-value { min-width: 56px; display: inline-block; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.sortable-th { cursor: pointer; user-select: none; position: relative; }
.sortable-th:hover { color: var(--text); }
.sortable-th::after { content: '\2195'; opacity: 0.35; margin-left: 4px; font-size: 11px; }
.sortable-th.sort-asc::after { content: '\2191'; opacity: 1; color: var(--rust); }
.sortable-th.sort-desc::after { content: '\2193'; opacity: 1; color: var(--rust); }
.crop-viewport {
  width: 220px; height: 220px; border-radius: 50%; overflow: hidden; position: relative;
  background: var(--bg); border: 2px dashed var(--border); cursor: grab; touch-action: none; user-select: none;
}
.crop-active .crop-viewport { cursor: move; border-style: solid; border-color: var(--rust); }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; max-width: 220px; }
.crop-hint { font-size: 11px; color: var(--text-dim); margin-top: 6px; max-width: 220px; }
.discord-badge {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 999px; background: #5865F2; flex-shrink: 0; transition: filter 0.15s ease;
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.discord-badge:hover { filter: brightness(1.15); }

/* ---------- Forms ---------- */
label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=email], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text); font-family: inherit;
}
textarea { resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 19px; height: 19px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: 5px; background: var(--bg); cursor: pointer;
  position: relative; vertical-align: middle; margin: 0;
}
input[type=checkbox]:checked { background: var(--rust); border-color: var(--rust); }
input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 10px;
  border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=checkbox]:disabled { opacity: 0.4; cursor: not-allowed; }

/* Supprime les flèches d'incrément/décrément des champs numériques partout sur le site. */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.no-spin::-webkit-inner-spin-button, .no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.no-spin { -moz-appearance: textfield; appearance: textfield; }

/* Grille de formulaire admin compacte et alignée (générateur de carte, etc.) */
.map-admin-grid { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.map-admin-grid .field { margin-bottom: 0; min-width: 140px; }
.map-admin-grid .field.field-sm { min-width: 76px; max-width: 90px; }
.map-admin-grid .field label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.map-admin-grid .field input[type=text],
.map-admin-grid .field input[type=number],
.map-admin-grid .field input[type=file] { width: 100%; padding: 7px 8px; font-size: 13px; box-sizing: border-box; }
.map-admin-grid .field input[type=color] { width: 100%; height: 34px; padding: 2px; }
.map-admin-submit { align-self: flex-end; min-width: auto !important; }
.input-sm { padding: 5px 6px !important; font-size: 13px; }

/* ---------- Interrupteur à glissière (rouge/vert) ---------- */
.slide-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.slide-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slide-switch .slide-track {
  position: absolute; inset: 0; cursor: pointer; background: var(--danger);
  border-radius: 999px; transition: background .18s ease; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.slide-switch .slide-track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.slide-switch input:checked + .slide-track { background: var(--toxic); }
.slide-switch input:checked + .slide-track::before { transform: translateX(20px); }
.slide-switch input:focus-visible + .slide-track { outline: 2px solid var(--rust); outline-offset: 2px; }
.pseudo-toggle-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pseudo-toggle-wrap .toggle-label { font-size: 12px; color: var(--text-dim); transition: color .18s ease; }
.pseudo-toggle-wrap .toggle-label.is-active { color: var(--text); font-weight: 600; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 500; }
td.num, th.num { text-align: right; font-family: 'JetBrains Mono', monospace; }
td.center, th.center { text-align: center; }
.table-wrap { overflow-x: auto; }
.hover-row { transition: background-color .12s ease; }
.hover-row:hover { background: #26344a; }
.calc-row { background: var(--panel); }
.calc-row:hover { background: #26344a; }
.members-row-own { background: rgba(184,146,74,.14); }
.members-row-own:hover { background: rgba(184,146,74,.22); }
.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }

/* ---------- Pills / chips ---------- */
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.pill-light { background: var(--panel-light); color: var(--text-muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); cursor: pointer; }
.chip.active { background: var(--toxic); color: var(--on-accent); }

/* ---------- Modals ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5,8,12,0.7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal-box.wide { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- Lightbox (agrandissement d'image) ---------- */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(5,8,12,0.88); z-index: 60;
  display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 100%; max-height: 90vh; border-radius: 8px; cursor: zoom-in; }
.lightbox-overlay img.zoomed { max-width: none; max-height: none; width: 190%; cursor: zoom-out; border-radius: 0; }
.lightbox-overlay:has(img.zoomed) { align-items: flex-start; justify-content: flex-start; }
.lightbox-overlay { overflow: auto; }
[data-lightbox] { cursor: zoom-in; }

/* ---------- Tabs (administration) ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); cursor: pointer; }
.tab-btn.active { background: var(--panel-light); color: var(--text); }

/* ---------- Rich text content ---------- */
.rt-content { font-size: 14px; line-height: 1.6; color: #D9CFC0; }
.rt-content.text-xs { font-size: 12px; }
.rt-content img { max-width: min(220px, 100%); max-height: 220px; width: auto; height: auto; border-radius: 8px; margin: 8px 0; display: block; cursor: zoom-in; object-fit: cover; }
.rt-content p { margin: 0 0 8px 0; }
.rt-toolbar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rt-toolbar-sticky { position: sticky; top: 0; z-index: 15; background: var(--panel); padding: 6px 0; }
.rt-toolbar button { background: var(--panel-light); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.rt-editor {
  min-height: 220px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 14px;
}
.rt-editor.rt-editor-tall { min-height: 380px; }
.rt-editor:focus { outline: 1px solid var(--rust); }

/* ---------- Gazette / Ressource image ---------- */
.gazette-comments-sep, .comments-sep {
  display: flex; align-items: center; gap: 10px; margin: 24px 0 0;
  text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; color: var(--text-dim);
}
.gazette-comments-sep::after, .comments-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.gazette-comments-box, .comments-box { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-top: 12px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.gallery-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-light); }
.gazette-images-grid { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.gazette-images-grid img { flex:1; min-width:200px; max-height:460px; object-fit:contain; }
.gallery-item {
  display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; transition: border-color 0.15s ease;
}
.gallery-item:hover { border-color: var(--rust); }
.gallery-caption { font-size: 11px; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }

/* ---------- Logo image (Identité du site) ---------- */
.sidebar-logo-img {
  width: 100px; height: 100px; object-fit: cover; border-radius: 6px; flex-shrink: 0;
}

/* ---------- Mode maintenance ---------- */
.maintenance-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  background: linear-gradient(90deg, var(--danger), var(--rust));
  color: #fff; text-align: center; font-size: 13px; font-weight: 600;
  padding: 8px 12px;
}
.app-shell.with-maintenance-banner { padding-top: 38px; }
.app-shell.with-maintenance-banner .sidebar { top: 38px; height: calc(100vh - 38px); }

/* ---------- Chat de l'alliance ---------- */
.chat-widget { position: fixed; right: 20px; bottom: 46px; z-index: 80; }
.chat-toggle-btn {
  width: 54px; height: 54px; border-radius: 50%; background: var(--chat-bubble); color: var(--on-accent);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); position: relative;
}
.chat-unread-badge {
  position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--bg);
}
.chat-new-banner {
  width: 100%; background: var(--action-btn); color: var(--on-accent); border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 7px; flex-shrink: 0;
}
.chat-panel {
  display: none; position: absolute; right: 0; bottom: 64px; width: 460px; height: 600px;
  background: var(--chat-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5); flex-direction: column;
}
.chat-panel.open { display: flex; }
.chat-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.chat-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-tab {
  flex: 1; padding: 8px; background: none; border: none; color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent;
}
.chat-tab.active { color: var(--text); border-bottom-color: var(--rust); }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 80%; display: flex; flex-direction: column; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; margin-left: 14px; }
.chat-msg-meta { font-size: 12px; margin-bottom: 2px; display: flex; gap: 5px; align-items: center; }
.chat-msg-role { font-weight: 700; }
.chat-msg-bubble { padding: 8px 11px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; color: #fff; word-break: break-word; cursor: pointer; }
.chat-msg.mine .chat-msg-bubble { background: var(--chat-own-bg); }
.chat-msg.theirs .chat-msg-bubble { background: var(--chat-other-bg); }
.chat-msg-bubble img { max-width: 160px; border-radius: 8px; margin-top: 6px; display: block; cursor: zoom-in; }
.chat-msg-time { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.chat-msg-delete { font-size: 10px; color: var(--danger); cursor: pointer; margin-top: 2px; background: none; border: none; padding: 0; display: none; }
.chat-msg.confirm-delete .chat-msg-delete { display: block; }
.chat-msg.unread .chat-msg-bubble { box-shadow: 0 0 0 2px var(--rust); }
.chat-input-row { display: flex; align-items: center; gap: 6px; padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-input-row input[type=text] { flex: 1; padding: 8px 10px; }
.chat-image-btn { cursor: pointer; font-size: 18px; flex-shrink: 0; }
.chat-image-preview { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); }
.chat-image-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.chat-image-preview button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; }

.mobile-menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 4px; flex-shrink: 0; }
.mobile-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 190; }
.mobile-backdrop.open { display: block; }

.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.clamp-5 {
  display: -webkit-box; -webkit-line-clamp: 5; line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.color-swatch-grid { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.color-swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 78px; }
.color-swatch-noWidth { width: auto; }
.color-swatch label { font-size: 10.5px; text-align: center; line-height: 1.2; margin: 0; height: 26px; display: flex; align-items: center; justify-content: center; }
.color-swatch input[type=color] { width: 44px; height: 32px; padding: 2px; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.birthdays-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.birthdays-side img { width: 100%; border-radius: 12px; max-height: 640px; object-fit: cover; }
.profile-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }

/* ---------- Bannière copyright ---------- */
.site-copyright {
  position: fixed; left: 260px; right: 0; bottom: 0; z-index: 30;
  background: var(--sidebar-bg); border-top: 1px solid var(--border);
  color: var(--text-dim); font-size: 11px; padding: 6px 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 8px;
}
.copyright-text { grid-column: 2; text-align: center; }
.copyright-version { grid-column: 3; justify-self: end; color: inherit; }
.main-content { padding-bottom: 40px; }

/* ---------- Mot de passe avec œil + compteur de bio ---------- */
.password-field-wrap { position: relative; }
.password-field-wrap input { padding-right: 40px; }
.password-eye-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
}
.bio-counter { text-align: right; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
input[type=number].no-spinner::-webkit-outer-spin-button,
input[type=number].no-spinner::-webkit-inner-spin-button,
input[type=number].no-spin::-webkit-outer-spin-button,
input[type=number].no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].no-spinner, input[type=number].no-spin { -moz-appearance: textfield; }

/* ---------- Responsive ---------- */
.day-short { display: none; }
@media (max-width: 640px) {
  .day-full { display: none; }
  .day-short { display: inline; }
}
@media (max-width: 860px) {
  .gazette-images-grid { flex-direction:column; }
  .gazette-images-grid img { min-width:0; flex:none; width:100%; }
  .mobile-menu-toggle { display: flex; align-items: center; }
  .sidebar {
    width: 250px; transform: translateX(-100%); transition: transform 0.22s ease; z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .site-copyright { left: 0; }
  .main-content { padding: 14px; padding-bottom: 44px; overflow-x: hidden; }
  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar h1 { font-size: 16px; flex: 1; }
  .field-row, .cols-2, .cols-3, .dash-grid, .profile-grid, .birthdays-layout { grid-template-columns: 1fr; }
  .field-row > *, .cols-2 > *, .cols-3 > *, .dash-grid > *, .profile-grid > * { min-width: 0; }
  .card-grid, .gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .site-copyright { font-size: 10px; padding: 5px 8px; }
  .panel, .card { padding: 14px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px 14px 8px 10px; white-space: nowrap; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chat-widget { right: 12px; bottom: 50px; }
  .chat-panel { width: calc(100vw - 24px); height: 60vh; }
}

@media (min-width: 861px) {
  .mobile-menu-toggle { display: none; }
}

@media (max-width: 420px) {
  .topbar h1 { font-size: 14px; }
  .user-menu-btn span:not(.online-dot) { display: none; }
  .discord-badge span { display: none; }
  .discord-badge { width: 36px; padding: 0; justify-content: center; }
}

