@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Base Obsidian Theme */
    --bg-base: #070b14;
    --bg-panel: rgba(13, 22, 38, 0.88);
    --bg-card: rgba(18, 30, 52, 0.75);
    --bg-card-hover: rgba(24, 40, 70, 0.95);
    
    /* Brand & Accent Colors */
    --neon-cyan: #00f3ff;
    --neon-green: #10b981;
    --neon-purple: #a855f7;
    --neon-amber: #f59e0b;
    --neon-magenta: #f43f5e;
    
    --metallic-gold: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
    --primary-gradient: linear-gradient(135deg, #00f3ff 0%, #0284c7 100%);
    --card-gradient: linear-gradient(145deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
    
    /* High Contrast Typography Colors */
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* Borders & Glows */
    --border-glass: rgba(0, 243, 255, 0.18);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-glow: 0 0 15px rgba(0, 243, 255, 0.25);
    
    /* Sizing & Touch Targets */
    --font-base: 17px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --bottom-nav-h: 75px;
    --touch-target: 48px;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: var(--font-base);
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 10% 15%, rgba(0, 243, 255, 0.08) 0px, transparent 45%),
        radial-gradient(at 90% 85%, rgba(168, 85, 247, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.04) 0px, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========================================================
   GLASSMORPHISM & PANELS
   ======================================================== */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.25s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ========================================================
   BOTTOM NAVIGATION (MOBILE-FIRST)
   ======================================================== */
.sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-h);
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: rgba(8, 14, 28, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    border-radius: 16px 16px 0 0;
    z-index: 1000;
    padding: 0 0.5rem;
    gap: 4px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.brand-icon {
    display: none; /* Hidden on mobile bottom nav */
}

.nav-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    min-height: var(--touch-target);
    min-width: 58px;
    flex: 0 0 auto;
    padding: 4px 6px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 2px;
    font-family: var(--font-heading);
    letter-spacing: 0.3px;
    color: var(--text-muted);
    white-space: nowrap;
}

.nav-icon:hover {
    color: var(--neon-cyan);
    transform: translateY(-2px);
}

.nav-icon.active {
    color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.12);
}

.nav-icon.active .nav-label {
    color: var(--neon-cyan);
    font-weight: 700;
}

.sidebar-user-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding-left: 8px;
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.user-profile-details {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-profile-name {
    font-weight: 700;
    font-size: 0.74rem;
    color: #fff;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-role {
    font-size: 0.64rem;
    color: var(--neon-cyan);
    font-weight: 800;
    text-transform: uppercase;
}

.nav-icon:hover {
    color: var(--neon-cyan);
    transform: translateY(-2px);
}

.nav-icon.active {
    color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.12);
}

.nav-icon.active .nav-label {
    color: var(--neon-cyan);
    font-weight: 700;
}

/* ========================================================
   VIEWS CONTAINER & GENERAL VIEWS
   ======================================================== */
.view-container {
    flex: 1;
    width: 100%;
    height: calc(100% - var(--bottom-nav-h));
    position: relative;
    overflow: hidden;
}

.mobile-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

/* Header standard for views */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(13, 22, 38, 0.6);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.view-header h2 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========================================================
   INBOX VIEW (CHATS & CONVERSATIONS)
   ======================================================== */
.chat-list-pane {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.pane-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.search-bar {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.search-bar input {
    width: 100%;
    height: 48px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.search-bar input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
    background: rgba(255, 255, 255, 0.09);
}

.chats {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chat-item:hover {
    background: rgba(0, 243, 255, 0.06);
    border-color: rgba(0, 243, 255, 0.2);
}

.chat-item.active {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.2);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    color: #000;
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 243, 255, 0.3);
}

.chat-preview {
    flex: 1;
    min-width: 0;
}

.chat-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.chat-preview h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
}

.badge-bot {
    color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid var(--neon-cyan);
}

.badge-human {
    color: var(--neon-magenta);
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid var(--neon-magenta);
}

.badge-day {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Chat Window Pane (Slides in on mobile) */
.chat-window-pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window-pane.active {
    transform: translateX(0);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(13, 22, 38, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-info p {
    font-size: 0.85rem;
    color: var(--neon-cyan);
    font-weight: 500;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background-color: #0b141a;
    background-image: radial-gradient(circle at 50% 50%, rgba(17, 27, 33, 0.6) 0%, rgba(11, 20, 26, 0.96) 100%),
                      url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M60 15c-15 0-25 10-25 22 0 5 2 9 6 13l-4 12 13-4c3 1 7 2 10 2 15 0 25-10 25-22s-10-23-25-23zm-2 30h-4v-4h4v4zm0-8h-4v-10h4v10zm-35 45c-6 0-11 5-11 11 0 3 1 5 3 7l-2 6 7-2c1 1 2 1 3 1 6 0 11-5 11-11s-5-12-11-12zm75-5c-7 0-13 6-13 13 0 3 1 6 4 8l-2 7 8-2c1 1 3 1 4 1 7 0 13-6 13-13s-6-14-14-14z' fill='%231f2c34' fill-opacity='0.28' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: repeat;
    scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Authentic WhatsApp Date Separator */
.chat-date-separator {
    display: flex;
    justify-content: center;
    margin: 10px 0 6px 0;
    position: sticky;
    top: 4px;
    z-index: 10;
    pointer-events: none;
}

.chat-date-pill {
    background: #182229;
    color: #8696a0;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* WhatsApp Message Bubbles */
.msg {
    max-width: 78%;
    padding: 7px 10px 7px 12px;
    border-radius: 7.5px;
    font-size: 0.96rem;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.15);
    color: #e9edef;
    margin-bottom: 2px;
}

.msg-in {
    align-self: flex-start;
    background: #202c33;
    border-top-left-radius: 0;
    margin-left: 8px;
}

.msg-in::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 8px solid #202c33;
}

.msg-out {
    align-self: flex-end;
    background: #005c4b;
    border-top-right-radius: 0;
    margin-right: 8px;
}

.msg-out::before {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 8px solid #005c4b;
}

.msg-out.bot-msg {
    background: #065042;
    border: 1px solid rgba(0, 243, 255, 0.25);
}

.msg-out.bot-msg::before {
    border-left-color: #065042;
}

.msg-bot-tag {
    font-size: 0.74rem;
    font-weight: 800;
    color: #00f3ff;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    opacity: 0.95;
}

.msg-meta {
    float: right;
    margin: 4px 0 -2px 10px;
    font-size: 0.7rem;
    color: #8696a0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    user-select: none;
    vertical-align: bottom;
}

.msg-out .msg-meta {
    color: rgba(233, 237, 239, 0.65);
}

/* Input Area Container (WhatsApp Web Bar) */
.input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: #202c33;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    position: relative;
}

.input-area input {
    flex: 1;
    height: 44px;
    background: #2a3942;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 1rem;
    color: #d1d7db;
    font-size: 0.98rem;
    outline: none;
    transition: all 0.2s;
}

.input-area input:focus {
    background: #323d45;
    border-color: rgba(0, 243, 255, 0.3);
}

.input-area input::placeholder {
    color: #8696a0;
    font-size: 0.94rem;
}

.input-area button {
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.input-area button:hover {
    color: #00f3ff;
    background: rgba(255, 255, 255, 0.08);
}

.btn-send-wa {
    background: #00a884 !important;
    color: #111b21 !important;
}

.btn-send-wa:hover {
    background: #06cf9c !important;
    transform: scale(1.05);
}

.btn-send-wa:active {
    transform: scale(0.95);
}

/* ========================================================
   RUTAS DIARIAS (DELIVERY DRIVER VIEW)
   ======================================================== */
.routes-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Day Selector Pills */
.day-selector-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}
.day-selector-scroll::-webkit-scrollbar {
    display: none;
}

.day-pill {
    padding: 0.65rem 1.15rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.day-pill.active {
    background: var(--neon-cyan);
    color: #031525;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.4);
    font-weight: 700;
}

/* Client & Route Cards */
.route-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, border-color 0.2s;
}

.route-card:hover {
    border-color: rgba(0, 243, 255, 0.3);
    transform: translateY(-2px);
}

.route-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.route-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.route-card-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(0, 243, 255, 0.15);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
}

.route-card-address {
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.route-card-details {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

.route-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.btn-gps {
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gps:hover {
    background: var(--neon-cyan);
    color: #031525;
}

.btn-wa {
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-wa:hover {
    background: var(--neon-green);
    color: #031525;
}

/* ========================================================
   MÉTRICAS (REAL KPI DASHBOARD)
   ======================================================== */
.metrics-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
}

.kpi-card.green::before {
    background: linear-gradient(to bottom, #10b981, #059669);
}

.kpi-card.amber::before {
    background: linear-gradient(to bottom, #f59e0b, #d97706);
}

.kpi-card.purple::before {
    background: linear-gradient(to bottom, #a855f7, #7c3aed);
}

.kpi-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.kpi-sub {
    font-size: 0.85rem;
    color: var(--neon-cyan);
    font-weight: 600;
}

.metrics-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.metrics-section h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1rem;
}

.bar-row:last-child {
    border-bottom: none;
}

/* ========================================================
   CATÁLOGO DE PRODUCTOS VIEW
   ======================================================== */
.catalog-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}

.product-card:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 243, 255, 0.2);
}

.product-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(168, 85, 247, 0.2);
    color: var(--neon-purple);
    border: 1px solid var(--neon-purple);
}

.product-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.product-price {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--neon-cyan);
}

.product-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ========================================================
   CLIENTES / DIRECTORIO VIEW
   ======================================================== */
.contacts-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ========================================================
   MODAL & TOAST STYLES
   ======================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 7, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Toast System */
#toast-container {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: rgba(13, 22, 38, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================================
   DESKTOP RESPONSIVE BREAKPOINT (>= 900px)
   ======================================================== */
@media (min-width: 900px) {
    .app-container {
        flex-direction: row;
    }

    .sidebar {
        position: relative;
        width: 85px;
        height: 100%;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        overflow-x: hidden;
        overflow-y: auto;
        gap: 1.2rem;
        padding-top: 1.5rem;
        padding-bottom: 1rem;
        border-right: 1px solid var(--border-glass);
        border-top: none;
        border-radius: 0;
        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .nav-icon {
        flex: 0 0 auto;
        width: 64px;
        min-width: 64px;
        min-height: 52px;
        padding: 6px 4px;
    }

    .brand-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 52px;
        border-radius: var(--radius-md);
        background: var(--primary-gradient);
        color: #031525;
        font-family: var(--font-heading);
        font-size: 1.6rem;
        font-weight: 800;
        margin-bottom: 0.5rem;
        box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    }

    .sidebar-user-section {
        margin-top: auto;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 0.5rem 0.2rem;
        width: 100%;
        border-left: none;
        margin-left: 0;
    }

    .sidebar-user-section .btn-logout {
        width: 100%;
        text-align: center;
    }

    .view-container {
        height: 100%;
    }

    /* On Desktop, Chat List and Window are side by side */
    #view-inbox {
        flex-direction: row;
    }

    .chat-list-pane {
        width: 380px;
        border-right: 1px solid var(--border-subtle);
    }

    .chat-window-pane {
        position: relative;
        transform: none;
        flex: 1;
    }

    .back-btn {
        display: none; /* No need for back button on desktop */
    }
}

/* ========================================================
   PASO 4: WHATSAPP CLOUD API ENHANCEMENTS (V21.0)
   ======================================================== */

/* Chat Subbar (24h Window & GPS Request) */
.chat-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(8, 14, 25, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.window-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
}

.window-badge.open {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #34d399;
}

.window-badge.closed {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid #f43f5e;
    color: #fb7185;
}

.window-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.window-badge.open .window-dot {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-dot 2s infinite;
}

.window-badge.closed .window-dot {
    background: #f43f5e;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-pedir-gps {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 243, 255, 0.14);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-pedir-gps:hover {
    background: var(--neon-cyan);
    color: #031525;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
    transform: translateY(-1px);
}

.btn-pedir-gps:active {
    transform: scale(0.96);
}

/* WhatsApp Double Checks */
.status-check {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    font-size: 0.85rem;
    letter-spacing: -2px;
    font-weight: 700;
    vertical-align: middle;
    transition: color 0.3s ease;
}

.status-check.sent {
    color: rgba(255, 255, 255, 0.55);
}

.status-check.delivered {
    color: rgba(255, 255, 255, 0.75);
}

.status-check.read {
    color: #00f3ff;
    text-shadow: 0 0 6px rgba(0, 243, 255, 0.6);
}

.status-check.failed {
    color: #f43f5e;
}

/* Location Message Bubble */
.location-bubble-card {
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.location-bubble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-cyan);
}

.location-bubble-coords {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: monospace;
}

.location-bubble-address {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.35;
}

.location-bubble-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.btn-loc-maps {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-loc-maps:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-loc-route {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    border: none;
    color: #031525;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-loc-route:hover {
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
    transform: translateY(-1px);
}

.btn-loc-route:active {
    transform: scale(0.96);
}

/* Media Messages (Images & Audio) */
.chat-media-img {
    max-width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-media-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 243, 255, 0.3);
}

.chat-media-audio {
    margin-top: 6px;
    width: 100%;
    max-width: 280px;
    border-radius: var(--radius-full);
}

/* ========================================================
   COLUMNA 3: PANEL DE PERFIL E INFORMACIÓN PERSONAL DEL CLIENTE
   ======================================================== */
.chat-profile-pane {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--border-glass);
    display: none;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
}

/* Mobile & Tablet Drawer */
@media (max-width: 1199px) {
    .chat-profile-pane {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 380px;
        z-index: 1050;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    }
    
    .chat-profile-pane.open {
        display: flex;
        transform: translateX(0);
    }
}

/* Desktop 3-Column Layout */
@media (min-width: 1200px) {
    .chat-profile-pane {
        display: flex;
        width: 360px;
        flex-shrink: 0;
        border-right: none;
    }
}

.chat-profile-pane.closed {
    display: none !important;
}

.profile-header-card {
    padding: 1.5rem 1.25rem 1rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.08) 0%, transparent 100%);
    position: relative;
}

.profile-avatar-big {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #031525;
    font-size: 2.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.profile-phone {
    font-size: 1rem;
    color: var(--neon-cyan);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.profile-actions-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.btn-profile-act {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-profile-act.wa {
    background: #25d366;
    color: #031525;
    font-weight: 700;
}

.btn-profile-act.call {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-section-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-field-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.profile-input {
    width: 100%;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    color: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.profile-input:focus {
    border-color: var(--neon-cyan);
    outline: none;
}

.profile-select {
    width: 100%;
    height: 42px;
    background: #091224;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    color: #fff;
    font-size: 0.95rem;
}

.profile-textarea {
    width: 100%;
    height: 65px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    resize: none;
}

.btn-profile-save {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    border: none;
    color: #031525;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.25rem;
}

.btn-profile-save:hover {
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transform: translateY(-1px);
}

.mini-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.mini-media-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: transform 0.2s;
}

.mini-media-item:hover {
    transform: scale(1.05);
    border-color: var(--neon-cyan);
}

.mini-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================================
   WHATSAPP WEB CLIP 📎 & MULTIMEDIA SUITE
   ======================================================== */
.btn-clip {
    background: transparent;
    color: #8696a0;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-clip:hover {
    color: #00f3ff;
    background: rgba(255, 255, 255, 0.08);
    transform: rotate(-15deg);
}

.btn-emoji {
    background: transparent;
    color: #8696a0;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-emoji:hover {
    color: #ffcc00;
    background: rgba(255, 255, 255, 0.08);
}

/* WhatsApp Circular Action Popover */
.clip-popover {
    position: absolute;
    bottom: 64px;
    left: 12px;
    background: #233138;
    border-radius: 16px;
    padding: 0.75rem 0.6rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
    z-index: 300;
    min-width: 230px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: popover-fade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popover-fade {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.clip-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #e9edef;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.92rem;
    font-weight: 500;
}

.clip-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateX(3px);
}

.clip-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.clip-icon-circle.photos { background: linear-gradient(135deg, #bf59cf, #8c25a1); }
.clip-icon-circle.doc { background: linear-gradient(135deg, #5157ae, #33398f); }
.clip-icon-circle.audio { background: linear-gradient(135deg, #e542a3, #b81775); }
.clip-icon-circle.location { background: linear-gradient(135deg, #1fa855, #128c7e); }
.clip-icon-circle.quick { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* Quick Emoji Palette Popover */
.emoji-popover {
    position: absolute;
    bottom: 64px;
    left: 48px;
    background: #233138;
    border-radius: 16px;
    padding: 0.75rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
    z-index: 300;
    width: 290px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: popover-fade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.emoji-palette-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #8696a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 4px;
}

.emoji-palette-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.emoji-btn {
    font-size: 1.45rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

/* WhatsApp Voice Note Recording Mode */
.voice-record-bar {
    display: none;
    align-items: center;
    gap: 12px;
    flex: 1;
    background: #111b21;
    padding: 6px 14px;
    border-radius: 24px;
    border: 1px solid rgba(244, 63, 94, 0.5);
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.rec-pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f43f5e;
    box-shadow: 0 0 8px #f43f5e;
    animation: rec-blink 0.8s infinite alternate;
}

@keyframes rec-blink {
    from { opacity: 0.3; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1.15); }
}

.voice-timer-text {
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: #e9edef;
    letter-spacing: 0.5px;
}

.btn-cancel-voice {
    background: transparent;
    border: none;
    color: #f43f5e;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 6px;
    transition: transform 0.15s;
}

.btn-cancel-voice:hover {
    transform: scale(1.15);
}

/* WhatsApp Custom Voice Note Player */
.wa-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    max-width: 320px;
    padding: 4px 2px;
}

.wa-audio-play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #00a884;
    border: none;
    color: #111b21;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.15s;
}

.wa-audio-play-btn:hover {
    transform: scale(1.06);
    background: #06cf9c;
}

.wa-audio-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wa-waveform-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 26px;
    cursor: pointer;
}

.wa-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    min-height: 4px;
    transition: background 0.15s;
}

.wa-bar.played {
    background: #00a884;
}

.wa-audio-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: #8696a0;
}

.wa-speed-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #e9edef;
    border: none;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.wa-speed-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.wa-audio-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* WhatsApp Document Bubble Card */
.wa-doc-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.22);
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
}

.wa-doc-bubble:hover {
    background: rgba(0, 0, 0, 0.38);
}

.wa-doc-icon-badge {
    width: 38px;
    height: 42px;
    background: #e53e3e;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.wa-doc-icon-badge.doc-blue {
    background: #3182ce;
}

.wa-doc-info {
    flex: 1;
    min-width: 0;
}

.wa-doc-title {
    font-weight: 600;
    color: #e9edef;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-doc-sub {
    font-size: 0.74rem;
    color: #8696a0;
    margin-top: 2px;
}

.wa-doc-download-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e9edef;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.15s;
}

.wa-doc-bubble:hover .wa-doc-download-btn {
    background: #00a884;
    color: #111b21;
    border-color: #00a884;
}

/* WhatsApp Image Bubble */
.wa-img-bubble {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
    background: #000;
    cursor: pointer;
}

.wa-img-bubble img {
    display: block;
    max-width: 100%;
    max-height: 280px;
    width: auto;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.wa-img-bubble:hover img {
    transform: scale(1.02);
}

.wa-img-caption {
    padding: 6px 4px 2px 4px;
    font-size: 0.95rem;
    color: #e9edef;
    line-height: 1.4;
}

/* Floating Media Preview Bar before sending */
.media-preview-bar {
    position: absolute;
    bottom: 64px;
    left: 10px;
    right: 10px;
    background: #1f2c34;
    border: 1px solid #00a884;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: none;
    align-items: center;
    gap: 0.85rem;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.75);
    z-index: 220;
    backdrop-filter: blur(20px);
    animation: popover-fade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-preview-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* In-Chat Search Bar Dropdown */
.chat-search-dropdown {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: #111b21;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 40;
}

.chat-search-dropdown input {
    flex: 1;
    height: 36px;
    background: #202c33;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0 10px;
    color: #e9edef;
    font-size: 0.9rem;
    outline: none;
}

.chat-search-dropdown input:focus {
    border-color: #00a884;
}

/* Chat Header Action Icons */
.chat-header-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.chat-header-btn:hover {
    color: #00f3ff;
    background: rgba(255, 255, 255, 0.08);
}

/* Chat List Filter Chips (Todos, No leídos, Hoy, Con Pedido) */
.chat-filter-chips {
    display: flex;
    gap: 6px;
    padding: 0.4rem 1.25rem 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-filter-chips::-webkit-scrollbar {
    display: none;
}

.chat-chip {
    padding: 5px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8696a0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.chat-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e9edef;
}

.chat-chip.active {
    background: rgba(0, 168, 132, 0.2);
    border-color: #00a884;
    color: #00a884;
    font-weight: 700;
}

/* ========================================================
   GALERÍA GLOBAL MULTIMEDIA (#view-gallery)
   ======================================================== */
.gallery-container {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    overflow-y: auto;
}

.gallery-filters {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
}

.gallery-card:hover {
    transform: translateY(-3px);
    border-color: var(--neon-cyan);
    box-shadow: 0 8px 24px rgba(0, 243, 255, 0.2);
}

.gallery-card-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #000;
    cursor: pointer;
}

.gallery-card-info {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.88rem;
}

.gallery-card-title {
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================
   DIFUSIÓN MASIVA POR GRUPOS (#view-broadcast)
   ======================================================== */
.broadcast-container {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
    overflow-y: auto;
}

.broadcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.85rem;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.group-card:hover {
    border-color: var(--neon-cyan);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.group-card.active {
    border-color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.12);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.25);
}

.broadcast-composer {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-pill:hover {
    background: var(--neon-cyan);
    color: #031525;
    transform: translateY(-1px);
}

.progress-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

/* ========================================================
   ENHANCED ROUTE & DRIVER STYLES (WAZE & ZONAS CÚCUTA)
   ======================================================== */
.zone-badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #fff;
    display: inline-block;
}

.btn-waze {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #33ccff;
    color: #031525;
    font-weight: 800;
    border-radius: var(--radius-md);
    text-decoration: none;
    padding: 8px 14px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-waze:hover {
    background: #00bfff;
    box-shadow: 0 0 12px rgba(51, 204, 255, 0.5);
    transform: translateY(-1px);
}

.btn-edit-route {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-edit-route:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    transform: translateY(-1px);
}

/* ========================================================
   BADGES PARA GRUPOS Y DETALLES DE EXCEL
   ======================================================== */
.badge-group {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #10b981;
    font-weight: 700;
    font-size: 0.76rem;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-day {
    background: rgba(0, 243, 255, 0.15);
    border: 1px solid rgba(0, 243, 255, 0.35);
    color: var(--neon-cyan);
    font-weight: 700;
    font-size: 0.76rem;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    text-transform: uppercase;
}

/* ========================================================
   CHIPS DE BARRIOS INTERACTIVOS (RUTAS)
   ======================================================== */
.barrio-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.barrio-chip:hover {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--neon-cyan);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 243, 255, 0.25);
}

.barrio-chip.active {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    color: #031525;
    font-weight: 800;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

.barrio-chip-count {
    background: rgba(0, 0, 0, 0.35);
    color: inherit;
    font-size: 0.74rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 800;
}

.barrio-chip.active .barrio-chip-count {
    background: rgba(0, 0, 0, 0.2);
    color: #031525;
}

/* ========================================================
   ALERT CONTROLS (SONIDO & VIBRACIÓN)
   ======================================================== */
.alert-control-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.alert-control-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.alert-control-btn.active {
    border-color: var(--neon-green);
    color: var(--neon-green);
    background: rgba(16, 185, 129, 0.12);
}

/* ========================================================
   LOGIN VIEW & MODAL
   ======================================================== */
.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(11, 20, 38, 0.96) 0%, rgba(3, 7, 18, 0.99) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(13, 22, 38, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.3);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 243, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 2.2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--neon-cyan), #3b82f6, var(--neon-green));
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.2rem;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: #031525;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.5);
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.8rem;
}

.login-field {
    text-align: left;
    margin-bottom: 1.1rem;
}

.login-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.login-input {
    width: 100%;
    height: 48px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.login-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
    background: rgba(255, 255, 255, 0.09);
}

.login-submit-btn {
    width: 100%;
    height: 50px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #031525;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(0, 243, 255, 0.4);
    transition: all 0.2s ease;
    margin-top: 0.8rem;
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.6);
}

.login-chips-container {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.login-quick-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
}

.login-quick-chip:hover {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--neon-cyan);
    color: #fff;
}

/* User Profile Pill in Sidebar/Header */
.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 0.85rem;
}

.btn-logout {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: var(--neon-magenta);
    border-radius: var(--radius-full);
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--neon-magenta);
    color: #fff;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
}

/* ==========================================================================
   DIRECTORIO DE CLIENTES - ORDEN ALFABÉTICO & CONTEO EN VIVO
   ========================================================================== */
.contacts-control-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    background: rgba(18, 30, 52, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
    margin-top: 0.6rem;
}

.contacts-custom-select {
    background: rgba(13, 22, 38, 0.95);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.contacts-custom-select:hover, .contacts-custom-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}

.contacts-custom-select option {
    background: #0d1626;
    color: #fff;
}

.contacts-alphabet-bar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 6px 2px;
    margin-top: 0.4rem;
    scrollbar-width: thin;
}

.contacts-alphabet-bar::-webkit-scrollbar {
    height: 4px;
}
.contacts-alphabet-bar::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 4px;
}

.letter-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 3px 9px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    user-select: none;
}

.letter-pill:hover {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--neon-cyan);
    color: #fff;
    transform: translateY(-1px);
}

.letter-pill.active {
    background: var(--primary-gradient);
    border-color: var(--neon-cyan);
    color: #031525;
    font-weight: 800;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.35);
}

.contacts-count-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 0.6rem;
    color: #fff;
    font-size: 0.92rem;
}

.contacts-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 0.5rem;
    margin-top: 1rem;
    background: rgba(18, 30, 52, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.btn-page-nav {
    background: rgba(0, 243, 255, 0.12);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
}

.btn-page-nav:not(:disabled):hover {
    background: var(--neon-cyan);
    color: #031525;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

/* ========================================================
   RESPONSIVE LOGIN BODY & MOBILE SCREEN ADAPTATIONS
   ======================================================== */
body.login-body {
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem 1rem !important;
}

@media (max-width: 540px) {
    body.login-body {
        padding: 1.25rem 0.75rem !important;
        align-items: center !important;
    }

    .login-card {
        padding: 1.6rem 1.15rem;
        border-radius: var(--radius-md);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
        max-width: 100%;
    }

    .login-logo {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
        border-radius: var(--radius-sm);
    }

    .login-title {
        font-size: 1.4rem;
        margin-bottom: 0.2rem;
    }

    .login-subtitle {
        font-size: 0.82rem;
        margin-bottom: 1.2rem;
    }

    .login-field {
        margin-bottom: 0.85rem;
    }

    .login-label {
        font-size: 0.74rem;
        margin-bottom: 0.3rem;
    }

    .login-input {
        height: 44px;
        font-size: 0.95rem;
        border-radius: var(--radius-sm);
        padding: 0 0.85rem;
    }

    .login-submit-btn {
        height: 48px;
        font-size: 1rem;
        margin-top: 0.5rem;
        border-radius: var(--radius-sm);
    }

    .login-chips-container {
        margin-top: 0.9rem;
        flex-direction: column;
        gap: 0.4rem;
        width: 100%;
    }

    .login-quick-chip {
        width: 100%;
        text-align: center;
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}

/* ========================================================
   GENERAL MOBILE CRM RESPONSIVENESS (< 768px)
   ======================================================== */
@media (max-width: 768px) {
    :root {
        --font-base: 15px;
        --bottom-nav-h: 72px;
    }

    .view-header {
        padding: 0.75rem 0.85rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .view-header h2 {
        font-size: 1.18rem;
    }

    .pane-header {
        padding: 0.75rem 0.85rem;
        gap: 0.5rem;
    }

    .pane-header h2 {
        font-size: 1.15rem;
    }

    .alert-control-btn {
        padding: 4px 8px;
        font-size: 0.74rem;
    }

    .contacts-container {
        padding: 0.75rem 0.65rem;
        gap: 0.6rem;
    }

    .contacts-control-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .contacts-control-bar > div {
        width: 100% !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        margin-left: 0 !important;
    }

    .contacts-custom-select {
        flex: 1;
        min-width: 0;
        font-size: 0.82rem;
        padding: 0.4rem 0.6rem;
    }

    .contacts-count-banner {
        padding: 0.6rem 0.85rem;
        font-size: 0.84rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .chat-item {
        padding: 0.75rem 0.85rem;
    }

    .chat-preview-header h3 {
        font-size: 0.98rem;
    }

    .chat-filter-chips {
        padding: 0.4rem 0.65rem;
        gap: 0.35rem;
    }

    .chat-chip {
        padding: 4px 10px;
        font-size: 0.78rem;
    }

    .day-selector-scroll {
        gap: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .day-pill {
        padding: 0.45rem 0.85rem;
        font-size: 0.82rem;
    }

    .letter-pill {
        padding: 3px 7px;
        font-size: 0.76rem;
    }

    .route-card {
        padding: 0.85rem;
    }

    .mobile-view {
        padding-bottom: 5px;
    }
}

/* ========================================================
   CORRECCIÓN CRÍTICA: SCROLL HASTA ABAJO EN MÓVILES (NO OCULTAR BOTONES)
   ======================================================== */
.catalog-container,
.broadcast-container,
.routes-container,
.contacts-container,
.metrics-container,
.gallery-container,
.chats,
#routes-cards-list,
#contacts-list-results {
    padding-bottom: calc(var(--bottom-nav-h) + 65px) !important;
}

/* Reglas de visibilidad para barra de navegación */
.nav-mobile-only {
    display: none !important;
}

.nav-desktop-only {
    display: flex !important;
}

.badge-daniela,
.badge-bot {
    color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.15) !important;
    border: 1px solid rgba(168, 85, 247, 0.45) !important;
    font-weight: 700 !important;
}

.badge-human,
.badge-asesor {
    color: var(--neon-magenta) !important;
    background: rgba(244, 63, 94, 0.15) !important;
    border: 1px solid var(--neon-magenta) !important;
    font-weight: 700 !important;
}

@media (max-width: 899px) {
    /* Barra inferior limpia de 5 botones principales como WhatsApp */
    .nav-desktop-only {
        display: none !important;
    }

    .nav-mobile-only {
        display: flex !important;
    }

    .sidebar {
        justify-content: space-around !important;
        padding: 0 4px !important;
        gap: 2px !important;
        height: 68px !important;
        overflow-x: hidden !important;
        overflow-y: hidden !important;
    }

    .sidebar .nav-desktop-only,
    .sidebar-user-section {
        display: none !important;
    }

    .nav-icon {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 4px 1px !important;
    }

    .nav-label {
        font-size: 0.67rem !important;
        letter-spacing: 0px !important;
    }

    .catalog-container,
    .broadcast-container,
    .routes-container,
    .contacts-container,
    .metrics-container,
    .gallery-container,
    .chats {
        padding-bottom: 140px !important;
    }
}

@media (min-width: 900px) {
    .nav-mobile-only {
        display: none !important;
    }
    .nav-desktop-only {
        display: flex !important;
    }
}

/* ========================================================
   ESTILOS WHATSAPP: CHIPS DE FILTRO SUPERIOR
   ======================================================== */
.chat-filter-chips {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.55rem 0.85rem;
    scrollbar-width: none;
    background: rgba(11, 20, 26, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    align-items: center;
}

.chat-filter-chips::-webkit-scrollbar {
    display: none;
}

.chat-chip {
    background: #202c33;
    color: #8696a0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.chat-chip:hover {
    background: #2a3942;
    color: #e9edef;
}

.chat-chip.active {
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
    border-color: #00a884;
    font-weight: 700;
}

.chip-count-badge {
    background: #00a884;
    color: #111b21;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.chip-count-badge.transfer {
    background: #f43f5e;
    color: #fff;
}

/* ========================================================
   ESTILOS MODAL AGENTE DE IA DANIELA (CONFIG & SIMULADOR)
   ======================================================== */
.daniela-tab-btn {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.daniela-tab-btn.active {
    background: var(--neon-cyan);
    color: #031525;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
}

.voice-record-pulse-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.15);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 1.4rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.voice-record-pulse-btn.recording {
    background: #f43f5e;
    color: #fff;
    border-color: #f43f5e;
    animation: mic-pulse 1.4s infinite;
}

@keyframes mic-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.daniela-rule-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.daniela-sim-chat {
    background: #0b141a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    height: 320px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* ========================================================
   ESTILOS DIFUSIÓN CON MULTIMEDIA (1 SOLO MENSAJE)
   ======================================================== */
.bcast-media-box {
    background: rgba(0, 243, 255, 0.05);
    border: 1px dashed rgba(0, 243, 255, 0.35);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.bcast-media-preview-container {
    position: relative;
    max-width: 240px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bcast-media-preview-container img,
.bcast-media-preview-container video {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    display: block;
}

/* ========================================================
   ESTILOS MENÚ MÓVIL "MÁS" (BOTTOM DRAWER)
   ======================================================== */
.mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.mobile-more-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mobile-more-card:hover, .mobile-more-card:active {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
}

.mobile-more-icon {
    font-size: 1.8rem;
}

.mobile-more-title {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
}

