* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta Hercules: solo azul oscuro y claro */
    --primary-color: #2E79B7;
    --primary-light: #60C1EE;
    --primary-dark: #286aa2;
    --secondary-color: #60C1EE;
    --secondary-dark: #1e5f8a;
    --success-color: #10b981;
    --danger-color: #286aa2;
    --warning-color: #f59e0b;
    --dark-bg: #1a0d1f;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

.brand-title-menu{
    color: #FFF;
    font-size: 15px;
    font-weight: bold;
}

/* Login Page - Split layout (brand + form) */
.login-page {
    font-family: 'Outfit', system-ui, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--dark-bg, #0f172a);
    color: var(--text-primary);
}

/* Skip link accesibilidad */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    transition: top 0.3s;
}
.skip-link:focus {
    top: 1rem;
}

/* Layout: dos columnas */
.login-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    width: 100%;
}
@media (max-width: 1024px) {
    .login-layout {
        grid-template-columns: 1fr;
    }
}

/* Panel izquierdo: branding */
.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    background: linear-gradient(
        135deg,
        var(--primary-dark) 0%,
        var(--primary-color) 50%,
        var(--secondary-color) 100%
    );
    overflow: hidden;
}
@media (max-width: 1024px) {
    .brand-panel {
        min-height: 35vh;
        padding: 2rem;
    }
}

.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 40%);
    pointer-events: none;
}

.mesh-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: meshFloat 20s ease-in-out infinite;
}
@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-10px, 10px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(10px, 5px); }
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: orbFloat 8s ease-in-out infinite;
}
.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.15);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}
.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--primary-light);
    bottom: -50px;
    right: -50px;
    animation-delay: -3s;
    opacity: 0.3;
}
.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--secondary-color);
    top: 50%;
    left: 60%;
    animation-delay: -5s;
    opacity: 0.25;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.brand-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 500px;
}

.brand-panel .brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary-color) 50%, var(--primary-light) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 36px;
    margin-bottom: 2rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: logoEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: translateY(30px);
    opacity: 0;
}
.brand-panel .brand-logo-img {
    width: 190px;
    height: auto;
    max-height: 190px;
    object-fit: contain;
}
@keyframes logoEntrance {
    to { transform: translateY(0); opacity: 1; }
}

.brand-title {
    font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textReveal 0.8s ease-out 0.2s forwards;
    transform: translateY(20px);
    opacity: 0;
}
.brand-subtitle {
    font-size: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2.5rem;
    animation: textReveal 0.8s ease-out 0.4s forwards;
    transform: translateY(20px);
    opacity: 0;
}
@keyframes textReveal {
    to { transform: translateY(0); opacity: 1; }
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    animation: textReveal 0.8s ease-out 0.6s forwards;
    transform: translateY(20px);
    opacity: 0;
}
.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    transition: 0.25s ease;
}
.feature-pill:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}
.feature-pill i {
    font-size: 0.875rem;
    opacity: 0.9;
}
@media (max-width: 1024px) {
    .brand-panel .brand-logo { width: 160px; height: 160px; margin-bottom: 1.5rem; }
    .brand-panel .brand-logo-img { max-height: 100px; width: 100px; }
    .brand-title { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); }
    .feature-pills { display: none; }
}

/* Panel derecho: formulario */
.form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: var(--dark-bg, #0f172a);
    position: relative;
    overflow: hidden;
}
/* Burbujas suaves de fondo */
.form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(46, 121, 183, 0.08) 0%, transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(96, 193, 238, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(46, 121, 183, 0.04) 0%, transparent 45%),
        radial-gradient(circle at 70% 25%, rgba(96, 193, 238, 0.05) 0%, transparent 30%),
        radial-gradient(circle at 25% 70%, rgba(46, 121, 183, 0.06) 0%, transparent 32%);
    pointer-events: none;
}
.form-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse 120px 120px at 10% 15%, rgba(255, 255, 255, 0.03) 0%, transparent 100%),
        radial-gradient(ellipse 80px 80px at 90% 85%, rgba(255, 255, 255, 0.02) 0%, transparent 100%),
        radial-gradient(ellipse 100px 100px at 50% 90%, rgba(46, 121, 183, 0.04) 0%, transparent 100%);
    pointer-events: none;
}

.form-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 10;
}

.form-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.form-header-brand {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.form-header h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    font-weight: 700;
    color: var(--light-bg);
    margin-bottom: 0.5rem;
}
.form-header p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.login-card {
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-card .form-group {
    margin-bottom: 1.5rem;
}
.login-card .form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-200, #e2e8f0);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.login-card .input-wrapper {
    position: relative;
}
.login-card .form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--light-bg);
    transition: 0.25s;
    outline: none;
}
.login-card .form-input::placeholder {
    color: var(--text-secondary);
}
.login-card .form-input:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
}
.login-card .form-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(46, 121, 183, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-card .input-wrapper:has(.password-toggle) .form-input {
    padding-right: 3rem;
}
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: 0.15s;
}
.password-toggle:hover {
    color: var(--slate-200, #e2e8f0);
}

/* Error container (login) */
.login-card .error-container {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    animation: shakeError 0.5s ease-in-out;
}
.login-card .error-container.show {
    display: flex;
}
.login-card .error-container i {
    color: #ef4444;
    font-size: 1.25rem;
}
.login-card .error-container span {
    font-size: 0.875rem;
    color: #fca5a5;
}
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* Botón submit (login) */
.login-card .btn-submit {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: 0.25s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(46, 121, 183, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.login-card .btn-submit .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.login-card .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(46, 121, 183, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.login-card .btn-submit:active {
    transform: translateY(0);
}
.login-card .btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
.login-card .btn-submit:hover i {
    transform: translateX(4px);
}
.login-card .btn-submit i {
    transition: transform 0.3s;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}
.divider span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: 100px;
    font-size: 0.75rem;
    color: #86efac;
}
.security-badge i {
    font-size: 0.75rem;
}

.form-footer {
    text-align: center;
    margin-top: 2rem;
}
.form-footer p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .login-card {
        padding: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-layout *,
    .login-layout *::before,
    .login-layout *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
.login-page :focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.1);
}

.form-group textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--primary-dark);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* App Layout + Sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.navbar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: white;
    padding: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    width: 280px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 1000;
    height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
}

.nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px 0 12px 0;
    min-height: 0;
}

.nav-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.nav-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.nav-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Usuario logueado + puntico verde */
.nav-user-wrap {
    position: relative;
}
.nav-user-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    max-width: 100%;
    min-width: 0;
}
.nav-user-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}
.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.nav-user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
    flex-shrink: 0;
    animation: nav-dot-pulse 2s ease-in-out infinite;
}
@keyframes nav-dot-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
}
.nav-user-name {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-user-chevron {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}
.nav-user-wrap.open .nav-user-chevron {
    transform: rotate(180deg);
}
.nav-user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    top: auto;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    z-index: 1100;
    overflow: hidden;
}
.nav-user-dropdown[hidden] {
    display: none !important;
}
.nav-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}
.nav-user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}
.nav-user-dropdown-item i {
    width: 18px;
    opacity: 0.9;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.4);
    flex-shrink: 0;
}

.brand-icon.brand-logo-img {
    width: 80px;
    height: 56px;
    padding: 6px;
    background: transparent;
    box-shadow: none;
}

.brand-logo-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.65;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-toggle.sidebar-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.sidebar-toggle.sidebar-hamburger:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section-bottom {
    margin-top: auto;
    padding-top: 12px;
    margin-bottom: 12px;
    padding-bottom: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.nav-logout-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    width: 100%;
    justify-content: center;
}

.nav-logout-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-logout-link i {
    font-size: 14px;
    opacity: 0.9;
}

.nav-section-bottom .nav-user-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: default;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.4);
    padding: 12px 12px 6px 12px;
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    margin-bottom: 0;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.nav-link-text {
    flex: 1;
    line-height: 1.4;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(6px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-link:hover .nav-link-icon {
    transform: scale(1.12);
}

.nav-link:active {
    transform: translateX(4px);
}

.nav-link.active {
    color: white;
    background: linear-gradient(135deg, rgba(46, 121, 183, 0.2) 0%, rgba(96, 193, 238, 0.2) 100%);
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.2);
    border: 1px solid rgba(46, 121, 183, 0.3);
}

.nav-link.active::before {
    height: 60%;
}

.nav-link.active .nav-link-icon {
    color: var(--primary-color);
    transform: scale(1.15);
}

.nav-link-danger {
    color: rgba(40, 106, 162, 0.95);
}

.nav-link-danger:hover {
    background: rgba(40, 106, 162, 0.12);
    color: var(--primary-dark);
}

.nav-link-danger.active {
    background: rgba(40, 106, 162, 0.15);
    border-color: rgba(40, 106, 162, 0.3);
}

.nav-link-danger.active::before {
    background: linear-gradient(180deg, var(--primary-dark), #1e5f8a);
}

body.sidebar-collapsed .navbar {
    width: 80px;
    overflow-x: hidden;
}

body.sidebar-collapsed .nav-container {
    padding: 16px 0;
}

body.sidebar-collapsed .nav-header {
    padding: 0 12px 14px 12px;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
}

body.sidebar-collapsed .nav-header-row {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
}

body.sidebar-collapsed .nav-user-wrap {
    padding: 6px;
}
body.sidebar-collapsed .nav-user-name {
    display: none;
}
body.sidebar-collapsed .nav-logout-text {
    display: none;
}

body.sidebar-collapsed .nav-brand {
    justify-content: center;
    gap: 0;
}

body.sidebar-collapsed .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

body.sidebar-collapsed .brand-icon.brand-logo-img {
    width: 56px;
    height: 56px;
}

body.sidebar-collapsed .brand-logo-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px;
    margin: 0 8px;
    border-radius: 8px;
}

body.sidebar-collapsed .nav-link-text {
    display: none;
}

body.sidebar-collapsed .nav-link-icon {
    margin: 0;
    width: 24px;
    height: 24px;
    font-size: 18px;
}

body.sidebar-collapsed .nav-menu {
    padding: 0 8px;
    overflow-x: hidden;
}

body.sidebar-collapsed .nav-section {
    margin-bottom: 12px;
}

body.sidebar-collapsed .nav-section-bottom {
    margin-top: auto;
    padding-top: 16px;
    justify-content: center;
}

body.sidebar-collapsed .nav-section-bottom .nav-user-wrap {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle.sidebar-hamburger {
    display: flex !important;
    flex-shrink: 0;
}

/* Estilos para botones de iconos en historial */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    background: transparent;
}

.btn-icon-primary {
    color: var(--primary-color);
    background: rgba(46, 121, 183, 0.1);
}

.btn-icon-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.3);
}

.btn-icon-danger {
    color: var(--danger-color);
    background: rgba(40, 106, 162, 0.1);
}

.btn-icon-danger:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(40, 106, 162, 0.3);
}

/* Versión flotante en esquina inferior derecha */
/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    right: 16px;
    bottom: 60px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 121, 183, 0.6);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(46, 121, 183, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(46, 121, 183, 0.7);
    }
}

/* Chatbot Modal */
.chatbot-modal {
    position: fixed;
    right: 16px;
    bottom: 130px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-modal.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-clear,
.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 14px;
}

.chatbot-clear:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chatbot-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message-user .chatbot-avatar-small {
    background: var(--text-secondary);
}

.chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chatbot-message-user .chatbot-message-content {
    background: var(--primary-color);
    color: white;
}

.chatbot-message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.chatbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message-content li {
    margin: 4px 0;
    font-size: 13px;
}

.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--primary-color);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.app-version {
    position: fixed;
    right: 16px;
    bottom: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 50;
}

.app-version i {
    font-size: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 32px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card-clickable {
    cursor: pointer;
}
.stat-card-clickable:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.stat-icon-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

.stat-icon {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 28px;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Dashboard profesional */
.dashboard-header {
    margin-bottom: 28px;
}
.dashboard-subtitle {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
@media (min-width: 900px) {
    .dashboard-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1200px) {
    .dashboard-cards {
        grid-template-columns: repeat(6, 1fr);
    }
}

.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 768px) {
    .dashboard-charts {
        grid-template-columns: 1fr 1fr;
    }
}
.dashboard-chart-wide {
    grid-column: 1 / -1;
    padding-left: 0;
    padding-right: 0;
}
.dashboard-chart-wide .dashboard-chart-title {
    padding-left: 24px;
    padding-right: 24px;
}
.dashboard-chart-wide .dashboard-chart-wrap {
    width: 100%;
    max-width: 100%;
    padding: 0 8px 16px;
}
.dashboard-chart-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dashboard-chart-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}
.dashboard-chart-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dashboard-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-chart-title i {
    color: var(--primary-color);
}

.dashboard-chart-wrap {
    position: relative;
    height: 280px;
}
.dashboard-no-data {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    z-index: 1;
    background: rgba(255,255,255,0.8);
}
.dashboard-chart-wrap.dashboard-chart-mini {
    height: 120px;
    max-width: 160px;
    margin: 0 auto;
}

.dashboard-kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}
.dashboard-kpi-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 8px 0 16px;
}

/* Templates */
.templates-list {
    display: grid;
    gap: 20px;
}

.template-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.template-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.template-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.template-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: var(--success-color);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.template-actions {
    display: flex;
    gap: 8px;
}

/* Vista Editor de Plantilla (página completa) */
.template-editor-view {
    max-width: 100%;
    padding-bottom: 2rem;
}

.template-editor-header {
    margin-bottom: 1.5rem;
}

.template-editor-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: color 0.2s, transform 0.2s;
}

.template-editor-back:hover {
    color: var(--primary-dark);
    transform: translateX(-2px);
}

.template-editor-back i {
    font-size: 1rem;
}

.template-editor-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.template-editor-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}

.template-editor-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.template-editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.template-editor-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-editor-section-content {
    gap: 0.75rem;
}

.template-editor-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.template-editor-input {
    width: 100%;
    max-width: 480px;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.template-editor-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.12);
}

.template-editor-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.template-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.template-editor-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .template-editor-layout {
        grid-template-columns: 1fr;
    }
    .template-widgets-panel {
        order: -1;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    .template-widgets-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .template-widgets-title,
    .template-widgets-hint {
        width: 100%;
    }
}

.template-widgets-panel {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

.template-widgets-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-widgets-title i {
    color: var(--primary-color);
}

.template-widgets-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.template-widgets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-widget-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: grab;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.template-widget-item:hover {
    background: rgba(46, 121, 183, 0.06);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(46, 121, 183, 0.15);
}

.template-widget-item:active {
    cursor: grabbing;
}

.template-widget-item i {
    color: var(--primary-color);
    width: 1.25rem;
    text-align: center;
}

.template-editor-main {
    min-width: 0;
}

.template-editor-dropzone.drag-over {
    outline: 2px dashed var(--primary-color);
    outline-offset: -2px;
    background: rgba(46, 121, 183, 0.04);
}

.template-editor-preview-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    background: var(--light-bg);
    min-height: 420px;
    max-height: 70vh;
    overflow-y: auto;
}

.template-editor-preview-inner {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 360px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.template-editor-editor-wrap {
    height: 480px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

.template-editor-quill {
    height: 100%;
}

.template-editor-html-wrap {
    height: 480px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.template-editor-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-editor-help code {
    background: rgba(46, 121, 183, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8125rem;
}

.template-editor-section-options {
    padding-top: 0.5rem;
}

.template-editor-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
}

.template-editor-checkbox-label input {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary-color);
}

.template-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.template-editor-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .template-editor-card {
        padding: 1.25rem;
    }
    .template-editor-title {
        font-size: 1.5rem;
    }
    .template-editor-editor-wrap,
    .template-editor-html-wrap {
        height: 380px;
    }
}

/* ========== Agregar clientes nuevos (vista espectacular) ========== */
#add-clients-page {
    padding-bottom: 2rem;
}

.add-clients-hero {
    position: relative;
    padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
    margin: -1rem -1.5rem 2rem -1.5rem;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    isolation: isolate;
}
.add-clients-hero-compact {
    padding: clamp(0.875rem, 2vw, 1.25rem) 1.5rem;
    margin: -1rem -1.5rem 1.25rem -1.5rem;
    border-radius: 0 0 16px 16px;
}
.add-clients-hero-compact .add-clients-hero-icon-wrap {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.5rem;
    border-radius: 12px;
}
.add-clients-hero-compact .add-clients-hero-icon-wrap i {
    font-size: 1.2rem;
}
.add-clients-hero-compact .add-clients-hero-title {
    font-size: clamp(1.15rem, 2.5vw, 1.4rem);
    font-weight: 700;
    margin: 0 0 0.25rem;
}
.add-clients-hero-compact .add-clients-hero-subtitle {
    font-size: 0.8125rem;
    opacity: 0.92;
}
.add-clients-hero-compact .add-clients-orb-1 {
    width: 160px;
    height: 160px;
    top: -40px;
    right: -40px;
}
.add-clients-hero-compact .add-clients-orb-2 {
    width: 120px;
    height: 120px;
    bottom: -30px;
    left: -30px;
}

.add-clients-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 45%, var(--secondary-color) 100%);
    z-index: 0;
}

.add-clients-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: addClientsOrb 10s ease-in-out infinite;
}
.add-clients-orb-1 {
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.2);
    top: -80px;
    right: -80px;
}
.add-clients-orb-2 {
    width: 240px;
    height: 240px;
    background: var(--primary-light);
    bottom: -60px;
    left: -60px;
    animation-delay: -4s;
    opacity: 0.3;
}
@keyframes addClientsOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.05); }
}

.add-clients-mesh {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: addClientsMesh 25s linear infinite;
}
@keyframes addClientsMesh {
    0% { transform: translate(0, 0); }
    100% { transform: translate(48px, 48px); }
}

.add-clients-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}

.add-clients-hero-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: addClientsIconIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.add-clients-hero-icon-wrap i {
    font-size: 2rem;
    color: #fff;
}
@keyframes addClientsIconIn {
    from { opacity: 0; transform: scale(0.8) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.add-clients-hero-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    animation: addClientsTextIn 0.5s ease-out 0.15s both;
}
.add-clients-hero-subtitle {
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.5;
    animation: addClientsTextIn 0.5s ease-out 0.25s both;
}
@keyframes addClientsTextIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.add-clients-card {
    max-width: 720px;
    margin: 0 auto;
}

.add-clients-card-inner {
    background: linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.88) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(46, 121, 183, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.add-clients-card-inner:hover {
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(46, 121, 183, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.add-clients-step {
    margin-bottom: 1.5rem;
}

.add-clients-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.add-clients-label i {
    color: var(--primary-color);
    font-size: 1rem;
}

.add-clients-select {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.75rem;
}
.add-clients-select:hover {
    border-color: var(--primary-light);
}
.add-clients-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(46, 121, 183, 0.15);
}

.add-clients-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
}

.add-clients-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0 1rem;
}
.add-clients-divider::before,
.add-clients-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}
.add-clients-divider span {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-clients-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.add-clients-form-fields-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}
@media (max-width: 640px) {
    .add-clients-form-fields-cols {
        grid-template-columns: 1fr;
    }
}
.add-clients-form-fields-cols .add-clients-field-full {
    grid-column: 1 / -1;
}

.add-clients-form-fields .form-group {
    margin-bottom: 0;
}
.add-clients-form-fields label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}
.add-clients-form-fields .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.add-clients-form-fields .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.12);
}

.add-clients-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.add-clients-btn-submit {
    min-width: 160px;
}
.add-clients-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.add-clients-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.add-clients-empty-state.hidden {
    display: none;
}
.add-clients-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(46, 121, 183, 0.08);
    border-radius: 16px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.add-clients-form-wrap[hidden] {
    display: none !important;
}
.add-clients-form-wrap:not([hidden]) {
    display: block;
    animation: addClientsFormIn 0.4s ease-out;
}
@keyframes addClientsFormIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Formulario clientes: grupos, hints y errores */
.add-clients-field-group {
    margin-bottom: 1.25rem;
}
.add-clients-field-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 0.375rem;
}
.add-clients-field-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin-top: 0.25rem;
    margin-bottom: 0;
}
.add-clients-field-error {
    display: block;
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
    min-height: 1.25em;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.add-clients-field-error.visible {
    opacity: 1;
}
.add-clients-input.is-invalid,
.add-clients-tel-prefix.is-invalid,
.add-clients-tel-numero.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}
.add-clients-input.is-valid,
.add-clients-tel-prefix.is-valid,
.add-clients-tel-numero.is-valid {
    border-color: #16a34a;
}
.add-clients-input:focus.is-invalid {
    border-color: #dc2626;
    outline: none;
}

/* Fila teléfono Venezuela: prefijo + 7 dígitos */
.add-clients-tel-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.75rem;
    align-items: start;
}
@media (max-width: 480px) {
    .add-clients-tel-row {
        grid-template-columns: 1fr;
    }
}
.add-clients-tel-prefix,
.add-clients-tel-numero {
    width: 100%;
}

/* Send Container */
.send-container {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 32px;
    background: var(--light-bg);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    padding: 14px 28px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn i {
    font-size: 16px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(46, 121, 183, 0.1);
}

.tab-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.3);
}

.tab-content {
    display: none;
    animation: fadeInContent 0.3s ease;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

.send-form {
    max-width: 700px;
    margin: 0 auto;
}

.send-form .form-group {
    margin-bottom: 24px;
}

.send-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.send-form input[type="text"],
.send-form input[type="email"],
.send-form select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.send-form input[type="text"]:focus,
.send-form input[type="email"]:focus,
.send-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.1);
}

.send-form small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.send-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    background: var(--light-bg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-form input[type="file"]:hover {
    border-color: var(--primary-color);
    background: rgba(46, 121, 183, 0.05);
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.data-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.data-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    background: white;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--light-bg);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Estilos específicos para tabla de actividades */
.activity-table {
    border-radius: 12px;
    overflow: hidden;
}

.activity-row {
    border-left: 4px solid transparent;
}

.activity-row:hover {
    border-left-color: var(--primary-color);
}

.activity-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-badge-create {
    background: #d1fae5;
    color: #065f46;
}

.activity-badge-update {
    background: #dbeafe;
    color: #1e40af;
}

.activity-badge-delete {
    background: #dbeafe;
    color: #1e40af;
}

.activity-badge-send {
    background: #fef3c7;
    color: #92400e;
}

.activity-badge-default {
    background: #e5e7eb;
    color: #374151;
}

.data-table tbody tr:hover {
    background-color: var(--light-bg);
}

/* Tabla "Gestionar clientes": celdas largas con ellipsis y tooltip al pasar el cursor */
#users-table-container .data-table {
    table-layout: fixed;
}
#users-table-container .data-table .cell-text-ellipsis {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#users-table-container .data-table th {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tabla Historial de Envíos: una línea con ellipsis y tooltip */
#history-table-container .data-table {
    table-layout: fixed;
}
#history-table-container .data-table .cell-text-ellipsis {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#history-table-container .data-table th {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

/* Modal correos no entregados */
.no-entregados-intro {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.motivo-no-entrega {
    max-width: 280px;
    word-break: break-word;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.no-entregados-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}
#no-entregados-pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}
#no-entregados-pagination button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.status-enviado {
    background-color: #d1fae5;
    color: #065f46;
}

.status-rebotado {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-error {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-pendiente {
    background-color: #fef3c7;
    color: #92400e;
}

.history-filters {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 12px;
    background: var(--light-bg, #f5f7fa);
    border: 1px solid var(--border-color);
}

.history-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}

.history-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.history-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.history-filter-group .form-control {
    min-width: 0;
}

.history-filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.history-filter-actions .btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .history-filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    .history-filter-group {
        min-width: 0;
    }
    .history-filter-actions {
        justify-content: flex-start;
    }
}

.history-controls {
    margin-bottom: 0;
}

/* Modal previsualización Excel */
.excel-preview-header {
    margin-bottom: 20px;
}
.excel-preview-stats {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
}
.excel-preview-stats h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.excel-preview-note {
    margin: 8px 0 0 0;
    opacity: 0.95;
    font-size: 0.9rem;
}
.excel-preview-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.excel-preview-columns span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.excel-preview-columns i {
    color: var(--primary-color);
}
.excel-preview-table-wrap {
    max-height: 420px;
    overflow: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
}
.excel-preview-table {
    width: 100%;
    border-collapse: collapse;
}
.excel-preview-table thead {
    position: sticky;
    top: 0;
    background: var(--light-bg);
    z-index: 1;
    box-shadow: 0 1px 0 var(--border-color);
}
.excel-preview-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.excel-preview-table td {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}
.excel-preview-table tbody tr:hover {
    background: var(--light-bg);
}
.excel-preview-col-num {
    width: 56px;
    text-align: center;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Zona de carga de archivo Excel (custom, sin "Elegir archivo") */
.excel-upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 24px;
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    background: rgba(46, 121, 183, 0.06);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.excel-upload-zone:hover {
    border-color: var(--primary-dark);
    background: rgba(46, 121, 183, 0.1);
}
.excel-upload-zone:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.25);
}
.excel-upload-zone.has-file {
    border-style: solid;
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
}
.excel-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.excel-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    pointer-events: none;
}
.excel-upload-zone.has-file .excel-upload-placeholder {
    display: none;
}
.excel-upload-icon {
    font-size: 28px;
    opacity: 0.9;
}
.excel-upload-text {
    font-size: 15px;
    font-weight: 600;
}
.excel-upload-filename {
    display: none;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.excel-upload-zone.has-file .excel-upload-filename {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.excel-upload-zone.has-file .excel-upload-filename i {
    color: var(--success-color);
    font-size: 20px;
}

/* Página Programar Envíos: estructura y estilos */
.schedule-page .send-container.schedule-container {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.schedule-form-card,
.schedule-list-section {
    background: white;
    padding: 24px 28px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.schedule-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.schedule-section-title i {
    color: var(--primary-color);
    font-size: 20px;
}

.schedule-form-block {
    margin-bottom: 24px;
}

.schedule-form-block:last-of-type {
    margin-bottom: 0;
}

.schedule-block-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.schedule-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.schedule-datetime-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px !important;
    font-weight: 500;
    color: var(--text-primary);
}

.schedule-datetime-label i {
    color: var(--primary-color);
}

.schedule-datetime-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.schedule-datetime-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-hint i {
    margin-right: 4px;
}

.schedule-form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.schedule-origin-section {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
}

.schedule-origin-section .form-group {
    margin-bottom: 12px;
}

.schedule-origin-section .form-group:last-child {
    margin-bottom: 0;
}

.schedule-list-section .schedule-section-title {
    margin-bottom: 16px;
}

.schedule-table-wrap {
    margin-bottom: 16px;
    border-radius: 10px;
    overflow: hidden;
}

.history-controls label,
#users-management-container label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

#history-items-per-page,
#users-items-per-page {
    padding: 8px 12px;
    font-size: 14px;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 1000px;
    width: 95%;
}

/* Modal de consola con tamaño fijo */
#consoleModal .modal-content {
    height: 85vh;
    max-height: 85vh;
}

.modal-header {
    padding: 28px 32px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h2 i {
    font-size: 28px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
    line-height: 1;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: white;
}

/* Enviar correo individual: botón Buscar clientes */
.send-single-dest-wrap .send-single-dest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.send-single-dest-wrap .send-single-dest-header label {
    margin-bottom: 0;
}
.send-single-dest-wrap .btn-outline.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.send-single-dest-wrap .btn-outline.btn-sm:hover {
    background: rgba(46, 121, 183, 0.08);
}

/* Modal Buscar clientes */
.search-clients-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.search-clients-input-wrap {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.search-clients-input-wrap .search-clients-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
}
.search-clients-input-wrap .search-clients-input:focus {
    outline: none;
    border-color: var(--primary-color);
}
.search-clients-input-wrap .search-clients-btn {
    padding: 0.625rem 1rem;
    flex-shrink: 0;
}
.search-clients-results {
    min-height: 120px;
}
.search-clients-empty,
.search-clients-loading {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.search-clients-empty i,
.search-clients-loading i {
    display: block;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary-light);
}
.search-clients-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}
.search-clients-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.search-clients-item:hover {
    background: rgba(46, 121, 183, 0.06);
    border-color: var(--primary-light);
}
.search-clients-item-name {
    font-weight: 600;
    color: var(--text-primary);
}
.search-clients-item-detail {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.search-clients-no-results,
.search-clients-error {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.search-clients-error {
    color: var(--danger-color, #dc2626);
}

/* Modal body de consola con scroll */
#consoleModal .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* El scroll estará en el console-output */
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.error-message {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f3f4f6;
}

.pagination button.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(46, 121, 183, 0.3);
    font-weight: 600;
}

.pagination button.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 121, 183, 0.4);
}

/* Mejoras adicionales para el paginador */
.pagination button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 121, 183, 0.1);
}

.pagination button:active:not(:disabled) {
    transform: translateY(0);
}

/* Responsive para paginador */
@media (max-width: 768px) {
    .pagination {
        gap: 2px;
    }
    
    .pagination button {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .pagination span {
        padding: 0 4px;
        min-width: 24px;
        height: 36px;
    }
}

/* Responsive */
/* Consola de envío */
.console-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.console-stats > div {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

#console-output {
    background: #1a1a1a;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Editor WYSIWYG Styles */
#editor-container-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    resize: vertical;
    min-height: 380px;
    overflow: auto;
}

#editor-container {
    height: 100%;
}

#editor-container .ql-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    height: 100%;
    border: none;
    border-top: 1px solid var(--border-color);
}

#editor-container .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
    background: var(--light-bg);
    border-radius: 8px 8px 0 0;
}

#editor-container .ql-toolbar .ql-custom {
    border: none;
    cursor: pointer;
    display: inline-block;
    padding: 4px 8px;
    margin: 0 2px;
}

#editor-container .ql-toolbar .ql-custom:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

/* Fuentes en el editor (claves en minúsculas con guiones = whitelist Quill) */
#editor-container .ql-editor .ql-font-arial { font-family: Arial, sans-serif; }
#editor-container .ql-editor .ql-font-georgia { font-family: Georgia, serif; }
#editor-container .ql-editor .ql-font-verdana { font-family: Verdana, sans-serif; }
#editor-container .ql-editor .ql-font-tahoma { font-family: Tahoma, sans-serif; }
#editor-container .ql-editor .ql-font-trebuchet-ms { font-family: 'Trebuchet MS', sans-serif; }
#editor-container .ql-editor .ql-font-times-new-roman { font-family: 'Times New Roman', serif; }
#editor-container .ql-editor .ql-font-courier-new { font-family: 'Courier New', monospace; }
#editor-container .ql-editor .ql-font-lucida-console { font-family: 'Lucida Console', monospace; }
#editor-container .ql-editor .ql-font-palatino-linotype { font-family: 'Palatino Linotype', serif; }
#editor-container .ql-editor .ql-font-comic-sans-ms { font-family: 'Comic Sans MS', cursive; }
#editor-container .ql-editor .ql-font-impact { font-family: Impact, sans-serif; }
#editor-container .ql-editor .ql-font-segoe-ui { font-family: 'Segoe UI', sans-serif; }
#editor-container .ql-editor .ql-font-open-sans { font-family: 'Open Sans', sans-serif; }
#editor-container .ql-editor .ql-font-roboto { font-family: Roboto, sans-serif; }
#editor-container .ql-editor .ql-font-lato { font-family: Lato, sans-serif; }
#editor-container .ql-editor .ql-font-montserrat { font-family: Montserrat, sans-serif; }
#editor-container .ql-editor .ql-font-oswald { font-family: Oswald, sans-serif; }
#editor-container .ql-editor .ql-font-source-sans-pro { font-family: 'Source Sans Pro', sans-serif; }
/* Desplegable fuentes: quitar el "Sans Serif" que Quill pone por defecto en cada opción */
#editor-container .ql-toolbar .ql-font .ql-picker-item::before {
    content: none !important;
    font-family: inherit !important;
}
#editor-container .ql-toolbar .ql-font .ql-picker-label::before {
    font-family: inherit !important;
}
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value=""]::before { content: 'Predeterminado' !important; }
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="arial"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="arial"]::before { content: 'Arial' !important; font-family: Arial, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="georgia"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="georgia"]::before { content: 'Georgia' !important; font-family: Georgia, serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="verdana"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="verdana"]::before { content: 'Verdana' !important; font-family: Verdana, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="tahoma"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="tahoma"]::before { content: 'Tahoma' !important; font-family: Tahoma, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="trebuchet-ms"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="trebuchet-ms"]::before { content: 'Trebuchet MS' !important; font-family: 'Trebuchet MS', sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="times-new-roman"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="times-new-roman"]::before { content: 'Times New Roman' !important; font-family: 'Times New Roman', serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="courier-new"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="courier-new"]::before { content: 'Courier New' !important; font-family: 'Courier New', monospace; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="lucida-console"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="lucida-console"]::before { content: 'Lucida Console' !important; font-family: 'Lucida Console', monospace; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="palatino-linotype"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="palatino-linotype"]::before { content: 'Palatino Linotype' !important; font-family: 'Palatino Linotype', serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="comic-sans-ms"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="comic-sans-ms"]::before { content: 'Comic Sans MS' !important; font-family: 'Comic Sans MS', cursive; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="impact"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="impact"]::before { content: 'Impact' !important; font-family: Impact, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="segoe-ui"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="segoe-ui"]::before { content: 'Segoe UI' !important; font-family: 'Segoe UI', sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="open-sans"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="open-sans"]::before { content: 'Open Sans' !important; font-family: 'Open Sans', sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="roboto"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="roboto"]::before { content: 'Roboto' !important; font-family: Roboto, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="lato"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="lato"]::before { content: 'Lato' !important; font-family: Lato, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="montserrat"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="montserrat"]::before { content: 'Montserrat' !important; font-family: Montserrat, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="oswald"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="oswald"]::before { content: 'Oswald' !important; font-family: Oswald, sans-serif; }
#editor-container .ql-toolbar .ql-font .ql-picker-label[data-value="source-sans-pro"]::before,
#editor-container .ql-toolbar .ql-font .ql-picker-item[data-value="source-sans-pro"]::before { content: 'Source Sans Pro' !important; font-family: 'Source Sans Pro', sans-serif; }
/* Tamaño: una sola opción "Normal" (false) y el resto en px */
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="12px"] { font-size: 12px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="14px"] { font-size: 14px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="16px"] { font-size: 16px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="18px"] { font-size: 18px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="20px"] { font-size: 20px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="24px"] { font-size: 24px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="28px"] { font-size: 28px; }
#editor-container .ql-toolbar .ql-size .ql-picker-item[data-value="32px"] { font-size: 32px; }

#editor-container .ql-editor {
    min-height: 450px;
    padding: 20px;
}

#editor-container .ql-editor.ql-blank::before {
    font-style: normal;
    color: var(--text-secondary);
}

#template-content {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* Estilos para el editor de imágenes */
#image-editor-container {
    max-width: 100%;
    max-height: 500px;
    overflow: auto;
}

#image-editor-container img {
    max-width: 100%;
    display: block;
}

/* Estilos para Cropper */
.cropper-container {
    max-width: 100%;
}

.cropper-view-box {
    outline: 2px solid var(--primary-color);
    outline-offset: -1px;
}

.cropper-face {
    background-color: rgba(46, 121, 183, 0.1);
}

.cropper-line {
    background-color: var(--primary-color);
}

/* Modal Sesión Expirada - Diseño profesional */
#sessionExpiredModal .session-expired-content {
    max-width: 420px;
    width: 90%;
    text-align: center;
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.05);
    background: linear-gradient(160deg, #ffffff 0%, #f5f7fa 100%);
    animation: sessionExpiredIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sessionExpiredIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-16px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.session-expired-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e8eef4 0%, #dde4ec 100%);
    color: var(--text-secondary);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.8), 0 2px 8px rgba(0,0,0,0.06);
}

.session-expired-title {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.session-expired-text {
    margin: 0 0 28px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.session-expired-actions {
    display: flex;
    justify-content: center;
}

.session-expired-actions .btn-lg {
    min-width: 200px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Modal Configurar Botón (plantilla) */
.modal-content-sm {
    max-width: 440px;
}

.input-with-color {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-with-color input[type="color"] {
    width: 44px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.input-with-color .form-control {
    flex: 1;
}

.form-row { display: flex; gap: 16px; }
.form-row-2 { flex-wrap: wrap; }
.form-row-2 .form-group { flex: 1; min-width: 120px; }
.checkbox-group { margin-bottom: 4px; }
.checkbox-group .checkbox-label { font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }

/* Botón de plantilla en editor: clicable para editar */
a.template-editor-btn {
    cursor: pointer;
    outline-offset: 2px;
}
a.template-editor-btn:hover {
    filter: brightness(1.05);
}
a.template-editor-btn:focus-visible {
    outline: 2px solid var(--primary-color);
}

/* Elementos arrastrables en el editor */
.editor-draggable {
    cursor: grab;
}
.editor-draggable:active {
    cursor: grabbing;
}
.template-button-embed {
    display: block;
    margin: 8px 0;
}
.template-button-embed .template-btn-drag-handle {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    padding: 4px 6px;
    cursor: grab;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1;
    user-select: none;
    border-radius: 4px;
}
.template-button-embed .template-btn-drag-handle:hover {
    color: var(--primary-color);
    background: rgba(46, 121, 183, 0.1);
}
.template-button-embed .template-editor-btn {
    vertical-align: middle;
}

/* Estilos para la consola de envío */
#consoleModal .console-stats {
    flex-shrink: 0; /* No se encoge */
    margin-bottom: 20px;
}

#consoleModal #console-output {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1a1a1a;
}

#consoleModal #console-output::-webkit-scrollbar {
    width: 8px;
}

#consoleModal #console-output::-webkit-scrollbar-track {
    background: #1a1a1a;
}

#consoleModal #console-output::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

#consoleModal #console-output::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Estilos para imágenes interactivas en el editor */
.image-wrapper {
    display: inline-block;
    position: relative;
    margin: 5px;
}

.image-wrapper:hover {
    outline: 2px dashed var(--primary-color);
    outline-offset: 2px;
}

.image-delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
}

.image-delete-btn:hover {
    transform: scale(1.1);
    background: var(--secondary-dark);
}

.image-resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 1000;
    transition: transform 0.2s, background-color 0.2s;
}

.image-resize-handle:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.interactive-image {
    cursor: move;
    position: relative;
    max-width: 100%;
    height: auto;
}

/* Permitir que el editor muestre HTML con estilos inline */
#editor-container .ql-editor {
    overflow: visible;
}

#editor-container .ql-editor * {
    max-width: 100%;
}

#editor-container .ql-editor img {
    display: inline-block;
    vertical-align: middle;
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

.main-content-header-mobile {
    display: none;
}

.sidebar-toggle-mobile {
    display: none;
}

@media (max-width: 1024px) {
    .app-layout {
        position: relative;
    }

    .navbar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-open .navbar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-content-header-mobile {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        background: white;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .sidebar-toggle-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: var(--light-bg);
        color: var(--text-primary);
        border-radius: 10px;
        cursor: pointer;
        font-size: 18px;
        transition: background 0.2s ease, transform 0.15s ease;
    }
    .sidebar-toggle-mobile:hover {
        background: var(--border-color);
        transform: scale(1.05);
    }

    .main-content {
        padding: 20px 16px;
    }
    
    .nav-header {
        padding: 20px 16px 20px 16px;
    }
    
    .nav-menu {
        padding: 0 8px;
    }
}

@media (max-width: 768px) {
    .navbar {
        width: 260px;
    }
    
    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .brand-icon.brand-logo-img {
        width: 56px;
        height: 44px;
    }
    
    .brand-title {
        font-size: 16px;
    }
    
    .brand-subtitle {
        font-size: 10px;
    }
    
    .nav-link {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .nav-link-icon {
        width: 18px;
        height: 18px;
        font-size: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .console-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Pagination ellipsis */
.pagination span {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    min-width: 32px;
    height: 40px;
    justify-content: center;
}

/* Nav link icons */
.nav-link i {
    margin-right: 6px;
    font-size: 14px;
}

/* Animación para nuevas actividades */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pestañas Campañas WhatsApp */
.whatsapp-tab {
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.whatsapp-tab:hover {
    color: var(--text-primary);
}
.whatsapp-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.whatsapp-tab i {
    margin-right: 6px;
}
