:root{--bg-app: #F8FAFC;--bg-surface: #FFFFFF;--bg-surface-secondary: #F1F5F9;--bg-topbar: #0F172A;--color-text-main: #0F172A;--color-text-muted: #64748B;--color-text-inverse: #FFFFFF;--border-color: #E2E8F0;--border-color-dark: #CBD5E1;--color-primary: #1E3A8A;--color-primary-hover: #1E40AF;--color-secondary: #0F766E;--color-accent: #D97706;--color-accent-soft: #FEF3C7;--color-emerald: #10B981;--color-emerald-soft: #D1FAE5;--color-danger: #EF4444;--font-body: "Inter", system-ui, -apple-system, sans-serif;--font-mono: "IBM Plex Mono", monospace;--font-display: "Space Grotesk", "Inter", sans-serif;--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05)}*{box-sizing:border-box;margin:0;padding:0}body{font-family:var(--font-body);background-color:var(--bg-app);color:var(--color-text-main);font-size:13px;line-height:1.5;-webkit-font-smoothing:antialiased}button,input,select,textarea{font-family:inherit;font-size:inherit}.hidden{display:none!important}.modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0f172abf;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:999999;display:flex;align-items:center;justify-content:center;padding:1rem}body.fullscreen-matrix-active .modal-overlay{z-index:999999}.modal-card{background:var(--bg-surface);border-radius:12px;box-shadow:var(--shadow-lg);width:100%;max-width:440px;padding:2rem;border:1px solid var(--border-color)}.modal-card.modal-large{max-width:760px}.modal-header h3{font-family:var(--font-display);font-size:1.25rem;color:var(--color-primary);margin-bottom:.25rem}.modal-header p{color:var(--color-text-muted);font-size:.85rem;margin-bottom:1.25rem}.brand-logo{display:flex;align-items:center;gap:.5rem;color:var(--color-primary);font-weight:700;font-size:.9rem;margin-bottom:1rem}.form-group{margin-bottom:1rem;display:flex;flex-direction:column;gap:.35rem}.form-group label{font-weight:600;font-size:.8rem;color:var(--color-text-main)}.form-group input,.form-group select,.form-group textarea,.select-input{width:100%;padding:.6rem .8rem;border-radius:6px;border:1px solid var(--border-color-dark);background:var(--bg-surface-secondary);color:var(--color-text-main);outline:none;transition:border-color .2s}.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:var(--color-primary);background:#fff}.code-editor{font-family:var(--font-mono);font-size:.85rem;line-height:1.4}.status-msg{padding:.6rem .8rem;border-radius:6px;font-size:.8rem;margin-top:.5rem}.status-msg.info{background:#e0f2fe;color:#0369a1}.status-msg.danger{background:#fee2e2;color:#b91c1c}.status-msg.success{background:#d1fae5;color:#047857}.app-layout{display:flex;flex-direction:column;height:100vh;overflow:hidden}.topbar{background:var(--bg-topbar);color:var(--color-text-inverse);padding:.6rem 1.25rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;box-shadow:var(--shadow-md);z-index:100}.topbar-left .brand{display:flex;align-items:center;gap:.75rem}.brand-icon{background:#ffffff1a;padding:.4rem;border-radius:8px;display:flex;color:var(--color-emerald)}.brand-text .title{font-family:var(--font-display);font-weight:700;font-size:1.05rem;display:block;line-height:1.1}.brand-text .subtitle{font-size:.7rem;color:#94a3b8;font-family:var(--font-mono)}.topbar-actions{display:flex;align-items:center;gap:.6rem}.divider{width:1px;height:24px;background:#fff3;margin:0 .25rem}.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.5rem .85rem;border-radius:6px;font-weight:600;font-size:.8rem;cursor:pointer;border:1px solid transparent;transition:all .15s ease;white-space:nowrap}.btn-primary{background:var(--color-primary);color:#fff}.btn-primary:hover{background:var(--color-primary-hover)}.btn-secondary{background:#334155;color:#f8fafc}.btn-secondary:hover{background:#475569}.btn-accent{background:var(--color-accent);color:#fff}.btn-accent:hover{background:#b45309}.btn-outline{background:transparent;border-color:#ffffff4d;color:#fff}.btn-outline:hover{background:#ffffff1a;border-color:#fff9}.btn-outline:disabled{opacity:.4;cursor:not-allowed}.btn-icon{background:transparent;color:#94a3b8;padding:.4rem;border:none;border-radius:4px;cursor:pointer}.btn-icon:hover{color:#fff;background:#ffffff1a}.btn-xs{padding:.25rem .5rem;font-size:.72rem}.btn-block{width:100%;justify-content:center}.file-upload-btn input[type=file]{display:none}.user-badge{display:flex;align-items:center;gap:.5rem;background:#ffffff14;padding:.3rem .6rem;border-radius:20px;font-size:.78rem}.user-badge .avatar{background:var(--color-emerald);color:#042f2e;font-weight:700;width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:.65rem}.app-body{display:flex;flex:1;overflow:hidden}.sidebar{width:280px;background:var(--bg-surface);border-right:1px solid var(--border-color);display:flex;flex-direction:column;flex-shrink:0}.sidebar-section{padding:1rem;display:flex;flex-direction:column;gap:.6rem;border-bottom:1px solid var(--border-color)}.sidebar-section:first-child{flex:1;overflow:hidden}.section-header{display:flex;align-items:center;justify-content:space-between}.section-title{font-family:var(--font-mono);font-size:.7rem;font-weight:600;color:var(--color-text-muted);letter-spacing:.5px}.badge{background:var(--bg-surface-secondary);color:var(--color-text-muted);font-family:var(--font-mono);padding:.1rem .4rem;border-radius:10px;font-size:.7rem}.search-box{display:flex;align-items:center;gap:.4rem;background:var(--bg-surface-secondary);border:1px solid var(--border-color);padding:.4rem .6rem;border-radius:6px;color:var(--color-text-muted)}.search-box input{border:none;background:transparent;outline:none;width:100%;font-size:.78rem}.field-pool-container{flex:1;overflow-y:auto;padding-right:.2rem}.field-pool{display:flex;flex-direction:column;gap:.4rem}.field-chip{display:flex;align-items:center;justify-content:space-between;padding:.45rem .6rem;background:var(--bg-surface);border:1px solid var(--border-color-dark);border-radius:6px;font-family:var(--font-mono);font-size:.75rem;cursor:grab;-webkit-user-select:none;user-select:none;transition:all .15s ease}.field-chip:hover{border-color:var(--color-primary);background:#f8fafc;transform:translate(2px)}.field-chip:active{cursor:grabbing}.field-chip .type-tag{font-size:.65rem;padding:.1rem .3rem;border-radius:3px;font-weight:600}.type-tag.num{background:#dcfce7;color:#166534}.type-tag.date{background:#fef3c7;color:#92400e}.type-tag.text{background:#f1f5f9;color:#475569}.type-tag.derived{background:#e0e7ff;color:#3730a3}.field-chip-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.field-chip-actions{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.btn-field-date{border:1px solid var(--border-color);background:var(--bg-surface-secondary);color:var(--color-primary);border-radius:4px;font-size:.62rem;font-weight:600;line-height:1.2;padding:.25rem .35rem;cursor:pointer;white-space:nowrap}.btn-field-date:hover{border-color:var(--color-primary);background:#eef2ff}.formula-field-picker{display:flex;flex-wrap:wrap;gap:.35rem;max-height:140px;overflow-y:auto}.formula-field-chip{border:1px solid var(--border-color);background:var(--bg-surface-secondary);color:var(--color-text-main);border-radius:999px;font-size:.72rem;padding:.2rem .55rem;cursor:pointer}.formula-field-chip:hover{border-color:var(--color-primary);color:var(--color-primary)}.date-parts-list{display:flex;flex-direction:column;gap:.35rem;max-height:240px;overflow-y:auto}.saved-cubes-list{max-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:.3rem}.cube-item-row{display:flex;align-items:center;justify-content:space-between;padding:.35rem .5rem;background:var(--bg-surface-secondary);border-radius:4px;font-size:.75rem}.cube-item-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:140px}.sidebar-footer{padding:.6rem 1rem;background:var(--bg-surface-secondary);font-family:var(--font-mono);font-size:.7rem;color:var(--color-text-muted)}.main-content{flex:1;display:flex;flex-direction:column;overflow:hidden;background:var(--bg-app)}.view-tabs{display:flex;background:var(--bg-surface);border-bottom:1px solid var(--border-color);padding:0 1rem}.tab-btn{display:flex;align-items:center;gap:.5rem;padding:.75rem 1.25rem;background:transparent;border:none;border-bottom:2px solid transparent;color:var(--color-text-muted);font-weight:600;font-size:.82rem;cursor:pointer;transition:all .15s ease}.tab-btn:hover{color:var(--color-primary)}.tab-btn.active{color:var(--color-primary);border-bottom-color:var(--color-primary);background:#1e3a8a08}.tab-content{flex:1;display:none;flex-direction:column;padding:1rem 1.25rem;overflow-y:auto}.tab-content.active{display:flex}.matrix-top-bar{margin-bottom:.75rem}.zone-card{background:var(--bg-surface);border:1px solid var(--border-color);border-radius:8px;padding:.6rem .8rem;box-shadow:var(--shadow-sm)}.zone-card.inline-zone{display:flex;align-items:center;gap:1rem}.zone-header{display:flex;flex-direction:column}.zone-name{font-family:var(--font-mono);font-weight:600;font-size:.7rem;color:var(--color-primary);letter-spacing:.5px}.zone-sub{font-size:.68rem;color:var(--color-text-muted)}.dropzone{min-height:38px;border:1.5px dashed var(--border-color-dark);border-radius:6px;background:var(--bg-surface-secondary);padding:.3rem;display:flex;flex-wrap:wrap;gap:.35rem;align-items:center;transition:all .15s ease}.dropzone:empty:before{content:"Arraste um campo aqui";font-family:var(--font-mono);font-size:.72rem;color:#94a3b8;padding:.2rem .4rem}.dropzone.dragover{background:#eff6ff;border-color:var(--color-primary);box-shadow:0 0 0 2px #1e3a8a26}.matrix-dimension-strip{display:flex;gap:.75rem;margin-bottom:.75rem}.flex-1{flex:1}.zone-chip{display:inline-flex;align-items:center;gap:.4rem;padding:.25rem .5rem;background:var(--bg-surface);border:1px solid var(--color-primary);border-radius:4px;font-family:var(--font-mono);font-size:.75rem;color:var(--color-primary);cursor:grab;box-shadow:0 1px 2px #0000000a}.zone-chip select{font-family:var(--font-mono);font-size:.68rem;padding:.1rem .2rem;border:1px solid var(--border-color);border-radius:3px;background:var(--bg-surface-secondary)}.zone-chip .btn-remove{background:none;border:none;color:#94a3b8;cursor:pointer;font-size:.85rem;line-height:1}.zone-chip .btn-remove:hover{color:var(--color-danger)}.matrix-toolbar{display:flex;align-items:center;justify-content:space-between;padding:.5rem .25rem}.toolbar-left{display:flex;align-items:center;gap:.5rem}.month-sort-badge{font-family:var(--font-mono);font-size:.7rem;background:#fef3c7;color:#92400e;padding:.2rem .5rem;border-radius:12px;font-weight:600}.matrix-stats{font-family:var(--font-mono);font-size:.72rem;color:var(--color-text-muted)}.matrix-container-wrap{background:var(--bg-surface);border:1px solid var(--border-color);border-radius:8px;overflow:auto;flex:1;min-height:380px;max-height:calc(100vh - 270px);box-shadow:var(--shadow-sm)}table.matrix-table{width:100%;border-collapse:collapse;font-family:var(--font-mono);font-size:.78rem}table.matrix-table th,table.matrix-table td{border:1px solid var(--border-color);padding:.45rem .75rem;white-space:nowrap}table.matrix-table thead th{background:#f1f5f9;color:var(--color-text-main);font-weight:600;text-align:center;position:sticky;top:0;z-index:10}table.matrix-table tbody th{background:#f8fafc;text-align:left;font-weight:500;position:sticky;left:0;z-index:5}table.matrix-table tr.matrix-data-row{cursor:pointer}table.matrix-table tr.row-selected td,table.matrix-table tr.row-selected th{background:#dbeafe;box-shadow:inset 0 0 0 9999px #1e3a8a14}table.matrix-table tr.row-selected td:first-child,table.matrix-table tr.row-selected th:first-child{box-shadow:inset 3px 0 #1e3a8a,inset 0 0 0 9999px #1e3a8a14}table.matrix-table td.val-up,table.matrix-table tr.total-row td.val-up,table.matrix-table td.total-col.val-up,table.matrix-table tr.subtotal-row td.val-up{color:#15803d;font-weight:600}table.matrix-table td.val-down,table.matrix-table tr.total-row td.val-down,table.matrix-table td.total-col.val-down,table.matrix-table tr.subtotal-row td.val-down{color:#b91c1c;font-weight:600}table.matrix-table .val-trend{font-size:.65rem;margin-right:.15rem;vertical-align:1px}table.matrix-table tr.total-row th,table.matrix-table tr.total-row td{background:#e0f2fe;font-weight:700;color:#0369a1}table.matrix-table td.total-col,table.matrix-table th.total-col{background:#f0fdf4;font-weight:600;color:#15803d}.tree-toggle-btn{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:3px;background:var(--color-primary);color:#fff;font-size:.65rem;font-weight:700;margin-right:.4rem;cursor:pointer;-webkit-user-select:none;user-select:none}.empty-state-hero{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:4rem 2rem;text-align:center;color:var(--color-text-muted)}.empty-state-hero .hero-icon{font-size:3rem;margin-bottom:.5rem}.empty-state-hero h3{font-family:var(--font-display);font-size:1.2rem;color:var(--color-text-main);margin-bottom:.25rem}.empty-state-hero p{max-width:440px;font-size:.85rem;margin-bottom:1.25rem}.chart-builder-grid{display:flex;gap:1rem;flex:1}.chart-config-panel{width:260px;display:flex;flex-direction:column;gap:.75rem}.chart-canvas-container{flex:1;background:var(--bg-surface);border:1px solid var(--border-color);border-radius:8px;padding:1.25rem;display:flex;align-items:center;justify-content:center;min-height:420px;box-shadow:var(--shadow-sm)}.chart-canvas-wrap{width:100%;height:100%}.filter-actions-bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:.75rem;padding-bottom:.5rem;border-bottom:1px solid var(--border-color)}.filter-counter{font-family:var(--font-mono);font-size:.72rem;color:var(--color-text-muted)}.filter-values-list{max-height:240px;overflow-y:auto;display:flex;flex-direction:column;gap:.35rem;padding-right:.2rem}.filter-value-item{display:flex;align-items:center;gap:.6rem;padding:.45rem .65rem;border-radius:4px;background:var(--bg-surface-secondary);font-family:var(--font-mono);font-size:.78rem;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .15s ease}.filter-value-item:hover{background:#e2e8f0}.filter-value-item input[type=checkbox]{width:15px;height:15px;cursor:pointer}.filter-btn-pill{background:var(--color-primary);color:#fff;border-radius:12px;padding:.15rem .45rem;font-size:.68rem;font-weight:600;cursor:pointer;margin-left:.2rem}.filter-btn-pill:hover{background:var(--color-primary-hover)}.filter-status-tag{font-size:.68rem;background:#dbeafe;color:#1e40af;padding:.1rem .35rem;border-radius:4px;font-weight:600}.excel-header-btn{display:inline-flex;align-items:center;gap:.35rem;background:var(--bg-surface);border:1px solid var(--border-color-dark);border-radius:4px;padding:.2rem .45rem;font-size:.72rem;cursor:pointer;color:var(--color-primary);font-family:var(--font-mono);box-shadow:0 1px 2px #0000000d;transition:all .15s ease}.excel-header-btn:hover{background:#eff6ff;border-color:var(--color-primary)}.excel-arrow{font-size:.65rem;color:var(--color-text-muted)}table.matrix-table tr.subtotal-row th,table.matrix-table tr.subtotal-row td{background:#f1f5f9;font-weight:600;color:#1e293b;border-top:1.5px solid var(--border-color-dark)}table.matrix-table tr.subtotal-row.collapsed-group th,table.matrix-table tr.subtotal-row.collapsed-group td{background:#e2e8f0;font-weight:700;color:var(--color-primary)}body.fullscreen-matrix-active .topbar,body.fullscreen-matrix-active .sidebar,body.fullscreen-matrix-active .view-tabs,body.fullscreen-matrix-active .matrix-top-bar,body.fullscreen-matrix-active .matrix-dimension-strip{display:none!important}body.fullscreen-matrix-active .app-layout{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99990;background:var(--bg-surface);padding:0!important;margin:0!important}body.fullscreen-matrix-active .app-body{height:100vh;width:100vw;overflow:hidden}body.fullscreen-matrix-active .main-content{height:100vh;width:100vw;padding:0!important;overflow:hidden}body.fullscreen-matrix-active #matrixView{display:flex;flex-direction:column;height:100vh;width:100vw;padding:0!important;overflow:hidden}body.fullscreen-matrix-active .matrix-builder-frame{display:flex;flex-direction:column;flex:1;height:100%;padding:0!important;margin:0!important;overflow:hidden}body.fullscreen-matrix-active .matrix-toolbar{background:var(--bg-topbar);color:#fff;padding:.5rem 1.25rem;border-bottom:1px solid rgba(255,255,255,.1);flex-shrink:0}body.fullscreen-matrix-active .matrix-toolbar .btn-xs{color:#fff;border-color:#fff6}body.fullscreen-matrix-active .matrix-toolbar .btn-accent{background:var(--color-danger);border-color:transparent}body.fullscreen-matrix-active .matrix-toolbar .btn-accent:hover{background:#b91c1c}body.fullscreen-matrix-active .matrix-toolbar .month-sort-badge{background:#fef3c726;color:#fde68a}body.fullscreen-matrix-active .matrix-toolbar .matrix-stats{color:#94a3b8}body.fullscreen-matrix-active .matrix-container-wrap{flex:1;height:0!important;max-height:none!important;min-height:0!important;border-radius:0;border:none;overflow:auto}.mobile-only-inline{display:none}@media (max-width: 1024px){.topbar-actions{gap:.35rem}.topbar-actions .btn span{display:none}.topbar-actions .btn-accent span,.topbar-actions .file-upload-btn span:first-of-type{display:inline}.sidebar{width:240px}.matrix-dimension-strip{flex-wrap:wrap}.flex-1{flex:1 1 45%;min-width:200px}.matrix-container-wrap{max-height:calc(100vh - 290px)}}@media (max-width: 768px){.mobile-only-inline{display:inline-flex}.sidebar{position:fixed;top:0;left:-310px;bottom:0;z-index:10000;width:290px;box-shadow:var(--shadow-lg);transition:left .28s cubic-bezier(.4,0,.2,1);overflow-y:auto}.sidebar.sidebar-drawer-open{left:0}.sidebar-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0f172a99;z-index:9999;animation:fadeIn .2s ease}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.topbar{padding:.45rem .75rem;gap:.5rem}.brand-text .subtitle{display:none}.brand-text .title{font-size:.9rem}.topbar-actions .btn span,.topbar-actions .file-upload-btn span,.topbar-actions .divider,.export-group,.tab-btn span{display:none}.matrix-dimension-strip{flex-direction:column;gap:.5rem}.flex-1{width:100%;flex:unset}.matrix-toolbar{flex-direction:column;align-items:flex-start;gap:.5rem;padding:.5rem .25rem}.toolbar-left{flex-wrap:wrap;gap:.35rem}.matrix-container-wrap{max-height:calc(100vh - 320px);min-height:240px}.tab-content{padding:.75rem}.chart-builder-grid{flex-direction:column}.chart-config-panel{width:100%}.chart-canvas-container{min-height:300px}.modal-card{padding:1.25rem;max-width:100%;border-radius:12px 12px 0 0;margin-top:auto}.modal-overlay{align-items:flex-end;padding:0}.modal-card.modal-large{max-width:100%;border-radius:12px 12px 0 0}}@media (max-width: 480px){.matrix-toolbar .btn-xs{padding:.2rem .35rem;font-size:.68rem}table.matrix-table th,table.matrix-table td{padding:.35rem .5rem;font-size:.72rem}}
