/* dashboard.css - dashboards do desktop (botão Dashboard da tela principal) */

#cz-dash {
    --db-bg: #f3f5f9;
    --db-card: #fff;
    --db-line: #edf0f5;
    --db-text: #1e2a3b;
    --db-muted: #7a8699;
    --db-brand: #0b3a75;
    --db-brand-2: #1557b0;
    --db-ok: #1a9e5c;
    --db-warn: #e08a00;
    --db-neg: #d64545;
    height: 100%;
    overflow: auto;
    background: var(--db-bg);
    color: var(--db-text);
    font-family: "Segoe UI", "Inter", Roboto, Arial, sans-serif;
    font-size: 13px;
}
#cz-dash *, #cz-dash *::before, #cz-dash *::after { box-sizing: border-box; }
#cz-dash button { font-family: inherit; cursor: pointer; }

#cz-dash .db-app { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }

/* ---------------------------------------------- cabeçalho */
#cz-dash .db-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--db-card); border-radius: 14px; padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
#cz-dash .db-title { display: flex; align-items: center; gap: 10px; margin-right: 8px; }
#cz-dash .db-ico {
    width: 40px; height: 40px; border-radius: 12px; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
#cz-dash .db-ico svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#cz-dash .db-title h1 { margin: 0; font-size: 18px; line-height: 1.1; }
#cz-dash .db-title span { font-size: 12px; color: var(--db-muted); }

#cz-dash .db-nav { display: flex; align-items: center; gap: 6px; }
#cz-dash .db-period { min-width: 130px; text-align: center; line-height: 1.2; }
#cz-dash .db-period strong { display: block; font-size: 16px; }
#cz-dash .db-period span { font-size: 12px; color: var(--db-muted); }

#cz-dash .db-icon {
    width: 32px; height: 32px; border-radius: 9px; border: 1px solid #dde2ea; background: #fff;
    font-size: 20px; line-height: 1; color: var(--db-text);
    display: inline-flex; align-items: center; justify-content: center;
}
#cz-dash .db-icon:hover { background: #e8f0fb; border-color: transparent; color: var(--db-brand); }
#cz-dash .db-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
#cz-dash .db-icon.spin svg { animation: db-spin .8s linear infinite; }
@keyframes db-spin { to { transform: rotate(360deg); } }

#cz-dash .db-segs { display: inline-flex; background: #f3f5f9; border-radius: 9px; padding: 3px; }
#cz-dash .db-seg { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; color: var(--db-muted); }
#cz-dash .db-seg.on { background: #fff; color: var(--db-brand); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

#cz-dash .db-datas { display: flex; align-items: center; gap: 6px; color: var(--db-muted); }
#cz-dash .db-datas input, #cz-dash .db-sel {
    height: 32px; border: 1px solid #dde2ea; border-radius: 9px; padding: 0 8px;
    font: inherit; color: var(--db-text); background: #fff;
}
#cz-dash .db-sel { min-width: 170px; max-width: 220px; font-weight: 600; }
#cz-dash .db-datas input { width: 128px; }
#cz-dash .db-acts { display: flex; gap: 6px; flex: none; }
#cz-dash .db-spacer { flex: 1; }
#cz-dash .db-close {
    width: 32px; height: 32px; border-radius: 9px; border: 0; background: #fdecec; color: #b42318;
    font-size: 20px; line-height: 1;
}
#cz-dash .db-close:hover { background: #fbd5d5; }

/* ---------------------------------------------- indicadores */
#cz-dash .db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
#cz-dash .db-kpi {
    background: var(--db-card); border-radius: 14px; padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
    border-top: 4px solid #c9d3e2;
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
#cz-dash .db-kpi span { font-size: 12px; font-weight: 600; color: var(--db-muted); text-transform: uppercase; letter-spacing: .04em; }
#cz-dash .db-kpi b { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cz-dash .db-kpi small { color: var(--db-muted); }
#cz-dash .db-kpi.main { border-top: 0; color: #fff; background: linear-gradient(135deg, #0b3a75, #1d66c4); }
#cz-dash .db-kpi.main span, #cz-dash .db-kpi.main small { color: rgba(255, 255, 255, .85); }
#cz-dash .db-kpi.main b { font-size: 28px; }
#cz-dash .db-kpi.ok { border-top-color: var(--db-ok); }
#cz-dash .db-kpi.warn { border-top-color: var(--db-warn); }
#cz-dash .db-kpi.neg { border-top-color: var(--db-neg); }
#cz-dash .db-kpi.info { border-top-color: var(--db-brand-2); }

/* ---------------------------------------------- cartões (grade de 12 colunas) */
#cz-dash .db-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
#cz-dash .db-card { background: var(--db-card); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); min-width: 0; }
#cz-dash .db-card.s4 { grid-column: span 4; }
#cz-dash .db-card.s6 { grid-column: span 6; }
#cz-dash .db-card.s8 { grid-column: span 8; }
#cz-dash .db-card.s12 { grid-column: span 12; }
#cz-dash .db-card h2 {
    margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--db-muted);
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
#cz-dash .db-card h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px; color: #9aa3b2; }
#cz-dash .db-vazio { color: var(--db-muted); padding: 18px 0; text-align: center; }
#cz-dash .db-rodape { color: #9aa3b2; font-size: 11px; text-align: right; }

#cz-dash .db-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: -4px 0 6px; font-size: 12px; color: var(--db-muted); }
#cz-dash .db-leg span { display: inline-flex; align-items: center; gap: 6px; }
#cz-dash .db-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* gráficos SVG */
#cz-dash .db-chart { width: 100%; min-height: 60px; }
#cz-dash .db-svg { display: block; overflow: visible; }
#cz-dash .db-grid line.db-grid, #cz-dash .db-svg .db-grid { stroke: #eef1f6; stroke-width: 1; }
#cz-dash .db-svg .db-zero { stroke: #c9d3e2; stroke-width: 1; }
#cz-dash .db-svg .db-ax { fill: #8a94a6; font-size: 11px; }
#cz-dash .db-svg .db-guia { stroke: #9aa3b2; stroke-width: 1; stroke-dasharray: 3 3; visibility: hidden; pointer-events: none; }
#cz-dash .db-svg .db-pt { pointer-events: none; }
#cz-dash .db-svg .db-dtot { fill: var(--db-text); font-size: 16px; font-weight: 700; }
#cz-dash .db-svg .db-fatia { transition: opacity .15s; }
#cz-dash .db-svg .db-fatia:hover { opacity: .8; }

/* rosca */
#cz-dash .db-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
#cz-dash .db-dn { width: 170px; flex: none; }
#cz-dash .db-dleg { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 6px; }
#cz-dash .db-dleg div { display: flex; align-items: center; gap: 8px; }
#cz-dash .db-dleg i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#cz-dash .db-dleg span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cz-dash .db-dleg b { white-space: nowrap; }
#cz-dash .db-dleg em { font-style: normal; color: var(--db-muted); font-size: 12px; width: 38px; text-align: right; }

/* ranking */
#cz-dash .db-rank { display: flex; flex-direction: column; gap: 10px; }
#cz-dash .db-rk-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
#cz-dash .db-rk-top i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#cz-dash .db-rk-nome { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cz-dash .db-rk-sub { color: var(--db-muted); font-size: 12px; white-space: nowrap; }
#cz-dash .db-rk-top b { white-space: nowrap; }
#cz-dash .db-track { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
#cz-dash .db-track span { display: block; height: 100%; border-radius: 999px; }

/* mapa de calor */
#cz-dash .db-heat { display: grid; gap: 3px; align-items: center; }
#cz-dash .db-hx { font-size: 10px; color: #8a94a6; text-align: center; }
#cz-dash .db-hy { font-size: 11px; color: var(--db-muted); font-weight: 600; }
#cz-dash .db-hc { height: 26px; border-radius: 5px; background: #f3f5f9; display: flex; align-items: center; justify-content: center; }
#cz-dash .db-hc em { font-style: normal; font-size: 11px; font-weight: 700; color: #fff; }
#cz-dash .db-hc em.dk { color: #0b3a75; }
#cz-dash .db-heatleg { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--db-muted); }
#cz-dash .db-heatleg i { width: 90px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, rgba(42,120,214,.12), rgba(42,120,214,1)); }

/* tabela */
#cz-dash .db-tabwrap { overflow-x: auto; }
#cz-dash .db-tab { width: 100%; border-collapse: collapse; }
#cz-dash .db-tab th {
    text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--db-muted); padding: 6px 8px; border-bottom: 1px solid var(--db-line); white-space: nowrap;
}
#cz-dash .db-tab td { padding: 7px 8px; border-bottom: 1px solid var(--db-line); white-space: nowrap; }
#cz-dash .db-tab tr:last-child td { border-bottom: 0; }
#cz-dash .db-tab tbody tr:hover { background: #f8fafc; }
#cz-dash .db-tab .r { text-align: right; }
#cz-dash .db-tab .b { font-weight: 700; }

/* dica */
#cz-dash .db-tip {
    position: fixed; z-index: 100000; display: none; pointer-events: none;
    background: #1e2a3b; color: #fff; border-radius: 8px; padding: 8px 10px;
    font-size: 12px; line-height: 1.5; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); max-width: 280px;
}
#cz-dash .db-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

@media (max-width: 1200px) {
    #cz-dash .db-card.s4, #cz-dash .db-card.s8 { grid-column: span 6; }
}
@media (max-width: 900px) {
    #cz-dash .db-card.s4, #cz-dash .db-card.s6, #cz-dash .db-card.s8 { grid-column: span 12; }
}

/* financeiro: cortesias e pagos com crédito (não entram no caixa) */
#cz-dash .db-kpi.cort { border-top-color: #e87ba4; }
#cz-dash .db-kpi.cred { border-top-color: #6250d6; }
