/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root, [data-theme="light"] {
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: rgba(15, 118, 110, 0.06);
    --primary-gradient: linear-gradient(135deg, #0f766e, #14b8a6);
    --bg: #f0f4f8;
    --bg-secondary: #f8fafc;
    --card-bg: #fff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --hover-bg: #f1f5f9;
    --header-bg: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    --header-text: #fff;
    --header-btn-bg: rgba(255,255,255,0.08);
    --header-btn-border: rgba(255,255,255,0.08);
    --header-btn-color: #e2e8f0;
    --input-bg: #f8fafc;
    --input-focus-bg: #fff;
    --table-header-bg: linear-gradient(180deg, #f8fafc, #f1f5f9);
    --modal-overlay: rgba(15, 23, 42, 0.65);
    --login-bg: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f766e 100%);
    --login-box-bg: rgba(255,255,255,0.97);
    --login-text: #0f172a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --primary-shadow-sm: 0 2px 8px rgba(15, 118, 110, 0.25);
    --primary-shadow-md: 0 6px 20px rgba(15, 118, 110, 0.35);
    --primary-shadow-lg: 0 8px 24px rgba(15, 118, 110, 0.4);
    --focus-ring: 0 0 0 4px rgba(15, 118, 110, 0.1);
    --chat-bg: linear-gradient(180deg, #e8ecf1, #f0f2f5);
    --chat-bubble-in: #fff;
    --chat-bubble-out: #dcf8c6;
    --chat-meta-color: #8696a0;
    --scrollbar-thumb: #c1c9d4;
    --scrollbar-hover: #94a3b8;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* === Tema Oscuro === */
[data-theme="dark"] {
    --primary: #14b8a6;
    --primary-light: #2dd4bf;
    --primary-bg: rgba(20, 184, 166, 0.1);
    --primary-gradient: linear-gradient(135deg, #0f766e, #14b8a6);
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --hover-bg: #334155;
    --header-bg: linear-gradient(135deg, #0a0f1a 0%, #131c2e 100%);
    --header-text: #f1f5f9;
    --header-btn-bg: rgba(255,255,255,0.06);
    --header-btn-border: rgba(255,255,255,0.06);
    --header-btn-color: #94a3b8;
    --input-bg: #0f172a;
    --input-focus-bg: #1e293b;
    --table-header-bg: linear-gradient(180deg, #1e293b, #0f172a);
    --modal-overlay: rgba(0, 0, 0, 0.75);
    --login-bg: linear-gradient(135deg, #020617 0%, #0f172a 50%, #0f766e 100%);
    --login-box-bg: rgba(30, 41, 59, 0.97);
    --login-text: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
    --primary-shadow-sm: 0 2px 8px rgba(20, 184, 166, 0.3);
    --primary-shadow-md: 0 6px 20px rgba(20, 184, 166, 0.25);
    --primary-shadow-lg: 0 8px 24px rgba(20, 184, 166, 0.35);
    --focus-ring: 0 0 0 4px rgba(20, 184, 166, 0.15);
    --chat-bg: linear-gradient(180deg, #0f172a, #1e293b);
    --chat-bubble-in: #1e293b;
    --chat-bubble-out: #1a3a2a;
    --chat-meta-color: #64748b;
    --scrollbar-thumb: #334155;
    --scrollbar-hover: #475569;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
}
/* === Tema Azul === */
[data-theme="blue"] {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-bg: rgba(37, 99, 235, 0.06);
    --primary-gradient: linear-gradient(135deg, #1e40af, #3b82f6);
    --bg: #f0f4ff;
    --bg-secondary: #f8faff;
    --card-bg: #fff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #dbeafe;
    --border-light: #eff6ff;
    --hover-bg: #eff6ff;
    --header-bg: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    --header-text: #fff;
    --header-btn-bg: rgba(255,255,255,0.08);
    --header-btn-border: rgba(255,255,255,0.08);
    --header-btn-color: #bfdbfe;
    --input-bg: #f8faff;
    --input-focus-bg: #fff;
    --table-header-bg: linear-gradient(180deg, #f8faff, #eff6ff);
    --modal-overlay: rgba(15, 23, 42, 0.65);
    --login-bg: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
    --login-box-bg: rgba(255,255,255,0.97);
    --login-text: #0f172a;
    --primary-shadow-sm: 0 2px 8px rgba(37, 99, 235, 0.25);
    --primary-shadow-md: 0 6px 20px rgba(37, 99, 235, 0.35);
    --primary-shadow-lg: 0 8px 24px rgba(37, 99, 235, 0.4);
    --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.1);
    --chat-bg: linear-gradient(180deg, #e8ecf8, #eff3fb);
    --chat-bubble-in: #fff;
    --chat-bubble-out: #dbeafe;
    --chat-meta-color: #8696a0;
    --scrollbar-thumb: #bfdbfe;
    --scrollbar-hover: #93c5fd;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
}
/* === Tema Violeta === */
[data-theme="purple"] {
    --primary: #7c3aed;
    --primary-light: #8b5cf6;
    --primary-bg: rgba(124, 58, 237, 0.06);
    --primary-gradient: linear-gradient(135deg, #6d28d9, #8b5cf6);
    --bg: #f5f3ff;
    --bg-secondary: #faf8ff;
    --card-bg: #fff;
    --text-primary: #1e1b4b;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e9d5ff;
    --border-light: #f5f3ff;
    --hover-bg: #f5f3ff;
    --header-bg: linear-gradient(135deg, #2e1065 0%, #4c1d95 100%);
    --header-text: #fff;
    --header-btn-bg: rgba(255,255,255,0.08);
    --header-btn-border: rgba(255,255,255,0.08);
    --header-btn-color: #c4b5fd;
    --input-bg: #faf8ff;
    --input-focus-bg: #fff;
    --table-header-bg: linear-gradient(180deg, #faf8ff, #f5f3ff);
    --modal-overlay: rgba(30, 27, 75, 0.65);
    --login-bg: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #7c3aed 100%);
    --login-box-bg: rgba(255,255,255,0.97);
    --login-text: #1e1b4b;
    --primary-shadow-sm: 0 2px 8px rgba(124, 58, 237, 0.25);
    --primary-shadow-md: 0 6px 20px rgba(124, 58, 237, 0.35);
    --primary-shadow-lg: 0 8px 24px rgba(124, 58, 237, 0.4);
    --focus-ring: 0 0 0 4px rgba(124, 58, 237, 0.1);
    --chat-bg: linear-gradient(180deg, #ede9fe, #f5f3ff);
    --chat-bubble-in: #fff;
    --chat-bubble-out: #e9d5ff;
    --chat-meta-color: #8696a0;
    --scrollbar-thumb: #c4b5fd;
    --scrollbar-hover: #a78bfa;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
}
/* === Tema Esmeralda === */
[data-theme="emerald"] {
    --primary: #059669;
    --primary-light: #10b981;
    --primary-bg: rgba(5, 150, 105, 0.06);
    --primary-gradient: linear-gradient(135deg, #047857, #10b981);
    --bg: #ecfdf5;
    --bg-secondary: #f0fdf4;
    --card-bg: #fff;
    --text-primary: #022c22;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #a7f3d0;
    --border-light: #d1fae5;
    --hover-bg: #d1fae5;
    --header-bg: linear-gradient(135deg, #022c22 0%, #064e3b 100%);
    --header-text: #fff;
    --header-btn-bg: rgba(255,255,255,0.08);
    --header-btn-border: rgba(255,255,255,0.08);
    --header-btn-color: #a7f3d0;
    --input-bg: #f0fdf4;
    --input-focus-bg: #fff;
    --table-header-bg: linear-gradient(180deg, #f0fdf4, #ecfdf5);
    --modal-overlay: rgba(2, 44, 34, 0.65);
    --login-bg: linear-gradient(135deg, #022c22 0%, #064e3b 50%, #059669 100%);
    --login-box-bg: rgba(255,255,255,0.97);
    --login-text: #022c22;
    --primary-shadow-sm: 0 2px 8px rgba(5, 150, 105, 0.25);
    --primary-shadow-md: 0 6px 20px rgba(5, 150, 105, 0.35);
    --primary-shadow-lg: 0 8px 24px rgba(5, 150, 105, 0.4);
    --focus-ring: 0 0 0 4px rgba(5, 150, 105, 0.1);
    --chat-bg: linear-gradient(180deg, #d1fae5, #ecfdf5);
    --chat-bubble-in: #fff;
    --chat-bubble-out: #a7f3d0;
    --chat-meta-color: #8696a0;
    --scrollbar-thumb: #a7f3d0;
    --scrollbar-hover: #6ee7b7;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
}
/* === Tema Atardecer === */
[data-theme="sunset"] {
    --primary: #ea580c;
    --primary-light: #f97316;
    --primary-bg: rgba(234, 88, 12, 0.06);
    --primary-gradient: linear-gradient(135deg, #c2410c, #f97316);
    --bg: #fff7ed;
    --bg-secondary: #fffbf5;
    --card-bg: #fff;
    --text-primary: #431407;
    --text-secondary: #78716c;
    --text-muted: #a8a29e;
    --border: #fed7aa;
    --border-light: #ffedd5;
    --hover-bg: #ffedd5;
    --header-bg: linear-gradient(135deg, #431407 0%, #7c2d12 100%);
    --header-text: #fff;
    --header-btn-bg: rgba(255,255,255,0.08);
    --header-btn-border: rgba(255,255,255,0.08);
    --header-btn-color: #fed7aa;
    --input-bg: #fffbf5;
    --input-focus-bg: #fff;
    --table-header-bg: linear-gradient(180deg, #fffbf5, #ffedd5);
    --modal-overlay: rgba(67, 20, 7, 0.65);
    --login-bg: linear-gradient(135deg, #431407 0%, #7c2d12 50%, #ea580c 100%);
    --login-box-bg: rgba(255,255,255,0.97);
    --login-text: #431407;
    --primary-shadow-sm: 0 2px 8px rgba(234, 88, 12, 0.25);
    --primary-shadow-md: 0 6px 20px rgba(234, 88, 12, 0.35);
    --primary-shadow-lg: 0 8px 24px rgba(234, 88, 12, 0.4);
    --focus-ring: 0 0 0 4px rgba(234, 88, 12, 0.1);
    --chat-bg: linear-gradient(180deg, #ffedd5, #fff7ed);
    --chat-bubble-in: #fff;
    --chat-bubble-out: #fed7aa;
    --chat-meta-color: #8696a0;
    --scrollbar-thumb: #fed7aa;
    --scrollbar-hover: #fdba74;
    --status-bar-bg: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* === Loading spinner === */
.section-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    flex-direction: column;
    gap: 16px;
    color: var(--text-muted);
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Fade-in animation for sections === */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.main > * { animation: fadeUp 0.35s ease; }

/* === Login === */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--login-bg);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-bg), transparent 70%);
    top: -200px;
    right: -200px;
    pointer-events: none;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--primary-bg), transparent 70%);
    bottom: -100px;
    left: -100px;
    pointer-events: none;
}

/* --- Login split layout --- */
.login-split {
    display: flex;
    width: 960px;
    max-width: 95vw;
    min-height: 580px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.05);
    position: relative;
    z-index: 1;
}

/* --- Hero (lado izquierdo) --- */
.login-hero {
    flex: 1.1;
    background: var(--primary-gradient);
    color: #fff;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    top: -120px;
    right: -100px;
}
.login-hero::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    bottom: -80px;
    left: -60px;
}
.login-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.login-hero-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: visible;
    margin-bottom: 1.2rem;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.3));
    animation: heroFloat 4s ease-in-out infinite;
}
.login-hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.login-hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.4rem;
    letter-spacing: -1px;
}
.login-hero-subtitle {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.85;
    margin-bottom: 0;
}
.login-hero-divider {
    width: 50px;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    margin: 1.2rem 0;
}
.login-hero-desc {
    font-size: 0.88rem;
    opacity: 0.65;
    margin-bottom: 1.8rem;
    line-height: 1.5;
    max-width: 300px;
}
.login-hero-features {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
.login-hero-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s;
}
.login-hero-feature:hover { background: rgba(255,255,255,0.2); }
.login-hero-feature-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}
.login-hero-footer {
    position: relative;
    z-index: 1;
    margin-top: 2.5rem;
    font-size: 0.72rem;
    opacity: 0.4;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- Form (lado derecho) --- */
.login-form-side {
    flex: 1;
    background: var(--login-box-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
}
.login-form-card {
    width: 100%;
    max-width: 340px;
    text-align: center;
}
.login-form-avatar {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}
.login-form-card h2 {
    color: var(--login-text);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    letter-spacing: -0.5px;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.btn-secondary-login {
    width: 100%;
    padding: 12px;
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border) !important;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 0;
}
.btn-secondary-login:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: var(--primary-bg) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
        width: 95vw;
        min-height: auto;
        border-radius: 20px;
    }
    .login-hero {
        padding: 2rem 1.5rem;
    }
    .login-hero-avatar { width: 80px; height: 80px; }
    .login-hero-title { font-size: 1.6rem; }
    .login-hero-desc { display: none; }
    .login-hero-features { gap: 8px; }
    .login-hero-feature { font-size: 0.75rem; padding: 6px 12px; }
    .login-hero-footer { display: none; }
    .login-form-side { padding: 1.5rem; }
    .login-form-avatar { width: 44px; height: 44px; }
}

/* --- Login box (registro, recovery) --- */
.login-box {
    background: var(--login-box-bg);
    backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    width: 420px;
    max-width: 95vw;
    text-align: center;
    position: relative;
    z-index: 1;
}
.login-logo {
    width: 68px;
    height: 68px;
    background: var(--primary-gradient);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    font-size: 1.8rem;
    color: #fff;
    box-shadow: var(--primary-shadow-lg);
}
.login-box h2 {
    margin-bottom: 0.25rem;
    color: var(--login-text);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.8rem;
}
.input-group {
    position: relative;
    margin-bottom: 14px;
}
.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    z-index: 1;
}
.input-group input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 0.92rem;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    background: var(--input-bg);
}
.input-group input:focus {
    border-color: var(--primary-light);
    box-shadow: var(--focus-ring);
    background: var(--input-focus-bg);
}
.input-group .toggle-pass {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.95rem;
    z-index: 2;
    transition: color 0.15s;
}
.input-group .toggle-pass:hover { color: var(--primary); }
.input-group:has(.toggle-pass) input { padding-right: 44px; }
#rec-codigo::placeholder {
    font-size: .85rem;
    letter-spacing: 2px;
    font-weight: 400;
    color: #cbd5e1;
}
.login-box button, .login-form-card button {
    width: 100%;
    padding: 13px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 8px;
    letter-spacing: 0.3px;
}
.login-box button:hover, .login-form-card button:hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-shadow-lg);
}
.login-box button:active, .login-form-card button:active { transform: translateY(0); }
.login-box .register-link, .login-form-card .register-link {
    text-align: center;
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.login-box .register-link a, .login-form-card .register-link a {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}
.login-box .register-link a:hover, .login-form-card .register-link a:hover { text-decoration: underline; }

/* Plan selector en registro */
.plan-option {
    display: block;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
}
.plan-option:hover { border-color: var(--primary); }
.plan-option.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    box-shadow: 0 0 0 1px var(--primary);
}
.plan-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.plan-option-name { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.plan-option-price { font-weight: 700; font-size: 0.88rem; color: var(--primary); }
.plan-option-desc { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 6px; }
.plan-option-features {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
}
.plan-option-features li {
    padding: 1px 0;
}
.plan-option-features i { color: var(--success); margin-right: 4px; font-size: 0.68rem; }

/* === App Shell === */
.app { display: none; }

.header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 24px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header h1 i { color: var(--primary-light); }
.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header .user-name {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-right: 6px;
    background: rgba(255,255,255,0.06);
    padding: 6px 14px;
    border-radius: 10px;
}
.header .user-name i { color: var(--primary-light); margin-right: 6px; }
.header-btn {
    background: var(--header-btn-bg);
    border: 1px solid var(--header-btn-border);
    color: var(--header-btn-color);
    width: 38px;
    height: 38px;
    border-radius: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 0.9rem;
    position: relative;
}
.header-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.15); }
.menu-toggle {
    background: none;
    border: none;
    color: var(--header-btn-color);
    font-size: 1.1rem;
    cursor: pointer;
    display: none;
    padding: 6px;
}
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 19px;
    height: 19px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--text-primary);
    animation: notifPop 0.3s ease;
}
@keyframes notifPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* === Theme Switcher === */
.theme-switcher { position: relative; }
.theme-menu {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 160px;
}
.theme-menu.show { display: block; animation: fadeIn 0.15s ease; }
.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.theme-option:hover { background: var(--hover-bg); color: var(--text-primary); }
.theme-option.active { background: var(--primary-bg); color: var(--primary); font-weight: 700; }
.theme-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.theme-option.active .theme-dot { border-color: var(--primary); }

/* === Layout === */
.layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* === Sidebar === */
.sidebar {
    width: 230px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    overflow-y: auto;
    transition: transform 0.3s;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 22px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    margin: 2px 0;
    border-radius: 0 10px 10px 0;
    margin-right: 8px;
}
.sidebar a i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
}
.sidebar a:hover {
    background: var(--hover-bg);
    color: var(--primary);
}
.sidebar a:hover i { opacity: 1; }
.sidebar a.active {
    background: var(--primary-bg);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.sidebar a.active i { opacity: 1; }
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 18px;
}

/* === Main === */
.main {
    flex: 1;
    padding: 28px;
    max-width: 1280px;
    min-width: 0;
}

/* === Cards === */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2 {
    margin-bottom: 18px;
    color: var(--text-primary);
    font-size: 1.08rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}
.card h2 i { color: var(--primary); font-size: 0.95rem; }

/* === Toolbar === */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.toolbar input, .toolbar select {
    padding: 9px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
    background: var(--card-bg);
}
.toolbar input:focus, .toolbar select:focus {
    border-color: var(--primary-light);
}
.toolbar input[type="text"] {
    flex: 1;
    min-width: 200px;
}

/* === Buttons === */
.btn {
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.1px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--primary-shadow-sm);
}
.btn-primary:hover {
    box-shadow: var(--primary-shadow-md);
    transform: translateY(-1px);
}
.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; }
.btn-success {
    background: linear-gradient(135deg, #22c55e, #25d366);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35); transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--hover-bg); color: var(--text-primary); }
.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 8px;
}

/* === Tables === */
table { width: 100%; border-collapse: collapse; }
table th, table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}
table th {
    background: var(--table-header-bg);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    position: sticky;
    top: 0;
    border-bottom: 2px solid var(--border);
}
table tr { transition: all 0.1s; }
table tr:hover { background: var(--primary-bg); }
table td .btn-sm { margin-right: 4px; margin-bottom: 2px; }

/* === Badges === */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-nuevo { background: #dbeafe; color: #1d4ed8; }
.badge-en_proceso { background: #fef3c7; color: #b45309; }
.badge-esperando_respuesta { background: #fce7f3; color: #be185d; }
.badge-completado { background: #dcfce7; color: #15803d; }
.badge-cancelado { background: #f1f5f9; color: var(--text-secondary); }
.badge-cliente { background: #dbeafe; color: #1d4ed8; }
.badge-colaborador { background: #f3e8ff; color: #7c3aed; }
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0; padding-bottom: 0; }
.tab-btn { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 0.9rem; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; border-radius: 8px 8px 0 0; }
.tab-btn:hover { background: #f8fafc; color: #334155; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.badge-pedido-nuevo { background: #dbeafe; color: #1d4ed8; }
.badge-pedido-confirmado { background: #fef3c7; color: #b45309; }
.badge-pedido-enviado { background: #f3e8ff; color: #7c3aed; }
.badge-pedido-entregado { background: #dcfce7; color: #15803d; }
.badge-pedido-cancelado { background: #fee2e2; color: #dc2626; }

/* === Tono === */
.tono-muy_contento { color: #15803d; font-weight: 600; }
.tono-contento { color: #16a34a; }
.tono-neutral { color: var(--text-secondary); }
.tono-molesto { color: #ea580c; }
.tono-muy_molesto { color: #dc2626; font-weight: 600; }

/* === Alert === */
.alert {
    padding: 14px 22px;
    border-radius: 12px;
    display: none;
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 200;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 420px;
    backdrop-filter: blur(8px);
}
@keyframes slideIn {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.alert-danger { background: rgba(254,242,242,0.95); color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: rgba(240,253,244,0.95); color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: rgba(255,251,235,0.95); color: #b45309; border: 1px solid #fde68a; }

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(6px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.show { display: flex; }
.modal {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 0;
    width: 500px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalSlide {
    from { transform: translateY(24px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 26px 0;
}
.modal h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}
.modal-close {
    background: var(--hover-bg);
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: all var(--transition);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
#modal-body {
    padding: 18px 26px;
    max-height: 75vh;
    overflow-y: auto;
}
.modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 12px;
}
.modal input, .modal select, .modal textarea {
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 4px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
    border-color: var(--primary-light);
    box-shadow: var(--focus-ring);
    background: var(--input-focus-bg);
}
.modal textarea { height: 80px; resize: vertical; }
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 18px 26px 22px;
    border-top: 1px solid var(--border-light);
}

/* === Stats / Dashboard === */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 0;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: .95rem;
}
.stat-card .number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1.2;
}
.stat-card .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard compact chips */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.dash-chip {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: all .2s;
}
.dash-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}
.dash-chip-alert { border-color: #fecaca; }
.dash-chip-icon { font-size: .9rem; margin-bottom: 4px; }
.dash-chip-n { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.dash-chip-label { font-size: .65rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }

/* === Dashboard sections === */
.dashboard-section {
    margin-bottom: 28px;
}
.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}
.dashboard-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}
.dashboard-section-title i {
    font-size: 0.95rem;
    color: var(--primary);
    width: 32px;
    height: 32px;
    background: var(--primary-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Dashboard conversation cards === */
.dash-conv-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--card-bg);
    transition: all var(--transition);
}
.dash-conv-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--text-muted);
}
.dash-conv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.dash-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.dash-conv-info { flex: 1; min-width: 0; }
.dash-conv-name { font-weight: 600; font-size: 0.9rem; }
.dash-conv-phone { font-size: 0.78rem; color: var(--text-muted); }

/* === WhatsApp === */
.wa-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
}
.wa-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wa-dot.online {
    background: #25d366;
    box-shadow: 0 0 8px rgba(37, 211, 102, 0.5);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 0 14px rgba(37, 211, 102, 0.6); }
}
.wa-dot.offline { background: #ef4444; }

.qr-container { text-align: center; padding: 24px; }
.qr-container img {
    max-width: 250px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.wa-tab.active {
    color: #25d366 !important;
    border-bottom: 2px solid #25d366;
    margin-bottom: -2px;
}
.wa-tab:hover:not(.active) {
    color: var(--text-primary) !important;
    background: var(--bg-primary);
}

/* --- WhatsApp config form fields --- */
#wa-extra input[type="text"],
#wa-extra input[type="number"],
#wa-extra input:not([type]),
#wa-extra select,
#wa-extra textarea {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 4px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: .85rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
#wa-extra input:focus,
#wa-extra select:focus,
#wa-extra textarea:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37,211,102,.12);
    outline: none;
}
#wa-extra textarea {
    resize: vertical;
    min-height: 56px;
    line-height: 1.5;
}
#wa-extra label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    margin-top: 12px;
}
#wa-extra label:first-child {
    margin-top: 0;
}
#wa-extra input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #25d366;
    cursor: pointer;
}

/* --- Tabs modernos (Contactos, etc.) --- */
.mod-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 5px;
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1px solid var(--border);
}
.mod-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: none;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .25s ease;
    position: relative;
}
.mod-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-primary);
}
.mod-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.mod-tab .tab-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    transition: all .25s ease;
}
.mod-tab.active .tab-icon {
    transform: scale(1.1);
}
.mod-tab .tab-badge {
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all .25s ease;
}
.mod-tab.active .tab-badge {
    background: var(--primary);
    color: #fff;
}

.dias-alerta {
    color: #dc2626;
    font-weight: 600;
    background: #fef2f2;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
}

/* === Section Header (Contacts, etc.) === */
.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}
.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}
.page-title i {
    color: var(--primary);
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 3px;
    font-weight: 500;
}

.contacts-toolbar {
    margin-bottom: 22px;
}
.search-box {
    position: relative;
    max-width: 480px;
}
.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}
.search-box input {
    width: 100%;
    padding: 12px 18px 12px 44px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 0.88rem;
    outline: none;
    transition: all var(--transition);
    background: var(--card-bg);
}
.search-box input:focus {
    border-color: var(--primary-light);
    box-shadow: var(--focus-ring);
}

/* === Contact Grid & Cards === */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 18px;
}

.contact-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}
.contact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition);
}
.contact-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--text-muted);
    transform: translateY(-3px);
}
.contact-card:hover::before { opacity: 1; }

.contact-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}
.contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.contact-info {
    flex: 1;
    min-width: 0;
}
.contact-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}
.contact-company {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.contact-company i { font-size: 0.7rem; color: var(--text-muted); }

.contact-ia-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.toggle-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}
.contact-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.contact-meta i {
    width: 16px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.contact-status-bar {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--status-bar-bg);
    border-radius: var(--radius-sm);
}
.contact-status-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}
.contact-status-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.contact-meta-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}
.contact-meta-value.alerta {
    color: #dc2626;
    background: #fef2f2;
    padding: 2px 10px;
    border-radius: 8px;
    display: inline-block;
    width: fit-content;
}
.contact-meta-value.ok { color: #15803d; }
.contact-meta-value.muted { color: var(--text-muted); font-weight: 400; }

.contact-notes {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--hover-bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-light);
    line-height: 1.5;
}
.contact-notes i { color: var(--primary); margin-right: 5px; }

.contact-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}
.action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: all var(--transition);
}
.action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.12); }
.action-btn:active { transform: scale(0.93); }

.action-edit { background: #eff6ff; color: #2563eb; }
.action-edit:hover { background: #dbeafe; }
.action-wa { background: #f0fdf4; color: #25d366; }
.action-wa:hover { background: #dcfce7; }
.action-schedule { background: #f1f5f9; color: #475569; }
.action-schedule:hover { background: #e2e8f0; }
.action-time { background: #eff6ff; color: #0284c7; }
.action-time:hover { background: #e0f2fe; }
.action-product { background: #fff7ed; color: #ea580c; }
.action-product:hover { background: #ffedd5; }
.action-survey { background: #faf5ff; color: #7c3aed; }
.action-survey:hover { background: #f3e8ff; }
.action-delete { background: #fef2f2; color: #dc2626; }
.action-delete:hover { background: #fee2e2; }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 18px;
    opacity: 0.2;
    display: block;
}
.empty-state p {
    font-size: 1rem;
    margin-bottom: 22px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .contact-grid { grid-template-columns: 1fr; }
    .contacts-header { flex-direction: column; align-items: flex-start; }
}

/* === Masivo list items === */
.masivo-item:hover { background: var(--bg-secondary); }
.masivo-item input[type="checkbox"] { cursor: pointer; }

/* === Toggle Switch === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: background 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* === View Toggle === */
.view-toggle {
    display: inline-flex;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.view-btn {
    width: 36px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all var(--transition);
}
.view-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.5); }
.view-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* === Table view avatars & actions === */
.contact-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.contact-actions-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.contact-actions-row .action-btn {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
    border-radius: 8px;
}

/* === Generic item cards (productos, pendientes, etc) === */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}
.item-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition);
}
.item-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--text-muted);
    transform: translateY(-3px);
}
.item-card:hover::before { opacity: 1; }
.item-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.item-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.item-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.1px;
}
.item-card-subtitle {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 2px;
}
.item-card-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.item-card-footer {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

@media (max-width: 768px) {
    .item-grid { grid-template-columns: 1fr; }
}

/* === Agenda items === */
.agenda-group {
    margin-bottom: 16px;
}
.agenda-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
}
.agenda-group-title {
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: capitalize;
}
.agenda-today-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 8px;
    background: #3b82f615;
    color: #3b82f6;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.agenda-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    align-items: flex-start;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.agenda-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}
.agenda-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.agenda-item-content { flex: 1; min-width: 0; }
.agenda-item-title {
    font-weight: 700;
    font-size: 0.82rem;
}
.agenda-item-meta {
    font-size: 0.73rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.agenda-item-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
}
.agenda-item-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-left: 6px;
}
.agenda-mini-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}
.agenda-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
/* Toggle vista calendario/lista */
/* Integraciones */
.integ-section { margin-bottom: 24px; }
.integ-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.integ-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}
.integ-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all var(--transition);
}
.integ-card:hover { box-shadow: var(--shadow-md); }
.integ-active { border-left: 3px solid #15803d; }
.integ-inactive { border-left: 3px solid #f59e0b; }
.integ-available { border-left: 3px solid var(--border); opacity: .85; }
.integ-available:hover { opacity: 1; }
.integ-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.integ-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.integ-card-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.integ-card-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.integ-card-sync {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.integ-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.integ-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    flex-shrink: 0;
}
.integ-status-on { background: #f0fdf4; color: #15803d; }
.integ-status-off { background: #fefce8; color: #a16207; }
@media (max-width: 600px) {
    .integ-grid { grid-template-columns: 1fr; }
}
/* Kambia board */
.kambia-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
}
.kambia-col {
    min-width: 240px;
    max-width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}
.kambia-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}
.kambia-col-count {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 700;
}
.kambia-col-body {
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kambia-ticket {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: box-shadow var(--transition);
}
.kambia-ticket:hover { box-shadow: var(--shadow-sm); }
.kambia-ticket-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.kambia-ticket-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.kambia-tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
.kambia-tag-petition { background: #dbeafe; color: #1e40af; }
.kambia-tag-complaint { background: #fef3c7; color: #92400e; }
.kambia-tag-claim { background: #fee2e2; color: #991b1b; }
.kambia-prio-low { background: #f0fdf4; color: #15803d; }
.kambia-prio-medium { background: #fefce8; color: #a16207; }
.kambia-prio-high { background: #fff1f2; color: #be123c; }
.kambia-prio-urgent { background: #fee2e2; color: #991b1b; }
.kambia-ticket-client {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.kambia-ticket-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.kambia-empty {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* Endpoint results */
.endpoint-docs {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.endpoint-result-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.endpoint-ok { border-left: 3px solid #15803d; }
.endpoint-err { border-left: 3px solid #dc2626; }
.endpoint-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.endpoint-status { color: #15803d; font-weight: 600; font-size: 0.82rem; }
.endpoint-status-err { color: #dc2626; }
.endpoint-result-body {
    padding: 14px 16px;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
}
/* Agenda tabs */
.agenda-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}
.agenda-tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: color var(--transition);
}
.agenda-tab-btn:hover { color: var(--text-primary); }
.agenda-tab-btn.active {
    color: var(--primary);
}
.agenda-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}
.agenda-tab-count {
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
/* Recordatorios list */
.rec-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.rec-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--card-bg);
    transition: background var(--transition);
}
.rec-list-item:hover { background: var(--bg-secondary); }
.rec-list-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
}
.rec-list-info {
    flex: 1;
    min-width: 0;
}
.rec-list-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rec-list-meta {
    display: flex;
    gap: 10px;
    font-size: 0.73rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    margin-top: 2px;
}
.rec-list-meta span { display: flex; align-items: center; gap: 4px; }
.rec-list-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}
.rec-list-error {
    font-size: 0.78rem;
    color: #dc2626;
    margin-top: 4px;
}
.rec-list-last {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.rec-list-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.agenda-view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.agenda-view-btn {
    padding: 6px 14px;
    border: none;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}
.agenda-view-btn:hover { background: var(--bg-secondary); }
.agenda-view-btn.active {
    background: var(--primary);
    color: #fff;
}
/* Resumen del dia */
.agenda-resumen-hoy {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 12px;
}
.agenda-resumen-titulo {
    font-weight: 700;
    font-size: 0.82rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.agenda-resumen-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.agenda-resumen-chip {
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.73rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* Calendario de agenda */
.agenda-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.agenda-cal-header {
    background: var(--bg-secondary);
    padding: 8px 4px;
    text-align: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.agenda-cal-cell {
    background: var(--card-bg);
    padding: 6px 4px;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.agenda-cal-cell:hover {
    background: var(--bg-secondary);
}
.agenda-cal-cell.has-items:hover {
    background: var(--primary-bg);
}
.agenda-cal-cell.other-month {
    background: var(--bg-secondary);
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.agenda-cal-cell.today {
    background: var(--primary-bg);
}
.agenda-cal-cell.today .agenda-cal-daynum {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.agenda-cal-daynum {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}
.agenda-cal-dots {
    display: flex;
    gap: 2px;
    margin-top: 3px;
}
.agenda-cal-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 768px) {
    .agenda-cal-cell { padding: 2px; min-height: 44px; }
    .agenda-cal-daynum { font-size: 0.7rem; }
    .agenda-cal-dot { width: 14px; height: 14px; font-size: 0.52rem; }
}

/* === Listas === */
.listas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.lista-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.lista-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.lista-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.lista-card-titulo {
    font-size: 0.95rem;
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lista-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lista-card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lista-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.lista-progress-bar-big {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}
.lista-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.lista-progress-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}
.lista-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.lista-add-row input {
    flex: 1;
}
.lista-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: all var(--transition);
}
.lista-item:hover {
    box-shadow: var(--shadow-sm);
}
.lista-item.completado {
    opacity: 0.6;
    background: var(--bg-secondary);
}
.lista-item-texto {
    flex: 1;
    font-size: 0.88rem;
    min-width: 0;
}
.lista-item-texto.tachado {
    text-decoration: line-through;
    color: var(--text-secondary);
}
.lista-check {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.lista-check input { display: none; }
.lista-check-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.lista-check input:checked + .lista-check-mark {
    background: var(--primary);
    border-color: var(--primary);
}
.lista-check input:checked + .lista-check-mark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

/* === Calendario Pendientes === */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}
.cal-nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all var(--transition);
}
.cal-nav-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.cal-month-title {
    font-size: 0.88rem;
    font-weight: 700;
    min-width: 160px;
    text-align: center;
    text-transform: capitalize;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.cal-header-cell {
    background: var(--bg-secondary);
    padding: 5px 3px;
    text-align: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cal-cell {
    background: var(--card-bg);
    min-height: 72px;
    padding: 3px;
    vertical-align: top;
    position: relative;
}
.cal-cell.other-month {
    background: var(--bg-secondary);
    opacity: 0.5;
}
.cal-cell.today {
    background: var(--primary-bg);
}
.cal-day-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 2px 5px;
    display: inline-block;
}
.cal-cell.today .cal-day-num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
}
.cal-event {
    display: block;
    padding: 1px 5px;
    margin: 1px 1px;
    border-radius: 3px;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--transition);
    text-decoration: none;
    color: #fff;
}
.cal-event:hover {
    opacity: 0.85;
}
.cal-event.pri-1 { background: #dc2626; }
.cal-event.pri-2 { background: #b45309; }
.cal-event.pri-3 { background: #64748b; }
.cal-event.completado { background: #16a34a; opacity: 0.6; text-decoration: line-through; }
.cal-event.cancelado { background: #94a3b8; opacity: 0.5; text-decoration: line-through; }
.cal-more {
    font-size: 0.68rem;
    color: var(--primary);
    padding: 1px 6px;
    cursor: pointer;
    font-weight: 600;
}
/* Lista cronológica */
.pend-date-group {
    margin-bottom: 20px;
}
.pend-date-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
}
.pend-date-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: capitalize;
}
.pend-date-count {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--primary-light);
    color: #fff;
    font-weight: 700;
}
.pend-date-item {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 4px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    align-items: center;
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.pend-date-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}
.pend-date-pri {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}
.pend-date-info {
    flex: 1;
    min-width: 0;
}
.pend-date-info-title {
    font-weight: 600;
    font-size: 0.88rem;
}
.pend-date-info-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.sin-fecha-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px dashed var(--border);
}
@media (max-width: 768px) {
    .cal-cell { min-height: 70px; }
    .cal-event { font-size: 0.6rem; padding: 1px 4px; }
    .cal-day-num { font-size: 0.7rem; }
}

/* === Chat / Conversaciones === */
/* Chat container - conversaciones */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
}
.chat-sidebar {
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
    max-height: 75vh;
    overflow-y: auto;
}
.chat-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background .15s;
}
.chat-sidebar-item:hover { background: var(--hover-bg); }
.chat-sidebar-item.active {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}
.chat-sidebar-item .chat-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .82rem; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.chat-sidebar-item .chat-info { flex: 1; min-width: 0; }
.chat-sidebar-item .chat-name { font-weight: 700; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.chat-sidebar-item .chat-preview { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chat-sidebar-item .chat-time { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }

.chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--card-bg);
}
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
}
.chat-header .chat-name { font-weight: 700; font-size: 1.05rem; }
.chat-header .chat-status { font-size: .75rem; color: var(--text-muted); }

.chat-messages {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--chat-bg);
}

.chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .87rem;
    line-height: 1.55;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chat-bubble.entrante {
    align-self: flex-start;
    background: var(--chat-bubble-in);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
    color: var(--text-primary);
}
.chat-bubble.saliente {
    align-self: flex-end;
    background: var(--chat-bubble-out);
    border-top-right-radius: 4px;
}
.chat-bubble .chat-meta {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 5px;
    font-size: .68rem;
    color: var(--chat-meta-color);
}
.chat-bubble .chat-auto-badge {
    font-size: .62rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf615, #a78bfa15);
    color: #7c3aed;
    font-weight: 700;
    letter-spacing: .3px;
}
.chat-date-divider {
    align-self: center;
    padding: 5px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: .72rem;
    color: var(--text-secondary);
    margin: 14px 0;
    font-weight: 600;
}
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: .9rem;
    gap: 8px;
    padding: 60px 20px;
}

/* Chat input bar */
.chat-input-bar {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    align-items: center;
}
.chat-input {
    flex: 1;
    padding: 11px 18px;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
    background: var(--input-bg);
}
.chat-input:focus {
    border-color: var(--primary-light);
    box-shadow: var(--focus-ring);
    background: var(--input-focus-bg);
}
.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all .15s;
    flex-shrink: 0;
    box-shadow: var(--primary-shadow-sm);
}
.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--primary-shadow-md);
}
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .chat-container { grid-template-columns: 1fr; }
    .chat-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* === Ficha de contacto (modal) === */
.ficha-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.ficha-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}
.ficha-info { min-width: 0; }
.ficha-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}
.ficha-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: .8rem;
    color: var(--text-secondary);
}
.ficha-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ficha-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ficha-stat {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 10px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
}
.ficha-stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}
.ficha-stat-lbl {
    font-size: .68rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    text-transform: capitalize;
}
.ficha-notas {
    font-size: .82rem;
    color: var(--text-secondary);
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 14px;
    line-height: 1.5;
}
.ficha-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 14px;
}
.ficha-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
}
.ficha-tab:hover { color: var(--text-primary); }
.ficha-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.ficha-tab-content { min-height: 100px; }
.ficha-chat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 45vh;
    overflow-y: auto;
    padding: 14px;
    background: var(--chat-bg);
    border-radius: 10px;
    border: 1px solid var(--border-light);
}
.ficha-inter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    font-size: .82rem;
}
.ficha-inter-icon {
    color: var(--text-muted);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.ficha-inter-text {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ficha-inter-tono { flex-shrink: 0; }
.ficha-inter-fecha {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.ficha-pend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    font-size: .85rem;
}
.ficha-pend-pri {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ficha-pend-text {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    font-weight: 600;
}
.ficha-pend-estado {
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
    flex-shrink: 0;
}

/* === Conversaciones - Cards === */
.conv-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    margin-bottom: 16px;
    transition: border-color .2s;
}
.conv-search-bar:focus-within { border-color: var(--primary-light); }
.conv-search-bar i { color: var(--text-muted); font-size: .85rem; }
.conv-search-bar input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 0;
    font-size: .88rem;
    outline: none;
    color: var(--text-primary);
}
.conv-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.conv-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow .15s, border-color .15s;
}
.conv-card:hover { box-shadow: var(--shadow-md); }
.conv-card-open { border-color: var(--primary-light); }
.conv-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background .15s;
}
.conv-card-header:hover { background: var(--hover-bg); }
.conv-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.conv-card-info {
    flex: 1;
    min-width: 0;
}
.conv-card-name {
    font-weight: 700;
    font-size: .92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-card-preview {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}
.conv-card-meta {
    text-align: right;
    flex-shrink: 0;
}
.conv-card-date {
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-bottom: 4px;
}
.conv-card-badges {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.conv-badge {
    font-size: .68rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.conv-badge-ia {
    background: #8b5cf612;
    color: #7c3aed;
}
.conv-card-chevron {
    color: var(--text-muted);
    font-size: .8rem;
    flex-shrink: 0;
    padding-left: 6px;
}
/* Expanded body */
.conv-card-body {
    border-top: 1px solid var(--border-light);
    padding: 16px 18px;
    background: var(--bg-secondary);
}
.conv-card-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.conv-card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.conv-card-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.conv-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.conv-msg-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.conv-msg-in .conv-msg-indicator { background: #3b82f6; }
.conv-msg-out .conv-msg-indicator { background: #16a34a; }
.conv-msg-content {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.conv-msg-text {
    font-size: .82rem;
    color: var(--text-primary);
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.conv-msg-time {
    font-size: .68rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.conv-msg-ia {
    font-size: .6rem;
    padding: 1px 6px;
    border-radius: 6px;
    background: #8b5cf615;
    color: #7c3aed;
    font-weight: 700;
}
.conv-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

@media (max-width: 768px) {
    .conv-card-header { padding: 12px 14px; gap: 10px; }
    .conv-card-stats { gap: 10px; }
}

/* === Interacciones - Timeline === */
.inter-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.inter-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.inter-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.inter-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.inter-stat-info { min-width: 0; }
.inter-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}
.inter-stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.inter-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.inter-filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.inter-filter-group select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .82rem;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
}
.inter-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    transition: border-color .2s;
}
.inter-search-box:focus-within { border-color: var(--primary-light); }
.inter-search-box i { color: var(--text-muted); font-size: .85rem; }
.inter-search-box input {
    border: none;
    background: none;
    padding: 8px 0;
    font-size: .85rem;
    outline: none;
    width: 200px;
    color: var(--text-primary);
}
.inter-results-count {
    font-size: .78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}
.inter-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.inter-date-group { margin-bottom: 8px; }
.inter-date-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.inter-date-line { flex: 1; height: 1px; background: var(--border); }
.inter-date-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: capitalize;
}
.inter-timeline { padding-left: 8px; }
.inter-card {
    display: flex;
    gap: 14px;
    margin-bottom: 4px;
}
.inter-card-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.inter-card-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .78rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    z-index: 1;
}
.inter-card-line {
    width: 2px;
    flex: 1;
    background: var(--border);
    min-height: 12px;
}
.inter-card:last-child .inter-card-line { display: none; }
.inter-card-content {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    transition: box-shadow .15s;
    min-width: 0;
}
.inter-card-content:hover { box-shadow: var(--shadow-md); }
.inter-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.inter-card-name {
    font-weight: 700;
    font-size: .9rem;
    color: var(--text-primary);
}
.inter-card-time {
    font-size: .72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.inter-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.inter-tag {
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.inter-card-resumen {
    font-size: .84rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: 4px;
    white-space: pre-wrap;
}
/* Expanded card - full width, no timeline column */
.inter-card-expanded {
    background: var(--card-bg);
    border: 2px solid var(--primary-light);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.inter-card-exp-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    transition: background .15s;
}
.inter-card-exp-header:hover { background: var(--hover-bg); }
.inter-card-exp-header .inter-card-avatar {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.inter-card-detail {
    padding: 16px 18px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}
.inter-detail-summary {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-secondary);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}
.inter-detail-summary span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.inter-detail-section-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.inter-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    font-size: .82rem;
}
.inter-detail-row-icon {
    color: var(--text-muted);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.inter-detail-row-text {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    line-height: 1.4;
}
.inter-detail-row-meta {
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.inter-detail-chat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: var(--chat-bg);
    border-radius: 10px;
    border: 1px solid var(--border-light);
}

@media (max-width: 768px) {
    .inter-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .inter-filters { flex-direction: column; align-items: stretch; }
    .inter-search-box input { width: 100%; }
}

/* === Facturas === */
.factura-accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.factura-account-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.factura-account-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* === Responsive - Tablet (768px) === */
@media (max-width: 768px) {
    /* Layout */
    .menu-toggle { display: block; }
    .layout { flex-direction: column; position: relative; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        width: 260px;
        z-index: 40;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        height: auto;
    }
    .sidebar.open { transform: translateX(0); }
    .main { padding: 16px; max-width: 100%; }

    /* Header */
    .header { padding: 0 14px; height: 56px; }
    .header h1 { font-size: 1.05rem; }
    .header .user-name { display: none; }
    .header-right { gap: 6px; }
    .header-btn { width: 34px; height: 34px; font-size: .82rem; }

    /* Page headers */
    .contacts-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .contacts-header > div:last-child { width: 100%; }
    .page-title { font-size: 1.1rem; }
    .page-title i { width: 32px; height: 32px; font-size: 0.85rem; }

    /* Dashboard */
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }

    /* Cards */
    .card { padding: 16px; margin-bottom: 14px; }
    .contact-grid { grid-template-columns: 1fr; }
    .item-grid { grid-template-columns: 1fr; }

    /* Tables */
    table { font-size: 0.78rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table th, table td { padding: 8px 10px; white-space: nowrap; }

    /* Modal */
    .modal { width: 95vw; max-width: 95vw; border-radius: 14px; max-height: 90vh; }
    .modal-header { padding: 16px 18px 0; }
    .modal h3 { font-size: 1rem; }
    #modal-body { padding: 14px 18px; }
    .modal-actions { padding: 12px 18px; }

    /* Buttons row */
    .contact-actions { flex-wrap: wrap; gap: 6px; }
    .contact-actions-row { flex-wrap: wrap; }
    .btn { font-size: .82rem; padding: 8px 14px; }
    .btn-sm { font-size: .75rem; padding: 6px 10px; }

    /* Search */
    .search-box input { font-size: .85rem; }

    /* Toolbar */
    .contacts-toolbar { flex-direction: column; gap: 8px; }
    .toolbar { flex-wrap: wrap; gap: 8px; }

    /* Interacciones */
    .inter-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .inter-filters { flex-direction: column; align-items: stretch; }
    .inter-filter-group { flex-wrap: wrap; }
    .inter-search-box input { width: 100%; }
    .inter-card-content { padding: 12px 14px; }

    /* Ficha contacto */
    .ficha-header { flex-direction: column; text-align: center; gap: 10px; }
    .ficha-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .ficha-stat { padding: 8px 6px; }
    .ficha-stat-val { font-size: .95rem; }
    .ficha-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ficha-tab { white-space: nowrap; padding: 8px 12px; font-size: .78rem; }

    /* Conversaciones */
    .conv-card-header { padding: 12px 14px; gap: 10px; }
    .conv-card-avatar { width: 38px; height: 38px; font-size: .78rem; }

    /* Chat */
    .chat-container { grid-template-columns: 1fr; }
    .chat-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
    .chat-bubble { max-width: 85%; }

    /* Tour */
    .tour-dialog { width: 95vw; max-width: none; }
    .tour-header { padding: 18px 18px 14px; }
    .tour-body { padding: 16px 18px; max-height: 50vh; }
    .tour-footer { padding: 12px 18px; }

    /* Integraciones */
    .integ-grid { grid-template-columns: 1fr !important; }

    /* Bloqueo vencido */
    .bloqueo-vencido-bar { font-size: .82rem; padding: 10px 14px; }

    /* Plan cards */
    .plan-option { padding: 14px; }
    .plan-option-header { flex-direction: column; gap: 4px; }

    /* Usuarios admin */
    .inter-stat-card { padding: 10px 12px; }
    .inter-stat-icon { width: 36px; height: 36px; }
    .inter-stat-value { font-size: 1.1rem; }
}

/* === Responsive - Mobile (480px) === */
@media (max-width: 480px) {
    /* Layout */
    .main { padding: 10px; }
    .header { padding: 0 10px; height: 52px; }
    .header h1 { font-size: .95rem; gap: 6px; }
    .header-logo { width: 28px; height: 28px; }

    /* Dashboard */
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-card .number { font-size: 1.3rem; }
    .stat-card .stat-icon { width: 32px; height: 32px; font-size: .8rem; }
    .stat-card .stat-label { font-size: .68rem; }
    .dash-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .dash-chip { padding: 10px 6px; }
    .dash-chip-n { font-size: 1rem; }
    .dash-chip-l { font-size: .6rem; }

    /* Cards */
    .card { padding: 14px; border-radius: 12px; }
    .contact-grid { grid-template-columns: 1fr; }
    .item-grid { grid-template-columns: 1fr; }
    .contact-card { padding: 14px; }
    .contact-avatar { width: 40px; height: 40px; font-size: .8rem; }

    /* Page headers */
    .page-title { font-size: 1rem; }
    .page-title i { width: 30px; height: 30px; font-size: .8rem; }
    .page-subtitle { font-size: .78rem; }

    /* Buttons */
    .btn { font-size: .78rem; padding: 7px 12px; }
    .btn-sm { font-size: .72rem; padding: 5px 8px; }
    .action-btn { width: 28px; height: 28px; font-size: .7rem; }

    /* Tables - horizontal scroll with visual cue */
    table { font-size: .75rem; }
    table th, table td { padding: 6px 8px; }

    /* Modal */
    .modal { width: 98vw; max-width: 98vw; border-radius: 12px; }
    .modal-header { padding: 14px 16px 0; }
    .modal h3 { font-size: .95rem; }
    #modal-body { padding: 12px 16px; }
    .modal-actions { padding: 10px 16px; flex-direction: column; }
    .modal-actions .btn { width: 100%; text-align: center; }

    /* Interacciones */
    .inter-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .inter-card { gap: 10px; }
    .inter-card-avatar { width: 32px; height: 32px; font-size: .7rem; }
    .inter-card-name { font-size: .82rem; }
    .inter-tag { font-size: .65rem; padding: 2px 7px; }

    /* Ficha */
    .ficha-avatar { width: 48px; height: 48px; font-size: .95rem; }
    .ficha-name { font-size: 1rem; }
    .ficha-meta { font-size: .75rem; gap: 8px; }
    .ficha-stats { grid-template-columns: repeat(2, 1fr); }
    .ficha-chat { max-height: 40vh; padding: 10px; }
    .ficha-inter-row { padding: 8px; font-size: .78rem; }
    .ficha-tab { padding: 6px 10px; font-size: .75rem; }

    /* Conversaciones */
    .conv-card-name { font-size: .85rem; }
    .conv-card-preview { font-size: .75rem; }
    .conv-badge { font-size: .62rem; padding: 1px 6px; }

    /* Chat */
    .chat-bubble { max-width: 90%; font-size: .82rem; padding: 8px 12px; }
    .chat-input { padding: 9px 14px; font-size: .82rem; }
    .chat-send-btn { width: 36px; height: 36px; font-size: .8rem; }

    /* Tour */
    .tour-dialog { width: 98vw; }
    .tour-header h2 { font-size: 1rem; }
    .tour-body { font-size: .84rem; padding: 14px 16px; }
    .tour-footer { flex-direction: column; gap: 10px; }
    .tour-footer .tour-nav { width: 100%; justify-content: flex-end; }
    .tour-footer .tour-skip { width: 100%; text-align: center; }

    /* Selects y inputs */
    select, input, textarea { font-size: .85rem !important; }

    /* Filtros interacciones */
    .inter-filter-group select { width: 100%; }

    /* Banner vencido */
    .bloqueo-vencido-bar { flex-direction: column; font-size: .8rem; }
    .trial-banner { flex-direction: column; text-align: center; font-size: .82rem; }

    /* Sidebar overlay for mobile */
    .sidebar { width: 85vw; max-width: 280px; }
}

/* === Responsive - Small Mobile (360px) === */
@media (max-width: 360px) {
    .main { padding: 8px; }
    .card { padding: 12px; }
    .stats { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .ficha-stats { grid-template-columns: 1fr 1fr; }
    .inter-stats-grid { grid-template-columns: 1fr 1fr; }
    .modal-actions { gap: 6px; }
    .header h1 span { display: none; }
}

/* === API Documentation === */
.api-doc-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.api-doc-intro p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.api-doc-capabilities {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}
[data-theme="dark"] .api-doc-capabilities {
    background: rgba(59, 130, 246, 0.1);
}
.api-doc-capabilities ul {
    list-style: none;
    margin: 8px 0 4px 0;
    padding: 0;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.api-doc-capabilities li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
}
.api-doc-capabilities li i {
    color: #3b82f6;
    width: 16px;
    text-align: center;
}
.api-doc-capabilities small {
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}
.api-doc-auth {
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.api-doc-auth code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.api-doc-auth small {
    color: var(--text-muted);
}
.api-doc-endpoint {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.2s;
}
.api-doc-endpoint:hover {
    box-shadow: var(--shadow-md);
}
.api-doc-method-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.api-method {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}
.api-method.post { background: #3b82f6; }
.api-method.get { background: #10b981; }
.api-method.put { background: #f59e0b; }
.api-method.delete { background: #ef4444; }
.api-path {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 600;
}
.api-doc-desc {
    color: var(--text-secondary);
    font-size: 0.84rem;
    margin-bottom: 8px;
}
.api-doc-toggle {
    font-size: 0.82rem;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    font-weight: 500;
}
.api-doc-toggle:hover {
    color: var(--primary-light);
}
.api-doc-toggle i {
    transition: transform 0.2s;
    font-size: 0.7rem;
}
.api-doc-endpoint.expanded .api-doc-toggle i {
    transform: rotate(180deg);
}
.api-doc-details {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}
.api-doc-endpoint.expanded .api-doc-details {
    display: block;
}
.api-doc-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.api-doc-subtitle:first-child {
    margin-top: 0;
}
.api-doc-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px 16px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    margin-bottom: 4px;
}
[data-theme="dark"] .api-doc-code {
    background: #0f172a;
    border: 1px solid var(--border);
}
.api-doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.api-doc-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
.api-doc-table td:first-child {
    white-space: nowrap;
    width: 160px;
}
.api-doc-table td:first-child code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
}
.api-doc-table td:last-child {
    color: var(--text-secondary);
}
.api-required {
    color: #ef4444;
    font-weight: 700;
    font-size: 0.9rem;
}
.api-doc-example, .api-doc-errors {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}
.api-doc-example .api-doc-subtitle,
.api-doc-errors .api-doc-subtitle {
    margin-top: 0;
    margin-bottom: 12px;
}
.api-doc-errors .api-doc-table td:first-child code {
    font-weight: 700;
}
@media (max-width: 600px) {
    .api-doc-table td:first-child { width: auto; }
    .api-doc-code { font-size: 0.72rem; padding: 10px 12px; }
}

/* === Searchable Select === */
.ss-wrapper {
    position: relative;
    width: 100%;
}
.ss-display {
    width: 100%;
    padding: 11px 38px 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.ss-display::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-muted);
    pointer-events: none;
}
.ss-display:hover { border-color: var(--primary-light); }
.ss-display:focus, .ss-wrapper.open .ss-display {
    border-color: var(--primary-light);
    box-shadow: var(--focus-ring);
    background: var(--input-focus-bg);
}
.ss-display .ss-placeholder { color: var(--text-muted); }
.ss-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: .7rem;
    transition: transform .2s;
}
.ss-wrapper.open .ss-chevron { transform: translateY(-50%) rotate(180deg); }
.ss-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
    max-height: 280px;
    overflow: hidden;
    flex-direction: column;
}
.ss-wrapper.open .ss-dropdown { display: flex; }
.ss-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ss-search input {
    width: 100%;
    padding: 9px 12px 9px 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.84rem;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}
.ss-search input:focus {
    border-color: var(--primary-light);
    background: var(--input-focus-bg);
}
.ss-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .75rem;
    pointer-events: none;
}
.ss-options {
    overflow-y: auto;
    flex: 1;
}
.ss-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.86rem;
    color: var(--text-primary);
    transition: background .15s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ss-option:hover, .ss-option.highlighted { background: var(--hover-bg); }
.ss-option.selected {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}
.ss-option-sub {
    font-size: .75rem;
    color: var(--text-muted);
    margin-left: auto;
}
.ss-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: .84rem;
}
.modal .ss-display {
    margin-bottom: 4px;
}
.ayuda-func-body.collapsed {
    display: none;
}

/* === Banner de Prueba Gratuita === */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 8px;
    margin: 10px 20px 0;
    font-size: .88rem;
    font-weight: 500;
}
.trial-banner i {
    font-size: 1.1rem;
}
.trial-banner.trial-active {
    background: linear-gradient(135deg, #eef6ff, #dbeafe);
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.trial-banner.trial-expired {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.trial-upgrade-btn {
    margin-left: auto;
    background: var(--primary-gradient);
    color: #fff !important;
    padding: 5px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.trial-upgrade-btn:hover {
    opacity: .9;
}
@media (max-width: 600px) {
    .trial-banner {
        margin: 8px 10px 0;
        padding: 8px 12px;
        font-size: .8rem;
        flex-wrap: wrap;
    }
    .trial-upgrade-btn {
        margin-left: 0;
        margin-top: 6px;
        width: 100%;
        text-align: center;
    }
}

/* === Bloqueo por cuenta vencida === */
body.cuenta-vencida #main-content {
    position: relative;
}
body.cuenta-vencida #main-content::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.45);
    z-index: 50;
    pointer-events: all;
    backdrop-filter: blur(1px);
}
body.cuenta-vencida #main-content button,
body.cuenta-vencida #main-content input,
body.cuenta-vencida #main-content select,
body.cuenta-vencida #main-content textarea,
body.cuenta-vencida #main-content a.btn,
body.cuenta-vencida #main-content .btn,
body.cuenta-vencida #main-content [onclick],
body.cuenta-vencida #main-content form {
    pointer-events: none !important;
    opacity: 0.5 !important;
    user-select: none !important;
}
/* Permitir sidebar, header, perfil, logout, mi-plan */
body.cuenta-vencida #sidebar,
body.cuenta-vencida header,
body.cuenta-vencida #pago-banner,
body.cuenta-vencida #trial-banner {
    pointer-events: auto !important;
    opacity: 1 !important;
}
body.cuenta-vencida #sidebar a,
body.cuenta-vencida header button,
body.cuenta-vencida header a {
    pointer-events: auto !important;
    opacity: 1 !important;
}
/* Sección mi-plan no se bloquea */
body.cuenta-vencida #main-content[data-section-active="mi-plan"]::after {
    display: none;
}
body.cuenta-vencida #main-content[data-section-active="mi-plan"] button,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] input,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] select,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] textarea,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] a.btn,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] .btn,
body.cuenta-vencida #main-content[data-section-active="mi-plan"] [onclick],
body.cuenta-vencida #main-content[data-section-active="mi-plan"] form {
    pointer-events: auto !important;
    opacity: 1 !important;
    user-select: auto !important;
}
/* Banner flotante de bloqueo */
.bloqueo-vencido-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    padding: 12px 20px;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(220,38,38,0.3);
}
.bloqueo-vencido-bar a {
    background: #fff;
    color: #dc2626;
    padding: 6px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: .85rem;
    transition: background .2s;
}
.bloqueo-vencido-bar a:hover {
    background: #fee2e2;
}

/* === Tour de bienvenida === */
.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    z-index: 9998;
    transition: opacity .3s;
}
.tour-dialog {
    position: fixed;
    z-index: 9999;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    padding: 0;
    max-width: 520px;
    width: 92vw;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: tourSlideIn .35s ease;
    overflow: hidden;
}
@keyframes tourSlideIn {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
.tour-header {
    background: var(--primary-gradient, linear-gradient(135deg, #0f766e, #14b8a6));
    color: #fff;
    padding: 24px 28px 18px;
}
.tour-header h2 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 800;
}
.tour-header p {
    margin: 0;
    font-size: .85rem;
    opacity: .85;
}
.tour-step-indicator {
    display: flex;
    gap: 6px;
    margin-top: 14px;
}
.tour-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: all .3s;
}
.tour-step-dot.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}
.tour-step-dot.done {
    background: rgba(255,255,255,0.7);
}
.tour-body {
    padding: 24px 28px;
    max-height: 55vh;
    overflow-y: auto;
    font-size: .9rem;
    line-height: 1.65;
    color: var(--text-primary);
}
.tour-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tour-body h3 i {
    color: var(--primary);
}
.tour-body .tour-info-box {
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0;
    font-size: .84rem;
}
.tour-body .tour-info-box h4 {
    font-size: .85rem;
    font-weight: 700;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tour-body .tour-info-box ul {
    margin: 6px 0 0;
    padding-left: 18px;
}
.tour-body .tour-info-box li {
    margin-bottom: 4px;
}
.tour-body .tour-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: .82rem;
    color: #92400e;
}
.tour-body .tour-tip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: .82rem;
    color: #1e40af;
}
.tour-body code {
    background: var(--bg-secondary, #f1f5f9);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .82rem;
    font-family: monospace;
}
.tour-footer {
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border, #e2e8f0);
}
.tour-footer .tour-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: .82rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background .2s;
}
.tour-footer .tour-skip:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.tour-footer .tour-nav {
    display: flex;
    gap: 8px;
}
.tour-footer .tour-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    border: none;
    transition: all .2s;
}
.tour-footer .tour-btn-secondary {
    background: var(--hover-bg, #f1f5f9);
    color: var(--text-primary);
}
.tour-footer .tour-btn-secondary:hover {
    background: var(--border);
}
.tour-footer .tour-btn-primary {
    background: var(--primary-gradient);
    color: #fff;
}
.tour-footer .tour-btn-primary:hover {
    opacity: .9;
}
@media (max-width: 600px) {
    .tour-dialog { width: 96vw; max-width: none; }
    .tour-header { padding: 18px 20px 14px; }
    .tour-body { padding: 18px 20px; max-height: 50vh; }
    .tour-footer { padding: 14px 20px; }
}
