/* =========================================================
   Agiliza · Acordos e Repasses — tema
   ========================================================= */
:root {
    --primaria: #2563eb;
    --primaria-escura: #1d4ed8;
    --primaria-suave: #eff4ff;
    --sidebar: #0f172a;
    --sidebar-2: #1e293b;
    --texto: #0f172a;
    --texto-2: #475569;
    --texto-3: #94a3b8;
    --borda: #e5e9f0;
    --fundo: #f4f6fb;
    --card: #ffffff;
    --sucesso: #16a34a;
    --perigo: #dc2626;
    --alerta: #d97706;
    --info: #0891b2;
    --roxo: #7c3aed;
    --laranja: #ea580c;
    --raio: 14px;
    --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
    --bs-primary: var(--primaria);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: var(--texto);
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
}

body { font-size: .9rem; -webkit-font-smoothing: antialiased; }
a { color: var(--primaria); text-decoration: none; }
a:hover { color: var(--primaria-escura); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; margin-left: 256px; display: flex; flex-direction: column; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 1040;
    background: linear-gradient(180deg, var(--sidebar) 0%, #111c33 100%);
    color: #cbd5e1; display: flex; flex-direction: column; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.35rem 1.25rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem;
    background: linear-gradient(135deg, #3b82f6, #6366f1); box-shadow: 0 6px 16px rgba(59, 130, 246, .35);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt strong { font-size: 1.05rem; letter-spacing: -.01em; }
.brand-txt small { color: #94a3b8; font-size: .72rem; }

.nav-lateral { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; }
.nav-secao { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: #64748b; padding: 1rem .75rem .4rem; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px;
    color: #cbd5e1; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; color: #64748b; transition: color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:hover i { color: #93c5fd; }
.nav-item.ativo { background: rgba(59, 130, 246, .16); color: #fff; }
.nav-item.ativo i { color: #60a5fa; }
.sidebar-rodape { padding: 1rem 1.25rem; font-size: .72rem; color: #475569; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-backdrop { display: none; }

.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 1rem;
    padding: .9rem 2rem; background: rgba(244, 246, 251, .85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--borda);
}
.topbar-titulo { flex: 1; min-width: 0; }
.topbar-titulo h1 { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.topbar-titulo p { margin: 0; color: var(--texto-2); font-size: .82rem; }
.topbar-acoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.user-chip {
    display: flex; align-items: center; gap: .5rem; border: 1px solid var(--borda); background: #fff;
    border-radius: 999px; padding: .25rem .75rem .25rem .25rem; font-weight: 500; color: var(--texto);
}
.avatar {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }
.btn-icon { border: 1px solid var(--borda); background: #fff; border-radius: 10px; width: 40px; height: 40px; }

.conteudo { padding: 1.75rem 2rem 3rem; max-width: 1500px; width: 100%; }

@media (max-width: 991.98px) {
    .app-main { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.aberta { transform: none; }
    .sidebar-backdrop.aberta { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
    .topbar { padding: .75rem 1rem; }
    .conteudo { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------- Cards ---------- */
.card { border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); background: var(--card); }
.card-header {
    background: transparent; border-bottom: 1px solid var(--borda); padding: 1rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
}
.card-header h2, .card-header h3, .card-titulo { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }

.stat {
    position: relative; overflow: hidden; padding: 1.15rem 1.25rem; height: 100%;
}
.stat-rotulo { color: var(--texto-2); font-size: .78rem; font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.stat-valor { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; margin-top: .35rem; white-space: nowrap; }
.stat-extra { color: var(--texto-3); font-size: .76rem; margin-top: .15rem; }
.stat-icone {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem;
    position: absolute; right: 1rem; top: 1rem;
}
.ic-azul { background: #eff4ff; color: var(--primaria); }
.ic-verde { background: #ecfdf3; color: var(--sucesso); }
.ic-ambar { background: #fff7e6; color: var(--alerta); }
.ic-vermelho { background: #fef2f2; color: var(--perigo); }
.ic-roxo { background: #f5f3ff; color: var(--roxo); }
.ic-ciano { background: #ecfeff; color: var(--info); }

/* ---------- Tabelas ---------- */
.table { margin: 0; --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .7rem 1rem; border-bottom-color: #eef1f6; vertical-align: middle; }
.table thead th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 600;
    background: #f8fafc; border-bottom: 1px solid var(--borda); white-space: nowrap;
}
.table-hover tbody tr:hover > * { background: #f8fbff; }
.table tfoot td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--borda); }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-responsive { border-radius: 0 0 var(--raio) var(--raio); }
.td-titulo { font-weight: 600; color: var(--texto); }
.td-sub { color: var(--texto-3); font-size: .76rem; }
.vazio { text-align: center; padding: 3rem 1rem; color: var(--texto-3); }
.vazio i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .7rem; padding: .38em .7em; border-radius: 999px; letter-spacing: .01em; }
.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; }
.badge-soft-warning { background: #fef3c7; color: #b45309; }
.badge-soft-info { background: #cffafe; color: #0e7490; }
.badge-soft-primary { background: #dbeafe; color: #1d4ed8; }
.badge-soft-secondary { background: #eef2f7; color: #475569; }
.badge-soft-dark { background: #e2e8f0; color: #1e293b; }
.badge-soft-light { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.badge-soft-purple { background: #ede9fe; color: #6d28d9; }
.badge-soft-orange { background: #ffedd5; color: #c2410c; }

/* ---------- Formulários ---------- */
.form-label { font-weight: 500; font-size: .8rem; color: var(--texto-2); margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe1ea; padding: .55rem .8rem; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: #93b4f7; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12); }
.input-group-text { border-radius: 10px; background: #f8fafc; border-color: #dbe1ea; color: var(--texto-2); }
.form-text { font-size: .75rem; }
.secao-form { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--texto-3); margin: 1.5rem 0 .75rem; }
.secao-form:first-child { margin-top: 0; }

.btn { border-radius: 10px; font-weight: 500; padding: .5rem 1rem; font-size: .875rem; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn-primary { background: var(--primaria); border-color: var(--primaria); box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-primary:hover { background: var(--primaria-escura); border-color: var(--primaria-escura); }
.btn-light { background: #fff; border: 1px solid var(--borda); color: var(--texto); }
.btn-light:hover { background: #f8fafc; border-color: #d4dbe6; }
.btn-soft { background: var(--primaria-suave); color: var(--primaria); border: 0; }
.btn-soft:hover { background: #dbe7ff; color: var(--primaria-escura); }

/* ---------- Filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filtros .form-control, .filtros .form-select { min-width: 150px; }

/* ---------- Simulação de cálculo ---------- */
.simulacao { background: linear-gradient(160deg, #0f172a, #1e3a8a); color: #e2e8f0; border-radius: var(--raio); padding: 1.35rem; position: sticky; top: 90px; }
.simulacao h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: #93c5fd; margin-bottom: 1rem; }
.sim-linha { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed rgba(148, 163, 184, .25); }
.sim-linha span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }
.sim-total { margin-top: .9rem; padding: .9rem 1rem; background: rgba(255, 255, 255, .08); border-radius: 12px; }
.sim-total small { color: #93c5fd; display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.sim-total strong { font-size: 1.6rem; color: #fff; letter-spacing: -.02em; }

/* ---------- Perfil do cliente ---------- */
.perfil-topo { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.perfil-topo h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.chip { background: #f1f5f9; color: var(--texto-2); border-radius: 999px; padding: .2rem .65rem; font-size: .75rem; }
.progresso { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progresso > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #22c55e); border-radius: 999px; }

/* ---------- Upload ---------- */
.dropzone {
    border: 2px dashed #c7d2e3; border-radius: var(--raio); background: #fafcff; padding: 2.5rem 1rem; text-align: center;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primaria); background: var(--primaria-suave); }
.dropzone i { font-size: 2.4rem; color: var(--primaria); }

/* ---------- Login ---------- */
.login-pagina { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-lado {
    background: radial-gradient(circle at 20% 20%, #1e40af 0%, #0f172a 60%); color: #e2e8f0; padding: 3.5rem;
    display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-lado::after {
    content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -180px;
    background: radial-gradient(circle, rgba(99, 102, 241, .35), transparent 70%);
}
.login-lado h2 { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; color: #fff; max-width: 420px; }
.login-lado ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.login-lado li { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; color: #cbd5e1; }
.login-lado li i { color: #60a5fa; }
.login-form { display: grid; place-items: center; padding: 2rem; background: #fff; }
.login-form form { width: 100%; max-width: 380px; }
@media (max-width: 991.98px) { .login-pagina { grid-template-columns: 1fr; } .login-lado { display: none; } }

/* ---------- Diversos ---------- */
.text-muted-2 { color: var(--texto-3) !important; }
.fw-600 { font-weight: 600; }
.lista-def { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.25rem; margin: 0; }
.lista-def dt { color: var(--texto-3); font-weight: 500; font-size: .8rem; }
.lista-def dd { margin: 0; font-weight: 500; }
.dropdown-menu { border-radius: 12px; border-color: var(--borda); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .75rem; font-size: .875rem; }
.modal-content { border-radius: 16px; border: 0; }
.modal-header, .modal-footer { border-color: var(--borda); }
.alert { border-radius: 12px; border: 0; }
.nav-tabs-soft { gap: .25rem; border: 0; }
.nav-tabs-soft .nav-link { border: 0; border-radius: 10px; color: var(--texto-2); font-weight: 500; padding: .45rem .9rem; }
.nav-tabs-soft .nav-link.active { background: var(--primaria-suave); color: var(--primaria); }
.linha-cancelada td { opacity: .5; }

/* ---------- Impressão (relatórios em PDF) ---------- */
@media print {
    .sidebar, .topbar, .no-print, .btn, .filtros, .alert { display: none !important; }
    .app-main { margin: 0; }
    .conteudo { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 0; }
    .print-only { display: block !important; }
    body { background: #fff; font-size: 10pt; }
    .table > :not(caption) > * > * { padding: .35rem .5rem; }
}
.print-only { display: none; }

/* Ajustes finais */
.form-control, .form-select { background-color: #fff; }
.form-control[readonly] { background-color: #f8fafc; }
@media (max-width: 575.98px) {
    .topbar { flex-wrap: wrap; }
    .topbar-titulo p { display: none; }
    .topbar-acoes { order: 3; width: 100%; }
    .stat-valor { font-size: 1.25rem; }
}
