/* ============================================================================
   SMS Mass Sender - Professional UI
   Diseño: Glassmorphism + Dark Theme Premium
   ============================================================================ */

:root {
    /* Colores base - Paleta profesional */
    --bg-primary: #0c0c0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #1e1e2a;
    
    /* Glassmorphism */
    --glass-bg: rgba(26, 26, 36, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    
    /* Acentos - Azul eléctrico profesional */
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-tertiary: #93c5fd;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --accent-glow: rgba(59, 130, 246, 0.25);
    --accent-subtle: rgba(59, 130, 246, 0.1);
    
    /* Texto */
    --text-primary: #f8fafc;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-accent: #60a5fa;
    
    /* Estados semánticos */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    
    /* Bordes */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(59, 130, 246, 0.4);
    --border-active: rgba(59, 130, 246, 0.6);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
    --shadow-inner: inset 0 1px 0 var(--glass-highlight);
    
    /* Bordes redondeados */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transiciones */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-normal: 250ms var(--ease-out);
    --transition-slow: 400ms var(--ease-out);
}

/* ============================================================================
   Reset & Base
   ============================================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

/* Fondo con gradiente y patrón */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Efecto de ruido sutil */
.bg-pattern::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* ============================================================================
   Header - Barra superior premium
   ============================================================================ */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(12, 12, 15, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.875rem 2rem;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cache-status {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.cache-icon {
    font-size: 0.875rem;
    opacity: 0.8;
}

.cache-text {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0;
}

.btn-refresh-cache {
    width: 26px;
    height: 26px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-refresh-cache:hover {
    background: var(--accent-subtle);
    border-color: var(--border-hover);
    color: var(--accent-secondary);
}

.btn-refresh-cache.btn-force-reload {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

.btn-refresh-cache.btn-force-reload:hover {
    background: var(--warning);
    color: white;
    transform: scale(1.1);
}

.btn-refresh-cache.loading {
    animation: spin 1s linear infinite;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    animation: pulse-dot 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: none;
}

.status-dot.error {
    background: var(--error);
    box-shadow: 0 0 8px var(--error);
}

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

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.user-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
    padding-right: 0.75rem;
    border-right: 1px solid var(--border-subtle);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-logout:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* ============================================================================
   Main Container - Grid Layout
   ============================================================================ */

.main-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
    display: grid !important;
    grid-template-columns: 320px 1fr 340px;
    width: 100%;
    min-height: calc(100vh - 80px);
    position: relative;
    grid-template-rows: auto auto;
    gap: 1.25rem;
    z-index: 1;
    visibility: visible !important;
    opacity: 1 !important;
}

.panel-plantillas { grid-row: 1 / 2; }
.panel-contactos { grid-row: 1 / 3; }
.panel-seleccionados { grid-row: 1 / 2; }
.panel-envio { grid-column: 1 / 2; grid-row: 2 / 3; }

/* ============================================================================
   Panels - Tarjetas glassmorphism
   ============================================================================ */

.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md), var(--shadow-inner);
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    animation: panel-enter 0.6s var(--ease-out) forwards;
    opacity: 1;
    transform: translateY(0);
    visibility: visible !important;
}

.panel:nth-child(1) { animation-delay: 0.05s; }
.panel:nth-child(2) { animation-delay: 0.1s; }
.panel:nth-child(3) { animation-delay: 0.15s; }
.panel:nth-child(4) { animation-delay: 0.2s; }

@keyframes panel-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.panel-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.panel-icon {
    font-size: 1rem;
    opacity: 0.9;
}

.panel-content {
    padding: 1rem 1.25rem;
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.panel-seleccionados .panel-content,
.panel-contactos .panel-content {
    max-height: 480px;
}

/* ============================================================================
   Tabs - Pestañas modernas
   ============================================================================ */

.tabs {
    display: flex;
    gap: 0.375rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.tab {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-secondary);
    background: var(--glass-highlight);
}

.tab.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fade-in 0.3s var(--ease-out);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================
   Loading & Empty States
   ============================================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: 1rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-state, .hint {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================================================
   Plantillas List
   ============================================================================ */

.plantillas-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    visibility: visible !important;
    opacity: 1 !important;
}

.plantilla-item {
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    visibility: visible !important;
    opacity: 1 !important;
}

.plantilla-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    transform: translateX(2px);
}

.plantilla-item.selected {
    border-color: var(--accent-primary);
    background: var(--accent-subtle);
    box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-sm);
}

.plantilla-item .icon {
    font-size: 1.25rem;
    opacity: 0.8;
}

.plantilla-item .info {
    flex: 1;
    min-width: 0;
}

.plantilla-item .name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plantilla-item .id {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.plantilla-item .check {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--border-default);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.plantilla-item.selected .check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.plantilla-item.selected .check::after {
    content: '✓';
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ============================================================================
   Etiquetas Grid
   ============================================================================ */

.etiquetas-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    visibility: visible !important;
    opacity: 1 !important;
}

.etiqueta-chip {
    padding: 0.625rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    font-size: 0.8rem;
    position: relative;
    overflow: hidden;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.etiqueta-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--chip-color, var(--accent-primary));
    opacity: 0.7;
}

.etiqueta-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
}

.etiqueta-chip.selected {
    border-color: var(--accent-primary);
    background: var(--accent-subtle);
}

.etiqueta-chip .name {
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Suscripciones */
.suscripciones-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    visibility: visible !important;
    opacity: 1 !important;
}

.suscripcion-chip {
    padding: 0.625rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.suscripcion-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    transform: translateY(-1px);
}

.suscripcion-chip.selected {
    border-color: var(--accent-primary);
    background: var(--accent-subtle);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.suscripcion-chip .name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}
}

/* ============================================================================
   Nuevos Contactos Section
   ============================================================================ */

.nuevos-header {
    margin-bottom: 1rem;
}

.nuevos-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    text-align: center;
}

.stat-card .stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-secondary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stat-card.stat-total .stat-number {
    color: var(--text-primary);
}

.nuevos-filtro {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.nuevos-filtro label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.nuevos-filtro select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.nuevos-filtro select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.contactos-nuevos-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 300px;
    overflow-y: auto;
}

.btn-add-all {
    width: 100%;
    margin-top: 0.75rem;
}

/* Badge para contactos nuevos */
.contacto-item.is-new {
    border-left: 3px solid var(--success);
}

.contacto-item .new-badge {
    padding: 0.125rem 0.375rem;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius-xs);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--success);
    text-transform: uppercase;
    margin-left: auto;
}

/* ============================================================================
   Todos Contactos Section
   ============================================================================ */

.todos-header {
    margin-bottom: 0.75rem;
}

.todos-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.todos-count strong {
    color: var(--accent-secondary);
}

.contactos-todos-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.todos-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================================
   Search Box
   ============================================================================ */

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-tertiary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-search {
    padding: 0.75rem 1rem;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    color: white;
}

.btn-search:hover {
    background: var(--accent-secondary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ============================================================================
   Contactos List
   ============================================================================ */

.contactos-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.contacto-item {
    padding: 0.75rem 0.875rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.contacto-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
}

.contacto-item.selected {
    border-color: var(--success);
    background: var(--success-bg);
}

.contacto-item .avatar,
.contacto-item .contacto-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: white;
    flex-shrink: 0;
}

.contacto-item .contacto-info {
    flex: 1;
    min-width: 0;
}

.contacto-item .contacto-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.contacto-item .contacto-mobile {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.contacto-item .info {
    flex: 1;
    min-width: 0;
}

.contacto-item .name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contacto-item .mobile {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.contacto-item .action {
    font-size: 1rem;
    opacity: 0;
    transition: all var(--transition-fast);
    color: var(--text-muted);
}

.contacto-item:hover .action {
    opacity: 0.6;
}

.contacto-item.selected .action {
    opacity: 1;
    color: var(--success);
}

/* ============================================================================
   Selected List
   ============================================================================ */

.selected-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.selected-item {
    padding: 0.625rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: slide-in 0.25s var(--ease-out);
}

@keyframes slide-in {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.selected-item .avatar {
    width: 28px;
    height: 28px;
    background: var(--accent-gradient);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.65rem;
    color: white;
}

.selected-item .info {
    flex: 1;
    min-width: 0;
}

.selected-item .name {
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-item .mobile {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.selected-item .btn-remove {
    width: 24px;
    height: 24px;
    background: var(--error-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    opacity: 0.7;
}

.selected-item .btn-remove:hover {
    background: var(--error);
    color: white;
    opacity: 1;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    letter-spacing: -0.01em;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

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

.btn-secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

.btn-enviar {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.btn-cargar-contactos {
    width: 100%;
    margin-top: 0.75rem;
}

.btn-icon {
    font-size: 1rem;
}

/* ============================================================================
   Badge
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.5rem;
    background: var(--accent-primary);
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

/* ============================================================================
   Envío Summary
   ============================================================================ */

.envio-summary {
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.summary-value {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-accent);
}

/* ============================================================================
   Progress
   ============================================================================ */

.envio-progress {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.progress-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 100px;
    width: 0%;
    transition: width 0.4s var(--ease-out);
}

.progress-message {
    margin-top: 0.625rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-stats {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-success { color: var(--success); }
.stat-error { color: var(--error); }

/* ============================================================================
   Result
   ============================================================================ */

.envio-result {
    margin-top: 1.25rem;
    padding: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-align: center;
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 1.25rem;
}

.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-number {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.result-stat:first-child .result-number { color: var(--success); }
.result-stat:last-child .result-number { color: var(--error); }

.result-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ============================================================================
   Toast
   ============================================================================ */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    z-index: 1000;
}

.toast {
    padding: 0.875rem 1.25rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: toast-enter 0.4s var(--ease-out);
    max-width: 320px;
}

@keyframes toast-enter {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--accent-primary); }

.toast-icon { font-size: 1rem; }
.toast-message { flex: 1; font-size: 0.85rem; }

/* ============================================================================
   Scrollbar
   ============================================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1400px) {
    .main-container {
        grid-template-columns: 280px 1fr 300px;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr 1fr;
        padding: 1rem;
    }
    
    .panel-plantillas { grid-column: 1 / 2; grid-row: 1 / 2; }
    .panel-seleccionados { grid-column: 2 / 3; grid-row: 1 / 2; }
    .panel-contactos { grid-column: 1 / 3; grid-row: 2 / 3; }
    .panel-envio { grid-column: 1 / 3; grid-row: 3 / 4; }
}

@media (max-width: 768px) {
    .header { padding: 0.75rem 1rem; }
    .header-actions { gap: 0.5rem; }
    .cache-status { display: none; }
    
    .main-container {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .panel-plantillas,
    .panel-seleccionados,
    .panel-contactos,
    .panel-envio {
        grid-column: 1 / 2;
        grid-row: auto;
    }
    
    .panel-content {
        max-height: 280px;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .etiquetas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
