/* ============================================================
   GLOPSA CHAT CORPORATIVO — Rediseño UX/UI v3
   Layout 3 columnas · Nav navy · Lista blanca · Header celeste
   Rojo GLOPSA solo como color de acción
   ============================================================ */
:root {
  /* Marca */
  --red:        #ED1C24;   /* acción: enviar, indicadores, activo */
  --red-dark:   #C8151C;
  --navy-1:     #123B63;   /* nav rail (arriba) */
  --navy-2:     #0E2C4C;   /* nav rail (abajo) */
  --navy-3:     #1F5D8B;   /* hover / secundario */
  --celeste:    #DDF3FF;   /* header chat, tarjetas seleccionadas */
  --celeste-2:  #EEF9FF;   /* mensajes enviados, hover */
  --header-top: #E8F7FF;   /* gradiente header (arriba) */
  --bg:         #F6F8FB;   /* fondo general */
  --line:       #DCE3EB;   /* separadores, bordes inputs */
  --line-soft:  #EAEFF4;
  --txt:        #243447;   /* texto principal */
  --txt-2:      #6B7C93;   /* texto secundario */
  --white:      #FFFFFF;
  --ok:         #22C55E;   /* estado disponible (verde) */
  --nav-soft:   rgba(255,255,255,0.72);
  --nav-line:   rgba(255,255,255,0.10);
  --shadow-sm:  0 1px 3px rgba(18,59,99,0.08);
  --shadow-md:  0 4px 16px rgba(18,59,99,0.10);
}

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

body {
  font-family: 'Inter', 'DM Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy-1), var(--navy-2));
}
.login-card {
  background: var(--white);
  padding: 40px 32px;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(8,24,44,0.45);
  text-align: center;
  width: 340px;
}
.login-card h1 { color: var(--navy-1); margin-bottom: 8px; font-size: 24px; font-weight: 800; }
.login-card p { color: var(--txt-2); margin-bottom: 22px; font-size: 14px; }
.login-card input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(31,93,139,.15); }
.login-card button {
  width: 100%;
  padding: 13px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background .18s, transform .08s;
}
.login-card button:hover { background: var(--red-dark); }
.login-card button:active { transform: scale(.98); }
.login-error {
  background: #FDECEC; color: var(--red-dark);
  border-radius: 10px; padding: 9px 12px;
  font-size: 13px; margin-bottom: 12px; text-align: left;
}

/* ---------- Layout principal 3 columnas ---------- */
.chat-screen { display: flex; height: 100vh; }

/* ============================================================
   COLUMNA 1 — Nav rail (navy)
   ============================================================ */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-1), var(--navy-2));
  display: flex;
  flex-direction: column;
  color: #fff;
  padding: 20px 16px;
  gap: 18px;
}

/* Logo */
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 4px; }
.brand-mark {
  width: 44px; height: 44px;
  background: var(--red);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; color: #fff;
  box-shadow: 0 4px 12px rgba(237,28,36,.35);
  flex-shrink: 0;
}
.brand-text { line-height: 1.1; flex: 1; min-width: 0; }
.brand-text b { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.brand-text span { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--nav-soft); font-weight: 600; margin-top: 2px; }
.sidebar-toggle-btn { flex-shrink: 0; transform: rotate(0deg); transition: transform .18s ease; }
.sidebar.collapsed .sidebar-toggle-btn { transform: rotate(180deg); }

/* Perfil usuario */
.me-info {
  display: flex; align-items: center; gap: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--nav-line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 0;
}
.me-avatar { width: 40px; height: 40px; font-size: 15px; flex-shrink: 0; }
.me-info .me-meta { min-width: 0; flex: 1; }
.me-info #me-name { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { font-size: 11.5px; color: var(--nav-soft); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.me-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px rgba(34,197,94,.25); }
.me-info .header-icon-btn { width: 30px; height: 30px; background: transparent; }

.sidebar-actions { display: flex; align-items: center; flex-shrink: 0; }

/* Menú de navegación */
.nav-menu { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--nav-soft);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border: none; background: none; text-align: left;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
  background: var(--celeste);
  color: var(--navy-1);
  border-left-color: var(--red);
  font-weight: 700;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.nav-item.active .nav-badge { background: var(--red); }

/* Footer */
.sidebar-footer {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--nav-line);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-footer .foot-brand { display: flex; align-items: center; gap: 9px; }
.sidebar-footer .foot-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.sidebar-footer .foot-brand b { font-size: 13px; font-weight: 700; }
.sidebar-footer .foot-brand span { font-size: 8px; letter-spacing: 1px; color: var(--nav-soft); display: block; }
.sidebar-footer small { font-size: 10.5px; color: var(--nav-soft); line-height: 1.5; }

/* botón cerrar sesión (icono) */
.header-icon-btn {
  background: rgba(255,255,255,0.12);
  border: none; color: #fff;
  border-radius: 9px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .18s; flex-shrink: 0;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.24); }

/* botón gestionar (admins) usa estilo nav-item — ver HTML */
.manage-btn { /* compat: se renderiza como nav-item */ }

/* ============================================================
   COLUMNA 2 — Lista de chats (blanca)
   ============================================================ */
.chat-col {
  width: 380px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.chat-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 22px 14px;
}
.chat-col-header h2 { font-size: 24px; font-weight: 800; color: var(--txt); }

/* Buscador */
.sidebar-search {
  display: flex; align-items: center; gap: 10px;
  margin: 0 22px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 15px;
  color: var(--txt-2);
  transition: border-color .15s, background .15s;
}
.sidebar-search:focus-within { border-color: var(--navy-3); background: #fff; }
.sidebar-search input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--txt); font-size: 14px; min-width: 0;
}
.sidebar-search input::placeholder { color: var(--txt-2); }

/* Tabs de filtro (Todos / No leídos / Favoritos) */
.chat-filters {
  display: flex; align-items: center; gap: 26px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
}
.filter-tab {
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--txt-2);
  padding: 8px 2px 12px;
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 7px;
  transition: color .15s;
}
.filter-tab:hover { color: var(--txt); }
.filter-tab.active { color: var(--red); border-bottom-color: var(--red); }
.filter-tab .filter-count {
  background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}

/* Filtro recientes/antiguos (icono + menú, funcional) */
.chats-filter { position: relative; flex-shrink: 0; }
.chats-filter-btn {
  background: var(--bg); border: 1px solid var(--line);
  color: var(--txt-2);
  width: 38px; height: 38px; border-radius: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  font-size: 0;
}
.chats-filter-btn::before {
  content: "";
  width: 16px; height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>") center/contain no-repeat;
}
.chats-filter-btn svg { display: none; }
.chats-filter-btn:hover { background: var(--celeste); color: var(--navy-1); }
#chats-filter-label { display: none; }

.dropdown-menu {
  position: absolute; top: 105%; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden; z-index: 60; min-width: 200px;
}
.dropdown-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; background: none; border: none; text-align: left;
  padding: 12px 15px; font-size: 13.5px; color: var(--txt); cursor: pointer;
}
.dropdown-menu button:hover { background: var(--celeste-2); }
.dropdown-menu button.active { font-weight: 700; color: var(--red); }
.dropdown-menu button i { width: 15px; text-align: center; color: var(--navy-3); }

/* Lista de conversaciones */
.chat-list { flex: 1; overflow-y: auto; padding: 10px 14px; }

.chat-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 14px;
  cursor: pointer;
  border-radius: 16px;
  margin-bottom: 4px;
  transition: background .15s, box-shadow .15s;
  position: relative;
}
.chat-item:hover { background: var(--celeste-2); }
.chat-item.active { background: var(--celeste); box-shadow: var(--shadow-sm); }

.chat-item .avatar-wrap { position: relative; flex-shrink: 0; }

.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--navy-1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.status-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok);
  position: absolute; right: -1px; bottom: -1px;
  border: 2.5px solid #fff;
}

.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-item-top strong {
  font-size: 14.5px; font-weight: 700; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item-time { font-size: 11.5px; color: var(--txt-2); flex-shrink: 0; }

.chat-item-preview {
  font-size: 12.5px; color: var(--txt-2); line-height: 1.35; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; max-height: 1.4em; word-break: break-word;
}
.chat-item-preview .preview-icon { margin-right: 4px; }

.chat-item-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  flex-shrink: 0;
}
.unread-badge {
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 11px; min-width: 20px; height: 20px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
}
.chat-pin-btn {
  background: none; border: none; color: var(--txt-2);
  cursor: pointer; padding: 2px; font-size: 12px;
  opacity: 0; transition: opacity .15s, color .15s;
}
.chat-item:hover .chat-pin-btn { opacity: 1; }
.chat-pin-btn.pinned { opacity: 1; color: var(--red); }

/* ============================================================
   COLUMNA 3 — Conversación
   ============================================================ */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  position: relative; min-width: 0;
  background: var(--bg);
}

/* Header celeste */
.chat-header {
  background: linear-gradient(180deg, var(--header-top), var(--celeste));
  color: var(--txt);
  padding: 16px 26px;
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line-soft);
}
.chat-header .avatar { width: 46px; height: 46px; background: var(--red); }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-info strong { display: block; font-size: 17px; font-weight: 700; color: var(--txt); }
.room-status { font-size: 12.5px; color: var(--txt-2); display: flex; align-items: center; gap: 5px; }
.room-status.online { color: #15803d; }
.typing-indicator { font-size: 12px; color: var(--navy-3); min-height: 0; }

.chat-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; position: relative; }
.room-options-menu { position: absolute; top: 100%; right: 0; margin-top: 6px; min-width: 190px; }
.chat-header .header-icon-btn,
.chat-header-actions button {
  background: #fff;
  border: 1px solid rgba(18,59,99,.06);
  color: var(--navy-1);
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .08s;
  box-shadow: var(--shadow-sm);
}
.chat-header .header-icon-btn:hover,
.chat-header-actions button:hover { background: var(--celeste-2); }
.chat-header .header-icon-btn:active,
.chat-header-actions button:active { transform: scale(.96); }

/* Búsqueda interna */
.chat-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.chat-search-bar input {
  flex: 1; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; outline: none;
}
.chat-search-bar input:focus { border-color: var(--navy-3); }
.chat-search-count { font-size: 12px; color: var(--txt-2); min-width: 46px; text-align: center; }
.chat-search-bar button {
  background: var(--bg); border: 1px solid var(--line); color: var(--txt);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 12px;
}
.chat-search-bar button:hover { background: var(--celeste); }

/* Banner fijado */
.pinned-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 22px;
  background: var(--celeste-2);
  border-bottom: 1px solid var(--line);
  color: var(--navy-1); font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.pinned-banner span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-banner button { background: none; border: none; cursor: pointer; color: var(--txt-2); font-size: 13px; }

/* Modo supervisión: banner + ocultar toda interacción de escritura */
.supervision-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 22px;
  background: #FFF4D6; color: #7A5B00;
  border-bottom: 1px solid #F0DFA6;
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.chat-main.supervision-mode .message-form { display: none; }
.chat-main.supervision-mode .msg-pin-btn { display: none; }
.chat-main.supervision-mode .chat-header-actions [data-action="call"],
.chat-main.supervision-mode .chat-header-actions [data-action="video"] { display: none; }

/* Área de mensajes */
.messages-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.messages {
  flex: 1;
  padding: 26px 40px;
  overflow-y: auto;
  overflow-anchor: none;
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  background:
    radial-gradient(circle at 12px 12px, rgba(18,59,99,0.028) 1.5px, transparent 1.6px);
  background-size: 26px 26px;
  background-color: var(--bg);
}

/* Separador de día en el flujo de mensajes */
.date-separator {
  align-self: center;
  background: rgba(255,255,255,0.92);
  color: var(--txt-2);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin: 4px 0;
}

/* Píldora flotante de fecha, estilo WhatsApp, se muestra al hacer scroll */
.date-pill.floating {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(18,59,99,0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.date-pill.floating.visible { opacity: 1; }

.message {
  max-width: 62%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14.5px; line-height: 1.45;
  position: relative; word-wrap: break-word;
}
.message.own {
  align-self: flex-end;
  background: var(--celeste);
  border-bottom-right-radius: 6px;
  color: var(--txt);
}
.message.other {
  align-self: flex-start;
  background: #fff;
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 6px;
}
.message .sender {
  font-weight: 700; font-size: 12.5px;
  color: var(--red);
  margin-bottom: 3px; display: block;
}
.message .time {
  font-size: 10.5px; color: var(--txt-2);
  float: right; margin-left: 10px; margin-top: 5px;
}
.message.own .time { color: #5a7a99; }

/* Checks de entrega/lectura (estilo WhatsApp) */
.msg-status-wrap { display: inline-block; margin-left: 4px; }
.msg-status { font-size: 12px; }
.msg-status.sent, .msg-status.delivered { color: #8AA6BD; }
.msg-status.read { color: #2E9CE8; }

.msg-pin-btn {
  position: absolute; top: -9px; right: -9px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 50%; width: 25px; height: 25px;
  font-size: 11px; cursor: pointer; display: none;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); z-index: 2;
}
.message:hover .msg-pin-btn { display: flex; }

.message.search-hit { outline: 2px solid var(--red); }
.message mark { background: #FFE29A; border-radius: 3px; padding: 0 2px; }

.message.system {
  align-self: center;
  background: #E7EEF6; color: var(--txt-2);
  font-size: 12.5px; border-radius: 12px; padding: 5px 12px;
}

/* ---------- Barra de envío ---------- */
.message-form {
  display: flex; align-items: center;
  padding: 16px 24px;
  background: var(--bg);
  gap: 12px; flex-shrink: 0;
}
.message-form input[type="text"] {
  flex: 1;
  padding: 15px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  font-size: 14.5px; outline: none;
  background: #fff; min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.message-form input[type="text"]:focus { border-color: var(--navy-3); }

.icon-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy-1);
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .18s, transform .08s; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { background: var(--celeste-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.recording { color: var(--red); border-color: var(--red); animation: recPulse 1s infinite; }
@keyframes recPulse { 50% { background: rgba(237,28,36,0.10); } }

/* Botón enviar: círculo rojo GLOPSA (elemento más llamativo) */
.send-btn {
  background: var(--red);
  border: none; color: #fff;
  width: 52px; height: 52px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .18s, transform .08s; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(237,28,36,.35);
}
.send-btn:hover { background: var(--red-dark); }
.send-btn:active { transform: scale(.96); }

/* Adjuntos "+" */
.attach-wrap { position: relative; flex-shrink: 0; }
.attach-menu { bottom: 56px; top: auto; left: 0; right: auto; }

.attachment-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: #fff;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.attachment-preview img { max-height: 70px; border-radius: 10px; }
.attachment-preview #attachment-preview-content {
  flex: 1; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--txt-2); min-width: 0;
}
.attachment-preview button {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 14px;
}

/* Grabación de voz */
.recording-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: #FFF4F4;
  border-top: 1px solid #F7D6D6;
  font-size: 13.5px; flex-shrink: 0;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse-dot 1s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
#recording-time { font-weight: 700; min-width: 36px; }
.rec-label { color: var(--txt-2); flex: 1; }
.recording-bar button {
  border: none; border-radius: 12px; padding: 8px 16px;
  cursor: pointer; font-size: 13px; font-weight: 700;
}
#recording-cancel { background: #EEF1F5; color: var(--txt); }
#recording-stop { background: var(--red); color: #fff; }

/* Multimedia */
.message img.msg-media {
  max-width: 280px; max-height: 300px;
  border-radius: 16px; display: block; cursor: pointer;
  margin-bottom: 5px; border: 3px solid #fff;
  box-shadow: var(--shadow-md);
}
.message audio.msg-media { display: block; margin-bottom: 4px; max-width: 260px; }

.file-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 13px; margin: 4px 0;
  text-decoration: none; color: var(--txt); max-width: 290px;
  transition: background .18s;
}
.file-chip:hover { background: var(--celeste-2); }
.file-chip-icon { font-size: 22px; }
.file-chip-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Drag & drop */
.drop-overlay {
  position: absolute; inset: 0;
  background: rgba(18,59,99,0.9);
  z-index: 50; display: flex; align-items: center; justify-content: center; color: #fff;
}
.drop-overlay-box {
  border: 3px dashed rgba(255,255,255,0.7);
  border-radius: 20px; padding: 44px 64px; text-align: center; font-size: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

/* Scrollbars */
.messages::-webkit-scrollbar { width: 7px; }
.messages::-webkit-scrollbar-thumb { background: #cbd6e2; border-radius: 4px; }
.chat-list::-webkit-scrollbar { width: 7px; }
.chat-list::-webkit-scrollbar-thumb { background: #d5dee8; border-radius: 4px; }

/* ============================================================
   Panel de administración / Configuración
   ============================================================ */
.admin-modal {
  position: fixed; inset: 0;
  background: rgba(18,59,99,0.55);
  backdrop-filter: blur(3px);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.admin-card {
  background: #fff; border-radius: 20px;
  width: 100%; max-width: 1200px; max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 70px rgba(8,24,44,0.5);
}
.admin-card.small { max-width: 560px; padding-bottom: 18px; overflow-y: auto; }
.admin-header {
  background: linear-gradient(120deg, var(--navy-1), var(--navy-3));
  color: #fff; padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.admin-header h2 { font-size: 18px; font-weight: 700; }
.admin-header button { background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 16px; cursor: pointer; width: 32px; height: 32px; border-radius: 9px; }
.admin-header button:hover { background: rgba(255,255,255,.3); }

.admin-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); flex-shrink: 0; padding: 0 12px; }
.admin-tab {
  padding: 15px 20px; background: none; border: none;
  font-size: 14px; font-weight: 600; color: var(--txt-2);
  cursor: pointer; border-bottom: 3px solid transparent;
}
.admin-tab:hover { color: var(--txt); }
.admin-tab.active { color: var(--red); border-bottom-color: var(--red); }
.admin-tab-content { padding: 22px; overflow-y: auto; flex: 1; }

.admin-primary-btn {
  background: var(--red); color: #fff; border: none;
  border-radius: 12px; padding: 11px 18px;
  font-size: 14px; font-weight: 700; cursor: pointer; margin-bottom: 16px;
  transition: background .18s, transform .08s;
}
.admin-primary-btn:hover { background: var(--red-dark); }
.admin-primary-btn:active { transform: scale(.98); }

.admin-inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-inline-form input {
  flex: 1; min-width: 160px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 11px; font-size: 14px; outline: none;
}
.admin-inline-form input:focus { border-color: var(--navy-3); }
.admin-inline-form .admin-primary-btn { margin-bottom: 0; }

.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
  transition: box-shadow .15s;
}
.admin-row:hover { box-shadow: var(--shadow-sm); }
.admin-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-row-main small { color: var(--txt-2); font-size: 12px; }
.admin-row-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-row-left .avatar { width: 38px; height: 38px; background: var(--navy-1); font-size: 13px; }
.admin-row-actions { display: flex; gap: 8px; flex-shrink: 0; }

.admin-mini-btn {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.admin-mini-btn:hover { background: var(--celeste); }
.admin-mini-btn.danger { background: #FDECEC; color: var(--red-dark); border-color: #F7D6D6; }
.admin-mini-btn.danger:hover { background: #FAD4D4; }

.badge { display: inline-block; background: var(--bg); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.badge-admin { background: var(--celeste); color: var(--navy-1); }
.badge-ok { background: #E7F6EC; color: #15803d; }
.badge-off { background: #FDECEC; color: var(--red-dark); }

/* Foto de perfil en editor */
.ue-photo-row { display: flex; align-items: center; gap: 16px; padding: 20px 22px 0; }
.ue-photo-preview { width: 68px; height: 68px; font-size: 24px; background: var(--navy-1); }
.ue-photo-actions { display: flex; flex-direction: column; gap: 8px; }

/* Editor de usuario */
.user-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px 22px 0; }
.user-editor-grid input, .user-editor-grid select {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 14px; outline: none; width: 100%;
}
.user-editor-grid input:focus, .user-editor-grid select:focus { border-color: var(--navy-3); }
.ue-check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt); grid-column: 1 / -1; }
.ue-groups {
  margin: 6px 22px 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start;
  min-height: 120px; max-height: 200px; overflow-y: auto; flex-shrink: 0;
}
.ue-group-check { font-size: 13.5px; color: var(--navy-1); font-weight: 600; cursor: pointer; }
.ue-group-check input { cursor: pointer; accent-color: var(--red); }
.ue-group-check small { color: var(--txt-2); font-weight: 400; }
.admin-card.small .admin-primary-btn { margin: 0 22px; }
.admin-card.small .login-error { margin: 0 22px 10px; }
.admin-card.small .sidebar-subtitle {
  padding: 14px 22px 4px; font-size: 12px; text-transform: uppercase;
  color: var(--txt-2); font-weight: 700; letter-spacing: .5px;
}
.sidebar-subtitle {
  padding: 14px 22px 4px; font-size: 12px; text-transform: uppercase;
  color: var(--txt-2); font-weight: 700; letter-spacing: .5px;
}
.ue-field { display: flex; flex-direction: column; gap: 5px; }
.ue-field label { font-size: 12px; font-weight: 600; color: var(--txt-2); }
.ue-field .req { color: var(--red); }
.ue-field input:invalid, .ue-field select:invalid { border-color: #E5A6A2; }
.ue-hint { margin: 0 22px 4px; font-size: 12px; color: var(--txt-2); }

/* Catálogos */
.catalogs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.catalog-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--bg); }
.catalog-card h3 { font-size: 14px; font-weight: 700; color: var(--navy-1); margin-bottom: 12px; }
.catalog-card .admin-inline-form { margin-bottom: 12px; }
.catalog-card .admin-inline-form input { min-width: 0; }
.catalog-card .admin-inline-form .admin-primary-btn { padding: 11px 13px; }
.catalog-card .admin-row { background: #fff; padding: 9px 13px; }
.catalog-card .admin-list { max-height: 300px; overflow-y: auto; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .chat-col { width: 330px; }
}
/* Rail colapsado — aplica por toggle manual (.sidebar.collapsed) y/o
   automáticamente en viewports angostos (media query abajo). */
.sidebar.collapsed { width: 76px; padding: 18px 10px; }
.sidebar.collapsed .brand-text, .sidebar.collapsed .me-info .me-meta, .sidebar.collapsed .me-info .header-icon-btn:not(.sidebar-toggle-btn),
.sidebar.collapsed .nav-item span:not(.nav-badge), .sidebar.collapsed .sidebar-footer small, .sidebar.collapsed .sidebar-footer .foot-brand > div { display: none; }
.sidebar.collapsed .brand { justify-content: center; }
.sidebar.collapsed .me-info { justify-content: center; padding: 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-footer { align-items: center; }

@media (max-width: 980px) {
  .sidebar { width: 76px; padding: 18px 10px; }
  .brand-text, .me-info .me-meta, .me-info .header-icon-btn,
  .nav-item span:not(.nav-badge), .sidebar-footer small, .sidebar-footer .foot-brand > div { display: none; }
  .brand { justify-content: center; }
  .me-info { justify-content: center; padding: 8px; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-footer { align-items: center; }
  .catalogs-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .chat-col { width: 100%; }
  .chat-main { display: none; }
  .chat-screen.viewing-chat .chat-col { display: none; }
  .chat-screen.viewing-chat .chat-main { display: flex; }
  .user-editor-grid, .ue-groups { grid-template-columns: 1fr; }
  .messages { padding: 18px; }
}

/* ============================================================
   Llamadas de voz / videollamada
   ============================================================ */
.call-modal {
  position: fixed; inset: 0;
  background: rgba(14,44,76,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.call-card {
  background: linear-gradient(180deg, var(--navy-1), var(--navy-2));
  color: #fff;
  border-radius: 24px;
  width: 100%; max-width: 760px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
}
.call-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.call-head strong { font-size: 18px; font-weight: 700; }
.call-status { font-size: 13px; color: rgba(255,255,255,0.75); }

.call-videos {
  position: relative;
  background: #081a2e;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
}
#remote-video { width: 100%; height: 100%; object-fit: cover; }
#local-video {
  position: absolute; right: 14px; bottom: 14px;
  width: 24%; min-width: 130px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  object-fit: cover;
  background: #0d2440;
}
.call-audio-placeholder {
  display: none;
  color: rgba(255,255,255,0.5);
}
.call-videos.audio-only { aspect-ratio: auto; min-height: 170px; }
.call-videos.audio-only #remote-video,
.call-videos.audio-only #local-video { display: none; }
.call-videos.audio-only .call-audio-placeholder { display: block; animation: callPulse 1.8s infinite; }
@keyframes callPulse { 50% { opacity: .45; transform: scale(.95); } }

.call-actions { display: flex; align-items: center; justify-content: center; gap: 18px; }
.call-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.14); color: #fff;
  transition: background .18s, transform .08s;
}
.call-btn:hover { background: rgba(255,255,255,0.26); }
.call-btn:active { transform: scale(.94); }
.call-btn.accept { background: #22C55E; }
.call-btn.accept:hover { background: #16A34A; }
.call-btn.hangup { background: var(--red); }
.call-btn.hangup:hover { background: var(--red-dark); }
.call-btn.muted { background: #F59E0B; }

/* Toast */
.app-toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-1); color: #fff;
  padding: 12px 22px; border-radius: 14px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 300;
}
.app-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   LLAMADAS GRUPALES — selector de participantes y grid dinámico
   ============================================================ */
.gcall-select-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.gcall-members {
  max-height: 300px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.gcall-member {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line-soft);
  cursor: pointer; transition: background .15s;
}
.gcall-member:hover { background: var(--celeste-2); }
.gcall-member-av { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }
.gcall-member-name { flex: 1; font-size: 14px; font-weight: 500; }
.gcall-member-state { font-size: 12px; color: var(--txt-2); }
.gcall-member-state.on { color: var(--ok); font-weight: 600; }
.gcall-call-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }

.gcall-card { width: min(720px, 94vw); }
.gcall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 4px;
  max-height: 55vh; overflow-y: auto;
}
.gcall-grid.video-mode { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.gcall-tile {
  background: var(--celeste-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px 10px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 130px; justify-content: center;
  transition: opacity .2s;
  position: relative;
}
.gcall-tile.host-muted { box-shadow: 0 0 0 2px #E5484D inset; }
.gcall-tile-muted-badge {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(20,24,32,0.75); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.gcall-tile-mod-btn {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(20,24,32,0.65); color: #fff; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2; transition: background .15s;
}
.gcall-tile-mod-btn:hover { background: #E5484D; }
.gcall-tile video {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 10px; background: #0b1626;
}
.gcall-tile.st-llamando { opacity: .75; }
.gcall-tile.st-llamando .gcall-tile-avatar { animation: gcallPulse 1.2s ease-in-out infinite; }
.gcall-tile.st-desconectado, .gcall-tile.st-rechazo { opacity: .45; filter: grayscale(.7); }
@keyframes gcallPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(237,28,36,.35); }
  50% { box-shadow: 0 0 0 10px rgba(237,28,36,0); }
}
.gcall-tile-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--navy-3); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; overflow: hidden;
}
.gcall-tile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gcall-tile-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gcall-tile-name { font-size: 13px; font-weight: 600; color: var(--txt); text-align: center; }
.gcall-tile-status { font-size: 11.5px; color: var(--txt-2); }
.gcall-tile.st-conectado .gcall-tile-status { color: var(--ok); font-weight: 600; }
.gcall-tile.st-llamando .gcall-tile-status { color: var(--red); }

/* ============================================================
   MÓDULO DE ARCHIVOS — estilo Google Drive
   ============================================================ */
.drive-view {
  flex: 1;
  display: flex;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

/* Sidebar interno del gestor */
.drive-sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  gap: 14px;
}
.drive-new-wrap { position: relative; }
.drive-new-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 22px;
  font-size: 14.5px; font-weight: 600; color: var(--txt);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, background .18s;
}
.drive-new-btn:hover { box-shadow: var(--shadow-md); background: var(--celeste-2); }
.drive-new-btn svg { color: var(--red); }
.drive-new-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 200px; z-index: 60;
}
.drive-nav { display: flex; flex-direction: column; gap: 2px; }
.drive-nav-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none;
  padding: 10px 14px; border-radius: 0 20px 20px 0;
  font-size: 14px; color: var(--txt);
  cursor: pointer; text-align: left;
  transition: background .15s;
}
.drive-nav-item:hover { background: var(--celeste-2); }
.drive-nav-item.active { background: var(--celeste); font-weight: 600; color: var(--navy-1); }
.drive-nav-item i { width: 16px; text-align: center; color: var(--navy-3); }
.drive-nav-item.active i { color: var(--navy-1); }
.drive-storage-label i { color: var(--navy-3); margin-right: 4px; }

.drive-storage { margin-top: auto; padding: 0 6px; }
.drive-storage-label { font-size: 12.5px; font-weight: 600; color: var(--txt-2); margin-bottom: 6px; }
.drive-storage-bar {
  height: 6px; border-radius: 4px;
  background: var(--line-soft); overflow: hidden; margin-bottom: 5px;
}
#drive-storage-fill {
  height: 100%; width: 0;
  background: var(--navy-3);
  border-radius: 4px;
  transition: width .3s;
}
#drive-storage-fill.full { background: var(--red); }
.drive-storage small { font-size: 11.5px; color: var(--txt-2); }

/* Área principal */
.drive-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.drive-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--header-top), var(--celeste));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.drive-breadcrumb { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.drive-crumb {
  background: none; border: none;
  font-size: 14.5px; color: var(--navy-3);
  padding: 4px 8px; border-radius: 8px;
  cursor: pointer; font-weight: 500;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drive-crumb:hover { background: rgba(255,255,255,.6); }
.drive-crumb.current { color: var(--txt); font-weight: 700; cursor: default; }
.drive-crumb-sep { color: var(--txt-2); font-size: 13px; }
.drive-toolbar-right { display: flex; align-items: center; gap: 8px; }
.drive-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 12px;
  color: var(--txt-2);
}
.drive-search input { border: none; outline: none; font-size: 13.5px; width: 170px; background: transparent; }
.drive-sort {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; font-size: 13px; background: var(--white); color: var(--txt);
  outline: none; cursor: pointer;
}

/* Contenido: grid y lista */
.drive-content { flex: 1; overflow-y: auto; padding: 18px; }
.drive-content.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  align-content: start;
}
.drive-content.grid .drive-item {
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  user-select: none;
}
.drive-content.grid .drive-item:hover { box-shadow: var(--shadow-md); border-color: var(--line); transform: translateY(-1px); }
.drive-item-thumb {
  height: 92px;
  display: flex; align-items: center; justify-content: center;
  background: var(--celeste-2);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.drive-icon { font-size: 42px; }
.drive-thumb { width: 100%; height: 100%; object-fit: cover; }
.drive-item-name {
  font-size: 13.5px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drive-item-sub { font-size: 11.5px; color: var(--txt-2); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.drive-badge { font-size: 11px; }
.drive-item-more {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.85);
  font-size: 15px; color: var(--txt-2);
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.drive-content.grid .drive-item:hover .drive-item-more { display: flex; }
.drive-item-more:hover { background: var(--celeste); color: var(--navy-1); }
.drive-item.trashed { opacity: .6; }

.drive-content.list { display: flex; flex-direction: column; gap: 2px; padding: 10px 18px; }
.drive-content.list .drive-item {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 130px 150px 90px 34px;
  align-items: center; gap: 10px;
  background: var(--white);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px; border-radius: 10px;
  cursor: pointer; position: relative;
}
.drive-content.list .drive-item:hover { background: var(--celeste-2); }
.drive-row-icon { font-size: 22px; display: flex; align-items: center; }
.drive-row-icon .drive-thumb { width: 32px; height: 32px; border-radius: 6px; }
.drive-row-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-row-owner, .drive-row-date, .drive-row-size { font-size: 12.5px; color: var(--txt-2); }
.drive-content.list .drive-item-more { position: static; display: flex; }

.drive-empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--txt-2); gap: 10px; font-size: 14.5px;
}

/* Menú contextual */
.drive-ctx-menu {
  position: fixed; z-index: 400;
  min-width: 230px;
  max-height: 70vh; overflow-y: auto;
}

/* Modales del gestor */
.drive-share-list { max-height: 180px; overflow-y: auto; }
.drive-share-row { display: flex; align-items: center; gap: 8px; }
.drive-share-name { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-perm-select {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 8px; font-size: 12.5px; background: var(--white); color: var(--txt);
  outline: none;
}
.drive-info-head { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 12px; }
.drive-info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.drive-info-table td { padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.drive-info-table td:first-child { color: var(--txt-2); width: 110px; font-weight: 500; }
.drive-info-access { list-style: none; font-size: 13px; color: var(--txt); display: flex; flex-direction: column; gap: 4px; }

/* Cuota de almacenamiento en el editor de usuario */
.ue-quota-card {
  margin: 0 22px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg);
}
.ue-quota-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ue-quota-input { flex: 1; }
.ue-quota-percent { font-size: 22px; font-weight: 700; color: var(--navy-1); line-height: 1; }
.ue-quota-bar {
  height: 10px; border-radius: 6px; background: var(--line-soft); overflow: hidden; margin-bottom: 12px;
}
#ue-quota-fill {
  height: 100%; width: 0%; background: var(--navy-3); border-radius: 6px;
  transition: width .25s ease, background .25s ease;
}
#ue-quota-fill.warn { background: #E8A33D; }
#ue-quota-fill.full { background: var(--red); }
.ue-quota-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.ue-quota-stat { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--txt-2); }
.ue-quota-stat i { color: var(--navy-3); width: 14px; text-align: center; }
.ue-quota-stat b { color: var(--navy-1); font-size: 13px; }
.ue-externo-hint { display: flex; align-items: flex-start; gap: 6px; color: var(--txt-2); line-height: 1.4; margin-top: -6px; }
.ue-externo-hint i { color: var(--navy-3); margin-top: 2px; }

/* Iconos de tipo de archivo (Font Awesome) */
.drive-icon i { font-size: 40px; }
.drive-row-icon i { font-size: 20px; }
.icon-pdf   { color: #D93025; }
.icon-word  { color: #2B579A; }
.icon-excel { color: #21A366; }
.icon-ppt   { color: #D24726; }
.icon-txt   { color: #6B7C93; }
.icon-zip   { color: #C08A2E; }
.icon-audio { color: #7B4EBD; }
.icon-video { color: #B3261E; }
.icon-image { color: #1F5D8B; }
.icon-file  { color: var(--txt-2); }
.icon-folder{ color: #F4B942; }
.icon-global{ color: var(--navy-3); }

/* Editor de texto integrado del Drive (dentro de la misma app, sin ventana aparte) */
.drive-editor-view {
  position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; z-index: 20;
}
.drive-editor-toolbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px; flex-shrink: 0;
  background: linear-gradient(120deg, var(--navy-1), var(--navy-3)); color: #fff;
  box-shadow: 0 2px 10px rgba(8,24,44,0.15);
}
.drive-editor-exit-btn {
  display: flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 10px; flex-shrink: 0; transition: background .15s;
}
.drive-editor-exit-btn:hover { background: rgba(255,255,255,0.26); }
.drive-editor-title-block { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; }
.drive-editor-file-icon { font-size: 17px; color: rgba(255,255,255,0.85); flex-shrink: 0; }
.drive-editor-filename {
  max-width: 360px; border: none; background: transparent; font-size: 15px; font-weight: 600;
  color: #fff; padding: 6px 4px; opacity: 1; -webkit-text-fill-color: #fff;
}
.drive-editor-status { font-size: 12px; font-weight: 600; color: var(--navy-1); padding: 4px 12px; border-radius: 20px; background: #fff; flex-shrink: 0; }
.drive-editor-status.dirty { background: #FFE39A; color: #7A4E00; }
.drive-editor-status.error { background: #FBBFB8; color: var(--red-dark); }
.drive-editor-status.loading { background: rgba(255,255,255,0.75); color: var(--navy-1); }
.drive-editor-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.drive-editor-toolbar-right .admin-mini-btn { background: rgba(255,255,255,0.14); color: #fff; border-color: transparent; }
.drive-editor-toolbar-right .admin-mini-btn:hover { background: rgba(255,255,255,0.26); }
.drive-editor-body { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 28px 20px; }
.drive-editor-textarea {
  width: 100%; max-width: 900px; min-height: 100%; border: none; outline: none; resize: none;
  padding: 32px 36px; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px rgba(8,24,44,0.08);
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace; font-size: 14.5px; line-height: 1.7;
  color: var(--txt);
}
.drive-editor-textarea:disabled { background: var(--line-soft); color: var(--txt-2); }
.drive-editor-textarea:focus { box-shadow: 0 6px 24px rgba(8,24,44,0.08), 0 0 0 3px var(--celeste); }

/* Seguridad: lista blanca de IPs */
.security-intro {
  display: flex; gap: 10px; align-items: flex-start; background: var(--celeste-2); border: 1px solid var(--celeste);
  border-radius: 10px; padding: 12px 14px; margin: 16px 22px; font-size: 13px; color: var(--txt); line-height: 1.5;
}
.security-intro i { color: var(--navy-3); margin-top: 2px; }
.security-intro code { background: var(--white); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.security-ip-icon {
  width: 36px; height: 36px; border-radius: 50%; background: var(--celeste); color: var(--navy-1);
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}

/* Responsive del gestor */
@media (max-width: 900px) {
  .drive-sidebar { width: 190px; }
  .drive-content.list .drive-item { grid-template-columns: 36px minmax(0,1fr) 90px 34px; }
  .drive-row-owner, .drive-row-date { display: none; }
}
@media (max-width: 640px) {
  .drive-view { flex-direction: column; }
  .drive-sidebar {
    width: 100%; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px; gap: 8px;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .drive-nav { flex-direction: row; }
  .drive-nav-item { border-radius: 12px; white-space: nowrap; padding: 8px 10px; }
  .drive-storage { display: none; }
  .drive-search input { width: 110px; }
}

/* ==========================================================
   RESPONDER MENSAJES (reply)
   ========================================================== */
.msg-reply-quote {
  display: flex; gap: 8px; align-items: stretch; cursor: pointer;
  background: rgba(0,0,0,0.05); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px;
}
.message.own .msg-reply-quote { background: rgba(255,255,255,0.45); }
.msg-reply-bar { width: 3px; border-radius: 3px; background: var(--navy-3); flex-shrink: 0; }
.msg-reply-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.msg-reply-body small { font-weight: 700; color: var(--navy-1); font-size: 11.5px; }
.msg-reply-body span { font-size: 12.5px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.reply-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px; background: #fff; border-top: 1px solid var(--line);
}
.reply-preview-bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--red); }
.reply-preview-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.reply-preview-body small { font-weight: 700; color: var(--red); font-size: 12px; }
.reply-preview-body span { font-size: 13px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reply-preview-cancel {
  border: none; background: var(--bg); border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 13px;
}

/* Menciones */
.mention-tag {
  color: var(--navy-1); background: var(--celeste); border-radius: 5px; padding: 0 4px;
  font-weight: 600; cursor: pointer;
}
.message.own .mention-tag { background: rgba(255,255,255,0.55); }
.msg-mention-flag { color: var(--red); margin-left: 3px; }

.mention-dropdown {
  position: absolute; bottom: 78px; left: 24px; right: 24px; max-width: 340px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md);
  max-height: 220px; overflow-y: auto; z-index: 55;
}
.mention-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.mention-item:hover, .mention-item.active { background: var(--celeste-2); }
.mention-item-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--navy-3); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.mention-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mention-item-name { font-size: 13.5px; font-weight: 600; color: var(--txt); flex: 1; }
.mention-item-user { color: var(--txt-2); font-size: 12px; }

/* Menú contextual de mensaje */
.msg-ctx-menu { position: fixed; min-width: 200px; }

/* Mini perfil (mención) */
.profile-popover {
  position: fixed; width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-md); padding: 18px; z-index: 90; display: flex; flex-direction: column;
  align-items: center; gap: 6px; text-align: center;
}
#profile-popover-close {
  position: absolute; top: 8px; right: 8px; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--txt-2);
}
.profile-popover-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--navy-3); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; overflow: hidden; margin-bottom: 4px;
}
.profile-popover-avatar img { width: 100%; height: 100%; object-fit: cover; }
#profile-popover-meta { color: var(--txt-2); font-size: 12.5px; margin-bottom: 6px; }
.profile-popover button.admin-primary-btn { width: 100%; justify-content: center; }

/* Opciones de chat (silenciar) */
.room-options-menu button i { color: var(--navy-3); margin-right: 6px; }

/* ==========================================================
   VISOR DE IMÁGENES (lightbox)
   ========================================================== */
.image-viewer { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.iv-backdrop { position: absolute; inset: 0; background: rgba(10,14,20,0.88); backdrop-filter: blur(6px); }
.iv-stage { position: relative; width: 92vw; height: 82vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.iv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: grab; transition: transform .08s ease-out; user-select: none; border-radius: 6px; }
.iv-close { position: absolute; top: 20px; right: 24px; z-index: 2; }
.iv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,0.12); border: none; color: #fff;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.iv-nav:hover { background: rgba(255,255,255,0.25); }
.iv-prev { left: 24px; } .iv-next { right: 24px; }
.iv-close {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.12); border: none; color: #fff;
  font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.iv-close:hover { background: rgba(255,255,255,0.25); }
.iv-counter { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: .85; }
.iv-toolbar {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; background: rgba(20,24,32,0.7); backdrop-filter: blur(6px);
  padding: 8px; border-radius: 16px; z-index: 2;
}
.iv-toolbar button {
  border: none; background: transparent; color: #fff; font-size: 13px; padding: 9px 14px; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; gap: 7px; transition: background .15s;
}
.iv-toolbar button:hover { background: rgba(255,255,255,0.15); }

/* ==========================================================
   NOTIFICACIONES
   ========================================================== */
.notif-body { padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.notif-body .ue-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
#notif-perm-hint { margin: -8px 0 2px 26px; }

/* ==========================================================
   HORARIO DE FUNCIONAMIENTO (admin + bloqueo)
   ========================================================== */
.schedule-card { margin: 0 22px 24px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 14px; }
.schedule-days { display: flex; gap: 10px; flex-wrap: wrap; }
.schedule-days label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--txt-2); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.schedule-times { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.schedule-times .ue-field { min-width: 130px; }

.horario-lock {
  position: fixed; inset: 0; z-index: 500; background: rgba(10,14,20,0.94);
  display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 24px;
}
.horario-lock-card { max-width: 420px; }
.horario-lock-card i { font-size: 46px; color: var(--red); margin-bottom: 16px; }
.horario-lock-card h2 { font-size: 20px; margin-bottom: 10px; }
.horario-lock-card p { color: rgba(255,255,255,0.75); font-size: 14.5px; line-height: 1.5; }

/* ==========================================================
   RESPONSIVE — mobile first, adaptado a móviles / tablets / laptops / monitores anchos
   ========================================================== */

/* Monitores muy anchos: limita el ancho útil para no estirar demasiado el layout */
@media (min-width: 1800px) {
  .chat-screen { max-width: 1760px; margin: 0 auto; }
}

/* Laptops / pantallas medianas */
@media (max-width: 1180px) {
  .message { max-width: 72%; }
  .iv-stage { width: 90vw; height: 78vh; }
}

/* Tablets (iPad Mini/Air/Pro y Android) */
@media (max-width: 1024px) {
  .chat-col { width: 260px; }
  .mention-dropdown { left: 16px; right: 16px; }
}

@media (max-width: 900px) {
  .message { max-width: 80%; }
  .drive-sidebar { width: 190px; }
  .schedule-times { flex-direction: column; align-items: stretch; }
  .schedule-times .ue-field { min-width: 0; }
}

/* Smartphones: overrides adicionales sobre el sistema responsive ya existente
   (el colapso del riel lateral y el cambio chat-col/chat-main ya está resuelto arriba) */
@media (max-width: 720px) {
  .message { max-width: 88%; font-size: 14px; }
  .message-form { padding: 10px 12px; gap: 8px; }
  .message-form input[type="text"] { padding: 12px 16px; }
  .icon-btn, .send-btn { width: 42px; height: 42px; }
  .reply-preview, .attachment-preview, .recording-bar { padding: 10px 12px; }
  .mention-dropdown { left: 10px; right: 10px; bottom: 66px; }
  .profile-popover { width: calc(100vw - 32px); left: 16px !important; }
  .iv-toolbar { flex-wrap: wrap; justify-content: center; bottom: 14px; }
  .iv-toolbar button span, .iv-toolbar button { font-size: 12px; padding: 8px 10px; }
  .iv-nav { width: 38px; height: 38px; }
  .drive-editor-textarea { padding: 16px; }
  .ue-quota-card, .schedule-card { margin-left: 12px; margin-right: 12px; }
  .admin-inline-form { flex-direction: column; align-items: stretch; }
}

@media (max-width: 420px) {
  .message { max-width: 92%; }
  .chat-header-actions { gap: 4px; }
  .room-options-menu { right: -40px; }
}

/* Pantallas táctiles: objetivos de toque más grandes (evita botones inaccesibles) */
@media (hover: none) and (pointer: coarse) {
  .msg-pin-btn { display: flex; }
  .header-icon-btn, .icon-btn { min-width: 42px; min-height: 42px; }
  .mention-item, .dropdown-menu button { padding-top: 12px; padding-bottom: 12px; }
}

/* ==========================================================
   MODAL GENÉRICO DE "INGRESAR UN VALOR" (reemplaza prompt())
   ========================================================== */
.prompt-modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,14,20,0.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: promptFadeIn .12s ease-out;
}
@keyframes promptFadeIn { from { opacity: 0; } to { opacity: 1; } }
.prompt-modal-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(8,24,44,0.35); padding: 22px 22px 20px;
  animation: promptPopIn .16s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes promptPopIn { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.prompt-modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.prompt-modal-header i { color: var(--navy-3); font-size: 16px; }
.prompt-modal-header strong { flex: 1; font-size: 16px; color: var(--txt); }
#prompt-modal-close { border: none; background: var(--bg); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; color: var(--txt-2); font-size: 12px; }
#prompt-modal-close:hover { background: var(--line-soft); }
.prompt-modal-message { font-size: 13px; color: var(--txt-2); margin: -6px 0 12px; }
.prompt-modal-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; color: var(--txt); outline: none; transition: border-color .15s;
}
.prompt-modal-input:focus { border-color: var(--navy-3); }
.prompt-modal-error { display: block; color: var(--red-dark); font-size: 12.5px; margin-top: 7px; }
.prompt-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.prompt-modal-actions .admin-primary-btn, .prompt-modal-actions .admin-mini-btn { margin: 0; }

/* ==========================================================
   MODAL DE NOTIFICACIONES (rediseño)
   ========================================================== */
.notif-card { max-width: 460px; padding-bottom: 20px; }
.notif-header {
  display: flex; align-items: center; gap: 14px; padding: 20px 22px;
  background: linear-gradient(120deg, var(--navy-1), var(--navy-3)); color: #fff;
  border-radius: 20px 20px 0 0; margin: -1px -1px 0;
}
.notif-header-icon {
  width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.notif-header-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-header-text strong { font-size: 16.5px; }
.notif-header-text small { color: rgba(255,255,255,0.75); font-size: 12px; }
.notif-header #notif-close { border: none; background: rgba(255,255,255,0.14); color: #fff; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; flex-shrink: 0; }
.notif-header #notif-close:hover { background: rgba(255,255,255,0.28); }
.notif-body { padding: 18px 22px 4px; display: flex; flex-direction: column; gap: 14px; }

.notif-perm-banner {
  display: flex; align-items: center; gap: 12px; background: #FFF6E5; border: 1px solid #F5D896;
  border-radius: 12px; padding: 12px 14px;
}
.notif-perm-banner i { color: #B9790A; font-size: 18px; flex-shrink: 0; }
.notif-perm-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-perm-banner-text strong { font-size: 13px; color: #7A4E00; }
.notif-perm-banner-text small { font-size: 12px; color: #8A6412; }
.notif-perm-banner .admin-primary-btn { margin: 0; padding: 8px 14px; font-size: 12.5px; flex-shrink: 0; }

.notif-switch-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s;
}
.notif-switch-row:hover { border-color: var(--celeste); }
.notif-switch-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-switch-text strong { font-size: 13.5px; color: var(--txt); }
.notif-switch-text small { font-size: 12px; color: var(--txt-2); }

.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: absolute; inset: 0; background: var(--line-soft); border-radius: 30px; transition: background .18s;
}
.switch-track::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--navy-3); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }

#notif-muted-list .admin-row { padding: 10px 4px; }

/* ==========================================================
   BARRA DE FORMATO DEL EDITOR DE TEXTO (H1/H2/H3, negrita, viñetas)
   ========================================================== */
.drive-editor-format-bar {
  display: flex; align-items: center; gap: 6px; padding: 8px 22px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--line);
}
.drive-editor-format-bar.disabled { opacity: .45; pointer-events: none; }
.fmt-btn {
  display: flex; align-items: center; justify-content: center; min-width: 34px; height: 30px;
  padding: 0 9px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--navy-1); cursor: pointer; transition: background .15s, border-color .15s;
}
.fmt-btn:hover { background: var(--celeste-2); border-color: var(--celeste); }
.fmt-btn:active { transform: scale(.96); }
.fmt-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.fmt-hint { color: var(--txt-2); font-size: 11.5px; margin-left: 6px; }

.drive-editor-body { position: relative; }
.drive-editor-preview {
  width: 100%; max-width: 900px; margin: 0 auto; min-height: 100%;
  padding: 32px 36px; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px rgba(8,24,44,0.08);
  font-size: 14.5px; line-height: 1.7; color: var(--txt);
}
.drive-editor-preview h1 { font-size: 28px; font-weight: 800; color: var(--navy-1); margin: 18px 0 10px; }
.drive-editor-preview h2 { font-size: 22px; font-weight: 700; color: var(--navy-1); margin: 16px 0 8px; }
.drive-editor-preview h3 { font-size: 18px; font-weight: 700; color: var(--navy-1); margin: 14px 0 6px; }
.drive-editor-preview h1:first-child, .drive-editor-preview h2:first-child, .drive-editor-preview h3:first-child { margin-top: 0; }
.drive-editor-preview p { margin: 0 0 10px; }
.drive-editor-preview ul { margin: 0 0 12px; padding-left: 24px; }
.drive-editor-preview li { margin-bottom: 4px; }
.drive-editor-preview strong { color: var(--navy-1); }
.drive-editor-preview-empty { color: var(--txt-2); font-style: italic; }

/* ==========================================================
   PANTALLA VACÍA (Esc cierra el chat activo — estilo WhatsApp Desktop)
   ========================================================== */
.chat-empty-state {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; background: var(--bg); padding: 24px;
}
.chat-empty-logo {
  width: 76px; height: 76px; border-radius: 22px; font-size: 34px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-1), var(--navy-3)); color: #fff; font-weight: 800;
  box-shadow: 0 10px 30px rgba(8,24,44,0.18);
}
.chat-empty-state h2 { font-size: 18px; color: var(--txt); font-weight: 700; }
.chat-empty-state p { font-size: 14px; color: var(--txt-2); max-width: 320px; }
.chat-empty-state small { color: var(--txt-2); font-size: 12px; margin-top: 6px; }
.chat-empty-state kbd {
  background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px;
  font-family: inherit; font-size: 11.5px; box-shadow: 0 1px 0 var(--line);
}

/* Enlaces detectados automáticamente dentro de los mensajes */
.msg-link { color: var(--navy-3); text-decoration: underline; word-break: break-word; }
.message.own .msg-link { color: #eaf3ff; }
.msg-link:hover { opacity: .85; }

/* ==========================================================
   REPRODUCTOR DE NOTAS DE VOZ (propio, con duración real)
   ========================================================== */
.voice-msg {
  display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 280px;
  padding: 6px 4px; margin-bottom: 2px;
}
.voice-audio-el { display: none; }
.voice-play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; flex-shrink: 0; cursor: pointer;
  background: var(--navy-3); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background .15s, transform .1s;
}
.voice-play-btn:hover { background: var(--navy-1); }
.voice-play-btn:active { transform: scale(.94); }
.message.own .voice-play-btn { background: rgba(255,255,255,0.9); color: var(--navy-1); }
.voice-progress {
  flex: 1; height: 6px; border-radius: 6px; background: rgba(0,0,0,0.12); cursor: pointer; position: relative;
}
.message.own .voice-progress { background: rgba(255,255,255,0.35); }
.voice-progress-fill {
  position: absolute; top: 0; left: 0; height: 100%; width: 0%; border-radius: 6px;
  background: var(--navy-3); transition: width .1s linear;
}
.message.own .voice-progress-fill { background: #fff; }
.voice-msg.playing .voice-progress-fill { transition: width .05s linear; }
.voice-time { font-size: 11.5px; color: var(--txt-2); flex-shrink: 0; min-width: 32px; text-align: right; }
.message.own .voice-time { color: rgba(255,255,255,0.8); }

/* ==========================================================
   AVATAR + NOMBRE CON COLOR POR USUARIO (mensajes de grupo)
   ========================================================== */
.messages.group-mode { padding-left: 78px; }
.msg-avatar {
  position: absolute; left: -44px; bottom: 0; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700;
  overflow: hidden; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 720px) {
  .messages.group-mode { padding-left: 54px; }
  .msg-avatar { left: -38px; width: 26px; height: 26px; font-size: 11px; }
}

/* ==========================================================
   VENTANA FLOTANTE (Picture-in-Picture) DE LLAMADAS
   ========================================================== */
.call-modal.minimized {
  background: transparent; backdrop-filter: none; pointer-events: none;
  align-items: flex-start; justify-content: flex-start; padding: 0; inset: auto;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
}
.call-modal.minimized .call-card {
  position: fixed; width: 260px; max-width: 260px; padding: 10px; gap: 8px;
  pointer-events: auto; cursor: grab; z-index: 250; box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  border-radius: 16px;
}
.call-modal.minimized .call-card:active { cursor: grabbing; }
.call-modal.minimized .call-head strong { font-size: 12.5px; }
.call-modal.minimized .call-status { font-size: 10.5px; }
.call-modal.minimized .call-videos { aspect-ratio: 16/10; border-radius: 12px; }
.call-modal.minimized #local-video { width: 34%; min-width: 0; right: 8px; bottom: 8px; }
.call-modal.minimized .gcall-grid { max-height: 130px; overflow: hidden; grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
.call-modal.minimized .gcall-tile { min-height: 60px; padding: 6px; }
.call-modal.minimized .gcall-tile-name { font-size: 10.5px; }
.call-modal.minimized .gcall-tile-status { display: none; }
.call-modal.minimized .call-actions { gap: 8px; }
.call-modal.minimized .call-btn { width: 38px; height: 38px; }
.call-modal.minimized .call-btn svg { width: 16px; height: 16px; }
.call-modal.minimized .call-btn i { font-size: 13px; }

/* ==========================================================
   CABECERA DE GRUPO CLICABLE (abre "Información del grupo")
   ========================================================== */
.chat-header-info { cursor: pointer; border-radius: 8px; padding: 2px 6px; margin: -2px -6px; transition: background .15s; }
.chat-header-info:hover { background: rgba(0,0,0,0.04); }
#current-room-avatar { cursor: pointer; }

/* ==========================================================
   PANEL "INFORMACIÓN DEL GRUPO"
   ========================================================== */
.group-info-card { max-width: 460px; max-height: 82vh; display: flex; flex-direction: column; padding-bottom: 16px; }
.group-info-tabs { display: flex; gap: 4px; padding: 14px 22px 0; flex-shrink: 0; }
.group-info-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  border: none; background: var(--bg); color: var(--txt-2); font-size: 13px; font-weight: 600;
  padding: 10px; border-radius: 10px 10px 0 0; cursor: pointer; transition: background .15s, color .15s;
}
.group-info-tab.active { background: var(--celeste); color: var(--navy-1); }
.group-info-tab-content { overflow-y: auto; padding-top: 12px; }
.ginfo-search { margin: 0 22px 10px; }
.ginfo-member-list { padding: 0 22px 4px; max-height: 340px; overflow-y: auto; }

.group-info-media-tabs { display: flex; gap: 6px; padding: 12px 22px 10px; flex-wrap: wrap; }
.ginfo-media-tab {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--txt-2); font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 20px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ginfo-media-tab.active { background: var(--navy-3); border-color: var(--navy-3); color: #fff; }
.ginfo-media-list { padding: 0 22px 4px; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ginfo-image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ginfo-image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; transition: opacity .15s; }
.ginfo-image-grid img:hover { opacity: .85; }
