:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-d: #1e3a8a;
  --ok: #16a34a;
  --err: #dc2626;
  --err-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --dup: #7c3aed;
  --dup-bg: #ede9fe;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: #f1f5f9; color: var(--ink); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--bg); color: #fff; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center; background: var(--brand); border-radius: 12px; }
.brand h1 { margin: 0; font-size: 19px; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: #94a3b8; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: #1e293b; }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.conn.ok .dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.conn.fail .dot { background: #f87171; }
.conn.checking .dot { background: #fbbf24; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.muted { color: var(--muted); font-size: 13px; }

.config { background: var(--panel); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.config-grid { display: grid; grid-template-columns: 1.3fr .8fr 1fr; gap: 22px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray); margin-bottom: 7px; }
.period { display: flex; align-items: center; gap: 8px; }
.period input, #eixo { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; }
#eixo { width: 100%; background: #fff; }
.shortcuts { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 12.5px; padding: 0; }
.link:hover { text-decoration: underline; }

.dropzone { border: 2px dashed #cbd5e1; border-radius: 12px; cursor: pointer; transition: .15s; }
.dropzone.sm { padding: 14px; text-align: center; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #f8fafc; }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); padding: 5px 10px; border-radius: 9px; font-size: 12.5px; }
.file-chip .rm { cursor: pointer; color: var(--muted); font-weight: 700; }
.file-chip .rm:hover { color: var(--err); }
.file-chip .fdata { color: var(--brand); font-weight: 600; }
.file-chip .fdata.erro { color: var(--err); }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.check-group h3 { margin: 0 0 10px; font-size: 14px; }
.check-items { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; cursor: pointer; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; }
.check:hover { background: #f8fafc; }
.check input { margin-top: 2px; }
.check .ct { font-weight: 600; }
.check .cd { color: var(--muted); font-size: 12px; }
.check code { background: #eef2ff; color: var(--brand); border-radius: 5px; padding: 0 5px; font-size: 11px; }

.nota { margin-top: 8px; font-size: 12px; color: var(--muted); }
.nota.ok { color: var(--ok); }
.nota.hidden { display: none; }

.aviso { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: var(--warn-bg);
  border: 1px solid #fcd34d; color: #92400e; font-size: 13.5px; }
.aviso.hidden { display: none; }
.aviso b { color: #78350f; }
.aviso .aviso-acoes { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.aviso .btn-sm { border: 0; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.aviso .btn-sm.fix { background: var(--warn); color: #fff; }
.aviso .btn-sm.fix:hover { background: #b45309; }
.aviso .btn-sm.ghost { background: transparent; color: #92400e; text-decoration: underline; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; }
.btn { border: 0; border-radius: 10px; padding: 11px 24px; font-size: 14px; font-weight: 600; cursor: pointer; transition: .12s; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:not(:disabled):hover { background: var(--brand-d); }
.btn.outline { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.outline:hover { border-color: var(--brand); color: var(--brand); }
.status-msg { font-size: 13.5px; color: var(--muted); }
.status-msg.err { color: var(--err); }

.progresso { background: #fff; border-radius: 14px; padding: 18px 22px; box-shadow: var(--shadow); margin-top: 18px; }
.bar { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #3b82f6); transition: width .3s; }

.stats { display: flex; gap: 24px; flex-wrap: wrap; margin: 20px 0 14px; font-size: 13.5px; color: var(--gray); }
.stats b { color: var(--ink); font-size: 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.card { background: #fff; border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); border-left: 4px solid var(--line); }
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 21px; font-weight: 700; margin-top: 3px; }
.card .sub { font-size: 11.5px; color: var(--muted); }
.card.dup { border-left-color: var(--dup); }
.card.aloc { border-left-color: var(--err); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 8px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 16px; font-size: 13.5px; cursor: pointer; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .badge { background: #e2e8f0; color: var(--ink); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; margin-left: 6px; }
.tab.active .badge { background: rgba(255,255,255,.25); color: #fff; }
.toolbar-right { display: flex; gap: 10px; }
.search { padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; min-width: 280px; }

.achados { display: flex; flex-direction: column; gap: 12px; }
.achado { background: #fff; border-radius: 12px; box-shadow: var(--shadow); border-left: 4px solid var(--line); overflow: hidden; }
.achado.alta { border-left-color: var(--err); }
.achado.media { border-left-color: var(--warn); }
.achado-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.achado-head .tipo { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: var(--dup-bg); color: var(--dup); }
.achado.aloc .achado-head .tipo { background: var(--err-bg); color: var(--err); }
.achado-head .desc { flex: 1; font-size: 13.5px; }
.achado-head .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.achado-body { padding: 0 16px 14px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--gray); font-weight: 600; font-size: 11.5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.met { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--brand); }
.met.PIX { background: #dcfce7; color: #15803d; }
.met.Boleto { background: #fef3c7; color: #b45309; }
.met.Gateway { background: #e0e7ff; color: #4338ca; }
.tag-banco { font-size: 11px; color: var(--muted); }
.st-R { color: var(--ok); font-weight: 600; }
.st-A, .st-C { color: var(--err); font-weight: 600; }
/* !important: utilitário de ocultar deve vencer regras com display próprio
   declaradas depois (ex.: .dash { display: grid }) */
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.login-card { background: #fff; border-radius: 18px; padding: 34px 38px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { font-size: 30px; width: 58px; height: 58px; display: grid; place-items: center; background: var(--brand); color: #fff; border-radius: 15px; margin: 0 auto 14px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card form { text-align: left; margin-top: 22px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray); margin: 12px 0 5px; }
.login-card input { width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.login-card input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.login-card .btn { width: 100%; margin-top: 18px; }
.login-erro { margin-top: 14px; padding: 10px 13px; border-radius: 9px; background: var(--err-bg); color: var(--err); font-size: 13px; }

/* ---------- Configuração de bases IXC ---------- */
.config-btn { background: #1e293b; border: 0; color: #cbd5e1; border-radius: 10px; width: 36px; height: 36px; font-size: 17px; cursor: pointer; }
.config-btn:hover { background: #334155; color: #fff; }
.config-bases { background: #fff; border-radius: 16px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid var(--line); }
.cb-head { display: flex; align-items: center; justify-content: space-between; }
.cb-head h2 { margin: 0; font-size: 17px; }
.bases-lista { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 20px; }
.base-row { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; }
.base-info { flex: 1; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.base-info .tok { background: #f1f5f9; border-radius: 6px; padding: 2px 8px; font-size: 11.5px; color: var(--gray); }
.base-st { font-size: 12.5px; min-width: 90px; }
.base-st.ok { color: var(--ok); font-weight: 600; }
.base-st.err { color: var(--err); font-weight: 600; }
.base-acoes { display: flex; gap: 6px; }
.btn-sm-b { padding: 6px 12px !important; font-size: 12.5px !important; }
.btn-sm-b.perigo:hover { border-color: var(--err) !important; color: var(--err) !important; }
.config-bases h3 { font-size: 14px; margin: 0 0 10px; }
.base-form .bf-grid { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; }
.base-form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray); margin-bottom: 5px; }
.base-form input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; }
.bf-acoes { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
#field-base { margin-bottom: 12px; }
#base { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; background: #fff; margin-bottom: 4px; }

/* ---------- Usuário logado (topbar) ---------- */
.top-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-chip .user-nome { color: #cbd5e1; }
.user-chip .sair { background: #1e293b; border: 0; color: #94a3b8; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.user-chip .sair:hover { background: #334155; color: #fff; }

/* ---------- Severidade baixa (informativo) ---------- */
.achado.baixa { border-left-color: #64748b; }
.achado.baixa .achado-head .tipo { background: #e2e8f0; color: #475569; }

/* ---------- Dashboard ---------- */
.dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.dash-panel { background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.dash-panel h3 { margin: 0 0 14px; font-size: 14px; color: var(--gray); }
.dash-panel.full { grid-column: 1 / -1; }
.hbar { display: grid; grid-template-columns: 150px 1fr 110px; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.hbar .hlabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.hbar .htrack { background: #f1f5f9; border-radius: 999px; height: 18px; overflow: hidden; }
.hbar .hfill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #3b82f6); min-width: 2px; }
.hbar.met-PIX .hfill { background: linear-gradient(90deg, #16a34a, #4ade80); }
.hbar.met-Boleto .hfill { background: linear-gradient(90deg, #d97706, #fbbf24); }
.hbar.met-Gateway .hfill { background: linear-gradient(90deg, #4338ca, #818cf8); }
.hbar.met-Cartão .hfill { background: linear-gradient(90deg, #be185d, #f472b6); }
.hbar .hval { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar .hval .hqtd { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 8px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.vbar .vfill { width: 100%; max-width: 46px; background: linear-gradient(180deg, #3b82f6, var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.vbar .vlabel { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.vbar .vval { font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
