:root {
    --primary: #0066ff;
    --primary-dark: #5b4dd4;
    --bg-dark: #94a3b8;
    --bg-surface: #e2e8f0;
    --bg-card: #eef1f6;
    --card-bg: rgba(228, 234, 244, 0.92);
    --accent: #2d7dd2;
    --accent-glow: rgba(45, 125, 210, 0.25);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.12);
    --border-accent: rgba(45, 125, 210, 0.35);
    --glass: rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: #dde3ee;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.18;
}

.blob-1 {
    background: #2d7dd2;
    top: -150px;
    right: -150px;
}

.blob-2 {
    background: #1a5fa0;
    bottom: -150px;
    left: -150px;
}

.container {
    width: 95%;
    max-width: 1100px;
    padding: 2.5rem;
    border-radius: 24px;
    position: relative;
    z-index: 1;
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255,255,255,0.6);
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

header h1 span {
    color: var(--primary);
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 1rem;
}

.badge-warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-success { background: rgba(37, 211, 102, 0.2); color: #25d366; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.card {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.card.active {
    display: block;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 16px;
    width: fit-content;
    margin: 2rem auto;
    min-width: 200px;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#qr-image {
    width: 200px;
    height: 200px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="file"],
textarea,
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="tel"],
select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

/* Flecha personalizada para selects */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23475569' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Icono del calendario oscuro para inputs date */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5) sepia(1) saturate(5) hue-rotate(180deg);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.btn-primary:hover {
    background: #20bc5a;
    transform: translateY(-2px);
}

.multimedia-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Zonas de upload estilizadas */
.file-upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.2rem 1rem;
    background: rgba(0,0,0,0.02);
    border: 1.5px dashed rgba(0,0,0,0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    min-height: 90px;
    user-select: none;
}
.file-upload-zone:hover {
    background: rgba(45,125,210,0.07);
    border-color: rgba(45,125,210,0.4);
}
.file-upload-zone.has-file {
    background: rgba(37,211,102,0.06);
    border-color: rgba(37,211,102,0.35);
    border-style: solid;
}
.file-upload-zone.has-file .file-upload-hint {
    color: #25d366;
}
.file-upload-video {
    grid-column: 1 / -1;
}
.file-upload-icon {
    font-size: 1.5rem;
    line-height: 1;
}
.file-upload-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-upload-hint {
    font-size: 0.68rem;
    color: #4b5563;
    transition: color 0.2s;
}

.progress-bar-container {
    background: rgba(15, 23, 42, 0.8);
    height: 10px;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

#progress-text {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.terminal {
    margin-top: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

.terminal ul { list-style: none; }
.terminal li { margin-bottom: 0.5rem; border-bottom: 1px solid rgba(0,0,0,0.04); padding-bottom: 0.25rem; }

.success { color: #25d366; }
.error { color: #ef4444; }

.nav-btn {
    flex: 1 1 calc(20% - 1rem);
    min-width: 140px;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.nav-btn.active {
    background: #2d7dd2;
    color: #ffffff;
    border-color: rgba(45, 125, 210, 0.5);
    box-shadow: 0 8px 20px -5px rgba(45, 125, 210, 0.4);
    transform: translateY(-2px);
}

.nav-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: #334155;
    border-color: rgba(0,0,0,0.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.3);
}

/* Presupuestos */
.budget-item-row input {
    transition: all 0.3s ease;
}

.budget-item-row input:focus {
    border-color: var(--primary) !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

#budgets-table-body tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.budget-item-row input:hover {
    border-color: rgba(0,0,0,0.15);
}

.budget-item-row {
    animation: fadeIn 0.3s ease forwards;
}

.terminal table {
    table-layout: fixed;
}

.terminal th, .terminal td {
    overflow: hidden;
    text-overflow: ellipsis;
}

#budgets-table-body td:last-child {
    overflow: visible !important;
    text-overflow: clip !important;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* --- Toggle Switch IA --- */
.ai-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 99px;
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}
.ai-toggle-wrapper:hover {
    border-color: rgba(0,0,0,0.18);
    background: rgba(0,0,0,0.06);
}
.ai-toggle-track {
    position: relative;
    width: 48px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 99px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}
.ai-toggle-track.on {
    background: linear-gradient(135deg, #25d366, #10b981);
    box-shadow: 0 0 12px rgba(37, 211, 102, 0.5);
}
.ai-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.ai-toggle-track.on .ai-toggle-thumb {
    transform: translateX(22px);
}
.ai-toggle-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: color 0.3s;
    color: #6b7280;
}
.ai-toggle-label.on {
    color: #25d366;
}

/* --- Acordeón Configuración IA --- */
.ai-card {
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}
.ai-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.ai-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.ai-card-header:hover {
    background: rgba(0,0,0,0.03);
}
.ai-card-arrow {
    font-size: 1rem;
    color: #6b7280;
    transition: transform 0.3s ease, color 0.2s;
    display: inline-block;
}
.ai-card.open .ai-card-arrow {
    transform: rotate(90deg);
    color: #1e293b;
}
.ai-card-body {
    display: none;
    padding: 0 1.25rem 1.25rem;
    animation: fadeInDown 0.2s ease;
}
.ai-card.open .ai-card-body {
    display: block;
}
.ai-card-body textarea {
    width: 100%;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    color: #1e293b;
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 0.85rem 1rem;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
    min-height: 80px;
}
.ai-card-body textarea:focus {
    outline: none;
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.ai-char-count {
    font-size: 0.7rem;
    color: #4b5563;
    text-align: right;
    margin-top: 0.3rem;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Tarjetas Biblioteca Multimedia IA --- */
#ai-media-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.ai-media-card {
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}
.ai-media-card:hover {
    border-color: rgba(45, 125, 210, 0.35);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    transform: translateY(-2px);
}
.ai-media-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f1f5f9;
    overflow: hidden;
    position: relative;
}
.ai-media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.ai-media-card:hover .ai-media-img {
    transform: scale(1.06);
}
.ai-media-info {
    padding: 0.75rem 0.9rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.ai-media-tag {
    font-size: 0.82rem;
    font-weight: 800;
    color: #25d366;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-media-hint {
    font-size: 0.68rem;
    color: #4b5563;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}
.ai-media-actions {
    display: flex;
    gap: 0.4rem;
}
.ai-media-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.ai-media-btn-update {
    background: rgba(45, 125, 210, 0.12);
    color: #5baaf5;
    border-color: rgba(45, 125, 210, 0.25);
}
.ai-media-btn-update:hover {
    background: rgba(45, 125, 210, 0.25);
    border-color: rgba(45, 125, 210, 0.5);
}
.ai-media-btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}
.ai-media-btn-delete:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.45);
}

/* ===== POOL DE NÚMEROS WHATSAPP ===== */
.number-card {
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    animation: fadeIn 0.35s ease;
}
.number-card:hover {
    border-color: rgba(37,211,102,0.25);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.number-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(37,211,102,0.1);
    border: 1px solid rgba(37,211,102,0.2);
}
.number-card-info {
    flex: 1;
    min-width: 0;
}
.number-card-alias {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.number-card-phone {
    font-size: 0.78rem;
    color: #25d366;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.03em;
}
.number-card-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}
.number-card-progress-wrap {
    width: 90px;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 99px;
    overflow: hidden;
}
.number-card-progress-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #25d366, #128c7e);
    transition: width 0.5s ease;
}
.number-card-stats-text {
    font-size: 0.7rem;
    color: #6b7280;
    white-space: nowrap;
}
.number-card-delete {
    background: none;
    border: 1px solid rgba(239,68,68,0.2);
    color: #f87171;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.number-card-delete:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.45);
    transform: scale(1.1);
}
.number-card-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.status-active {
    background: rgba(37,211,102,0.12);
    color: #25d366;
    border: 1px solid rgba(37,211,102,0.25);
}
.status-full {
    background: rgba(239,68,68,0.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
}
.status-pending {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.25);
}
#rotation-table-body tr {
    border-bottom: 1px solid rgba(0,0,0,0.03);
    transition: background 0.2s;
}
#rotation-table-body tr:hover {
    background: rgba(0,0,0,0.02);
}
#rotation-table-body td {
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10000;
}
.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 14px;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.05);
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-success { border-left: 4px solid #22c55e; }
.toast-info    { border-left: 4px solid #3b82f6; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-error   { border-left: 4px solid #ef4444; }
.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    margin-left: auto;
    padding: 0.2rem;
    line-height: 1;
}
.toast-close:hover { color: #64748b; }

@keyframes slideIn {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- Email Preview --- */
#email-preview-body img {
    max-width: 100% !important;
    height: auto !important;
}

/* ==========================================================================
   RESPONSIVE MOBILE
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding: 0 !important;
        align-items: flex-start !important;
        background-color: #f1f5f9 !important;
    }

    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.25rem 0.85rem !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    header { margin-bottom: 1.5rem !important; }
    header h1 { font-size: 1.6rem !important; }
    header img { max-height: 38px !important; }

    #user-header-badge {
        flex-direction: column !important;
        gap: 0.4rem !important;
    }

    .tabs-nav {
        gap: 0.35rem !important;
        margin-bottom: 1.25rem !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        padding-bottom: 0.5rem !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
    }

    .nav-btn {
        padding: 0.55rem 0.85rem !important;
        font-size: 0.78rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    section.card div[style*="grid-template-columns"],
    div[style*="grid-template-columns"],
    #email-campaign-section div[style*="grid-template-columns"],
    #active-clients-section div[style*="grid-template-columns"],
    #frequent-clients-section div[style*="grid-template-columns"],
    #todos-section div[style*="grid-template-columns"],
    #budgets-section div[style*="grid-template-columns"],
    #followups-section div[style*="grid-template-columns"],
    #numbers-section div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    #email-campaign-section div[style*="border-right"] {
        border-right: none !important;
        border-bottom: 1px solid rgba(0,0,0,0.08) !important;
        padding: 1rem 0.85rem !important;
    }

    #email-campaign-section div[style*="padding: 1.5rem"] {
        padding: 1rem 0.85rem !important;
    }

    #brevo-config-status {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }

    #state-search-panel div[style*="display:flex; justify-content:space-between"],
    #email-state-search-panel div[style*="display:flex; justify-content:space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    #state-search-panel div[style*="grid-template-columns:repeat(3,1fr)"],
    #email-state-search-panel div[style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)) !important;
        gap: 0.5rem !important;
    }

    #cancel-state-search-btn, #cancel-email-state-search-btn {
        width: 100% !important;
        text-align: center !important;
    }

    #prospects-form, #emails-search-form, #ai-media-form {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    #prospects-form .input-group,
    #emails-search-form .input-group,
    #ai-media-form .input-group {
        width: 100% !important;
        min-width: 100% !important;
    }

    .input-group, form {
        width: 100% !important;
        max-width: 100% !important;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }

    .btn-primary,
    button[type="submit"] {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    div[style*="overflow-x: auto"],
    .terminal {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table { min-width: 500px !important; }

    #toast-container {
        bottom: 1rem !important;
        right: 0.85rem !important;
        left: 0.85rem !important;
    }

    .toast {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ==========================================================================
   MOBILE NAV
   ========================================================================== */
.mobile-nav-wrapper {
    display: none;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 100;
}

.mobile-menu-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.mobile-menu-toggle-btn:active { transform: scale(0.98); }

.mobile-menu-dropdown {
    display: none;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.6rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-menu-dropdown.open { display: flex !important; }

.mobile-nav-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mobile-nav-item.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    font-weight: 700;
}

.tabs-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .mobile-nav-wrapper { display: block !important; }
    .tabs-nav { display: none !important; }

    #agenda-section div[style*="flex: 1"],
    #agenda-section div[style*="flex: 2"] {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    #agenda-section div[style*="display: flex; justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    #contacts-table-body td, #contacts-table-body th,
    #agenda-section table th, #agenda-section table td {
        padding: 0.65rem 0.75rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        line-height: 1.4 !important;
    }
}

/* ========================================= */
/*       PREMIUM SAAS DESIGN CLASSES         */
/* ========================================= */

.premium-container {
    background: white;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.07);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.premium-header {
    padding: 2rem 2rem 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.premium-header.purple {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}

.premium-header.blue {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
}

.premium-header.green {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #10b981 100%);
}

.premium-header.teal {
    background: linear-gradient(135deg, #134e4a 0%, #0f766e 50%, #14b8a6 100%);
}

.premium-header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    pointer-events: none;
}

.premium-header::after {
    content: '';
    position: absolute;
    bottom: -50px;
    right: 80px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: none;
}

.premium-header-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.premium-header-content {
    position: relative;
    z-index: 1;
    flex-grow: 1;
}

.premium-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: white;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.premium-header p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
}

.premium-header-action {
    position: relative;
    z-index: 1;
    margin-left: auto;
}

.premium-body {
    padding: 0;
}

.premium-section {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.premium-section:last-child {
    border-bottom: none;
}

.premium-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.premium-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: white;
}

.premium-section-icon.blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.premium-section-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.premium-section-icon.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.premium-section-icon.purple { background: linear-gradient(135deg, #8b5cf6, #c084fc); }

.premium-section-title h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.premium-input-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.4rem;
}

.premium-help-accordion {
    margin-bottom: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.05);
    overflow: hidden;
}

.premium-help-summary {
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #6366f1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.premium-help-icon {
    background: #6366f1;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.premium-help-content {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 0.86rem;
    color: #cbd5e1;
    line-height: 1.5;
    background: rgba(20,28,48,0.95);
}
