:root{
  --bg:#f3f6fa;--surface:#fff;--line:#dfe7f0;--text:#1d2a38;--muted:#6c7c8f;
  --navy:#0c3558;--navy2:#134f7b;--blue:#1976c9;--green:#13a665;--cyan:#0d92b4;
  --orange:#f28a2e;--purple:#7652c8;--red:#e45858;--shadow:0 8px 26px rgba(21,54,84,.08);
  --kr:#10a060;--acert:#1976c9;--access:#f28a2e;
}
*{box-sizing:border-box}
html{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:var(--bg)}
body{margin:0;background:linear-gradient(180deg,#eef4f9 0,#f6f8fb 360px,#f3f6fa 100%);min-height:100vh}
button,input,select{font:inherit}
button{cursor:pointer}.hidden{display:none!important}
.topbar{min-height:120px;background:linear-gradient(120deg,#0a3559 0%,#0d4771 60%,#113c5f 100%);color:#fff;padding:22px 28px;display:flex;justify-content:space-between;gap:28px;align-items:center;box-shadow:0 10px 30px rgba(9,43,72,.18);position:relative;z-index:4}
.brand-wrap{display:flex;gap:15px;align-items:center;min-width:360px}.brand-mark{width:54px;height:54px;border-radius:15px;background:linear-gradient(145deg,#fff,#d8f1e5);color:#087347;display:grid;place-items:center;font-weight:900;letter-spacing:-1px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.75),0 8px 24px rgba(0,0,0,.15)}
.eyebrow{font-size:11px;letter-spacing:.13em;font-weight:800;color:#9ed6ef;margin-bottom:3px}.topbar h1{font-size:25px;line-height:1.1;margin:0 0 4px;letter-spacing:-.02em}.topbar p{margin:0;color:#c9dcea;font-size:13px}.header-right{display:flex;align-items:center;gap:22px}.header-meta{display:flex;align-items:center;gap:18px}.meta-item{display:flex;flex-direction:column;min-width:135px}.meta-label{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:#9bbbd0;margin-bottom:4px}.meta-item strong{font-size:13px}.meta-divider{width:1px;height:40px;background:rgba(255,255,255,.25)}.header-actions{display:flex;gap:8px}
.btn{border:0;border-radius:10px;padding:10px 14px;font-weight:800;font-size:12px;display:inline-flex;gap:7px;align-items:center;justify-content:center;transition:.18s ease}.btn:hover{transform:translateY(-1px)}.btn-primary{background:#15a366;color:#fff;box-shadow:0 6px 16px rgba(21,163,102,.25)}.btn-primary:hover{background:#118d59}.btn-ghost{background:rgba(255,255,255,.1);color:#fff;border:1px solid rgba(255,255,255,.22)}.btn-ghost:hover{background:rgba(255,255,255,.16)}.btn-secondary{background:#eaf2f8;color:#164c73;border:1px solid #d2e3ef}.btn-danger{background:#fff1f1;color:#bc3838;border:1px solid #f4c8c8}.btn-icon{font-size:15px}
.shell{display:grid;grid-template-columns:220px minmax(0,1fr);max-width:1600px;margin:0 auto;min-height:calc(100vh - 120px)}.sidebar{padding:18px 14px 24px;background:rgba(244,248,251,.86);border-right:1px solid #dde6ee;position:sticky;top:0;height:calc(100vh - 0px);align-self:start;overflow:auto}.sidebar-title{display:flex;align-items:center;justify-content:space-between;font-size:12px;text-transform:uppercase;letter-spacing:.09em;font-weight:900;color:#536b80;margin:3px 4px 13px}.filter-dot{width:8px;height:8px;border-radius:50%;background:#cbd6df}.filter-dot.active{background:#18a867;box-shadow:0 0 0 4px rgba(24,168,103,.12)}.filter-field{display:block;margin-bottom:11px}.filter-field>span{display:block;font-size:10px;font-weight:800;color:#6a7d8f;margin:0 0 5px 4px}.filter-field input,.filter-field select{width:100%;height:39px;border:1px solid #d8e3ec;background:#fff;border-radius:9px;color:#27384a;padding:0 10px;outline:none;font-size:12px;box-shadow:0 2px 7px rgba(33,67,96,.03)}.filter-field input:focus,.filter-field select:focus{border-color:#86b8d8;box-shadow:0 0 0 3px rgba(37,126,183,.08)}.btn-reset{width:100%;background:#164f76;color:#fff;margin-top:3px}.sidebar-info{margin-top:18px;background:#eef8f3;border:1px solid #d8eee3;border-radius:12px;padding:12px;display:flex;gap:9px}.sidebar-info-icon{width:24px;height:24px;flex:0 0 auto;border-radius:8px;background:#16a366;color:#fff;display:grid;place-items:center;font-size:12px;font-weight:900}.sidebar-info strong{font-size:11px;color:#275842}.sidebar-info p{font-size:10px;line-height:1.45;color:#61796a;margin:3px 0 0}
.content{padding:18px 18px 38px;min-width:0}.loading-card,.empty-state{background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}.loading-card{display:flex;align-items:center;gap:14px;padding:22px}.loading-card strong{display:block;font-size:13px}.loading-card span{font-size:11px;color:var(--muted)}.spinner{width:26px;height:26px;border:3px solid #dbe7ef;border-top-color:#1676b8;border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.empty-state{text-align:center;padding:58px 24px}.empty-icon{width:56px;height:56px;border-radius:16px;background:#eaf3f8;color:#1c6e9f;display:grid;place-items:center;margin:0 auto 14px;font-size:27px}.empty-state h2{margin:0 0 7px;font-size:20px}.empty-state p{max-width:600px;margin:0 auto 18px;color:var(--muted);font-size:12px;line-height:1.55}
.kpi-grid{display:grid;grid-template-columns:repeat(5,minmax(150px,1fr));gap:10px;margin-bottom:10px}.kpi-card{background:#fff;border:1px solid #e0e7ee;border-radius:12px;min-height:106px;padding:13px 15px;box-shadow:0 4px 14px rgba(32,65,91,.055);position:relative;overflow:hidden}.kpi-card:after{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:var(--accent)}.kpi-blue{--accent:#1b6eb2}.kpi-green{--accent:#14a365}.kpi-cyan{--accent:#0c94b5}.kpi-purple{--accent:#7356c4}.kpi-slate{--accent:#64788c}.kpi-top{display:flex;justify-content:space-between;color:#64778a;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.045em}.kpi-icon{font-size:14px;color:var(--accent)}.kpi-card>strong{display:block;font-size:26px;line-height:1.05;margin:9px 0 3px;color:#1d2e40;letter-spacing:-.035em}.kpi-card small{color:#8795a2;font-size:9.5px}
.company-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:10px}.company-card{background:#fff;border:1px solid #e0e7ee;border-radius:12px;padding:12px 14px;box-shadow:0 4px 14px rgba(32,65,91,.045);display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;border-top:3px solid var(--company)}.company-card.kr{background:linear-gradient(130deg,#fff 55%,#effaf4)}.company-name{display:flex;align-items:center;gap:8px;font-weight:900;font-size:12px}.company-dot{width:9px;height:9px;border-radius:50%;background:var(--company)}.company-statline{display:flex;gap:18px;margin-top:8px}.company-statline div{display:flex;flex-direction:column}.company-statline strong{font-size:15px}.company-statline span{font-size:9px;color:#8291a0;text-transform:uppercase;font-weight:700}.company-share{text-align:right}.company-share strong{font-size:20px;color:var(--company)}.company-share span{display:block;font-size:9px;color:#8a98a6}
.chart-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.panel{background:#fff;border:1px solid #e0e7ee;border-radius:12px;box-shadow:0 4px 14px rgba(32,65,91,.045);padding:12px 13px;min-width:0}.panel-wide{grid-column:span 2}.panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:8px}.panel-head h3{font-size:12px;margin:0 0 2px}.panel-head p{font-size:9.5px;margin:0;color:#81909f}.panel-badge{font-size:9px;background:#edf4f8;color:#4c6c82;border:1px solid #dae7ef;border-radius:999px;padding:4px 7px;font-weight:800;white-space:nowrap}.chart-wrap{position:relative;height:215px}.chart-lg{height:245px}.table-grid{display:grid;grid-template-columns:1.25fr 1fr;gap:10px;margin-top:10px}.table-panel{padding-bottom:5px}.table-scroll{overflow:auto}.table-scroll table{width:100%;border-collapse:collapse;white-space:nowrap}.table-scroll th{font-size:9px;text-align:left;color:#6f8090;text-transform:uppercase;letter-spacing:.03em;padding:8px;border-bottom:1px solid #dde6ed}.table-scroll td{font-size:10px;padding:8px;border-bottom:1px solid #edf1f4;color:#344657}.table-scroll tbody tr:last-child td{border-bottom:0}.table-scroll tbody tr.kr-row{background:#f2fbf6}.table-scroll td.num{text-align:right;font-variant-numeric:tabular-nums}.company-pill{display:inline-flex;align-items:center;gap:6px;font-weight:800}.company-pill:before{content:"";width:7px;height:7px;border-radius:50%;background:var(--pill)}.privacy-note{margin-top:10px;background:#eff7f4;border:1px solid #d9ebe4;border-radius:11px;padding:11px 13px;display:flex;gap:9px;color:#4d6e61;font-size:10px;line-height:1.45}.privacy-note strong{color:#2c5c49}
.modal{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:18px}.modal-backdrop{position:absolute;inset:0;background:rgba(8,25,40,.58);backdrop-filter:blur(3px)}.modal-card{position:relative;width:min(720px,96vw);max-height:88vh;overflow:auto;background:#fff;border-radius:18px;box-shadow:0 28px 70px rgba(0,0,0,.25);padding:20px}.modal-lg{width:min(850px,96vw)}.modal-head{display:flex;justify-content:space-between;gap:15px;margin-bottom:15px}.modal-kicker{font-size:9px;letter-spacing:.13em;color:#128052;font-weight:900}.modal-head h2{font-size:20px;margin:2px 0 4px}.modal-head p{font-size:11px;color:#758798;margin:0;max-width:660px;line-height:1.45}.modal-close{width:34px;height:34px;border:1px solid #dce4eb;border-radius:10px;background:#f7f9fb;color:#506273;font-size:22px;line-height:1}.dropzone{border:2px dashed #bed3e1;background:#f6fafc;border-radius:15px;padding:26px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:5px;transition:.18s}.dropzone.drag{border-color:#17a266;background:#f1fbf6}.drop-icon{font-size:28px;color:#1c709e}.dropzone strong{font-size:14px}.dropzone span{font-size:10px;color:#7b8c9a}.dropzone .btn{margin-top:7px}.import-rules{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0}.import-rules>div{border:1px solid #e0e7ed;border-radius:11px;padding:9px;display:flex;gap:8px}.import-rules>div>span{width:21px;height:21px;border-radius:7px;background:#eaf4f0;color:#118356;display:grid;place-items:center;font-size:10px;font-weight:900;flex:0 0 auto}.import-rules p{font-size:9px;line-height:1.4;margin:0;color:#718191}.import-rules strong{font-size:10px;color:#405466}.upload-queue{display:grid;gap:8px}.upload-item{border:1px solid #e0e7ed;border-radius:11px;padding:10px 11px}.upload-row{display:flex;justify-content:space-between;gap:12px;align-items:center}.upload-name{font-size:11px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.upload-status{font-size:9px;color:#718293;white-space:nowrap}.progress{height:6px;border-radius:999px;background:#edf2f5;overflow:hidden;margin-top:8px}.progress>span{display:block;height:100%;width:0;background:linear-gradient(90deg,#176fa8,#15a366);transition:width .2s}.upload-item.error{border-color:#f0bcbc;background:#fff7f7}.upload-item.done{border-color:#c8e6d6;background:#f7fcf9}.bases-list{display:grid;gap:8px}.base-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;border:1px solid #e0e7ed;border-radius:12px;padding:11px}.base-name{font-size:11px;font-weight:900;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.base-meta{font-size:9px;color:#7b8b99;margin-top:4px;display:flex;gap:10px;flex-wrap:wrap}.base-badge{display:inline-flex;background:#eaf7f0;color:#13774f;border-radius:999px;padding:3px 6px;font-size:8px;font-weight:900}.toast-container{position:fixed;right:18px;bottom:18px;z-index:70;display:grid;gap:8px;width:min(360px,calc(100vw - 36px))}.toast{background:#163c57;color:#fff;border-radius:12px;padding:12px 13px;box-shadow:0 12px 35px rgba(0,0,0,.2);font-size:11px;line-height:1.4;animation:toastIn .2s ease}.toast.error{background:#a43c3c}.toast.success{background:#14724d}@keyframes toastIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media(max-width:1150px){.kpi-grid{grid-template-columns:repeat(3,1fr)}.chart-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.panel-wide{grid-column:span 2}.header-meta{display:none}}
@media(max-width:820px){.topbar{align-items:flex-start;flex-direction:column;padding:17px;gap:14px}.brand-wrap{min-width:0}.header-right{width:100%;justify-content:flex-end}.shell{grid-template-columns:1fr}.sidebar{position:relative;height:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;border-right:0;border-bottom:1px solid #dde6ee;padding:12px}.sidebar-title,.sidebar-info{grid-column:1/-1}.filter-field{margin:0}.btn-reset{grid-column:1/-1}.content{padding:12px}.kpi-grid,.company-grid{grid-template-columns:1fr 1fr}.chart-grid,.table-grid{grid-template-columns:1fr}.panel-wide{grid-column:auto}.import-rules{grid-template-columns:1fr}.topbar h1{font-size:21px}}
@media(max-width:520px){.kpi-grid,.company-grid{grid-template-columns:1fr}.header-actions{width:100%}.header-actions .btn{flex:1}.brand-mark{width:46px;height:46px}.chart-wrap{height:230px}.modal{padding:8px}.modal-card{padding:14px}.sidebar{grid-template-columns:1fr 1fr}}

/* Sidebar recolhível / expansível */
.shell{transition:grid-template-columns .24s ease}
.sidebar{transition:padding .24s ease,background .24s ease}
.sidebar-title{min-height:34px;gap:8px;margin:0 0 13px}
.sidebar-title-copy{display:flex;align-items:center;gap:7px;min-width:0}
.sidebar-filter-icon{width:24px;height:24px;display:grid;place-items:center;border-radius:8px;background:#e7eff5;color:#285f83;font-size:16px;line-height:1;font-weight:900;flex:0 0 auto}
.sidebar-title-text{white-space:nowrap;overflow:hidden;transition:opacity .14s ease,width .2s ease}
.sidebar-title .filter-dot{flex:0 0 auto}
.sidebar-toggle{width:30px;height:30px;border:1px solid #d5e1ea;border-radius:9px;background:#fff;color:#315d7b;display:grid;place-items:center;flex:0 0 auto;box-shadow:0 2px 7px rgba(33,67,96,.05);transition:background .18s ease,border-color .18s ease,transform .18s ease}
.sidebar-toggle:hover{background:#edf5fa;border-color:#bfd2df}
.sidebar-toggle span{font-size:24px;line-height:1;transform:translateY(-1px)}
.shell.sidebar-collapsed{grid-template-columns:64px minmax(0,1fr)}
.shell.sidebar-collapsed .sidebar{padding-left:10px;padding-right:10px;overflow:hidden}
.shell.sidebar-collapsed .sidebar-title{justify-content:center;margin-bottom:0;flex-direction:column;gap:8px}
.shell.sidebar-collapsed .sidebar-title-copy{justify-content:center}
.shell.sidebar-collapsed .sidebar-title-text,
.shell.sidebar-collapsed .sidebar-title .filter-dot,
.shell.sidebar-collapsed .filter-field,
.shell.sidebar-collapsed .btn-reset,
.shell.sidebar-collapsed .sidebar-info{display:none}
.shell.sidebar-collapsed .sidebar-toggle{width:34px;height:34px}
.shell.sidebar-collapsed .sidebar-filter-icon{width:34px;height:34px;border-radius:10px}

@media(max-width:820px){
  .sidebar-title{display:flex;grid-column:1/-1;margin:0;min-height:38px}
  .sidebar-title-copy{flex:1}
  .sidebar-toggle{margin-left:auto}
  .shell.sidebar-collapsed{grid-template-columns:1fr}
  .shell.sidebar-collapsed .sidebar{display:flex;height:62px;min-height:62px;padding:11px 12px;overflow:hidden;align-items:center;border-bottom:1px solid #dde6ee}
  .shell.sidebar-collapsed .sidebar-title{width:100%;flex-direction:row;justify-content:space-between;margin:0;gap:8px}
  .shell.sidebar-collapsed .sidebar-title-copy{justify-content:flex-start;flex:1}
  .shell.sidebar-collapsed .sidebar-title-text{display:inline;opacity:1;width:auto}
  .shell.sidebar-collapsed .sidebar-title .filter-dot{display:inline-block}
  .shell.sidebar-collapsed .sidebar-filter-icon{width:28px;height:28px;border-radius:8px}
  .shell.sidebar-collapsed .sidebar-toggle{width:34px;height:34px}
}

/* Sidebar v1.2 - controle independente e sempre clicável */
#dashboardSidebar{position:sticky;top:0;overflow:visible}
#dashboardSidebar .sidebar-toggle{
  position:absolute;
  top:17px;
  right:-15px;
  z-index:15;
  width:30px;
  height:38px;
  border-radius:0 10px 10px 0;
  border:1px solid #cad9e4;
  border-left:0;
  background:#fff;
  color:#245a7d;
  display:grid;
  place-items:center;
  box-shadow:5px 3px 12px rgba(31,66,94,.12);
}
#dashboardSidebar .sidebar-toggle:hover{background:#edf5fa}
#dashboardSidebar .sidebar-toggle:active{transform:translateX(1px)}
#dashboardSidebar .sidebar-toggle span{font-size:25px;line-height:1;transform:translateY(-1px)}
.shell.sidebar-collapsed{grid-template-columns:58px minmax(0,1fr)}
.shell.sidebar-collapsed #dashboardSidebar{padding:18px 8px 24px;overflow:visible}
.shell.sidebar-collapsed #dashboardSidebar .sidebar-title{justify-content:center;margin:0}
.shell.sidebar-collapsed #dashboardSidebar .sidebar-title-copy{justify-content:center;width:100%}
.shell.sidebar-collapsed #dashboardSidebar .sidebar-title-text,
.shell.sidebar-collapsed #dashboardSidebar .filter-dot,
.shell.sidebar-collapsed #dashboardSidebar .filter-field,
.shell.sidebar-collapsed #dashboardSidebar .btn-reset{display:none}
.shell.sidebar-collapsed #dashboardSidebar .sidebar-filter-icon{width:34px;height:34px;border-radius:10px}
.shell.sidebar-collapsed #dashboardSidebar .sidebar-toggle{right:-15px}

@media(max-width:820px){
  #dashboardSidebar{position:relative;overflow:visible}
  #dashboardSidebar .sidebar-toggle{top:12px;right:12px;border-left:1px solid #cad9e4;border-radius:10px;width:36px;height:36px;box-shadow:0 3px 10px rgba(31,66,94,.10)}
  #dashboardSidebar .sidebar-title{padding-right:48px}
  .shell.sidebar-collapsed{grid-template-columns:1fr}
  .shell.sidebar-collapsed #dashboardSidebar{display:block;height:60px;min-height:60px;padding:11px 12px;overflow:visible}
  .shell.sidebar-collapsed #dashboardSidebar .sidebar-title{display:flex;width:100%;padding-right:48px;justify-content:flex-start;align-items:center}
  .shell.sidebar-collapsed #dashboardSidebar .sidebar-title-copy{justify-content:flex-start}
  .shell.sidebar-collapsed #dashboardSidebar .sidebar-title-text{display:inline}
  .shell.sidebar-collapsed #dashboardSidebar .filter-dot{display:inline-block}
  .shell.sidebar-collapsed #dashboardSidebar .sidebar-filter-icon{width:28px;height:28px;border-radius:8px}
}
