/*
 * Statistics page — color tokens and dataviz primitives.
 *
 * Series colors are validated (lightness band, chroma floor, colorblind separation)
 * against the white surface of Bootstrap cards. To change palette, edit only the
 * variables below.
 */
.gx-viz,
.gx-viz-section {
    --viz-surface: #ffffff;
    --viz-ink: #0b0b0b;
    --viz-ink-secondary: #52514e;
    --viz-ink-muted: #898781;
    --viz-grid: #e1e0d9;
    --viz-axis: #c3c2b7;
    --viz-series-1: #2a78d6;
    --viz-series-2: #eb6834;
    --viz-series-3: #1baf7a;
    --viz-series-4: #eda100;
    --viz-deemphasis: #a8a7a0;
    --viz-good: #0ca30c;
    --viz-warning: #fab219;
    --viz-critical: #d03b3b;
}

/* ---- Section headings --------------------------------------------------- */

.gx-viz-section {
    align-items: baseline;
    border-bottom: 1px solid var(--viz-grid);
    column-gap: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
}

.gx-viz-section__title {
    color: var(--viz-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.gx-viz-section__hint {
    color: var(--viz-ink-muted);
    font-size: 0.75rem;
}

/* ---- Stat tiles --------------------------------------------------------- */

.gx-viz-tile__label {
    color: var(--viz-ink-secondary);
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.gx-viz-tile__value {
    color: var(--viz-ink);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
}

.gx-viz-tile__hint {
    color: var(--viz-ink-muted);
    font-size: 0.75rem;
}

.gx-viz-hero {
    color: var(--viz-ink);
    font-size: 3.25rem;
    font-weight: 600;
    line-height: 1;
}

/* ---- Meter -------------------------------------------------------------- */

.gx-viz-meter {
    background-color: #dbe8f9; /* no gray track: same hue family as the fill */
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.gx-viz-meter__fill {
    background-color: var(--viz-series-1);
    border-radius: 0 4px 4px 0;
    height: 100%;
}

.gx-viz-meter__fill--good {
    background-color: var(--viz-good);
}

.gx-viz-meter__fill--warning {
    background-color: var(--viz-warning);
}

.gx-viz-meter__fill--critical {
    background-color: var(--viz-critical);
}

/* ---- Horizontal bars ---------------------------------------------------- */

.gx-viz-bars {
    display: flex;
    flex-direction: column;
    gap: 2px; /* surface gap between adjacent bars */
}

.gx-viz-bar {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 10rem) 1fr auto;
    min-height: 24px; /* comfortable hover target */
    padding: 1px 0;
}

.gx-viz-bar__label {
    color: var(--viz-ink-secondary);
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gx-viz-bar__track {
    min-width: 0;
}

.gx-viz-bar__fill {
    background-color: var(--viz-deemphasis);
    border-radius: 0 4px 4px 0; /* rounded data end, square baseline */
    height: 14px;
    min-width: 2px;
}

.gx-viz-bar__fill--accent {
    background-color: var(--viz-series-1);
}

.gx-viz-bar__value {
    color: var(--viz-ink);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    min-width: 3.5rem;
    text-align: right;
}

.gx-viz-bar:hover .gx-viz-bar__label,
.gx-viz-bar:hover .gx-viz-bar__value {
    color: var(--viz-ink);
}

/* ---- Horizontal stacked bars ------------------------------------------- */

.gx-viz-stack {
    display: flex;
    gap: 2px; /* surface gap between segments */
    min-width: 0;
}

.gx-viz-stack__segment {
    border-radius: 0;
    height: 14px;
    min-width: 2px;
}

.gx-viz-stack__segment:last-child {
    border-radius: 0 4px 4px 0;
}

.gx-viz-stack__segment--1 {
    background-color: var(--viz-series-1);
}

.gx-viz-stack__segment--2 {
    background-color: var(--viz-series-2);
}

.gx-viz-stack__segment--3 {
    background-color: var(--viz-series-3);
}

/* ---- Columns ----------------------------------------------------------- */

.gx-viz-columns {
    align-items: flex-end;
    display: flex;
    gap: 2px;
}

.gx-viz-column {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
}

.gx-viz-column__cap {
    color: var(--viz-ink);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.gx-viz-column__plot {
    align-items: flex-end;
    border-bottom: 1px solid var(--viz-axis);
    display: flex;
    height: 140px;
    justify-content: center;
}

.gx-viz-column__fill {
    background-color: var(--viz-series-1);
    border-radius: 4px 4px 0 0; /* rounded data end, square baseline */
    max-width: 24px;
    min-height: 2px;
    width: 60%;
}

.gx-viz-column__label {
    color: var(--viz-ink-secondary);
    font-size: 0.75rem;
    padding-top: 0.375rem;
    text-align: center;
    word-break: break-word;
}

/* ---- Legend ------------------------------------------------------------ */

.gx-viz-legend {
    color: var(--viz-ink-secondary);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    gap: 0.25rem 1rem;
}

.gx-viz-legend__item {
    align-items: center;
    display: flex;
    gap: 0.375rem;
}

.gx-viz-legend__swatch {
    border-radius: 2px;
    display: inline-block;
    height: 10px;
    width: 10px;
}

/* ---- Line charts (rendered by the viz-line controller) ----------------- */

.gx-viz-line {
    position: relative;
}

.gx-viz-line svg {
    display: block;
    height: auto;
    width: 100%;
}

.gx-viz-line__grid {
    stroke: var(--viz-grid);
    stroke-width: 1;
}

.gx-viz-line__axis {
    stroke: var(--viz-axis);
    stroke-width: 1;
}

.gx-viz-line__tick {
    fill: var(--viz-ink-muted);
    font-size: 11px;
}

.gx-viz-line__label {
    fill: var(--viz-ink-secondary);
    font-size: 11px;
}

.gx-viz-line__path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.gx-viz-line__marker {
    stroke: var(--viz-surface);
    stroke-width: 2; /* surface ring */
}

.gx-viz-line__crosshair {
    stroke: var(--viz-axis);
    stroke-width: 1;
}

/* ---- Donut (rendered by the viz-donut controller) ---------------------- */

.gx-viz-donut {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.gx-viz-donut__plot {
    flex: 0 0 auto;
    max-width: 100%;
    position: relative;
    width: 270px;
}

.gx-viz-donut__plot svg {
    display: block;
    height: auto;
    width: 100%;
}

.gx-viz-donut__arc {
    fill: none;
    transition: opacity 0.15s ease-in-out;
}

/* the hovered arc keeps its color; the others recede without changing hue */
.gx-viz-donut__arc--muted {
    opacity: 0.35;
}

.gx-viz-donut__total {
    fill: var(--viz-ink);
    font-size: 26px;
    font-weight: 600;
}

.gx-viz-donut__caption {
    fill: var(--viz-ink-muted);
    font-size: 11px;
}

.gx-viz-donut__share {
    fill: var(--viz-ink-secondary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.gx-viz-donut__legend {
    display: flex;
    flex: 1 1 12rem;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.gx-viz-donut__entry {
    align-items: baseline;
    border-radius: 4px;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    min-height: 22px; /* comfortable hover target */
    padding: 0.125rem 0.375rem;
}

/* the pointed-at entry names the arc brought forward in the ring */
.gx-viz-donut__entry--active {
    background-color: #f2f1ec;
}

.gx-viz-donut__entry--active .gx-viz-donut__name {
    color: var(--viz-ink);
}

.gx-viz-donut__swatch {
    border-radius: 2px;
    height: 10px;
    transform: translateY(1px);
    width: 10px;
}

.gx-viz-donut__name {
    color: var(--viz-ink-secondary);
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gx-viz-donut__value {
    color: var(--viz-ink);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

/* ---- Tooltip (line charts) --------------------------------------------- */

.gx-viz-tooltip {
    background-color: var(--viz-ink);
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    left: 0;
    line-height: 1.4;
    padding: 0.375rem 0.5rem;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translate(-50%, -100%);
    white-space: nowrap;
    z-index: 5;
}

.gx-viz-tooltip[hidden] {
    display: none;
}


.gx-viz-empty {
    color: var(--viz-ink-muted);
    font-size: 0.8125rem;
    padding: 1.5rem 0;
    text-align: center;
}
