:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;color:#e4ebff;background:#0a1020;color-scheme:dark}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{background:#242f4c;color:#e7ecfc;border:1px solid #465272;border-radius:9px;padding:10px 14px;cursor:pointer;font-weight:600}button:hover{background:#324267}button:disabled{opacity:.45;cursor:not-allowed}.primary{background:#5368e9;border-color:#637aff;color:white}.primary:hover{background:#6c80f7}.ghost{background:transparent}h1,h2,h3,p{margin-top:0}h1{font-size:25px}h2{font-size:18px}h3{font-size:14px}p{line-height:1.6;color:#afbbd7;font-size:14px}a{color:#a8bfff}.emblem{background:linear-gradient(135deg,#6b83ff,#3340ad);display:grid;place-items:center;width:38px;height:38px;border-radius:10px;color:white;font-weight:800;font-size:15px;flex-shrink:0}#shell{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}#shell[hidden],.page[hidden],#gate[hidden],[hidden]{display:none!important}aside{background:#0f172a;border-right:1px solid #29334b;padding:23px 15px;display:flex;flex-direction:column;gap:40px;position:sticky;top:0;height:100vh}.brand{display:flex;gap:11px;align-items:center;padding:3px 10px}.brand strong{font-size:16px}.brand small{display:block;font-size:11px;color:#92a4ca;margin-top:3px}.nav{display:flex;flex-direction:column;gap:7px}.nav button{text-align:left;background:transparent;border:0;font-size:13px;font-weight:550;padding:12px 13px;color:#b3c0dc}.nav button.active,.nav button:hover{background:#23335a;color:white}.bottom{margin-top:auto;display:flex;align-items:center;justify-content:space-between;font-size:12px;color:#9cadd3;padding:8px}.bottom button{padding:7px 10px;font-size:12px}main{padding:30px clamp(18px,3.2vw,55px);max-width:1650px;width:100%;min-width:0}header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:24px;border-bottom:1px solid #29334b;padding-bottom:20px}header h1{margin-bottom:6px}header p{margin:0}.header-right{display:flex;align-items:center;gap:11px;font-size:12px;color:#a3b1d2}.dot{width:8px;height:8px;border-radius:50%;background:#50d3ad}.page{display:flex;flex-direction:column;gap:18px}.metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.metric,.panel{background:#131e34;border:1px solid #2c3954;border-radius:13px;padding:22px}.metric{display:flex;flex-direction:column;gap:13px}.metric span{font-size:12px;color:#a3b1d2}.metric strong{font-size:23px;letter-spacing:-.4px;overflow-wrap:anywhere}.columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.panel h2{margin-bottom:12px}.panel-title{display:flex;justify-content:space-between;gap:15px;align-items:flex-start}.button-row{display:flex;flex-wrap:wrap;gap:9px;align-items:center}.note{font-size:12px;color:#93a4c8;margin:13px 0 0}.progress{height:11px;background:#2c3653;border-radius:20px;overflow:hidden}.progress>div{background:linear-gradient(90deg,#4d66ec,#7c96fd);height:100%;transition:width .3s}.split{display:grid;grid-template-columns:minmax(0,2.5fr) minmax(180px,1fr);gap:20px}.tables{max-height:250px;overflow:auto;font-size:12px}.tables>div{padding:5px 0;color:#acc4e4;border-bottom:1px solid #28334c}label{display:block;font-size:13px;color:#b9c5e0;margin:14px 0 10px}input,select,textarea{display:block;background:#0c152a;color:#e2eafa;border:1px solid #3b4967;border-radius:8px;padding:11px;width:100%;margin-top:7px}textarea{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;line-height:1.6;resize:vertical}.inline{display:flex;align-items:center;gap:10px;margin:0}.inline select{margin:0;width:85px}.check{display:flex;gap:8px;align-items:center}.check input{width:auto;margin:0}.data{border-collapse:collapse;width:100%;font-size:12px;margin-top:15px;overflow-wrap:anywhere}.data th,.data td{text-align:left;border-bottom:1px solid #2b3956;padding:11px 9px;vertical-align:top}.data th{color:#aabadd;font-size:11px}.table-wrap{overflow:auto;max-height:520px}.mono,.log,.secret{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere}.log{background:#0b1426;border:1px solid #2f3d59;padding:17px;border-radius:8px;max-height:460px;overflow:auto;line-height:1.5}.secret{color:#8dffe0}.alert{border:1px solid #5b628d;background:#28365c;color:#e6edff;border-radius:9px;padding:13px 17px;margin-bottom:18px;font-size:13px}.error{color:#ff98a2}.danger{color:#ff9fa6;border-color:#8b4a57}.muted{color:#94a5cb;font-size:12px}.pill{padding:4px 9px;border-radius:7px;background:#253558;color:#bdd0ff;font-size:11px}.auth-window{min-height:100vh;display:grid;place-items:center;padding:20px}.auth-card{width:min(460px,100%);background:#131e34;padding:32px;border:1px solid #2e3d5b;border-radius:16px}.auth-card .emblem{margin-bottom:20px}.auth-card button{width:100%;margin-top:15px}.auth-card label{margin:19px 0}.panel hr{border:0;border-top:1px solid #34415d;margin:23px 0}footer{font-size:11px;color:#667899;margin-top:30px}@media(max-width:1050px){.metric-grid{grid-template-columns:repeat(2,1fr)}.columns{grid-template-columns:1fr}}@media(max-width:760px){#shell{display:block}aside{position:static;height:auto;padding:10px;gap:10px}.brand{padding:5px}.nav{flex-direction:row;overflow-x:auto}.nav button{white-space:nowrap;padding:9px}.bottom{display:none}main{padding:20px 12px}header{flex-direction:column}.split{grid-template-columns:1fr}.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.metric,.panel{padding:14px}.metric strong{font-size:18px}.panel-title{flex-direction:column}}@media(max-width:390px){.metric-grid{grid-template-columns:1fr}}

/* Exportação CSV: progresso persistente e link de download visível */
.export-status{background:#142642;border:1px solid #375781;color:#dce8ff;border-radius:9px;padding:12px 14px;font-size:13px;margin-top:14px}
.download-link{display:inline-flex;align-items:center;justify-content:center;background:#355bc0;color:#fff;border:1px solid #6781e7;border-radius:9px;padding:10px 14px;text-decoration:none;font-size:13px;font-weight:600;cursor:pointer}
.download-link:hover{background:#456bd4}
#exportDownload{margin-top:10px}

/* Pesquisa simples/avançada e paginação sem limite global de resultados */
.search-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(215px,1fr));gap:8px 17px}
.search-grid label{min-width:0}
.search-results{min-width:0;max-width:100%}
.rule-list{display:flex;flex-direction:column;gap:9px;margin:18px 0}
.rule-row{display:grid;grid-template-columns:minmax(155px,2fr) minmax(135px,1fr) minmax(175px,2fr) auto;gap:10px;padding:12px;border:1px solid #394869;border-radius:9px;background:#0e1931;align-items:center}
.rule-row input,.rule-row select{margin:0}
.pager{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:15px 0}
.pager-label{font-size:13px;color:#c6d5f1}.pager-jump{width:94px;margin:0}.search-results .table-wrap{max-height:580px}
@media(max-width:800px){.rule-row{grid-template-columns:1fr 1fr}.rule-row .rule-value{grid-column:1/2}}
@media(max-width:520px){.rule-row{grid-template-columns:1fr}.rule-row .rule-value{grid-column:auto}}

.checkbox-line{display:flex;align-items:center;gap:8px;font-size:12px;color:#b8c8e7;margin-top:9px}.checkbox-line input{width:auto;margin:0}
/* Log modes. Keep the original raw-text style in both tabs. */
.log-tabs{display:flex;gap:8px;flex-wrap:wrap;border-bottom:1px solid #34415d;margin:12px 0 13px;padding-bottom:10px}
.log-tabs button{background:#182844;color:#bbc9e8;border-color:#344663}
.log-tabs button.active,.log-tabs button[aria-selected="true"]{background:#5368e9;border-color:#637aff;color:#fff}
.log-tabs button:focus-visible{outline:2px solid #aac0ff;outline-offset:2px}

/* Fixed log viewport: changing tabs or refreshing must never resize the GUI.
   Preserve 80-character dividers and the original terminal alignment. */
#paneExecution .log,#paneTechnical .log{
  height:460px;min-height:460px;max-height:460px;
  overflow:auto;white-space:pre;overflow-wrap:normal;
  font-variant-ligatures:none;tab-size:4;scrollbar-gutter:stable;
  overscroll-behavior:contain;
}
@media(max-width:760px){
  #paneExecution .log,#paneTechnical .log{height:380px;min-height:380px;max-height:380px;}
}

/* Console como no CNPJ Station: alinhamento preservado, tamanho fixo nas duas abas. */
#logContent.log,#technicalLogContent.log{
  height:460px;min-height:460px;max-height:460px;
  white-space:pre;overflow-wrap:normal;overflow:auto;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-variant-ligatures:none;tab-size:4;scrollbar-gutter:stable;
  overscroll-behavior:contain;
}
@media(max-width:760px){
  #logContent.log,#technicalLogContent.log{height:380px;min-height:380px;max-height:380px;}
}
