* { box-sizing: border-box; }
body {
    background: #F3F4F6;
    font-family: sans-serif; 
    color: #1F2937;
    min-height: 100vh;
    margin: 0;
}

/* Fondo sutil con patrón de puntos */
.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
    background-image: radial-gradient(circle, #D1D5DB 0.8px, transparent 0.8px);
    background-size: 24px 24px;
}

/* Tarjetas */
.card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
    border-color: #D1D5DB;
}

/* Select estilizado (con flecha dorada) */
.select-styled {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23D4A843' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}
.select-styled:focus {
    border-color: #D4A843;
    box-shadow: 0 0 0 3px rgba(212,168,67,0.15);
}

/* Inputs y Textarea */
.input-styled {
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    color: #1F2937;
    border-radius: 8px;
    transition: all 0.2s;
}
.input-styled::placeholder { color: #9CA3AF; }
.input-styled:focus {
    outline: none;
    border-color: #D4A843;
    box-shadow: 0 0 0 3px rgba(212,168,67,0.15);
}

/* Botón Primario (Dorado) */
.btn-gold {
    background: linear-gradient(135deg, #D4A843 0%, #B8902A 100%);
    color: #FFFFFF;
    font-weight: 600;
    border-radius: 8px;
    padding: 12px 28px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(212,168,67,0.3);
    border: none;
    cursor: pointer;
}
.btn-gold:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212,168,67,0.45);
}
.btn-gold:active:not(:disabled) { transform: translateY(0); }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* Botón Secundario (Contorno) */
.btn-outline {
    background: #FFFFFF;
    color: #374151;
    font-weight: 500;
    border-radius: 8px;
    padding: 12px 28px;
    border: 1px solid #D1D5DB;
    transition: all 0.25s ease;
    cursor: pointer;
}
.btn-outline:hover:not(:disabled) {
    border-color: #D4A843;
    color: #D4A843;
    background: rgba(212,168,67,0.04);
}
.btn-outline:disabled { opacity: 0.35; cursor: not-allowed; }

/* Botón Pequeño */
.btn-sm { padding: 8px 16px; font-size: 0.8125rem; border-radius: 6px; }

/* Dropdown de búsqueda (Lista de clientes) */
.search-dropdown {
    position: fixed;
    z-index: 99999;
    max-height: 260px;
    overflow-y: auto;
    background: #FFFFFF;
    border: 2px solid #D4A843;
    border-top: 1px solid #D4A843;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    display: none;
}
.search-dropdown.open { display: block; }
.search-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #F3F4F6;
    transition: background 0.15s;
}
.search-item:hover { background: rgba(212,168,67,0.06); }
.search-item:last-child { border-bottom: none; }

/* Alertas (Toasts) */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid transparent;
}
.toast.exito { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.toast.error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.toast.info  { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.toast.out   { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from{opacity:0;transform:translateX(60px) scale(0.95)} to{opacity:1;transform:translateX(0) scale(1)} }
@keyframes toastOut { from{opacity:1;transform:translateX(0) scale(1)} to{opacity:0;transform:translateX(60px) scale(0.95)} }

/* Pantalla de Carga (Loading) */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 8888;
    background: rgba(243,244,246,0.85);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.active { display: flex; }
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #E5E7EB;
    border-top-color: #D4A843;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Animación de entrada */
.fade-up { opacity: 0; transform: translateY(20px); animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Tarjeta del cliente seleccionado */
.cliente-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 14px 16px;
}

/* Etiquetas de los campos */
.label {
    display: block;
    color: #6B7280;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Caja donde se muestra la liga generada */
.link-box {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #059669;
    word-break: break-all;
    user-select: all;
    line-height: 1.6;
}

/* Personalización del Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* Respetar preferencias de movimiento reducido en el sistema operativo */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}