/* ChatCifrado · Production Design System v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-main: #060913;
  --bg-surface: rgba(12, 20, 39, 0.85);
  --bg-surface-elevated: rgba(19, 32, 60, 0.9);
  --bg-card: rgba(16, 26, 48, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(0, 242, 254, 0.35);
  --border-active: #00f2fe;

  --accent-cyan: #00f2fe;
  --accent-blue: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #3b82f6 100%);
  --accent-glow: 0 0 25px rgba(0, 242, 254, 0.35);

  --status-emerald: #10b981;
  --status-emerald-glow: 0 0 16px rgba(16, 185, 129, 0.45);
  --status-rose: #f43f5e;
  --status-rose-glow: 0 0 22px rgba(244, 63, 94, 0.5);
  --status-amber: #f59e0b;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-elevated: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(0, 242, 254, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Header */
.app-header {
  height: 68px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 20;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-glow {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  color: #060913;
  font-weight: 800;
  font-size: 1.2rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.header-user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-id-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-role-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-admin {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.role-user {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Workspace */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 350px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.sidebar-actions {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #060913;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-search {
  padding: 12px 16px;
}
.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.sidebar-lists {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 8px 6px 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.chat-item.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
}

.chat-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  border: 1px solid var(--border-subtle);
}
.chat-avatar.guest {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.chat-item-text h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}
.chat-item-text p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Chat Main View */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(8, 13, 26, 0.5);
  position: relative;
}

.chat-header {
  height: 68px;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.chat-peer-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.chat-peer-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
}
.peer-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
}

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

.btn-call {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-call:hover {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.btn-video {
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: var(--accent-cyan);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-video:hover {
  background: var(--accent-cyan);
  color: #060913;
  box-shadow: var(--accent-glow);
}

.e2ee-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--status-emerald);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}
.e2ee-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-emerald);
  box-shadow: var(--status-emerald-glow);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-danger:hover {
  background: var(--status-rose);
  color: #ffffff;
  box-shadow: var(--status-rose-glow);
}

/* Messages Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-bubble {
  max-width: 68%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.2s ease-out;
}
.message-bubble.mine {
  align-self: flex-end;
}
.message-bubble.theirs {
  align-self: flex-start;
}

.msg-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-body {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.message-bubble.mine .msg-body {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2) 0%, rgba(59, 130, 246, 0.25) 100%);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.message-bubble.theirs .msg-body {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* Encrypted Media Rendering */
.msg-media-img {
  max-width: 100%;
  max-height: 380px;
  border-radius: var(--radius-sm);
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
  object-fit: cover;
}
.msg-media-img:hover {
  transform: scale(1.015);
}

.msg-media-video {
  max-width: 100%;
  max-height: 380px;
  border-radius: var(--radius-sm);
  outline: none;
  background: #000;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 2px 4px 0 4px;
}

/* Chat Input Bar with Media Attachment */
.chat-input-bar {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}
.btn-attach {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}
.btn-attach:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(0, 242, 254, 0.4);
}

.input-message {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.input-message:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.btn-send {
  background: var(--accent-gradient);
  border: none;
  color: #060913;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: var(--accent-glow);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
}
.modal-content.wide {
  max-width: 960px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.form-input:focus {
  border-color: var(--accent-cyan);
}

/* Link generated box */
.generated-link-box {
  background: rgba(0, 242, 254, 0.05);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.link-url {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.2);
}
.admin-tab {
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}
.admin-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}
.admin-table th {
  padding: 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

/* --- WEBRTC CALL OVERLAY --- */
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.95);
  backdrop-filter: blur(25px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}

.call-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--status-emerald);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.call-video-grid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
}

.video-remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-local-pip {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 130px;
  border-radius: var(--radius-md);
  border: 2px solid var(--accent-cyan);
  object-fit: cover;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
  z-index: 10;
  background: #111;
}

.audio-only-avatar-pulse {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.audio-pulse-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #060913;
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.5);
  animation: audioPulse 1.8s infinite ease-in-out;
}

@keyframes audioPulse {
  0% { transform: scale(0.96); box-shadow: 0 0 20px rgba(0, 242, 254, 0.3); }
  50% { transform: scale(1.08); box-shadow: 0 0 45px rgba(0, 242, 254, 0.7); }
  100% { transform: scale(0.96); box-shadow: 0 0 20px rgba(0, 242, 254, 0.3); }
}

.call-controls-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  background: rgba(18, 30, 56, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: fit-content;
  margin: 0 auto;
}

.btn-dock {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-dock:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}
.btn-dock.active-mute {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--status-rose);
  color: #fda4af;
}
.btn-dock-hangup {
  background: var(--status-rose);
  color: white;
  border-color: transparent;
  box-shadow: var(--status-rose-glow);
}
.btn-dock-hangup:hover {
  background: #e11d48;
  transform: scale(1.08);
}

/* Incoming Call Banner Modal */
.incoming-call-modal {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 10px 40px rgba(0, 242, 254, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 250;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDown {
  from { transform: translate(-50%, -40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.btn-call-accept {
  background: var(--status-emerald);
  color: #060913;
  font-weight: 700;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--status-emerald-glow);
}
.btn-call-decline {
  background: var(--status-rose);
  color: white;
  font-weight: 700;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--status-rose-glow);
}

/* Lightbox Fullscreen Media Viewer */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(15px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}
.lightbox-close-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Guest Entrance Screen */
.guest-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.guest-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-elevated);
  text-align: center;
}
.guest-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #060913;
  box-shadow: var(--accent-glow);
}

.destroyed-card {
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: var(--status-rose-glow);
}
.destroyed-icon {
  background: var(--status-rose);
  color: white;
  box-shadow: var(--status-rose-glow);
}

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

/* ==============================================================================
   ChatCifrado · Mobile Responsive Design System (Screens < 768px & Touch Devices)
   ============================================================================== */

.btn-mobile-back {
  display: none;
}

@media (max-width: 768px) {
  #app {
    height: 100dvh;
    height: -webkit-fill-available;
  }

  .app-header {
    height: 56px;
    padding: 0 12px;
  }

  .brand-logo-glow {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    border-radius: 9px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-sub {
    display: none;
  }

  .user-id-pill span:last-child {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-role-pill {
    display: none;
  }

  .header-user-badge {
    gap: 6px;
  }

  .btn-icon span.label {
    display: none;
  }

  /* Mobile Workspace Navigation (Sidebar vs Active Chat View) */
  .workspace {
    position: relative;
    width: 100%;
    height: calc(100dvh - 56px);
    overflow: hidden;
  }

  .sidebar {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    border-right: none;
    display: flex;
  }

  .chat-main {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    display: none;
  }

  .workspace.chat-open .sidebar {
    display: none;
  }

  .workspace.chat-open .chat-main {
    display: flex;
    z-index: 15;
  }

  .btn-mobile-back {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: rgba(0, 242, 254, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
    margin-right: 8px;
    cursor: pointer;
    min-width: 40px;
    min-height: 36px;
  }

  .chat-header {
    height: 56px;
    padding: 0 10px;
  }

  .chat-peer-info {
    gap: 8px;
  }

  .chat-peer-info h3 {
    font-size: 0.92rem;
    max-width: 115px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .peer-badge {
    display: none;
  }

  .chat-actions-group {
    gap: 5px;
  }

  .btn-call, .btn-video {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .e2ee-indicator span {
    display: none;
  }
  .e2ee-indicator {
    padding: 5px;
  }

  .messages-container {
    padding: 12px 10px;
    gap: 10px;
  }

  .message-bubble {
    max-width: 88%;
    padding: 9px 12px;
    font-size: 0.9rem;
  }

  .chat-input-bar {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px;
    gap: 8px;
  }

  .input-message {
    font-size: 16px; /* Prevents unwanted auto-zoom on iOS Safari */
    padding: 10px 12px;
  }

  .btn-attach {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
  }

  .btn-send {
    padding: 9px 14px;
    font-size: 0.85rem;
  }

  /* Mobile Video Call Modal */
  .video-call-overlay {
    padding: 0;
  }

  .video-call-container {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .local-video-pip {
    width: 105px;
    height: 145px;
    top: 14px;
    right: 14px;
    border-radius: 12px;
  }

  .call-controls-bar {
    bottom: 24px;
    gap: 12px;
    padding: 8px 14px;
  }

  .btn-call-action {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  /* Mobile Dialogs & Cards */
  .modal-content {
    width: 92% !important;
    padding: 22px 18px !important;
  }

  .login-card {
    width: 92% !important;
    padding: 28px 20px !important;
  }

  .guest-card {
    width: 92% !important;
    padding: 28px 20px !important;
  }
}
