/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilos para formulário de contrato */
.form-hint {
    display: block;
    font-size: 12px;
    color: #64748B;
    margin-top: 4px;
    font-style: italic;
}

.form-hint::before {
    content: "💡 ";
}

.required {
    color: var(--error-color);
    font-weight: 600;
}

.btn-action.btn-contract,
.action-btn.contract {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: white;
}

.btn-action.btn-contract:hover,
.action-btn.contract:hover {
    background: linear-gradient(135deg, var(--primary-green-dark), var(--primary-green));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

:root {
    --primary-green: #10b981;
    --primary-green-dark: #059669;
    --primary-green-light: #34d399;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============================================
   ESTILOS PARA PÁGINAS DE AUTENTICAÇÃO
   Design Futurista com Glassmorphism
   ============================================ */

body.auth-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background: 
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.15) 0%, transparent 60%),
        #0a1929;
    background-attachment: fixed;
}

/* Background com imagem - MAIS VIVO */
body.auth-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.9;
    z-index: 0;
    filter: brightness(1.15) saturate(1.3) contrast(1.1);
}

/* Overlay gradiente colorido */
body.auth-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.2) 0%, 
        rgba(59, 130, 246, 0.15) 25%,
        rgba(16, 185, 129, 0.18) 50%, 
        rgba(59, 130, 246, 0.12) 75%,
        rgba(16, 185, 129, 0.15) 100%);
    z-index: 1;
}

/* Container principal - Glassmorphism Futurista */
.auth-container {
    width: 100%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.25),
        0 4px 16px rgba(16, 185, 129, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    padding: 48px 40px;
    position: relative;
    z-index: 10;
    margin: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 40px);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Efeito de brilho no topo do container */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%);
    z-index: 1;
}

/* Esconder scrollbar mas manter funcionalidade */
.auth-container::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.auth-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Header com logo e título */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(16, 185, 129, 0.3);
    position: relative;
}

/* Logo circular com efeito futurista */
.auth-logo-round {
    width: 110px;
    height: 110px;
    margin: 0 auto 24px;
    display: block;
    border-radius: 50%;
    box-shadow: 
        0 8px 32px rgba(16, 185, 129, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.1),
        inset 0 2px 8px rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 8px;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

/* Anel brilhante ao redor do logo */
.auth-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, 
        rgba(16, 185, 129, 0.3) 0%,
        rgba(16, 185, 129, 0.1) 50%,
        transparent 70%);
    z-index: 1;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Subtítulo com gradiente harmonizado */
.auth-subtitle {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    text-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(16, 185, 129, 0.4);
    position: relative;
    z-index: 2;
}

.auth-header p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    margin: 0;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Formulário */
.auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: #ffffff;
    font-family: inherit;
    box-sizing: border-box;
    font-weight: 500;
}

.form-group input:focus {
    outline: none;
    border-color: #10b981;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 0 0 4px rgba(16, 185, 129, 0.25),
        0 4px 16px rgba(16, 185, 129, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

/* Botão primário harmonizado */
.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    font-family: inherit;
    letter-spacing: 0.8px;
    box-shadow: 
        0 4px 20px rgba(16, 185, 129, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.25), 
        transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 28px rgba(16, 185, 129, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(16, 185, 129, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Footer com link */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-footer p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.auth-footer a {
    color: #34d399;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    text-shadow: 
        0 0 10px rgba(52, 211, 153, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-footer a:hover {
    color: #10b981;
    text-shadow: 
        0 0 15px rgba(16, 185, 129, 0.8),
        0 1px 3px rgba(0, 0, 0, 0.3);
    text-decoration: underline;
}

/* Mensagens de erro/sucesso harmonizadas */
.message {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.error {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
        0 4px 16px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.message.success {
    background: rgba(16, 185, 129, 0.25);
    color: #ffffff;
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 
        0 4px 16px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Decoração verde */
.green-accent {
    position: absolute;
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-green-light), var(--primary-green));
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(60px);
    z-index: -1;
}

.green-accent.top-left {
    top: -100px;
    left: -100px;
}

.green-accent.bottom-right {
    bottom: -100px;
    right: -100px;
}

/* ============================================
   RESPONSIVIDADE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    body.auth-page {
        padding: 20px 16px;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        min-height: 100dvh;
    }
    
    .auth-container {
        padding: 36px 28px;
        border-radius: 20px;
        max-width: 100%;
        margin: 0 auto;
        max-height: calc(100vh - 40px);
        width: calc(100% - 32px);
        box-sizing: border-box;
    }
    
    .auth-header {
        margin-bottom: 24px;
        padding-bottom: 20px;
    }
    
    .auth-logo-round {
        width: 90px;
        height: 90px;
        margin-bottom: 16px;
    }
    
    .auth-subtitle {
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn-primary {
        padding: 16px;
        font-size: 16px;
        margin-top: 12px;
    }
    
    .auth-footer {
        margin-top: 24px;
        padding-top: 20px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 24px 20px;
    }
    
    .auth-header h1 {
        font-size: 22px;
    }
}

/* Loading state */
.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loading spinner */
.loading-spinner {
    display: block !important;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-right-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -11px;
    margin-top: -11px;
    z-index: 10;
    opacity: 1;
    visibility: visible;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.btn-primary.loading {
    pointer-events: none;
}

.btn-primary.loading .btn-text {
    opacity: 0;
    transition: opacity 0.2s;
}

/* Animações de entrada */
.form-group {
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   SISTEMA DE MODAIS - DESIGN MODERNO E RESPONSIVO
   Recriado do zero com nova estética futurista
   ============================================ */

/* ========== BASE DO MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.modal.active {
    display: flex;
}

.modal:not(.active) {
    display: none !important;
}

/* Backdrop com blur */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Container do Modal */
.modal-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 18px;
    max-width: min(100%, 560px);
    width: 100%;
    min-height: min(72vh, 640px);
    max-height: 94vh;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset,
        0 0 60px rgba(16, 185, 129, 0.15),
        0 8px 32px rgba(16, 185, 129, 0.08);
    position: relative;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(16, 185, 129, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
}

/* Compatibilidade com estrutura antiga modal-content */
.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 18px;
    max-width: min(100%, 560px);
    width: 100%;
    min-height: min(72vh, 640px);
    max-height: 94vh;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset,
        0 0 60px rgba(16, 185, 129, 0.15),
        0 8px 32px rgba(16, 185, 129, 0.08);
    position: relative;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(16, 185, 129, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
    padding: 0;
}

/* Garantir que modal-actions dentro de modal-content fique dentro */
.modal-content .modal-actions,
.modal-content .modal-footer {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Garantir que form dentro de modal-content não ultrapasse */
.modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-content > form > .modal-actions {
    margin-top: auto;
    flex-shrink: 0;
}

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

/* ========== HEADER DO MODAL ========== */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--primary-green) 0%, 
        var(--primary-green-light) 50%, 
        var(--primary-green) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.vendedor-nome {
    color: var(--primary-green);
    font-weight: 600;
    font-size: 0.85em;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* ========== CORPO SCROLLÁVEL ========== */
.modal-body {
    padding: 18px 22px 22px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1;
    min-height: 0;
    overflow-wrap: anywhere;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    overscroll-behavior-x: none !important;
    will-change: scroll-position;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    position: relative;
    /* Garantir que o scroll funcione */
    -webkit-overflow-scrolling: touch;
    /* Forçar que eventos de touch sejam capturados */
    pointer-events: auto;
}

/* ========== FORM GROUPS ========== */
.modal-body .form-group,
.modal-container .form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.modal-body .form-group:last-child,
.modal-container .form-group:last-child {
    margin-bottom: 0;
}

/* ========== LABELS ========== */
.modal-body label,
.modal-container label {
    font-size: 12px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
    display: block;
    line-height: 1.5;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ========== INPUTS, SELECTS, TEXTAREAS ========== */
.modal-body input,
.modal-body select,
.modal-body textarea,
.modal-container input,
.modal-container select,
.modal-container textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    color: #111827;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    font-family: inherit;
    font-weight: 500;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 0 rgba(16, 185, 129, 0);
}

.modal-body input:hover,
.modal-body select:hover,
.modal-body textarea:hover,
.modal-container input:hover,
.modal-container select:hover,
.modal-container textarea:hover {
    border-color: #d1d5db;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.08),
        0 0 0 2px rgba(16, 185, 129, 0.05);
    transform: translateY(-1px);
}

.modal-body input::placeholder,
.modal-container input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus,
.modal-container input:focus,
.modal-container select:focus,
.modal-container textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 
        0 0 0 4px rgba(16, 185, 129, 0.12),
        0 4px 16px rgba(16, 185, 129, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    background: #ffffff;
}

.modal-body textarea,
.modal-container textarea {
    min-height: 140px;
    resize: vertical;
    font-family: inherit;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-height: 720px) {
    .modal-container,
    .modal-content {
        min-height: auto;
        max-height: 96vh;
    }
}

@media (max-width: 640px) and (min-height: 640px) {
    .modal-container,
    .modal-content {
        min-height: min(58vh, 560px);
    }
}

.modal-body input[readonly],
.modal-container input[readonly] {
    background: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.modal-body input[type="checkbox"],
.modal-body input[type="radio"],
.modal-container input[type="checkbox"],
.modal-container input[type="radio"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-green);
}

.modal-body input[type="file"],
.modal-container input[type="file"] {
    padding: 14px;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-body input[type="file"]:hover,
.modal-container input[type="file"]:hover {
    border-color: var(--primary-green);
    background: #f0fdf4;
    transform: translateY(-2px);
}

/* ========== ACTIONS INLINE (dentro do modal-body) ========== */
.modal-actions-inline {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    justify-content: flex-end;
}

.modal-actions-inline button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    letter-spacing: 0.3px;
    text-transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.modal-actions-inline .btn-cancel {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    border: 2px solid #d1d5db;
}

.modal-actions-inline .btn-cancel:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-actions-inline .btn-save {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-actions-inline .btn-save:hover {
    background: linear-gradient(135deg, var(--primary-green-dark) 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.modal-actions-inline .btn-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-actions-inline .btn-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* ========== ACTIONS ========== */
.modal-actions,
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px 32px;
    border-top: 2px solid rgba(16, 185, 129, 0.15);
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.modal-actions button,
.modal-footer button {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.modal-actions button::before,
.modal-footer button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.modal-actions button:hover::before,
.modal-footer button:hover::before {
    left: 100%;
}

.btn-save,
.modal-actions .btn-save,
.modal-footer .btn-save {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 16px rgba(16, 185, 129, 0.4),
        0 2px 8px rgba(16, 185, 129, 0.3);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.btn-save:hover,
.modal-actions .btn-save:hover,
.modal-footer .btn-save:hover {
    background: linear-gradient(135deg, var(--primary-green-dark) 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
}

.btn-cancel,
.modal-actions .btn-cancel,
.modal-footer .btn-cancel {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    border: 2px solid #d1d5db;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-cancel:hover,
.modal-actions .btn-cancel:hover,
.modal-footer .btn-cancel:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.btn-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

/* ========== MODAL EXCLUIR ========== */
.modal-excluir-content {
    padding: 32px;
}

.modal-excluir-content p {
    font-size: 16px;
    color: #374151;
    margin-bottom: 12px;
    line-height: 1.6;
}

.modal-excluir-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px 32px;
    border-top: 2px solid rgba(16, 185, 129, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.modal-excluir-actions button {
    min-width: 140px;
    padding: 14px 28px;
}

/* ========== TEXTOS ========== */
.modal-body p,
.modal-body span:not(.badge):not(.status-badge),
.modal-container p,
.modal-container span:not(.badge):not(.status-badge) {
    color: #374151;
}

.modal-body p,
.modal-container p {
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 16px;
}

/* ========== INFO BOX ========== */
.modal-body .info-box,
.modal-container .info-box {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid;
    background: rgba(255, 255, 255, 0.8);
}

.modal-body .info-box i,
.modal-container .info-box i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ========== AUTOCOMPLETE ========== */
.modal-body .clientes-autocomplete,
.modal-body .cidades-autocomplete,
.modal-container .clientes-autocomplete,
.modal-container .cidades-autocomplete {
    position: relative;
    width: 100%;
    z-index: 10;
}

.modal-body .autocomplete-list,
.modal-container .autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid var(--primary-green);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin-top: -2px;
}

.modal-body .autocomplete-item,
.modal-container .autocomplete-item {
    padding: 14px 18px;
    cursor: pointer;
    color: #374151;
    font-size: 14px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 500;
}

.modal-body .autocomplete-item:last-child,
.modal-container .autocomplete-item:last-child {
    border-bottom: none;
}

.modal-body .autocomplete-item:hover,
.modal-container .autocomplete-item:hover {
    background: linear-gradient(90deg, #f0fdf4 0%, #ffffff 100%);
    color: #111827;
    padding-left: 22px;
}

/* ========== CLIENTES RECENTES ========== */
.modal-body .clientes-recentes,
.modal-container .clientes-recentes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    align-items: center;
}

.modal-body .clientes-recentes span,
.modal-container .clientes-recentes span {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-body .cliente-recente-btn,
.modal-container .cliente-recente-btn {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    color: var(--primary-green);
    border: 2px solid #bbf7d0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.modal-body .cliente-recente-btn:hover,
.modal-container .cliente-recente-btn:hover {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: #ffffff;
    border-color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ========== FORM ROW ========== */
.modal-body .form-row,
.modal-container .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Estilização específica para campos de endereço */
.modal-body .form-group[style*="flex: 0 0"] {
    min-width: 0;
}

.modal-body .form-group small {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
    display: block;
    line-height: 1.4;
}

/* ========== SCROLLBAR ========== */
.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-green-dark) 0%, #047857 100%);
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: flex-end;
        overflow: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        overscroll-behavior: contain;
    }
    
    .modal.active {
        touch-action: pan-y !important;
    }
    
    .modal-backdrop {
        background: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        touch-action: none;
        pointer-events: auto;
    }
    
    .modal-container {
        border-radius: 28px 28px 0 0;
        max-width: 100%;
        width: 100%;
        max-height: 95vh;
        height: 95vh;
        margin: 0;
        animation: modalSlideUpMobile 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 
            0 -10px 40px rgba(0, 0, 0, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset,
            0 0 80px rgba(16, 185, 129, 0.2);
        border: 1px solid rgba(16, 185, 129, 0.2);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        /* Permitir scroll no container */
        touch-action: pan-y !important;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    @keyframes modalSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .modal-header {
        padding: 22px 24px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.1),
            0 2px 8px rgba(16, 185, 129, 0.1);
        border-bottom: 2px solid rgba(16, 185, 129, 0.25);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    .modal-header h2 {
        font-size: 22px;
        font-weight: 700;
    }
    
    .modal-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    }
    
    .modal-close {
        width: 38px;
        height: 38px;
        font-size: 18px;
        background: rgba(239, 68, 68, 0.15);
    }
    
    .modal-body {
        padding: 24px;
        padding-bottom: 24px;
        /* Forçar scroll habilitado com todas as propriedades necessárias */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        overscroll-behavior-y: contain !important;
        overscroll-behavior-x: none !important;
        max-height: calc(95vh - 80px);
        height: auto !important;
        will-change: scroll-position;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        position: relative;
        scroll-behavior: smooth;
        /* Garantir que o modal-body tenha prioridade */
        z-index: 2;
        /* Forçar que eventos de touch sejam capturados */
        pointer-events: auto !important;
        /* Garantir que o elemento seja scrollável */
        -webkit-overflow-scrolling: touch;
    }
    
    /* Garantir que o scroll funcione mesmo com body bloqueado */
    .modal.active .modal-body {
        pointer-events: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        touch-action: pan-y !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        z-index: 2;
        /* Forçar scroll habilitado */
        overflow: auto !important;
        /* Garantir que eventos de touch funcionem */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Permitir seleção de texto em inputs */
    .modal.active .modal-body input,
    .modal.active .modal-body textarea,
    .modal.active .modal-body select {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* Permitir scroll no container do modal também */
    .modal.active .modal-container {
        touch-action: pan-y !important;
        overflow: hidden;
    }
    
    /* Garantir que elementos dentro do modal-body não bloqueiem scroll */
    .modal-body * {
        touch-action: auto;
    }
    
    .modal-body input,
    .modal-body select,
    .modal-body textarea {
        touch-action: manipulation;
    }
    
    /* Botões dentro do modal-body podem ser clicados */
    .modal-body button {
        touch-action: manipulation;
        pointer-events: auto;
    }
    
    /* Garantir que form dentro de modal-body permita scroll */
    .modal-body form {
        touch-action: pan-y;
        overflow: visible;
    }
    
    /* Garantir que os botões sticky não bloqueiem scroll quando o usuário arrasta sobre eles */
    .modal.active .modal-actions,
    .modal.active .modal-footer {
        pointer-events: none;
    }
    
    /* Mas permitir cliques nos botões */
    .modal.active .modal-actions button,
    .modal.active .modal-footer button {
        pointer-events: auto;
        touch-action: manipulation;
    }
    
    /* Botões inline dentro do modal-body (não sticky) */
    .modal-actions-inline {
        display: flex;
        gap: 12px;
        margin-top: 24px;
        padding-top: 20px;
        border-top: 1px solid rgba(16, 185, 129, 0.1);
        flex-direction: row;
        justify-content: space-between;
    }
    
    .modal-actions-inline button {
        flex: 1;
        padding: 12px 20px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 12px;
        letter-spacing: 0.3px;
        text-transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
        pointer-events: auto;
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    .modal-actions-inline .btn-cancel {
        background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
        color: #374151;
        border: 2px solid #d1d5db;
    }
    
    .modal-actions-inline .btn-save {
        background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
        color: #ffffff;
        border: none;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    
    .modal-actions-inline .btn-delete {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        color: #ffffff;
        border: none;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
    
    .modal-actions-inline .btn-delete:hover {
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    }
    
    .modal-actions,
    .modal-footer {
        padding: 20px 24px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        flex-direction: column;
        gap: 12px;
        box-shadow: 
            0 -4px 24px rgba(0, 0, 0, 0.15),
            0 -2px 12px rgba(16, 185, 129, 0.1);
        background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
        border-top: 2px solid rgba(16, 185, 129, 0.2);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        /* Não bloquear eventos de touch para scroll */
        pointer-events: none;
    }
    
    .modal-actions button,
    .modal-footer button {
        width: 100%;
        justify-content: center;
        padding: 18px 24px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 16px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        /* Permitir apenas cliques, não bloquear scroll */
        touch-action: manipulation;
        pointer-events: auto;
        position: relative;
        z-index: 1;
    }
    
    .modal-actions .btn-save,
    .modal-footer .btn-save {
        box-shadow: 
            0 6px 20px rgba(16, 185, 129, 0.4),
            0 2px 8px rgba(16, 185, 129, 0.3);
    }
    
    .modal-actions .btn-cancel,
    .modal-footer .btn-cancel {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
    
    .modal-excluir-content {
        padding: 24px;
    }
    
    .modal-excluir-actions {
        padding: 20px 24px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
        background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
        border-top: 2px solid rgba(16, 185, 129, 0.15);
        /* Não bloquear eventos de touch para scroll */
        pointer-events: none;
    }
    
    .modal-excluir-actions button {
        /* Permitir apenas cliques, não bloquear scroll */
        touch-action: manipulation;
        pointer-events: auto;
        position: relative;
        z-index: 1;
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 14px;
    }
    
    .modal-body .form-row,
    .modal-container .form-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .modal-body input,
    .modal-body select,
    .modal-body textarea {
        padding: 16px 20px;
        font-size: 16px;
        border-radius: 14px;
    }
    
    .modal-body label {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    body.modal-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: none;
    }
    
    /* Garantir que o scroll funcione dentro do modal mesmo com body bloqueado */
    .modal.active .modal-body {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        pointer-events: auto !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        scroll-behavior: smooth;
    }
    
    /* Permitir scroll no container do modal também */
    .modal.active .modal-container {
        touch-action: pan-y !important;
        overflow: hidden;
    }
    
    /* Garantir que elementos interativos não bloqueiem scroll */
    .modal.active .modal-body input,
    .modal.active .modal-body select,
    .modal.active .modal-body textarea {
        touch-action: manipulation;
    }
    
    .modal.active .modal-body button {
        touch-action: manipulation;
    }
}
