     :root {
        --primary: #2563eb;
        --primary-dark: #1d4ed8;
        --primary-light: #dbeafe;
        --accent: #10b981;
        --bg-body: #f8fafc;
        --bg-card-top: #eff6ff;
        --text-main: #1e293b;
        --text-muted: #64748b;
        --white: #ffffff;
      }

      body {
        margin: 0;
        padding: 0;
        min-height: 100vh;
        background-color: var(--bg-body);
        background-image:
          radial-gradient(
            circle at 10% 20%,
            rgba(37, 99, 235, 0.05) 0%,
            transparent 20%
          ),
          radial-gradient(
            circle at 90% 80%,
            rgba(16, 185, 129, 0.05) 0%,
            transparent 20%
          );
        font-family: "Plus Jakarta Sans", "Segoe UI", Roboto, sans-serif;
        color: var(--text-main);
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 10px;
      }

      .wrapper {
        width: 100%;
        max-width: 400px;
        display: flex;
        justify-content: center;
      }

      .card {
        width: 100%;
        background: linear-gradient(
          to bottom,
          var(--bg-card-top) 0%,
          var(--white) 35%
        );
        border-radius: 30px;
        box-shadow: 0 20px 50px rgba(37, 99, 235, 0.12);
        padding: 30px 24px;
        position: relative;
        overflow: hidden;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 20px;
      }

      .card-header {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
      }

      .date-display {
        font-size: 11px;
        color: var(--primary);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
      }

      .greeting-text {
        font-size: 20px;
        font-weight: 700;
        margin: 0;
        line-height: 1.3;
        color: var(--text-main);
      }

      .profile-section {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
      }

      .avatar {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        object-fit: cover;
        border: 3px solid var(--white);
        box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
        margin-bottom: 12px;
        background: #e2e8f0;
      }

      .doctor-name {
        font-size: 22px;
        font-weight: 700;
        margin: 0;
      }

      .doctor-role {
        font-size: 14px;
        color: var(--accent);
        font-weight: 600;
        margin: 4px 0 2px 0;
      }

      .doctor-id {
        font-size: 11px;
        color: var(--text-muted);
        margin: 0;
      }

      .internal-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin: 10px 0;
      }

      .stat-box {
        background: var(--white);
        padding: 15px;
        border-radius: 18px;
        text-align: center;
        border: 1px solid #f1f5f9;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.04);
        transition: transform 0.2s;
      }

      .stat-box:hover {
        transform: translateY(-2px);
        border-color: var(--primary-light);
      }

      .stat-num {
        font-size: 24px;
        font-weight: 800;
        color: var(--primary);
        display: block;
        margin-bottom: 2px;
      }

      .stat-box:nth-child(2) .stat-num {
        color: var(--accent);
      }

      .stat-text {
        font-size: 11px;
        color: var(--text-muted);
        font-weight: 500;
      }

      .action-area {
        margin-top: 5px;
      }

      .btn-main {
        width: 100%;
        background: var(--primary);
        color: var(--white);
        border: none;
        padding: 16px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        transition: all 0.2s;
        box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
        font-family: inherit;
      }

      .btn-main:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 12px 25px rgba(37, 99, 235, 0.4);
      }

      .btn-main:active {
        transform: translateY(0);
      }

      .btn-main svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
      }

      .btn-main:disabled {
        background: #94a3b8;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
      }

      .social-bar {
        display: flex;
        justify-content: flex-end;
        gap: 15px;
        margin-top: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f1f5f9;
      }

      .social-bar a {
        color: #94a3b8;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: all 0.2s;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: transparent;
      }

      .social-bar a:hover {
        color: var(--primary);
        background: var(--primary-light);
        transform: translateY(-2px);
      }

      .social-bar svg {
        width: 18px;
        height: 18px;
        fill: currentColor;
      }

      .card-footer {
        text-align: center;
        font-size: 10px;
        color: #94a3b8;
        margin-top: auto;
        padding-top: 10px;
        letter-spacing: 0.5px;
      }

      .login-logo {
        text-align: center;
        margin-bottom: 10px;
      }

      .login-logo h1 {
        font-size: 32px;
        color: var(--primary);
        margin: 0;
        font-weight: 800;
        letter-spacing: -1px;
      }

      .login-logo p {
        color: var(--text-muted);
        margin: 5px 0 0;
        font-size: 14px;
      }

      .form-group {
        margin-bottom: 15px;
      }

      .form-group label {
        display: block;
        font-size: 12px;
        color: #475569;
        margin-bottom: 6px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.3px;
      }

      .form-group input,
      .form-group textarea {
        width: 100%;
        padding: 14px 15px;
        border: 2px solid #e2e8f0;
        border-radius: 12px;
        font-family: inherit;
        font-size: 14px;
        box-sizing: border-box;
        outline: none;
        transition:
          border-color 0.2s,
          background-color 0.2s;
        background: #f8fafc;
        color: var(--text-main);
      }

      .form-group input:focus {
        border-color: var(--primary);
        background: var(--white);
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
      }

      .error-msg {
        color: #ef4444;
        font-size: 12px;
        text-align: center;
        margin-top: -10px;
        margin-bottom: 10px;
        display: none;
      }

      #loginSection {
        display: flex;
        width: 100%;
        max-width: 400px;
      }

      #dashboardSection {
        display: none;
      }

      .loading-spinner {
        border: 3px solid #e2e8f0;
        border-top: 3px solid var(--primary);
        border-radius: 50%;
        width: 20px;
        height: 20px;
        animation: spin 1s linear infinite;
        display: inline-block;
        margin-right: 10px;
        vertical-align: middle;
      }

      @keyframes spin {
        0% {
          transform: rotate(0deg);
        }

        100% {
          transform: rotate(360deg);
        }
      }

      /* --- MODALES --- */
      .modal-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(8px);
        z-index: 1000;
        justify-content: center;
        align-items: flex-start;
        padding: 15px;
        box-sizing: border-box;
        opacity: 0;
        transition: opacity 0.3s ease;
        overflow-y: auto;
      }

      .modal-overlay.active {
        display: flex;
        opacity: 1;
      }

      .modal-content {
        background: var(--white);
        /* <--- EL FONDO BLANCO QUE FALTABA */
        width: 100%;
        max-width: 550px;
        border-radius: 24px;
        padding: 30px;
        position: relative;
        box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2);
        transform: scale(0.95);
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        overflow-y: auto !important;
        max-height: 90vh;
        margin-top: 20px;
        margin-bottom: 20px;
        box-sizing: border-box;
      }

      .modal-overlay.active .modal-content {
        transform: scale(1);
      }

      .modal-header {
        margin-bottom: 20px;
        text-align: center;
      }

      .modal-header h2 {
        margin: 0;
        font-size: 20px;
        color: var(--text-main);
      }

      .modal-header p {
        margin: 5px 0 0;
        color: var(--text-muted);
        font-size: 13px;
      }

      .close-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #f1f5f9;
        border: none;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        cursor: pointer;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.2s;
        z-index: 10;
      }

      .close-btn:hover {
        background: #e2e8f0;
        color: var(--text-main);
      }

      .form-group textarea {
        resize: none;
        height: 80px;
      }

      .modal-actions {
        display: flex;
        gap: 10px;
        margin-top: 25px;
      }

      .btn-cancel {
        flex: 1;
        padding: 12px;
        background: #f1f5f9;
        border: none;
        border-radius: 12px;
        font-weight: 600;
        color: #64748b;
        cursor: pointer;
        font-family: inherit;
        transition: background 0.2s;
      }

      .btn-cancel:hover {
        background: #e2e8f0;
      }

      .btn-save {
        flex: 2;
        padding: 12px;
        background: var(--primary);
        border: none;
        border-radius: 12px;
        font-weight: 600;
        color: var(--white);
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        font-family: inherit;
        transition: all 0.2s;
      }

      .btn-save:hover {
        background: var(--primary-dark);
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
      }

      /* LETRAS MÁS PEQUEÑAS EN CELULAR */
      @media (max-width: 480px) {
        .modal-content {
          padding: 20px !important;
          border-radius: 18px !important;
          margin-top: 10px !important;
        }

        .modal-header h2 {
          font-size: 17px !important;
        }

        .form-group label {
          font-size: 10px !important;
          margin-bottom: 4px !important;
        }

        .form-group input,
        .form-group textarea {
          padding: 10px 12px !important;
          font-size: 12px !important;
          border-radius: 10px !important;
        }

        .form-group textarea {
          height: 70px !important;
        }

        .btn-cancel,
        .btn-save {
          padding: 10px !important;
          font-size: 13px !important;
        }
      }

      .receta-visor {
        width: 500px !important;
        height: 649px !important;
        /* Matemática exacta: 500px * 11 / 8.5 */
        max-width: none !important;
        aspect-ratio: unset !important;
        background-color: #ffffff;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 auto 20px auto;
        position: relative;
        overflow: hidden;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3) !important;
        background-size: 100% 100% !important;
        background-position: top left !important;
        background-repeat: no-repeat !important;
      }

      .campo-receta {
        position: absolute;
        color: #000000;
        font-family: "Times New Roman", Times, serif;
        font-size: 14px;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow: hidden;
        width: 200px;
      }

      /* PANEL ADMIN */
      .medico-admin-card {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 14px;
        transition: all 0.2s;
      }

      .medico-admin-card:hover {
        transform: translateY(-2px);
        border-color: var(--primary);
        box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
      }

      .ma-fila-superior {
        display: flex;
        align-items: center;
        gap: 14px;
      }

      .ma-avatar {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--white);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        background: #e2e8f0;
        flex-shrink: 0;
      }

      .ma-datos {
        flex: 1;
        min-width: 0;
      }

      .ma-datos h4 {
        margin: 0;
        font-size: 15px;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .ma-datos p {
        margin: 3px 0 0 0;
        font-size: 12px;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .ma-fila-botones {
        display: flex;
        gap: 6px;
        align-items: center;
      }

      .ma-fila-botones .spacer {
        flex: 1;
      }

      .ma-fila-badges {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }

      .ma-badge {
        font-size: 10px;
        color: #64748b;
        background: #f1f5f9;
        padding: 3px 10px;
        border-radius: 6px;
        white-space: nowrap;
      }

      .ma-badge.vigente {
        color: #10b981;
        background: rgba(16, 185, 129, 0.1);
        font-weight: 600;
      }

      .ma-badge.por-vencer {
        color: #f59e0b;
        background: rgba(245, 158, 11, 0.1);
        font-weight: 600;
      }

      .ma-badge.vencido {
        color: #ef4444;
        background: rgba(239, 68, 68, 0.1);
        font-weight: 600;
      }

      .btn-sm {
        padding: 6px 12px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 11px;
        font-weight: 600;
        color: var(--white);
        transition: 0.2s;
        font-family: inherit;
        flex-shrink: 0;
      }

      .btn-sm:hover {
        transform: translateY(-1px);
      }

      .btn-plan-basico {
        background: #f59e0b;
      }

      .btn-plan-pro {
        background: var(--primary);
      }

      .btn-config {
        background: #64748b;
      }

      .meta-contenedor {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 14px 18px;
        margin-bottom: 18px;
      }

      .meta-texto {
        font-size: 13px;
        color: var(--text-muted);
        font-weight: 500;
      }

      .meta-numero {
        font-size: 28px;
        font-weight: 800;
        color: var(--primary);
        line-height: 1;
      }

      .meta-separador {
        font-size: 16px;
        color: #cbd5e1;
        font-weight: 400;
        margin: 0 4px;
      }

      .meta-total {
        font-size: 14px;
        color: #94a3b8;
        font-weight: 600;
      }

      .meta-barra {
        width: 100%;
        height: 6px;
        background: #e2e8f0;
        border-radius: 3px;
        margin-top: 10px;
        overflow: hidden;
      }

      .meta-barra-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--primary), var(--accent));
        border-radius: 3px;
        transition: width 0.6s ease;
      }

      /* BOTON BLOQUEADO (NO ES DEL PANEL ADMIN, PERO VA AQUÍ) */
      .btn-locked {
        width: 100%;
        background: #f1f5f9;
        color: #94a3b8;
        border: 2px dashed #cbd5e1;
        padding: 16px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 16px;
        cursor: not-allowed;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-family: inherit;
        transition: all 0.2s;
      }

      .btn-locked:hover {
        background: #e2e8f0;
        transform: none;
      }

      /* PACIENTES */
      .paciente-card {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: all 0.2s;
      }

      .paciente-card:hover {
        border-color: var(--primary);
        background: #eff6ff;
        transform: translateX(5px);
      }

      .paciente-info h4 {
        margin: 0;
        font-size: 15px;
        color: var(--text-main);
      }

      .paciente-info p {
        margin: 3px 0 0;
        font-size: 12px;
        color: var(--text-muted);
      }

      .paciente-acciones {
        display: flex;
        gap: 8px;
      }

      .btn-icon {
        background: #f1f5f9;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: 0.2s;
        color: var(--text-muted);
      }

      .btn-icon:hover {
        background: var(--primary-light);
        color: var(--primary);
      }

      .btn-icon.delete:hover {
        background: #fee2e2;
        color: #ef4444;
      }

      .tipo-pac-btn {
        flex: 1;
        padding: 12px !important;
        font-size: 13px !important;
        opacity: 0.5;
        background: #f1f5f9 !important;
        color: #64748b !important;
        box-shadow: none !important;
      }

      .tipo-pac-btn.active {
        opacity: 1;
        background: var(--primary) !important;
        color: white !important;
      }

      .btn-save[style*="ef4444"]:hover:not(:disabled) {
    background: #dc2626 !important;
      }

      .btn-pase {
  background: #006455 !important;
  box-shadow: 0 8px 20px rgba(0, 100, 85, 0.3) !important;
}
.btn-pase:hover {
  background: #004d40 !important;
  box-shadow: 0 12px 25px rgba(0, 100, 85, 0.4) !important;
}



/* Contenedor que agrupa las dos tarjetas pequeñas */
/* Contenedor que agrupa las dos tarjetas pequeñas */
.login-container {
    display: flex;
    gap: 25px; 
    width: 100%;
    max-width: 820px; 
    padding: 0;
    height: 95vh; /* Ocupa el 95% de la pantalla para asegurar que no haga scroll */
    max-height: 750px; /* Límite máximo de altura en px */
}

/* La tarjeta de login vuelve a su tamaño original chiquito */
#loginSection {
    flex: 0 0 400px; 
    max-width: 400px;
    border-radius: 30px;
    padding: 20px 24px !important; /* <--- LO HACE MÁS CHICO ARRIBA/ABAJO */
    gap: 12px !important; /* <--- ACERCA LOS ELEMENTOS */
}

/* La tarjeta promo se adapta al espacio sobrante con el mismo estilo */
/* La tarjeta promo se adapta al espacio sobrante con el mismo estilo */
.promo-section {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 25px 25px; /* <--- LO HACE MÁS CHICO ARRIBA/ABAJO */
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 30px; 
    box-shadow: 0 20px 50px rgba(37, 99, 235, 0.12); 
    position: relative;
    overflow: hidden;
}

.promo-section::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.promo-section h2 { font-size: 22px; margin-bottom: 15px; line-height: 1.2; font-weight: 800; } /* <--- TÍTULO MÁS PEQUEÑO */
.promo-benefits { list-style: none; margin-bottom: 15px; } /* <--- ACERCA LA LISTA AL BOTÓN */
.promo-benefits li { margin-bottom: 8px; font-size: 13px; display: flex; align-items: flex-start; line-height: 1.4; gap: 0; } 
.promo-benefits li i { flex-shrink: 0; margin-top: 3px; }
.promo-benefits li span { flex: 1; text-align: justify; }
.promo-benefits li i { color: var(--primary-light); margin-right: 8px; margin-top: 2px; font-size: 12px; } /* <--- ÍCONOS MÁS CHICOS */

.promo-whatsapp { display: flex; align-items: center; gap: 12px; }
.promo-whatsapp p { font-size: 14px; font-weight: 600; }

.btn-wa-circle {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; background-color: #25D366; color: white; /* <--- CÍRCULO WA MÁS PEQUEÑO */
    text-decoration: none; border-radius: 50%; font-size: 20px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4); transition: all 0.3s ease;
}
.btn-wa-circle:hover { background-color: #1ebe5d; transform: scale(1.1); }

.login-logo-img {
    max-width: 180px; /* Ajusta este número si quieres el logo más grande o pequeño */
    height: auto;
    margin-bottom: 0px;
}

/* ========================================
   PESTAÑAS DEL MODAL DE CONFIGURACIÓN
   ======================================== */
.config-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.config-tab:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.config-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.config-panel {
    display: none;
}

.config-panel.active {
    display: block;
}

/* Slug input focus */
#slugContainer:focus-within {
    border-color: var(--primary) !important;
}

#slugContainer.slug-error {
    border-color: var(--danger) !important;
}

#slugContainer.slug-ok {
    border-color: var(--accent) !important;
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 4px solid #2563eb;
}

.toast.error { border-left-color: #ef4444; }
.toast.success { border-left-color: #22c55e; }

.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-msg { font-size: 13px; color: #1e293b; line-height: 1.4; flex: 1; }

.toast-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* === RESPONSIVE (Movil: Efecto segunda página) === */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        max-width: 400px; /* En móvil todo vuelve a ser de 400px */
    }

    #loginSection {
        flex: none;
        width: 100%;
        min-height: 100vh; /* Ocupa toda la pantalla del celular */
        border-radius: 0 0 30px 30px; /* Redondea solo la parte de abajo */
    }

    .promo-section {
        min-height: 100vh; /* Obliga a hacer scroll como "página 2" */
        border-radius: 30px 25px 0 0;
    }
}

/* Campos del visor de historial - Responsivo */
.campo-historial {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 600px) {
    .campo-historial {
        flex-direction: column;
        gap: 2px;
        padding: 10px 0;
    }
}