/* ══════════════════════════════════════════════════
   WA.MVC Broadcasting — V3 PWA Mobile-First
   Bottom tabs, safe areas, touch-optimized
   ══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #075E54;
  --primary-light: #128C7E;
  --accent: #25D366;
  --accent-dark: #1DA851;
  --teal: #00BCD4;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --green-light: #D1FAE5;
  --orange: #F59E0B;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --shadow-md: 0 10px 30px rgba(7,94,84,.12);
  --grad-green: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
  --grad-header: linear-gradient(120deg, #064E45 0%, #075E54 45%, #128C7E 100%);
  --grad-accent: linear-gradient(135deg, #25D366 0%, #16B85A 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;
  --header-height: 56px;
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { height:100%; overflow:hidden; }
body {
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:var(--gray-100);
  color:var(--gray-800);
  height:100%;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -webkit-text-size-adjust:100%;
  touch-action:manipulation;
}

/* ═══ INSTALL BANNER ═══ */
.install-banner {
  position:fixed; bottom:calc(var(--nav-height) + var(--safe-bottom) + 8px);
  left:12px; right:12px; z-index:900;
  background:var(--white); border-radius:16px;
  box-shadow:0 8px 30px rgba(0,0,0,0.15);
  padding:12px 16px;
  animation:slideUp 0.3s ease;
}
.install-content {
  display:flex; align-items:center; gap:12px;
}
.install-icon {
  width:44px; height:44px; border-radius:12px;
  background:var(--accent); color:var(--white);
  display:flex; align-items:center; justify-content:center;
  font-size:22px; flex-shrink:0;
}
.install-text { flex:1; min-width:0; }
.install-text strong { display:block; font-size:14px; color:var(--gray-800); }
.install-text span { font-size:12px; color:var(--gray-500); }
.install-close {
  background:none; border:none; color:var(--gray-400);
  font-size:16px; padding:8px; cursor:pointer;
}

/* ═══ LOGIN ═══ */
.login-wrap {
  height:100vh;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  background:linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
  padding:20px;
  padding-top:calc(20px + var(--safe-top));
  position:relative; overflow:hidden;
}
.login-bg-logo {
  position:relative; z-index:1;
  flex-shrink:0;
  margin-bottom:80px;
  margin-top:auto;
  pointer-events:none;
}
.login-bg-logo img {
  width:120px; max-width:40vw;
  opacity:0.9;
  filter:brightness(10);
  display:block; margin:0 auto;
}
.login-card {
  position:relative; z-index:1;
  background:var(--white);
  border-radius:24px;
  padding:36px 24px;
  width:100%; max-width:380px;
  margin-bottom:auto;
  box-shadow:0 20px 60px rgba(0,0,0,0.2);
  text-align:center;
}
.login-logo { margin-bottom:28px; }
.login-logo h1 { font-size:22px; font-weight:800; color:var(--gray-800); margin-top:8px; }
.login-logo p { font-size:13px; color:var(--gray-400); margin-top:4px; }
.login-field { margin-top:18px; text-align:left; }
.login-field label { font-size:12px; font-weight:600; color:var(--gray-600); margin-bottom:6px; display:block; }
.input-eye-wrap { position:relative; display:flex; align-items:center; }
.input-eye-wrap .input { padding-right:44px; width:100%; }
.eye-toggle {
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  background:none; border:none; cursor:pointer; color:var(--primary);
  padding:8px; font-size:20px; z-index:2;
}
.login-error { color:var(--red); font-size:13px; margin-top:12px; display:none; text-align:center; }

/* ═══ APP LAYOUT ═══ */
.app-layout {
  display:flex; flex-direction:column;
  height:100vh; height:100dvh;
  overflow:hidden;
}

/* ═══ HEADER (replaces topbar) ═══ */
.app-header {
  background:var(--grad-header);
  color:var(--white);
  padding:10px 16px;
  padding-top:calc(10px + var(--safe-top));
  display:flex; align-items:center; justify-content:space-between;
  min-height:var(--header-height);
  flex-shrink:0;
  z-index:100;
  box-shadow:0 2px 14px rgba(7,94,84,.25);
}
.header-left { display:flex; align-items:center; gap:10px; }
.header-title { font-size:17px; font-weight:700; letter-spacing:-0.3px; }
.header-right { display:flex; align-items:center; gap:6px; }
.header-user { font-size:12px; color:rgba(255,255,255,0.7); }
.header-btn {
  background:rgba(255,255,255,0.15); border:none; color:var(--white);
  width:36px; height:36px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:14px; cursor:pointer;
}
.header-btn:active { background:rgba(255,255,255,0.25); }

/* ═══ CONTENT SCROLL AREA ═══ */
.app-content {
  flex:1; overflow-y:auto; overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  padding:12px;
  padding-bottom:calc(12px + var(--nav-height) + var(--safe-bottom));
}

/* ═══ BOTTOM NAV (mobile app style) ═══ */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0;
  background:var(--white);
  border-top:1px solid var(--gray-200);
  display:flex;
  padding-bottom:var(--safe-bottom);
  z-index:100;
  box-shadow:0 -2px 10px rgba(0,0,0,0.05);
}
.nav-item {
  flex:1;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px;
  padding:8px 4px 6px;
  border:none; background:none;
  font-family:inherit;
  font-size:10px; font-weight:500;
  color:var(--gray-400);
  cursor:pointer;
  transition:color 0.2s;
  position:relative;
}
.nav-item i { font-size:20px; transition:transform 0.2s; }
.nav-item.active { color:var(--accent-dark); font-weight:700; }
.nav-item.active i {
  transform:translateY(-2px) scale(1.12);
  color:var(--accent-dark);
  filter:drop-shadow(0 3px 6px rgba(37,211,102,.4));
}
.nav-item.active::after {
  content:''; position:absolute; top:0;
  width:36px; height:3px; border-radius:0 0 4px 4px;
  background:var(--grad-accent);
}
.nav-item:active { transform:scale(0.92); }

/* ═══ SECTIONS / CARDS ═══ */
.section {
  background:var(--white);
  border-radius:var(--radius);
  box-shadow:var(--shadow-md);
  padding:18px;
  margin-bottom:14px;
  border:1px solid rgba(16,24,40,.04);
}
.section-title {
  font-size:15px; font-weight:700;
  color:var(--primary);
  margin-bottom:12px;
  display:flex; align-items:center; gap:8px;
}
.section-title i { font-size:16px; }
.section-subtitle { font-size:13px; color:var(--gray-500); }

/* ═══ BUTTONS ═══ */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:10px 18px; border:none; border-radius:12px;
  font-size:14px; font-weight:600; cursor:pointer;
  transition:all 0.15s; font-family:inherit;
  -webkit-user-select:none; user-select:none;
}
.btn:active { transform:scale(0.96); }
.btn:disabled { opacity:0.5; cursor:not-allowed; transform:none; }
.btn-green { background:var(--grad-accent); color:var(--white); box-shadow:0 4px 12px rgba(37,211,102,.28); }
.btn-green:active { filter:brightness(.95); }
.btn-primary { background:var(--grad-header); color:var(--white); box-shadow:0 4px 12px rgba(7,94,84,.22); }
.btn-red { background:var(--red); color:var(--white); box-shadow:0 4px 12px rgba(239,68,68,.25); }
.btn-outline { background:transparent; border:2px solid var(--gray-200); color:var(--gray-600); }
.btn-sm { padding:7px 12px; font-size:12px; border-radius:10px; }
.btn-full { width:100%; }
.btn-send-big {
  width:100%; padding:17px;
  background:var(--grad-accent); color:var(--white);
  font-size:16px; font-weight:800; letter-spacing:.2px;
  border:none; border-radius:16px;
  cursor:pointer; transition:0.2s;
  box-shadow:0 8px 22px rgba(37,211,102,0.4);
  margin-top:8px;
}
.btn-send-big:active { transform:scale(0.98); background:var(--accent-dark); }
.btn-send-big:disabled { background:var(--gray-300); box-shadow:none; }

/* ═══ INPUTS ═══ */
.input {
  width:100%; padding:12px 14px;
  border:1.5px solid var(--gray-200);
  border-radius:12px;
  font-size:15px; font-family:inherit;
  outline:none; transition:border 0.2s;
  -webkit-appearance:none;
}
.input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(7,94,84,0.1); }
.textarea { resize:vertical; min-height:300px; font-size:16px; line-height:1.5; }
.select { appearance:auto; }

/* ═══ CONEXION ═══ */
.welcome-msg {
  text-align:center; padding:8px 0 16px;
  font-size:14px; color:var(--gray-600);
}
.welcome-msg strong { color:var(--primary); }
.qr-box {
  border:2px dashed var(--gray-300);
  border-radius:var(--radius);
  padding:32px 16px;
  text-align:center;
  margin-bottom:14px;
}
.qr-box .qr-icon { font-size:48px; margin-bottom:10px; }
.qr-box p { font-size:13px; color:var(--gray-400); }
.qr-box img { max-width:220px; width:100%; border-radius:8px; }
.wa-connected { text-align:center; padding:16px; }
.wa-connected .conn-icon { font-size:48px; margin-bottom:8px; }
.wa-connected h3 { font-size:18px; font-weight:800; color:var(--accent); margin-bottom:8px; }
.wa-badge {
  display:inline-flex; align-items:center; gap:6px;
  background:var(--green-light); color:var(--accent-dark);
  padding:5px 16px; border-radius:20px;
  font-size:13px; font-weight:600; margin-bottom:14px;
}
.wa-badge::before { content:''; width:8px; height:8px; border-radius:50%; background:var(--accent); animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.wa-info { font-size:14px; color:var(--gray-600); margin-bottom:4px; }
.wa-info strong { color:var(--gray-800); }

/* ═══ PLANTILLAS ═══ */
.plantilla-header {
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:14px; flex-wrap:wrap; gap:8px;
}
.plantilla-list { display:flex; flex-direction:column; gap:8px; overflow:visible; }
.plantilla-list::-webkit-scrollbar { display:none; }
.plantilla-list { -ms-overflow-style:none; scrollbar-width:none; }
.pl-row {
  background:var(--white); border-radius:12px; padding:10px 12px;
  border:1px solid var(--gray-200); display:flex; align-items:center;
  gap:8px; transition:0.2s;
}
.pl-row:active { transform:scale(0.98); }
.pl-drag-handle {
  cursor:grab; font-size:18px; color:var(--gray-400); flex-shrink:0;
  padding:4px; user-select:none; touch-action:none;
}
.pl-drag-handle:active { cursor:grabbing; }
.pl-row.pl-dragging { opacity:0.4; background:var(--gray-100); }
.pl-placeholder {
  border:2px dashed var(--primary); background:rgba(7,94,84,0.05);
  min-height:48px; border-radius:12px;
}
.pl-number {
  background:var(--primary); color:var(--white); border-radius:50%;
  width:24px; height:24px; display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; flex-shrink:0;
}
.pl-title {
  flex:1; font-size:13px; font-weight:600; color:var(--gray-800);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.pl-actions { display:flex; gap:4px; flex-shrink:0; }
.pl-icon-btn {
  width:28px; height:28px; min-width:28px; min-height:28px;
  border-radius:50%; border:none;
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all .2s;
  padding:0; position:relative; overflow:visible;
}
.pl-icon-btn i,
.pl-icon-btn .fas,
.pl-icon-btn .fa-solid {
  font-size:13px !important; color:#fff !important;
  display:inline-block !important; width:auto !important; height:auto !important;
  line-height:1 !important; position:relative; z-index:2;
}
.pl-icon-edit { background:#2980b9; }
.pl-icon-edit:hover { background:#1a5276; transform:scale(1.1); }
.pl-icon-del { background:#e74c3c; }
.pl-icon-del:hover { background:#c0392b; transform:scale(1.1); }
.pl-counter {
  background:#2980b9; color:#fff; border-radius:12px;
  padding:2px 10px; font-size:12px; font-weight:700;
  margin-left:8px; margin-right:auto;
}

/* ═══ ENVIOS ═══ */
.compose-toggle {
  display:flex; border:2px solid var(--gray-200);
  border-radius:12px; overflow:hidden; margin-bottom:12px;
}
.compose-toggle-btn {
  flex:1; padding:10px; border:none;
  font-size:13px; font-weight:600; cursor:pointer;
  background:var(--white); color:var(--gray-500);
  transition:0.2s; font-family:inherit;
}
.compose-toggle-btn.active { background:var(--primary); color:var(--white); }

/* Galería horizontal deslizante (swipe) — ahorra espacio vertical */
.tmpl-grid {
  display:flex; gap:10px; margin-bottom:12px;
  overflow-x:auto; padding:4px 2px 10px;
  scroll-snap-type:x proximity;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.tmpl-grid::-webkit-scrollbar { height:0; display:none; }
.tmpl-thumb {
  flex:0 0 auto; width:88px;
  scroll-snap-align:start;
  border:2px solid transparent;
  border-radius:14px; overflow:hidden;
  cursor:pointer; transition:0.2s; text-align:center; padding:8px 4px;
  background:var(--white);
}
.tmpl-thumb:active { background:var(--gray-100); transform:scale(0.96); }
.tmpl-thumb.selected { border-color:var(--accent); background:var(--green-light); box-shadow:0 4px 12px rgba(37,211,102,.25); }
.tmpl-circle {
  width:70px; height:70px; border-radius:50%; margin:0 auto 6px;
  overflow:hidden; background:var(--grad-green);
  display:flex; align-items:center; justify-content:center;
  border:2px solid var(--gray-200);
}
.tmpl-circle img { width:100%; height:100%; object-fit:cover; }
.tmpl-circle span { color:var(--white); font-size:24px; font-weight:700; }
.tmpl-thumb-label { font-size:12px; }

/* Adjuntos múltiples (chips) */
.media-list { display:flex; flex-wrap:wrap; gap:10px; }
.media-chip {
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  background:var(--gray-50); border:1px solid var(--gray-200);
  border-radius:10px; padding:5px;
}
.media-remove {
  position:absolute; top:-7px; right:-7px;
  width:20px; height:20px; border-radius:50%; border:2px solid #fff;
  background:var(--red); color:#fff; font-size:13px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  box-shadow:0 1px 4px rgba(0,0,0,.3);
}
.tmpl-thumb.selected .tmpl-circle { border-color:var(--accent); }
.tmpl-thumb-label { font-size:13px; color:var(--gray-600); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; padding:2px 4px; }

.preview-bubble {
  background:#E7FFDB; border-radius:0 12px 12px 12px; padding:12px; margin-top:10px;
  position:relative;
}
.preview-bubble::before {
  content:''; position:absolute; top:0; left:-8px;
  border:8px solid transparent; border-top-color:#E7FFDB; border-right-color:#E7FFDB;
}
.preview-bubble img { width:100%; border-radius:8px; margin-bottom:8px; }
.preview-bubble h4 { font-size:14px; font-weight:700; margin-bottom:4px; }
.preview-bubble p { font-size:13px; color:var(--gray-600); line-height:1.5; white-space:pre-line; }
.preview-bubble .pv-link { color:var(--primary); font-size:12px; word-break:break-all; }
.preview-bubble .pv-time { text-align:right; font-size:11px; color:var(--gray-400); margin-top:4px; }

.group-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:10px; flex-wrap:wrap; gap:8px;
}
.group-search {
  padding:10px 12px; border:1.5px solid var(--gray-200);
  border-radius:10px; font-size:14px; font-family:inherit;
  outline:none; width:100%; -webkit-appearance:none;
}
.group-search:focus { border-color:var(--primary); }
.group-scroll {
  max-height:280px; overflow-y:auto;
  border:1px solid var(--gray-200); border-radius:12px;
  -webkit-overflow-scrolling:touch;
}
.g-row {
  display:flex; align-items:center; gap:10px;
  padding:11px 12px; border-bottom:1px solid var(--gray-100);
  cursor:pointer; transition:background 0.1s;
  min-height:44px; /* touch target */
}
.g-row:last-child { border-bottom:none; }
.g-row:active { background:var(--gray-50); }
.g-row input[type="checkbox"] { width:20px; height:20px; accent-color:var(--accent); cursor:pointer; flex-shrink:0; }
.g-row .g-name { flex:1; font-size:14px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.g-row .g-count { font-size:13px; font-weight:700; color:var(--gray-400); }
.g-selected-info { font-size:13px; color:var(--primary); font-weight:600; margin-top:8px; }

.speed-options {
  display:flex; border:2px solid var(--gray-200);
  border-radius:12px; overflow:hidden; margin-bottom:8px;
}
.speed-btn {
  flex:1; padding:10px; border:none;
  font-size:13px; font-weight:600; cursor:pointer;
  background:var(--white); color:var(--gray-500);
  transition:0.2s; font-family:inherit;
}
.speed-btn[data-speed="seguro"].active { background:var(--accent); color:var(--white); }
.speed-btn[data-speed="rapido"].active { background:#e53935; color:var(--white); }
.speed-btn[data-speed="manual"].active { background:#1e88e5; color:var(--white); }
.speed-info {
  background:var(--green-light); border-radius:10px;
  padding:10px 14px; margin-bottom:12px;
}
.speed-info strong { color:var(--accent-dark); }
.speed-info p { font-size:12px; color:var(--gray-600); margin-top:2px; }

.hist-table { width:100%; border-collapse:collapse; font-size:12px; }
.hist-table th {
  text-align:left; padding:8px;
  font-size:10px; text-transform:uppercase;
  letter-spacing:0.5px; color:var(--gray-400);
  border-bottom:2px solid var(--gray-200);
}
.hist-table td { padding:8px; border-bottom:1px solid var(--gray-100); }
.badge-ok { background:var(--green-light); color:var(--accent-dark); padding:2px 10px; border-radius:10px; font-weight:600; font-size:11px; }
.badge-fail { background:var(--red-light); color:var(--red); padding:2px 10px; border-radius:10px; font-weight:600; font-size:11px; }

/* ═══ RESUMEN ═══ */
.stats-grid {
  display:grid; grid-template-columns:1fr 1fr;
  gap:10px; margin-bottom:14px;
}
.stat-card {
  background:var(--white); border-radius:16px;
  padding:18px 14px; text-align:center;
  border:1px solid var(--gray-100);
  box-shadow:0 4px 14px rgba(16,24,40,.06);
  position:relative; overflow:hidden;
}
.stat-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:4px;
  background:var(--grad-header);
}
.stat-card.green::before { background:var(--grad-accent); }
.stat-card.red::before { background:linear-gradient(135deg,#EF4444,#DC2626); }
.stat-card.orange::before { background:linear-gradient(135deg,#F59E0B,#D97706); }
.stat-card .stat-num { font-size:28px; font-weight:800; color:var(--primary); letter-spacing:-.5px; }
.stat-card .stat-label { font-size:11px; color:var(--gray-500); margin-top:3px; font-weight:600; }
.stat-card.green .stat-num { color:var(--accent-dark); }
.stat-card.red .stat-num { color:var(--red); }
.stat-card.orange .stat-num { color:var(--orange); }

/* ═══ SEGURIDAD ═══ */
.user-item {
  display:flex; align-items:center; gap:10px;
  padding:12px 0; border-bottom:1px solid var(--gray-100);
}
.user-item:last-child { border-bottom:none; }
.user-avatar {
  width:40px; height:40px; border-radius:50%;
  background:var(--primary); color:var(--white);
  display:flex; align-items:center; justify-content:center;
  font-size:15px; font-weight:700; flex-shrink:0;
}
.user-info { flex:1; min-width:0; }
.user-name { font-size:14px; font-weight:600; }
.user-email { font-size:12px; color:var(--gray-400); overflow:hidden; text-overflow:ellipsis; }
.user-rol {
  font-size:11px; padding:3px 10px; border-radius:10px; font-weight:600;
}
.user-rol.admin { background:#DBEAFE; color:#1D4ED8; }
.user-rol.invitado { background:var(--green-light); color:#065F46; }

/* ═══ PROGRESS ═══ */
.prog-bar-bg { background:var(--gray-100); border-radius:20px; height:12px; overflow:hidden; }
.prog-bar-fill {
  height:100%; border-radius:20px;
  background:linear-gradient(90deg, var(--primary), var(--accent));
  transition:width 0.5s; min-width:0;
}
.prog-stats { display:flex; justify-content:space-between; font-size:13px; color:var(--gray-500); margin-bottom:6px; }
.prog-counters { display:flex; gap:8px; margin-top:12px; }
.prog-counter {
  flex:1; text-align:center; padding:12px 8px;
  background:var(--gray-50); border-radius:12px;
}
.prog-counter .num { font-size:20px; font-weight:800; }
.prog-counter .lbl { font-size:11px; color:var(--gray-400); }
.prog-counter.ok .num { color:var(--accent); }
.prog-counter.fail .num { color:var(--red); }

/* ═══ BROADCAST SUMMARY ═══ */
.summary-card {
  background:var(--white); border-radius:16px;
  border:1px solid var(--gray-200);
  box-shadow:0 2px 12px rgba(0,0,0,0.06);
  margin-top:16px; overflow:hidden;
}
.summary-header {
  display:flex; align-items:center; gap:8px;
  padding:14px 16px; border-bottom:1px solid var(--gray-100);
}
.summary-title { font-size:15px; font-weight:700; flex:1; }
.summary-close {
  background:none; border:none; color:var(--gray-400);
  cursor:pointer; font-size:16px; padding:4px;
}
.summary-msg {
  padding:10px 16px 2px; font-size:14px; font-weight:600; color:var(--gray-800);
}
.summary-date {
  padding:2px 16px 12px; font-size:12px; color:var(--gray-400);
  display:flex; align-items:center; gap:5px;
}
.summary-stats {
  display:flex; padding:0 16px 14px; gap:8px;
}
.summary-stat {
  flex:1; text-align:center; padding:10px 6px;
  background:var(--gray-50); border-radius:10px;
}
.summary-stat-num { font-size:22px; font-weight:800; color:var(--gray-800); }
.summary-stat-lbl { font-size:11px; color:var(--gray-400); margin-top:2px; }
.summary-stat.ok .summary-stat-num { color:var(--accent); }
.summary-stat.fail .summary-stat-num { color:var(--red); }
.summary-status {
  text-align:center; padding:10px; color:var(--white);
  font-size:13px; font-weight:600;
  display:flex; align-items:center; justify-content:center; gap:6px;
}

/* ═══ TOAST ═══ */
.toast {
  position:fixed; top:calc(12px + var(--safe-top)); left:50%; transform:translateX(-50%);
  background:var(--gray-800); color:var(--white);
  padding:10px 24px; border-radius:24px;
  font-size:13px; font-weight:500;
  z-index:999; opacity:0; transition:opacity 0.3s; max-width:85%;
  pointer-events:none;
}
.toast.show { opacity:1; }
.toast.success { background:var(--accent-dark); }
.toast.error { background:var(--red); }

/* ═══ UTILITIES ═══ */
.empty { text-align:center; padding:32px 16px; color:var(--gray-400); }
.empty i { font-size:40px; margin-bottom:10px; display:block; }
.empty p { font-size:13px; }
.hidden { display:none!important; }
.mt { margin-top:10px; }
.mb { margin-bottom:10px; }
.text-center { text-align:center; }
@keyframes spin { to { transform:rotate(360deg); } }
.spinner { animation:spin 1s linear infinite; }
@keyframes slideUp { from{transform:translateY(100px);opacity:0} to{transform:translateY(0);opacity:1} }



/* ═══ SEND + STOP BUTTONS ═══ */
.send-btn-row {
  display:flex; gap:8px; margin-top:8px;
}
.send-btn-row .btn-send-big {
  flex:1;
}
.btn-stop-big {
  display:flex; align-items:center; justify-content:center; gap:6px;
  padding:14px 20px; border-radius:14px; border:none;
  background:#e74c3c; color:#fff;
  font-size:15px; font-weight:700; cursor:pointer;
  transition:all .2s; white-space:nowrap;
}
.btn-stop-big:hover { background:#c0392b; }
.btn-stop-big:disabled { opacity:0.7; cursor:wait; }

/* ═══ HISTORIAL ═══ */
.hist-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 0; border-bottom:1px solid var(--gray-100);
}
.hist-info { flex:1; min-width:0; }
.hist-title { font-size:13px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hist-date { font-size:11px; color:var(--gray-400); }
.hist-right { text-align:right; flex-shrink:0; margin-left:8px; }
.hist-counts { font-size:11px; color:var(--gray-500); margin-top:2px; }
.hist-retry-btn {
  display:inline-flex; align-items:center; gap:4px;
  margin-top:4px; padding:4px 10px; border-radius:16px;
  border:none; background:#e74c3c; color:#fff;
  font-size:11px; font-weight:600; cursor:pointer;
  transition:all .2s;
}
.hist-retry-btn:hover { background:#c0392b; transform:scale(1.05); }
.hist-retry-btn:disabled { opacity:0.7; cursor:wait; }

/* ═══ RESPONSIVE — Desktop ═══ */
@media (min-width:768px) {
  .app-content { max-width:600px; margin:0 auto; padding:20px; padding-bottom:calc(20px + var(--nav-height) + var(--safe-bottom)); }
  .bottom-nav { max-width:600px; left:50%; transform:translateX(-50%); border-radius:16px 16px 0 0; }
  .install-banner { max-width:400px; left:50%; right:auto; transform:translateX(-50%); }
  .stats-grid { grid-template-columns:repeat(3,1fr); }
  .compose-cols { display:flex; gap:16px; }
  .compose-cols > div { flex:1; }
  .group-search { width:200px; }
}

/* Protect Font Awesome icons from font-family inheritance */
.fas, .far, .fa-solid, .fa-regular,
.fas::before, .far::before,
.fa-solid::before, .fa-regular::before {
  font-family:"Font Awesome 6 Free" !important;
  font-style:normal !important;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
.fab, .fa-brands,
.fab::before, .fa-brands::before {
  font-family:"Font Awesome 6 Brands" !important;
  font-style:normal !important;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
.fas, .fa-solid { font-weight:900 !important; }
