/*
  Estilos dos componentes compartilhados das telas (partials/modal e os botões
  padrão). Fica fora do Tailwind de propósito: é CSS escrito à mão, carregado
  pelo layout, e não depende de um novo build para funcionar.

  As cores abaixo são as da marca. Devem acompanhar o token "marca" do
  tailwind.config.js: se a cor da marca mudar, muda nos dois lugares.
*/
:root {
    --marca-50: #eef2ff;
    --marca-500: #6366f1;
    --marca-600: #4f46e5;
    --marca-700: #4338ca;
}

/* ------------------------------------------------------------------ Modal */

.modal-kmb {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-kmb[hidden] {
    display: none;
}

.modal-kmb-fundo {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .5);
}

.modal-kmb-caixa {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 28rem;
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.modal-kmb-caixa.modal-kmb-md { max-width: 32rem; }
.modal-kmb-caixa.modal-kmb-lg { max-width: 42rem; }
.modal-kmb-caixa.modal-kmb-xl { max-width: 48rem; }
.modal-kmb-caixa.modal-kmb-xxl { max-width: 64rem; }
/* Telas de conferência com tabela larga (ex.: lançar nota fiscal). */
.modal-kmb-caixa.modal-kmb-tela { max-width: 72rem; }

.modal-kmb-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-kmb-titulo {
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

/* Complemento do título escrito pela tela (o nome do item aberto). */
.modal-kmb-subtitulo {
    color: #6b7280;
    font-weight: 400;
}

.modal-kmb-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
}

.modal-kmb-x:hover {
    background: #f3f4f6;
    color: #4b5563;
}

/* O corpo rola; cabeçalho e rodapé ficam sempre à vista. */
.modal-kmb-corpo {
    padding: 20px;
    overflow-y: auto;
}

/*
  O rodapé encosta nas bordas da caixa por margem negativa (o corpo tem 20px de
  respiro). O !important é necessário: quando o rodapé fica dentro de um
  formulário com "space-y-*" do Tailwind, aquela classe zera a margem de baixo
  dos filhos e o rodapé ficava 20px acima do fim do modal.
*/
.modal-kmb-rodape {
    position: sticky;
    bottom: -20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 20px -20px -20px !important;
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* A página de trás não rola enquanto há modal aberto. */
body.modal-kmb-aberto {
    overflow: hidden;
}

/*
  No celular o modal também fica no meio da tela, com uma margem em volta —
  não colado na parte de baixo (pedido de 11/11/2026). Só os botões do rodapé
  mudam: dividem a largura, para ficarem fáceis de tocar.
*/
@media (max-width: 640px) {
    .modal-kmb { padding: 12px; }
    .modal-kmb-caixa { max-height: calc(100vh - 24px); }
    .modal-kmb-rodape > * { flex: 1; }
}

/* 100dvh desconta a barra do navegador do celular, onde ela existe. */
@supports (height: 100dvh) {
    .modal-kmb-caixa { max-height: calc(100dvh - 32px); }

    @media (max-width: 640px) {
        .modal-kmb-caixa { max-height: calc(100dvh - 24px); }
    }
}

/* ----------------------------------------------------------------- Botões */

.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}

.botao:focus-visible {
    outline: 2px solid var(--marca-600);
    outline-offset: 2px;
}

.botao:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.botao-primario {
    background: var(--marca-600);
    color: #fff;
}

.botao-primario:hover:not(:disabled) {
    background: var(--marca-500);
}

.botao-secundario {
    border-color: #d1d5db;
    background: #fff;
    color: #374151;
}

.botao-secundario:hover:not(:disabled) {
    background: #f9fafb;
}

/* Concluir, resolver, aprovar: ação que encerra algo com sucesso. */
.botao-sucesso {
    background: #16a34a;
    color: #fff;
}

.botao-sucesso:hover:not(:disabled) {
    background: #22c55e;
}

.botao-perigo {
    background: #dc2626;
    color: #fff;
}

.botao-perigo:hover:not(:disabled) {
    background: #ef4444;
}
