/* =========================
   SISTEMA / DASHBOARD BASE
   ========================= */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html,
body {
    min-height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: #eef0f5;
    color: #1a2332;
    font-size: 13px;
    overflow-x: hidden;
    overflow-y: auto;
}

.shell {
    display: flex;
    min-height: 100vh;
    height: auto;
    overflow: visible;
    align-items: stretch;
}

.sb {
    width: 220px;
    background: #1a2640;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width .25s ease;
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sb.closed {
    width: 0;
}

.sb-brand {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sb-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #2e6be6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-icon svg {
    width: 15px;
    height: 15px;
    fill: white;
}

.sb-title {
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.sb-title small {
    display: block;
    font-size: 8.5px;
    font-weight: 400;
    color: #4a6280;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.sb-nav {
    flex: 1;
    min-height: 0;
    padding: 12px 10px;
    overflow-y: auto;
}

.sb-nav::-webkit-scrollbar {
    width: 2px;
}

.sb-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 2px;
}

.nav-sec {
    font-size: 8.5px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: #354d6a;
    font-weight: 600;
    padding: 8px 9px 5px;
    display: block;
    white-space: nowrap;
}

.ni {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 7px;
    cursor: pointer;
    color: #6b829e;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.ni:hover {
    background: rgba(255,255,255,.05);
    color: #a0b8d0;
}

.ni.on {
    background: rgba(46,107,230,.15);
    color: #6fa3f7;
    border-left-color: #2e6be6;
}

.ni svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: .75;
}

.ni.on svg {
    opacity: 1;
}

.ni-badge {
    margin-left: auto;
    font-size: 9px;
    font-family: 'DM Mono', monospace;
    color: #354d6a;
    background: #1e2e44;
    border-radius: 4px;
    padding: 1px 7px;
}

.ni.on .ni-badge {
    color: #6fa3f7;
    background: rgba(46,107,230,.2);
}

.sb-foot {
    padding: 13px 18px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.sb-live {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: #4a6280;
    font-family: 'DM Mono', monospace;
}

.dot-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22d3a0;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: .2; }
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    overflow: visible;
}

.topbar {
    min-height: 56px;
    background: #fff;
    border-bottom: 1px solid #dde2ea;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-right: 18px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.toggle-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a2640;
    border-right: 1px solid #f0f2f6;
    flex-shrink: 0;
    transition: background .15s;
    position: relative;
}

.toggle-btn:hover {
    background: #f0f4ff;
}

.toggle-btn svg {
    width: 19px;
    height: 19px;
}

.toggle-btn .tb-dot {
    position: absolute;
    top: 11px;
    right: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2e6be6;
}

.crumb {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #8a97a8;
    padding: 0 16px;
}

.crumb b {
    color: #1a2332;
    font-weight: 600;
}

.crumb svg {
    width: 9px;
    height: 9px;
    opacity: .35;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    flex-wrap: wrap;
    padding: 8px 0;
}

.t-period {
    background: #e8f0fe;
    color: #1a56c4;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
}

.t-export {
    background: #1a2640;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background .15s;
}

.t-export:hover {
    background: #2e3f60;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-date {
    padding: 6px 8px;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    font-size: 11px;
    color: #1a2332;
    background: #fff;
}

.filter-sep {
    font-size: 11px;
    color: #8a97a8;
}

.filter-btn {
    background: #1a2640;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.filter-btn:hover {
    background: #2e3f60;
}

.tabs {
    background: #fff;
    border-bottom: 1px solid #dde2ea;
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    position: sticky;
    top: 56px;
    z-index: 199;
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.tabs::-webkit-scrollbar {
    height: 0;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 17px;
    height: 44px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #8a97a8;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    flex-shrink: 0;
    transition: color .15s;
}

.tab:hover {
    color: #3d5a7a;
    background: #fafbfc;
}

.tab.on {
    color: #1a56c4;
    border-bottom-color: #2e6be6;
    font-weight: 600;
}

.tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tc);
    opacity: .3;
    flex-shrink: 0;
    transition: opacity .2s;
}

.tab.on .tab-dot {
    opacity: 1;
}

.tab-num {
    background: #f0f2f6;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 9.5px;
    font-family: 'DM Mono', monospace;
    color: #8a97a8;
}

.tab.on .tab-num {
    background: #e8f0fe;
    color: #1a56c4;
}

.tab-div {
    width: 1px;
    background: #eef0f5;
    align-self: stretch;
    margin: 9px 0;
    flex-shrink: 0;
}

.panels {
    flex: 1;
    min-height: auto;
    overflow: visible;
}

.pan {
    display: none;
    padding: 18px 22px;
    flex-direction: column;
    gap: 14px;
    min-height: max-content;
}

.pan.on {
    display: flex;
}

.ph {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ph-eyebrow {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ph-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a2332;
    letter-spacing: -.5px;
    line-height: 1.15;
}

.ph-sub {
    font-size: 11px;
    color: #aab4c0;
    margin-top: 4px;
}

.ph-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.pill {
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 600;
}

.pill-blue { background: #e8f0fe; color: #1a56c4; }
.pill-gray { background: #f0f2f6; color: #6b7a8d; border: 1px solid #e2e6ed; }
.pill-red  { background: #fdeaea; color: #b91c1c; }

.kstrip {
    display: grid;
    gap: 11px;
}

.k4 {
    grid-template-columns: repeat(4, minmax(0,1fr));
}

.k3 {
    grid-template-columns: repeat(3, minmax(0,1fr));
}

.kpi {
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    position: relative;
    overflow: hidden;
    min-height: 110px;
}

.kpi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kc, #2e6be6);
    border-radius: 3px 3px 0 0;
}

.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.kpi-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: #a0aab8;
    line-height: 1.2;
}

.kpi-ico {
    width: 31px;
    height: 31px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-ico svg {
    width: 14px;
    height: 14px;
}

.kpi-val {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1;
    color: #1a2332;
}

.kpi-val.sm {
    font-size: 17px;
    letter-spacing: -.3px;
}

.kpi-bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
}

.kpi-hint {
    font-size: 10px;
    color: #b0bac8;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-spark {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 84px;
    height: 36px;
    pointer-events: none;
    opacity: .45;
}

.kpi-spark svg {
    width: 100%;
    height: 100%;
    display: block;
}

.kpi-bar {
    margin-top: 6px;
}

.tr {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tr.up { background: #e6f9f0; color: #0d7a4e; }
.tr.dn { background: #fdeaea; color: #b91c1c; }
.tr.nu { background: #f0f2f6; color: #6b7a8d; }

.chart-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.chart-card {
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: 10px;
    padding: 16px;
    width: 100%;
    min-width: 0;
}

.cc-head {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2332;
}

.cc-sub {
    font-size: 9.5px;
    color: #b0bac8;
    margin-top: 2px;
}

.chart-area {
    position: relative;
    min-width: 0;
}

.tbl-card {
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
}

.tbl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid #f0f2f6;
    flex-wrap: wrap;
    gap: 10px;
}

.tbl-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2332;
}

.tbl-right {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.tbl-search {
    background: #f4f6fa;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    padding: 6px 11px;
    font-size: 11.5px;
    width: 200px;
    color: #1a2332;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color .2s;
}

.tbl-search:focus {
    border-color: #2e6be6;
}

.tbl-count {
    background: #f0f2f6;
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 9.5px;
    font-family: 'DM Mono', monospace;
    color: #8a97a8;
}

.tbl-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    min-width: 0;
}

table.dt {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table.dt thead th {
    background: #f8f9fb;
    color: #a0aab8;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eef0f5;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

table.dt tbody tr {
    border-bottom: 1px solid #f4f6fa;
    transition: background .1s;
}

table.dt tbody tr:hover {
    background: #f8f9fb;
}

table.dt tbody td {
    padding: 10px 14px;
    vertical-align: middle;
}

.tbl-footer {
    padding: 10px 16px;
    border-top: 1px solid #f0f2f6;
    font-size: 10px;
    color: #a0aab8;
}

.tbl-footer code {
    background: #f0f2f6;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'DM Mono', monospace;
}

.bdg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.bdg::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.bdg-g { background: #e6f9f0; color: #0d7a4e; }
.bdg-g::before { background: #0d7a4e; }

.bdg-r { background: #fdeaea; color: #b91c1c; }
.bdg-r::before { background: #b91c1c; }

.bdg-b { background: #e8f0fe; color: #1a56c4; }
.bdg-b::before { background: #2e6be6; }

.bdg-v { background: #f3f0fe; color: #5b21b6; }
.bdg-v::before { background: #7c3aed; }

.bdg-y { background: #fef9e6; color: #92620a; }
.bdg-y::before { background: #d97706; }

.c-gr { color: #0d7a4e; }
.c-rd { color: #b91c1c; }
.c-bl { color: #1a56c4; }
.c-am { color: #92620a; }
.c-or { color: #c2410c; }
.c-pu { color: #6d28d9; }
.c-dim { color: #a0aab8; }
.fw7 { font-weight: 700; }
.mono { font-family: 'DM Mono', monospace; }

@media (max-width: 1100px) {
    .k4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .k3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 700px) {
    .sb { width: 0; }
    .k4, .k3 { grid-template-columns: 1fr; }
    .pan { padding: 12px 14px; }
    .topbar { padding-right: 10px; }
    .tabs { top: 56px; }
}