@font-face {
  font-family: 'CloudflareFont';
  src: url('https://pub-3923c5a3b11d4011a948d7b59520698e.r2.dev/0336a89fb4e7fc1d-s.p.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fdf8f4;
  --white: #ffffff;
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-300: #fdba74;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --orange-800: #9a3412;
  --orange-900: #7c2d12;
  --sidebar-width: 240px;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(124,45,18,0.08);
  --shadow-md: 0 4px 32px rgba(124,45,18,0.13);
}

html, body {
  font-family: 'CloudflareFont', sans-serif;
  background-color: var(--bg);
  color: var(--orange-700);
  min-height: 100vh;
}

/* ─── AUTH PAGE ─────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 32px;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 20% 80%, #fed7aa44 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, #fdba7444 0%, transparent 50%);
}

.auth-logo {
  font-size: clamp(36px, 8vw, 64px);
  font-weight: 700;
  color: var(--orange-900);
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-logo span {
  color: var(--orange-400);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--orange-200);
  border-radius: 24px;
  padding: 36px 40px 40px;
  box-shadow: var(--shadow-md);
}

.auth-card h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-400);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--orange-100);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--orange-700);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--white);
  color: var(--orange-900);
  box-shadow: 0 1px 4px rgba(124,45,18,0.12);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--orange-800);
  letter-spacing: 0.02em;
}

.form-group input {
  padding: 12px 14px;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 15px;
  color: var(--orange-900);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(251,146,60,0.15);
}

.form-group input::placeholder {
  color: var(--orange-300);
}

.btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: var(--orange-400);
  color: white;
  border: none;
  border-radius: 999px;
  font-family: 'CloudflareFont', sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--orange-500);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 20px;
}

/* ─── APP LAYOUT ────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR (app normal, no chat) ─────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--orange-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(124,45,18,0.06);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  font-size: 22px;
  font-weight: 700;
  color: var(--orange-900);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--orange-100);
}

.sidebar-logo span {
  color: var(--orange-400);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--orange-700);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'CloudflareFont', sans-serif;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--orange-100);
  color: var(--orange-900);
}

.nav-item.active {
  background: var(--orange-100);
  color: var(--orange-900);
  font-weight: 600;
}

.nav-item.logout {
  color: var(--orange-400);
}

.nav-item.logout:hover {
  background: #fff1e6;
  color: var(--orange-600);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--orange-100);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--orange-800);
  flex-shrink: 0;
}

.sidebar-email {
  font-size: 12px;
  color: var(--orange-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── MAIN CONTENT ──────────────────────────────────────── */

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 40px 48px;
  min-height: 100vh;
  background: var(--bg);
}

.page-header {
  margin-bottom: 36px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--orange-900);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--orange-700);
  margin-top: 4px;
  font-weight: 400;
}

/* ─── DASHBOARD STATS ───────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-400);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--orange-900);
  line-height: 1;
}

.stat-delta {
  font-size: 12px;
  color: var(--orange-400);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-delta.up { color: #16a34a; }
.stat-delta.down { color: #dc2626; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff1e6;
  color: var(--orange-500);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--orange-400);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.recent-section {
  background: var(--white);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.recent-section h3 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-400);
  margin-bottom: 16px;
}

.recent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--orange-100);
  font-size: 14px;
  color: var(--orange-800);
}

.recent-row:last-child { border-bottom: none; }

.recent-row-label { font-weight: 500; }
.recent-row-time { font-size: 12px; color: var(--orange-400); }

/* ─── CREATE ROOM ───────────────────────────────────────── */

.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
}

.center-panel h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--orange-900);
  margin-bottom: 28px;
  text-align: center;
}

.card {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}

.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--orange-100);
  border: 2px dashed var(--orange-300);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.avatar-preview:hover { border-color: var(--orange-400); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.avatar-upload-btn {
  font-size: 12px;
  color: var(--orange-400);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: 'CloudflareFont', sans-serif;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

select {
  padding: 12px 14px;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 15px;
  color: var(--orange-900);
  background: var(--bg);
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fb923c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

select:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(251,146,60,0.15);
}

textarea {
  padding: 12px 14px;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 15px;
  color: var(--orange-900);
  background: var(--bg);
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(251,146,60,0.15);
}

/* ─── ROOM SETTINGS ─────────────────────────────────────── */

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--orange-100);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-label { font-size: 14px; color: var(--orange-800); font-weight: 500; }
.toggle-desc { font-size: 12px; color: var(--orange-400); margin-top: 2px; }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--orange-200);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--orange-400); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── ROOM ID COPY ──────────────────────────────────────── */

.id-copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--orange-100);
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
}

.id-copy-box code {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--orange-900);
  letter-spacing: 0.05em;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--orange-400);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.copy-btn:hover { color: var(--orange-600); }

/* ─── JOIN ROOM ─────────────────────────────────────────── */

.join-input-big {
  padding: 18px 20px;
  border: 2px solid var(--orange-200);
  border-radius: 12px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--orange-900);
  background: var(--white);
  outline: none;
  width: 100%;
  text-align: center;
  letter-spacing: 0.15em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.join-input-big:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgba(251,146,60,0.15);
}

.join-input-big::placeholder {
  color: var(--orange-200);
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* ─── PUBLIC ROOMS ──────────────────────────────────────── */

.rooms-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 14px;
  color: var(--orange-900);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(251,146,60,0.15);
}

.filter-select {
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 14px;
  color: var(--orange-800);
  background: var(--white);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fb923c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

.filter-select:focus { border-color: var(--orange-400); }

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.room-card {
  background: var(--white);
  border: 1px solid var(--orange-200);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.room-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--orange-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--orange-700);
  flex-shrink: 0;
  overflow: hidden;
}

.room-avatar img { width: 100%; height: 100%; object-fit: cover; }

.room-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--orange-900);
  line-height: 1.2;
}

.room-category {
  font-size: 11px;
  color: var(--orange-400);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.room-desc {
  font-size: 13px;
  color: var(--orange-700);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.room-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--orange-100);
  padding-top: 10px;
}

.online-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--orange-700);
  font-weight: 500;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: #16a34a;
  border-radius: 50%;
}

.room-time {
  font-size: 11px;
  color: var(--orange-400);
}

/* ─── CHAT PAGE ─────────────────────────────────────────── */

/* .chat-sidebar y .members-panel NO usan position:fixed
   porque el chat usa su propio flex layout (.chat-wrap).
   El fixed estaba rompiendo el layout del chat. */

.chat-sidebar {
  width: 220px;
  background: var(--white);
  border-right: 1px solid var(--orange-200);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  /* SIN position: fixed — el chat usa flex */
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  background: var(--white);
  border-bottom: 1px solid var(--orange-200);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-room-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-room-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--orange-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--orange-700);
  flex-shrink: 0;
  overflow: hidden;
}

.chat-room-avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-room-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--orange-900);
}

.chat-room-meta {
  font-size: 12px;
  color: var(--orange-400);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--orange-200);
  border-radius: 8px;
  color: var(--orange-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--orange-100);
  color: var(--orange-700);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--orange-200); border-radius: 2px; }

.msg {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  animation: fadeIn 0.2s ease;
}

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

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange-700);
  flex-shrink: 0;
  margin-top: 2px;
}

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

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.msg-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange-900);
}

.msg-time {
  font-size: 11px;
  color: var(--orange-400);
}

.msg-text {
  font-size: 14px;
  color: var(--orange-800);
  line-height: 1.5;
  word-break: break-word;
}

.msg-image {
  max-width: 280px;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--orange-200);
}

.msg.own { flex-direction: row-reverse; }
.msg.own .msg-body { text-align: right; }
.msg.own .msg-meta { flex-direction: row-reverse; }

.msg.own .msg-text {
  display: inline-block;
  background: var(--orange-400);
  color: white;
  padding: 8px 12px;
  border-radius: 12px 12px 2px 12px;
  text-align: left;
  max-width: 360px;
  word-break: break-word;
}

.msg-system {
  text-align: center;
  font-size: 12px;
  color: var(--orange-400);
  padding: 8px 0;
}

/* ─── CHAT INPUT ────────────────────────────────────────── */

.chat-input-area {
  background: var(--white);
  border-top: 1px solid var(--orange-200);
  padding: 14px 20px;
  flex-shrink: 0;
}

.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--orange-200);
  border-radius: 14px;
  padding: 8px 10px 8px 14px;
  transition: border-color 0.2s;
}

.chat-input-box:focus-within {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(251,146,60,0.1);
}

.chat-textarea {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-family: 'CloudflareFont', sans-serif;
  font-size: 14px;
  color: var(--orange-900);
  resize: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
  padding: 0;
}

.chat-textarea::placeholder { color: var(--orange-300); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--orange-400);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

.chat-send-btn:hover { background: var(--orange-500); transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.97); }

.chat-attach-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--orange-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.chat-attach-btn:hover {
  background: var(--orange-100);
  color: var(--orange-600);
}

/* ─── MEMBERS PANEL ─────────────────────────────────────── */

.members-panel {
  width: 200px;
  flex-shrink: 0;
  background: var(--white);
  border-left: 1px solid var(--orange-200);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  /* SIN position: fixed — el chat usa flex */
}

.members-panel h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-400);
  padding: 18px 14px 10px;
  border-bottom: 1px solid var(--orange-100);
  position: sticky;
  top: 0;
  background: var(--white);
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  transition: background 0.15s;
}

.member-item:hover { background: var(--orange-50); }

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange-700);
  flex-shrink: 0;
  position: relative;
}

.member-status {
  width: 8px;
  height: 8px;
  background: #16a34a;
  border-radius: 50%;
  border: 1.5px solid white;
  position: absolute;
  bottom: 0;
  right: 0;
}

.member-name {
  font-size: 13px;
  color: var(--orange-800);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-kick {
  background: none;
  border: none;
  color: var(--orange-300);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'CloudflareFont', sans-serif;
  display: none;
  transition: color 0.15s, background 0.15s;
}

.member-item:hover .member-kick { display: block; }
.member-kick:hover { color: #dc2626; background: #fee2e2; }

/* ─── CALL OVERLAY ──────────────────────────────────────── */

.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(124, 45, 18, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.call-overlay.active { display: flex; }

.call-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(124,45,18,0.25);
  width: 320px;
}

.call-room-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--orange-900);
  margin-bottom: 6px;
}

.call-status {
  font-size: 13px;
  color: var(--orange-400);
  margin-bottom: 32px;
}

.call-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.call-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.call-btn:hover { transform: scale(1.08); }
.call-btn.end { background: #dc2626; color: white; }
.call-btn.mute { background: var(--orange-100); color: var(--orange-700); }
.call-btn.speaker { background: var(--orange-100); color: var(--orange-700); }
.call-btn.muted { background: var(--orange-200); }

/* ─── TOAST ─────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--orange-900);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── MODAL ─────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(124,45,18,0.4);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(124,45,18,0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--orange-900);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.btn-secondary {
  flex: 1;
  padding: 11px 20px;
  background: var(--orange-100);
  color: var(--orange-700);
  border: none;
  border-radius: 999px;
  font-family: 'CloudflareFont', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--orange-200); }

/* ─── EMPTY STATE ───────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--orange-400);
}

.empty-state svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 14px;
  color: var(--orange-400);
}

/* ─── LOADING ───────────────────────────────────────────── */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── RESPONSIVE ────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 24px 20px; }
  .chat-main { margin-left: 0; }
  .members-panel { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}