.aps-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.aps-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.aps-field {
    flex: 1;
}

.aps-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.aps-field input,
.aps-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.aps-cpf-group input {
    padding-right: 40px;
}

.aps-input-group {
    position: relative;
}

#btn-pesquisar {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    opacity: 0.7;
}

#btn-pesquisar:hover {
    opacity: 1;
}

/*#btn-pesquisar:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}*/

#btn-pesquisar:disabled {
    pointer-events: auto !important;
    opacity: 0.6;  /* Visual disabled */
}

#botoesNovo,
#botoesExistente {
    all: revert !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 20px !important;
    width: 100% !important;
}

#botoesNovo button,
#botoesExistente button {
    all: revert !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    border: 1px solid #d1dbe8 !important;
    cursor: pointer !important;
    background: #ffffff !important;
    color: #0056a6 !important;
}

#botoesNovo button:first-child,
#botoesExistente button:first-child {
    background: #00c896 !important;
    color: #fff !important;
    border: none !important;
}

#botoesNovo button:hover,
#botoesExistente button:hover {
    opacity: .85 !important;
}

#aps-mensagem {
    margin-top: 3px;
    padding: 3px;
    border-radius: 4px;
}

/* 🔹 Layout label + input lado a lado (igual ao primeiro formulário) */
.aps-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* label alinhado à esquerda, largura controlada */
.aps-field > label {
  display: block;
  width: 140px;          /* ajuste fino aqui */
  margin-bottom: 0;     /* remove o espaço vertical antigo */
  text-align: right;    /* alinha o texto do label */
  white-space: nowrap;
  flex-shrink: 0;
}

/* input e select ocupam o restante */
.aps-field > input,
.aps-field > select {
  flex: 1;
}

/* 🔹 Botões desabilitados */
#botoesNovo button:disabled,
#botoesExistente button:disabled {
  background: #e0e0e0 !important;
  color: #8a8a8a !important;
  border: 1px solid #cccccc !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* GARANTE VISIBILIDADE E POSICIONAMENTO DO BOTÃO */
.aps-input-group {
  position: relative;
  z-index: 1; /* Evita sobreposição pelo input */
}

/* ESTILIZAÇÃO ESSENCIAL PARA O BOTÃO COM SVG */
#btn-pesquisar {
  display: flex !important;       /* Centraliza conteúdo */
  align-items: center !important; /* Centraliza verticalmente */
  justify-content: center !important; /* Centraliza horizontalmente */
  padding: 0 !important;          /* Remove padding padrão do botão */
  z-index: 10 !important;         /* Fica ACIMA do input */
  line-height: 1 !important;      /* Evita altura extra */
}

/* DIMENSIONAMENTO E COR DO SVG */
#btn-pesquisar svg {
  width: 18px !important;         /* Tamanho ideal para botão 32px */
  height: 18px !important;
  fill: currentColor !important;  /* Herda 'color: white' do botão */
  display: block !important;      /* Remove espaçamento inline */
  pointer-events: none !important; /* Evita interferência em cliques */
}

/* OPCIONAL: Debug visual temporário (remova depois) */
/* #btn-pesquisar { background: red !important; } */

#labelUsuarioAtivo {
    font-weight: 700; /* negrito */
}

#labelUsuarioAtivo.label-azul {
    color: #0056a6 !important;
    font-weight: 700;
}

#labelUsuarioAtivo.label-vermelho {
    color: #d63638 !important;
    font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════════════════════ */
/* 🔹 CORREÇÃO PARA TABLET - ALINHAMENTO À ESQUERDA COM LABELS AO LADO            */
/* ════════════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1024px) {
    /* Container principal */
    .aps-container {
        padding: 15px !important;
        max-width: 100% !important;
    }
    
    /* Linhas do formulário - força coluna única no tablet */
    .aps-row {
        flex-direction: column !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
        align-items: stretch !important;
    }
    
    /* Campos do formulário - ocupam 100% da largura */
    .aps-field {
        width: 100% !important;
        flex: 0 0 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Labels - mantém ao lado dos inputs, alinhados à esquerda */
    .aps-field > label {
        display: block !important;
        width: 140px !important;     /* Mantém largura fixa */
        text-align: right !important; /* Label alinhado à direita */
        margin-bottom: 0 !important;
    }
    
    /* Inputs e selects - ocupam o restante */
    .aps-field > input,
    .aps-field > select {
        width: calc(100% - 155px) !important; /* 140px label + 15px gap */
        flex: none !important;
        box-sizing: border-box !important;
    }
    
    /* Campo CPF - ajuste específico */
    .aps-cpf-group {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .aps-cpf-group input {
        width: calc(100% - 155px) !important;
        box-sizing: border-box !important;
    }
    
    /* Botão de pesquisa - mantém ao lado do input */
    .aps-input-group {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        width: calc(100% - 155px) !important;
    }
    
    #btn-pesquisar {
        position: absolute !important;
        right: 5px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
    }
    
    /* Botões de ação - linha única no tablet */
    #botoesNovo,
    #botoesExistente {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
    
    #botoesNovo button,
    #botoesExistente button {
        flex: 1 !important;
        min-width: 150px !important;
        max-width: none !important;
    }
}

/* ════════════════════════════════════════════════════════════════════════════════ */
/* 🔹 CORREÇÃO PARA DESKTOP - ALINHAMENTO À ESQUERDA COM LABELS AO LADO           */
/* ════════════════════════════════════════════════════════════════════════════════ */

@media (min-width: 1025px) {
    /* Container principal - remove margens laterais */
    .aps-container {
        padding: 20px !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    
    /* Linhas do formulário - mantém layout em duas colunas */
    .aps-row {
        display: flex !important;
        gap: 20px !important;
        margin-bottom: 20px !important;
        flex-wrap: wrap !important;
    }
    
    /* Campos do formulário - alinha à esquerda */
    .aps-field {
        flex: 1 !important;
        min-width: 250px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Labels - mantém ao lado dos inputs */
    .aps-field > label {
        display: block !important;
        width: 140px !important;
        text-align: right !important;
        margin-bottom: 0 !important;
    }
    
    /* Inputs e selects - ocupam o restante */
    .aps-field > input,
    .aps-field > select {
        width: calc(100% - 155px) !important;
        flex: none !important;
        box-sizing: border-box !important;
    }
    
    /* Campo CPF - ajuste específico */
    .aps-cpf-group {
        flex: 1 !important;
        min-width: 250px !important;
    }
    
    .aps-cpf-group input {
        width: calc(100% - 155px) !important;
        box-sizing: border-box !important;
    }
    
    /* Botão de pesquisa - mantém ao lado do input */
    .aps-input-group {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        width: calc(100% - 155px) !important;
    }
    
    #btn-pesquisar {
        position: absolute !important;
        right: 5px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
    }
}

/* ════════════════════════════════════════════════════════════════════════════════ */
/* 🔹 CORREÇÃO PARA MOBILE - ALINHAMENTO À ESQUERDA COM LABELS ACIMA              */
/* ════════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* Container principal - remove padding lateral em mobile */
    .aps-container {
        padding: 15px !important;
        max-width: 100% !important;
    }
    
    /* Linhas do formulário - força coluna única */
    .aps-row {
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 15px !important;
        align-items: stretch !important;
    }
    
    /* Campos do formulário - ocupam 100% da largura */
    .aps-field {
        width: 100% !important;
        flex: 0 0 100% !important;
        display: block !important; /* Remove layout flex horizontal */
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Labels - alinhados à esquerda, acima do input */
    .aps-field > label {
        display: block !important;
        width: auto !important;      /* Remove largura fixa */
        text-align: left !important; /* Alinha texto à esquerda */
        margin-bottom: 5px !important;
        margin-right: 0 !important;
    }
    
    /* Inputs e selects - ocupam 100% da largura */
    .aps-field > input,
    .aps-field > select {
        width: 100% !important;
        flex: none !important;
        box-sizing: border-box !important;
    }
    
    /* Campo CPF - ajuste específico */
    .aps-cpf-group {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .aps-cpf-group input {
        padding-right: 12px !important; /* Remove padding extra para botão */
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Botão de pesquisa - abaixo do input em mobile */
    .aps-input-group {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    #btn-pesquisar {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        padding: 10px !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
    }
    
    /* Botões de ação - coluna única em mobile */
    #botoesNovo,
    #botoesExistente {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    #botoesNovo button,
    #botoesExistente button {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Mensagem de feedback */
    #aps-mensagem {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}