:root {
  color-scheme: light dark;
  --bg: #f4f1ea;
  --fg: #222;
  --accent: #7a2f8a;
  --border: #ccc;
  --tab-bg: #e4ddcf;
  --tab-active-bg: #fdfbf6;
}

body.dark {
  --bg: #1b1b1f;
  --fg: #eee;
  --border: #444;
  --tab-bg: #26262c;
  --tab-active-bg: #333340;
}

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 1.5rem;
}

a { color: var(--accent); }

.card {
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

form { display: flex; flex-direction: column; gap: 0.75rem; }
label { font-size: 0.85rem; }
input, select, button { padding: 0.5rem; font-size: 1rem; }
button { cursor: pointer; background: var(--accent); color: white; border: none; border-radius: 4px; }
button:disabled { background: #999; cursor: not-allowed; }

.error { color: #c0392b; font-size: 0.9rem; }
.notice { color: #2c7a4b; font-size: 0.9rem; }

/* --- Salons : en-tête + onglets --- */
.rooms-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.tab-bar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.room-tab {
  padding: 0.4rem 0.8rem;
  background: var(--tab-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.room-tab.active {
  background: var(--tab-active-bg);
  font-weight: bold;
}

.room-tab .tab-close {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font-size: 0.8rem;
  opacity: 0.6;
}

.add-room select { font-size: 0.85rem; padding: 0.2rem; }

.connected-count { font-size: 0.85rem; opacity: 0.8; }

/* --- Layout salon --- */
.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  height: 78vh;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 0 8px 8px 8px;
  background: var(--tab-active-bg);
  padding: 0.75rem;
}

.member-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

#connected-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 1;
  background: var(--bg);
}
#connected-list li { padding: 0.35rem 0.6rem; cursor: pointer; }
#connected-list li.selected { background: var(--accent); color: white; border-radius: 4px; }

.member-actions {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.8rem;
}
#selected-pseudo-label { display: block; margin-bottom: 0.4rem; opacity: 0.8; }
.member-buttons { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.member-buttons button { font-size: 0.75rem; padding: 0.3rem 0.5rem; }

#messages { list-style: none; padding: 0.5rem; margin: 0; overflow-y: auto; flex: 1; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
#messages li { margin-bottom: 0.3rem; line-height: 1.4; }
#messages time { color: #888; font-size: 0.75rem; margin-right: 0.4rem; }
#messages li.own-pm { font-style: italic; opacity: 0.85; }
.admin-delete-message { color: #c0392b; font-size: 0.75rem; opacity: 0.7; }
.admin-delete-message:hover { opacity: 1; }

.room-panel { display: flex; flex-direction: column; gap: 0.5rem; height: 100%; min-height: 0; }
#message-form { gap: 0.4rem; }
.pm-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.pm-toggle input { padding: 0; width: auto; }
#pm-target { font-weight: bold; color: var(--accent); }
.message-input-row { display: flex; gap: 0.5rem; }
.message-input-row input { flex: 1; }

.charme-warning {
  border: 2px solid #c0392b;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(192, 57, 43, 0.08);
  margin-bottom: 0.75rem;
}
.charme-warning button { margin-right: 0.5rem; }
