/* ERP Web — estilos compartilhados */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
}

/* ── Barra superior ─────────────────────────────────────────── */
.topbar {
    background: #1e40af;
    color: #fff;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.topbar .marca { font-weight: bold; font-size: 16px; letter-spacing: 0.3px; }
.topbar .empresa { opacity: 0.85; font-size: 13px; }
.topbar .esp { flex: 1; }
.topbar .usuario { font-size: 13px; opacity: 0.9; }
.topbar a.btn-logout {
    color: #fff; text-decoration: none; padding: 4px 12px;
    border: 1px solid rgba(255,255,255,0.4); border-radius: 4px;
    font-size: 12px;
}
.topbar a.btn-logout:hover { background: rgba(255,255,255,0.15); }

/* ── Conteúdo ───────────────────────────────────────────────── */
.conteudo { padding: 16px; }
.cartao {
    background: #fff;
    border-radius: 6px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}

h1.titulo { margin: 0 0 12px 0; font-size: 20px; color: #1e293b; }

/* ── Formulário ─────────────────────────────────────────────── */
.linha { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.linha label { font-weight: 500; color: #475569; min-width: 80px; }
.campo { flex: 1; min-width: 0; }
input.campo, select.campo, textarea.campo { width: 100%; }
input, select, textarea {
    font-family: inherit;
    font-size: 14px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #1e293b;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
input[readonly] { background: #f1f5f9; cursor: not-allowed; }
textarea { resize: vertical; min-height: 50px; }

input.curto { width: 100px; }
input.medio { width: 180px; }

/* ── Botões ─────────────────────────────────────────────────── */
.btn {
    padding: 7px 14px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}
.btn:hover { background: #f8fafc; }
.btn.primario { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.primario:hover { background: #1d4ed8; }
.btn.sucesso { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn.sucesso:hover { background: #15803d; }
.btn.perigo { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.perigo:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.esp-flex { flex: 1; }

/* ── Combo de busca (autocomplete) ──────────────────────────── */
.combo-busca { position: relative; flex: 1; min-width: 0; }
.combo-busca > input { width: 100%; }
.combo-busca .resultados {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 2px;
}
.combo-busca .resultados .item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.combo-busca .resultados .item:hover,
.combo-busca .resultados .item.foco { background: #dbeafe; }
.combo-busca .resultados .item .sub { color: #64748b; font-size: 11px; }
.combo-busca .resultados .vazio { padding: 10px; color: #94a3b8; text-align: center; font-size: 13px; }

/* ── AG Grid: altura e tema fino ────────────────────────────── */
#grid-itens, #grid-lista {
    width: 100%;
    height: 420px;
}
.ag-theme-quartz .ag-cell.celula-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Total ──────────────────────────────────────────────────── */
.total-rodape {
    font-size: 20px;
    font-weight: bold;
    color: #2563eb;
    padding: 8px 0;
}

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-box {
    background: #fff; padding: 28px 32px; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); width: 100%; max-width: 360px;
}
.login-box h1 { margin: 0 0 18px 0; color: #1e40af; text-align: center; }
.login-box .linha { flex-direction: column; align-items: stretch; }
.login-box .linha label { min-width: 0; }
.login-box input { width: 100%; padding: 9px 10px; font-size: 15px; }
.login-box .btn { width: 100%; padding: 10px; font-size: 15px; margin-top: 6px; }
.login-box .erro {
    background: #fee2e2; color: #991b1b; padding: 8px 12px;
    border-radius: 4px; margin-bottom: 10px; font-size: 13px;
}

/* ── Mensagens ──────────────────────────────────────────────── */
.toast-area {
    position: fixed; top: 14px; right: 14px; z-index: 9999;
    display: flex; flex-direction: column; gap: 6px; max-width: 360px;
}
.toast {
    background: #1e293b; color: #fff; padding: 10px 14px;
    border-radius: 5px; box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    animation: fadein 0.18s ease-out;
}
.toast.ok { background: #16a34a; }
.toast.erro { background: #dc2626; }
@keyframes fadein { from {opacity:0; transform: translateX(20px);} to {opacity:1; transform:none;} }
