.view-nav {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 8px 24px rgba(31,55,86,.06);
}

.view-tab {
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    color: var(--muted);
    background: transparent;
    font-size: 12px;
    font-weight: 850;
    transition: .18s ease;
}

.view-tab:hover { color: var(--primary); background: var(--primary-soft); }
.view-tab.active { color: #fff; background: var(--primary); box-shadow: 0 7px 17px rgba(18,104,229,.22); }
.dashboard-view { display: none; }
.dashboard-view.active { display: block; }

.report-notice {
    margin-top: 14px;
    border: 1px solid #ffe0a8;
    color: #76500f;
    background: #fff8e8;
    border-radius: 14px;
    padding: 12px 15px;
    font-size: 12px;
    line-height: 1.5;
}

.report-controls { margin-top: 20px; padding: 18px; }
.report-control-grid {
    display: grid;
    grid-template-columns: minmax(230px, 1.15fr) minmax(260px, 2fr) minmax(130px, .55fr) auto;
    gap: 12px;
    align-items: end;
}

.report-summary-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(310px, .6fr);
    gap: 14px;
}

.report-chart-card,
.report-info-card { padding: 19px; }

.report-bars { display: grid; gap: 12px; margin-top: 17px; }
.report-bar-item { display: grid; gap: 7px; }
.report-bar-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.report-bar-title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 800;
}
.report-bar-value { flex: 0 0 auto; color: var(--primary); font-size: 11px; font-weight: 850; white-space: nowrap; }
.report-bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #edf2f7; }
.report-bar-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1268e5, #0f9f8f);
}

.report-facts { display: grid; gap: 9px; margin-top: 15px; }
.report-fact {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 11px;
}
.report-fact span { color: var(--muted); }
.report-fact strong { max-width: 62%; text-align: right; overflow-wrap: anywhere; }

.report-table-card { margin-top: 18px; }
#reportTable { min-width: 880px; }
#reportTable th[data-key] { cursor: pointer; position: relative; padding-right: 27px; }
#reportTable th[data-key]::after { content: "↕"; position: absolute; right: 9px; color: #a6b2c1; }
#reportTable th.sorted-asc::after { content: "↑"; color: var(--primary); }
#reportTable th.sorted-desc::after { content: "↓"; color: var(--primary); }
#reportTable tbody tr { cursor: default; }

.rank-pill {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 900;
}

.dataset-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(500px, 50vw);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-radius: 999px;
    padding: 6px 9px;
    color: var(--teal);
    background: var(--teal-soft);
    font-size: 10px;
    font-weight: 850;
}

.detail-highlight {
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #d9e9ff;
    border-radius: 12px;
    background: #f4f9ff;
    color: #24527f;
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .report-control-grid { grid-template-columns: 1fr 1fr; }
    .report-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .view-nav { width: 100%; }
    .view-tab { flex: 1 1 auto; }
    .report-control-grid { grid-template-columns: 1fr; }
    .dataset-chip { max-width: 100%; }
}
