.page-container {
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--cor-menu-cards);
}

.page-header h1 {
    font-size: 2rem;
    color: var(--cor-texto-principal);
    margin-bottom: 5px;
    font-weight: 700;
}

.page-header h1 i {
    color: var(--cor-botao);
    margin-right: 10px;
}

.page-header p {
    color: var(--cor-texto-secundario);
    font-size: 1rem;
}

.card-actions {
    padding: 20px 25px;
    border-bottom: 1px solid var(--cor-menu-cards);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cor-texto-secundario);
}

.search-box input {
    padding-left: 45px;
}

.text-center {
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background-color: var(--cor-fundo);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-small {
    width: 90%;
    max-width: 500px;
}

.modal-large {
    width: 90%;
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid var(--cor-menu-cards);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--cor-texto-principal);
    font-weight: 700;
}

.modal-header h2 i {
    color: var(--cor-botao);
    margin-right: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--cor-texto-secundario);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--cor-erro);
}

.modal-body {
    padding: 30px;
}

.modal-body h3 {
    font-size: 1.2rem;
    color: var(--cor-texto-principal);
    margin: 25px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cor-menu-cards);
    font-weight: 600;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body h3 i {
    color: var(--cor-botao);
    margin-right: 8px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--cor-menu-cards);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 0;
}

.form-row .form-group {
    flex: 1;
}

/* ==========================================
   USUARIOS - Estilos específicos
   ========================================== */

/* Badges de tipo de usuário */
.badge-tipo {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-ADMIN_GERAL {
    background: linear-gradient(135deg, #8B1538, #A91D3A);
    color: white;
}

.badge-ADMIN {
    background: #007bff;
    color: white;
}

.badge-CONTADOR {
    background: #17a2b8;
    color: white;
}

.badge-USUARIO {
    background: #6c757d;
    color: white;
}

/* Badge de aviso (senha provisória) */
.badge-warning {
    display: inline-block;
    background: var(--cor-aviso);
    color: #856404;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

/* Empresas vinculadas */
.empresas-badge {
    display: inline-block;
    background: var(--cor-menu-cards);
    padding: 3px 8px;
    border-radius: 3px;
    margin: 2px;
    font-size: 0.85em;
}

/* Tabela */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container thead th {
    background-color: var(--cor-menu-cards);
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--cor-texto-principal);
    border-bottom: 2px solid var(--cor-cinza);
}

.table-container tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--cor-menu-cards);
    vertical-align: middle;
}

.table-container tbody tr:hover {
    background-color: var(--cor-menu-cards);
}

/* Content card (reutilizável) */
.content-card {
    background-color: var(--cor-fundo);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.content-card .card-body {
    padding: 20px 25px;
}

/* Label small */
.small {
    font-size: 0.85rem;
    display: block;
    margin-bottom: 5px;
    color: var(--cor-texto-secundario);
}

/* Vínculos no modal */
.vinculo-row {
    margin-bottom: 5px !important;
    gap: 8px !important;
}

.vinculo-row .form-group {
    margin-bottom: 0;
}

.vinculo-row .form-control {
    padding: 6px 10px;
    font-size: 0.9rem;
}

/* Linhas de vínculos na tabela */
.vinculo-linha {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
}

.vinculo-linha + .vinculo-linha {
    border-top: 1px solid var(--cor-menu-cards);
    margin-top: 3px;
    padding-top: 6px;
}

.vinculo-linha .badge-tipo {
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.vinculo-linha .empresas-badge {
    margin: 1px 2px;
}

/* Vínculos no modal - manter em uma linha */
.vinculo-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

@media (max-width: 768px) {
    .vinculo-row {
        flex-wrap: wrap !important;
    }
}

.vinculo-row .btn-danger {
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   UPLOAD DE LOGO DA EMPRESA
   ============================================ */

.preview-container-empresa {
    background: var(--cor-fundo);
    border: 2px dashed var(--cor-borda);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 140px;
    margin-bottom: 10px;
}

.logo-mask-empresa {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cor-menu-cards);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.logo-mask-empresa img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.input-upload {
    padding: 10px;
    border: 1px solid var(--cor-borda);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    background: var(--cor-fundo);
    color: var(--cor-texto-principal);
}

.upload-hint {
    color: var(--cor-texto-secundario);
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

/* Modal de crop precisa ficar acima do modal de empresa */
#modalCropLogoEmpresa {
    z-index: 2100 !important;
}

#modalCropLogoEmpresa .crop-modal-content {
    z-index: 2101 !important;
}

/* ============================================
   MODAL DE RECORTE DE LOGO
   ============================================ */

.crop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.crop-modal-content {
    background: var(--cor-fundo);
    border-radius: 10px;
    padding: 25px;
    max-width: 560px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10001;
}

.crop-modal-content h3 {
    margin: 0 0 20px 0;
    color: var(--cor-primaria);
    font-size: 1.3rem;
}

.crop-area {
    position: relative;
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.crop-area img {
    max-width: 100%;
    display: block;
}

/* Círculo para guia visual do recorte */
.crop-area-logo::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at center,
            transparent 0,
            transparent 40%,
            rgba(255,255,255,0.9) 40.5%,
            rgba(0,0,0,0.6) 41%);
}

.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Responsivo */
@media (max-width: 768px) {
    .crop-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .crop-area {
        max-height: 300px;
    }
}