/* === PREAMBLE TOGGLE === */
.preamble-toggle {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5em;
    text-align: left;
    flex: 1;
    letter-spacing: inherit;
}

.preamble-toggle:focus {
    outline: none;
}

.preamble-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.preamble-toggle[aria-expanded="true"] .preamble-chevron {
    transform: rotate(90deg);
}

/* === KPI CARDS === */
.kpi-card {
    border: 2px solid var(--border);
    background-color: var(--surface);
    padding: 0.85rem 1rem 0.75rem;
    text-align: center;
    height: 100%;
}

.kpi-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.48rem;
    color: var(--accent-dark);
    letter-spacing: 0.06em;
    margin-bottom: 0.45rem;
    line-height: 1.4;
}

.kpi-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.05rem;
    color: var(--accent);
    line-height: 1.2;
    word-break: break-all;
}

.kpi-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: var(--text);
    margin-top: 0.3rem;
    opacity: 0.7;
    line-height: 1.3;
}

/* === INFO BUTTONS === */
.info-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    letter-spacing: 0.05em;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.info-btn:hover,
.info-btn:focus {
    background: var(--accent);
    color: var(--nav-bg);
    outline: none;
}

/* === PROGRESS CARD (compact) === */
.progress-card-body {
    padding: 0.75rem 1.25rem;
}

/* === PROGRESS LEGEND === */
.progress-legend {
    display: flex;
    gap: 1.25rem;
    font-size: 0.75rem;
    color: var(--text);
    flex-wrap: wrap;
}

.legend-dot {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.3em;
    vertical-align: middle;
}

/* === CHART CONTAINERS === */
.chart-container {
    width: 100%;
    height: 260px;
}

.chart-container-wide {
    width: 100%;
    height: 280px;
}

/* === CHART CAPTION === */
.chart-caption {
    font-size: 0.72rem;
    color: var(--accent-dark);
    margin-top: 0.6rem;
    margin-bottom: 0;
    line-height: 1.5;
}

/* === BOOTSTRAP POPOVER — RETRO OVERRIDES === */
.popover {
    border: 2px solid var(--border) !important;
    border-radius: 0 !important;
    background-color: var(--bg) !important;
    font-family: 'JetBrains Mono', monospace !important;
    max-width: 340px;
}

.popover-header {
    background-color: var(--text) !important;
    color: var(--accent) !important;
    font-family: 'Press Start 2P', monospace !important;
    font-size: 0.55rem !important;
    border-radius: 0 !important;
    border-bottom: 2px solid var(--accent) !important;
    padding: 0.55rem 1rem !important;
}

.popover-body {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    font-size: 0.8rem !important;
    line-height: 1.65 !important;
    padding: 1rem !important;
}

.popover-body p {
    margin-bottom: 0.5rem;
}

.popover-body p:last-child {
    margin-bottom: 0;
}

.popover-body ol {
    padding-left: 1.2rem;
    margin-bottom: 0;
}

.popover-body li {
    margin-bottom: 0.35rem;
}

.popover-body a {
    color: var(--accent-dark);
}

.bs-popover-bottom > .popover-arrow::after,
.bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::after {
    border-bottom-color: var(--text) !important;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .kpi-value {
        font-size: 0.85rem;
    }

    .kpi-label {
        font-size: 0.42rem;
    }

    .chart-container {
        height: 210px;
    }

    .chart-container-wide {
        height: 240px;
    }

    .progress-legend {
        font-size: 0.65rem;
        gap: 0.75rem;
    }

    .info-btn {
        font-size: 0.55rem;
        padding: 0.2rem 0.4rem;
    }
}
