/* Portal da Franqueadora — KPI cards estilo plataforma de BI.
   Neutro em tema: cores de texto herdam do card MAD; acentos semânticos fixos. */

/* Item de CSS grid: sem min-width:0 o conteúdo estoura a coluna. */
.fq-kpi-card { min-width: 0; }

.fq-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 12px;
    min-height: 128px;
}

.fq-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.fq-kpi-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    opacity: .62;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.fq-kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.fq-kpi-foot {
    font-size: 11px;
    opacity: .55;
}

.fq-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.fq-pill-up   { color: #047857; background: rgba(16, 185, 129, .14); }
.fq-pill-down { color: #B91C1C; background: rgba(239, 68, 68, .13); }
.fq-pill-flat { color: #64748B; background: rgba(148, 163, 184, .16); }

[data-theme="dark"] .fq-pill-up   { color: #34D399; }
[data-theme="dark"] .fq-pill-down { color: #F87171; }
[data-theme="dark"] .fq-pill-flat { color: #94A3B8; }

.fq-kpi-spark {
    width: 100%;
    height: 30px;
    margin-top: auto;
    padding-top: 6px;
}

.fq-kpi-spark svg { display: block; width: 100%; height: 100%; }

@media (max-width: 1100px) {
    .fq-kpi-value { font-size: 23px; }
}

/* ── Tabelas analíticas (mad-data-table nas telas) ─────────────────────── */

/* Link "ver mais" no header do card */
.fq-card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.fq-table-link {
    font-size: 12px;
    font-weight: 600;
    color: #2563EB;
    text-decoration: none;
    white-space: nowrap;
}

.fq-table-link:hover { text-decoration: underline; }

[data-theme="dark"] .fq-table-link { color: #60A5FA; }

/* Conteúdo de card com tabela: encosta a tabela nas bordas do card */
.mad-card > .fq-card-table { padding: 0 0 2px; }

.fq-card-table table { width: 100%; }

/* Tabela comprida ao lado de chart: rola por dentro, card não estica a dupla */
.fq-card-table.fq-scroll {
    max-height: 480px;
    overflow-y: auto;
}

/* Colapsável (details) vestido de mad-card */
.fq-details > .fq-details-summary {
    cursor: pointer;
    user-select: none;
    font-weight: 700;
    font-size: 14px;
    padding: 14px 20px;
    color: #334155;
}

[data-theme="dark"] .fq-details > .fq-details-summary { color: #CBD5E1; }

/* ── Helper "de onde vem esse número" (tooltip do CTO) ─────────────────── */

.fq-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #94A3B8;
    cursor: help;
    margin-left: 6px;
    flex: 0 0 auto;
    vertical-align: middle;
}

.fq-help:hover, .fq-help:focus { color: #2563EB; outline: none; }

.fq-help-tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    z-index: 80;
    width: 320px;
    max-width: 74vw;
    background: #0F172A;
    color: #E2E8F0;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.55;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    white-space: normal;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
}

.fq-help--esq .fq-help-tip { right: auto; left: -8px; }

.fq-help:hover .fq-help-tip, .fq-help:focus .fq-help-tip { display: block; }

[data-theme="dark"] .fq-help-tip { background: #1E293B; border: 1px solid rgba(148, 163, 184, .2); }
