/* ============================================================
   Identidade Visual MAIZ - Central de Análise de Crédito
   Laranja #EA5B0C | Cinza #575756 | Preto #181B1C | Light #E7E6E6
   ============================================================ */
:root {
    --orange: #EA5B0C;
    --gray: #575756;
    --black: #181B1C;
    --silver: #706F6F;
    --light: #E7E6E6;
    --white: #FFFFFF;
    --orange-10: rgba(234, 91, 12, 0.10);
    --grifado: #FCE3D3;
    --radius: 0.375rem;
    --radius-lg: 0.5rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;
    font-weight: 300;
    color: var(--black);
    background: var(--white);
    line-height: 1.6;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout com sidebar ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--black);
    border-right: 3px solid var(--orange);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding: 24px 24px 20px;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 2px;
    text-decoration: none;
    border-bottom: 1px solid #2A2D2E;
}
.brand:hover { text-decoration: none; }
.brand-mai { color: var(--light); }
.brand-z { color: var(--orange); }
.brand-sub {
    width: 100%;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: var(--silver);
    margin-top: 2px;
}

.sidenav { padding: 16px 12px; flex: 1; }
.sidenav-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--silver);
    padding: 8px 12px;
}
.sidenav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--light);
    padding: 11px 12px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 400;
    margin-bottom: 2px;
}
.sidenav a .ico { font-size: 1.05rem; width: 20px; text-align: center; }
.sidenav a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.sidenav a.active { color: var(--orange); background: var(--orange-10); font-weight: 500; }

.sidebar-footer {
    padding: 16px 24px;
    font-size: 0.75rem;
    color: var(--silver);
    border-top: 1px solid #2A2D2E;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 40;
    background: var(--black);
    color: var(--orange);
    border: none;
    width: 42px; height: 42px;
    border-radius: var(--radius);
    font-size: 1.3rem;
    cursor: pointer;
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(24, 27, 28, 0.6);
    z-index: 25;
}
.sidebar-overlay.show { display: block; }

.main { flex: 1; min-width: 0; }

/* ---------- Container ---------- */
.container { max-width: 1080px; margin: 32px auto; padding: 0 32px; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
    .sidebar-toggle { display: block; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .container { margin-top: 64px; padding: 0 20px; }
}

h1 { font-size: 2rem; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 1.5rem; font-weight: 300; margin: 0 0 16px; }
.subtitle { color: var(--gray); margin: 0 0 32px; }

/* ---------- Cards ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--white);
    border: 1px solid var(--light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.card h3 {
    font-size: 1.125rem;
    font-weight: 500;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card .hint { color: var(--gray); font-size: 0.875rem; margin: 0 0 20px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.875rem; color: var(--gray); margin: 0 0 6px; font-weight: 400; }
input[type=text], input[type=number], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--light);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    margin-bottom: 16px;
    background: var(--white);
    color: var(--black);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
textarea { resize: vertical; min-height: 72px; }

/* dropzone */
.dropzone {
    border: 2px dashed var(--light);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    color: var(--gray);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--orange); background: var(--orange-10); }
.dropzone .big { font-size: 2rem; color: var(--orange); }
.filelist { font-size: 0.875rem; color: var(--black); margin-bottom: 16px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: rgba(234, 91, 12, 0.9); text-decoration: none; }
.btn-outline { background: transparent; color: var(--orange); border: 1px solid var(--orange); }
.btn-outline:hover { background: var(--orange-10); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { background: var(--light); text-decoration: none; }
.btn-danger { background: #DC2626; color: var(--white); }
.btn-danger:hover { background: #B91C1C; text-decoration: none; }
.btn-block { width: 100%; justify-content: center; }

/* botão de excluir em linha de tabela (parece link) */
.link-danger {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: #DC2626;
    cursor: pointer;
}
.link-danger:hover { text-decoration: underline; }

/* ---------- Flash ---------- */
.flash-wrap { margin-bottom: 24px; }
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 8px; font-size: 0.9375rem; }
.flash-error { background: #FEE2E2; color: #991B1B; }
.flash-success { background: #D1FAE5; color: #065F46; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--light); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
thead th {
    background: var(--black);
    color: var(--white);
    text-align: left;
    padding: 12px 16px;
    font-weight: 500;
}
tbody td { padding: 10px 16px; border-top: 1px solid var(--light); }
tbody tr:hover { background: #FAFAFA; }
tbody tr.grifado { background: var(--grifado); font-weight: 500; }
tbody tr.grifado:hover { background: #F9D8C3; }
.valor { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.valor.neg { color: #B91C1C; }
.valor.pos { color: #065F46; }
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--orange-10);
    color: var(--orange);
}
.badge-gray { background: var(--light); color: var(--gray); }
.badge-ok   { background: #D1FAE5; color: #065F46; }
.badge-reserva { background: #DBEAFE; color: #1E40AF; }
.badge-erro { background: #FEE2E2; color: #991B1B; }

/* ---------- Tela de login ---------- */
.tela-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--black);
    padding: 24px;
}
.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    border-top: 4px solid var(--orange);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-brand { font-size: 2.25rem; font-weight: 700; letter-spacing: 3px; }
.login-brand .brand-mai { color: var(--gray); }
.login-brand .brand-z { color: var(--orange); }
.login-sub { color: var(--gray); font-size: 0.875rem; margin: 4px 0 0; }
.login-nota {
    margin: 24px 0 0;
    font-size: 0.75rem;
    color: var(--silver);
    line-height: 1.6;
}

/* usuario logado na sidebar */
.sidebar-user {
    padding: 12px 24px;
    border-top: 1px solid #2A2D2E;
    font-size: 0.8125rem;
    color: var(--light);
}
.sidebar-user .nome { display: block; font-weight: 500; }
.sidebar-user a { font-size: 0.75rem; color: var(--silver); }
.sidebar-user a:hover { color: var(--orange); }

/* abas (pré-cadastro / reserva) */
.abas {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--light);
    margin-bottom: 24px;
}
.aba {
    padding: 12px 24px;
    color: var(--gray);
    font-size: 0.9375rem;
    font-weight: 400;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.aba:hover { color: var(--black); text-decoration: none; }
.aba.ativa { color: var(--orange); border-bottom-color: var(--orange); font-weight: 500; }
.aba-contador {
    background: var(--light);
    color: var(--gray);
    border-radius: 9999px;
    padding: 1px 9px;
    font-size: 0.75rem;
}
.aba.ativa .aba-contador { background: var(--orange-10); color: var(--orange); }

/* barra de acoes em lote (selecionar analises) */
.barra-acoes {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--light);
    border: 1px solid var(--light);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    flex-wrap: wrap;
}
.barra-acoes .sel-todos {
    display: flex; align-items: center; gap: 8px;
    margin: 0; font-size: 0.875rem; color: var(--black); cursor: pointer;
}
.barra-acoes .contador { flex: 1; font-size: 0.8125rem; color: var(--gray); }
.barra-acoes .btn:disabled { opacity: .45; cursor: not-allowed; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; }

/* ---------- Console de acompanhamento (logs ao vivo) ---------- */
.console-wrap {
    border: 1px solid var(--light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.console-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--light);
    font-size: 0.8125rem;
    color: var(--gray);
}
.console-status { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.console-status.ok { color: #065F46; }
.console-status.erro { color: #B91C1C; }
.pisca {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--orange);
    animation: pulsar 1s ease-in-out infinite;
}
@keyframes pulsar { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

.console {
    margin: 0;
    padding: 18px 20px;
    background: var(--black);
    color: #E7E6E6;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    min-height: 280px;
    max-height: 460px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* parecer em modo edição */
.relatorio-edit {
    width: 100%;
    min-height: 480px;
    padding: 20px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--black);
    background: var(--white);
    border: 1px solid var(--light);
    border-radius: var(--radius-lg);
    resize: vertical;
    margin-bottom: 0;
}
.relatorio-edit:focus { outline: 2px solid var(--orange); border-color: var(--orange); }

/* bloco do parecer da analise de credito */
.relatorio {
    margin: 0;
    padding: 24px;
    background: #FAFAFA;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--black);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 620px;
    overflow: auto;
}

/* ---------- Stats ---------- */
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 24px 0; }
.stat {
    flex: 1;
    min-width: 160px;
    border: 1px solid var(--light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}
.stat .label { font-size: 0.8125rem; color: var(--gray); }
.stat .value { font-size: 1.5rem; font-weight: 700; }
.stat .value.pos { color: #065F46; }
.stat .value.neg { color: #B91C1C; }

/* card de estatística clicável (filtro de repetidas) */
.stat-clicavel { cursor: pointer; user-select: none; transition: border-color .15s, background .15s; }
.stat-clicavel:hover { border-color: var(--orange); background: var(--orange-10); }
.stat-clicavel.ativo { border-color: var(--orange); background: var(--orange-10); border-width: 2px; }
.stat-clicavel .estado-filtro {
    margin-top: 6px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--orange);
    font-weight: 500;
}

/* barra de filtros das tabelas */
.filtros {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filtro-busca {
    flex: 1;
    min-width: 260px;
    margin-bottom: 0;
    padding: 9px 12px;
}
.filtro-select { width: auto; min-width: 180px; margin-bottom: 0; padding: 9px 12px; }
.filtro-contador { font-size: 0.8125rem; color: var(--gray); white-space: nowrap; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

.footer { text-align: center; color: var(--silver); font-size: 0.8125rem; padding: 32px 0; border-top: 1px solid var(--light); margin-top: 48px; }

.empty { text-align: center; padding: 48px; color: var(--gray); border: 1px dashed var(--light); border-radius: var(--radius-lg); }
.warn-banner { background: #FEF3C7; color: #92400E; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 24px; font-size: 0.875rem; }
