/* Standard reusable graph primitives. Keep graph shell, controls, cards, legend, and tooltip here. */
.standard-graph-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 14px;
    align-items: stretch;
}

.standard-graph-layout--single {
    grid-template-columns: 1fr;
}

.standard-graph-area {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    min-width: 0;
    min-height: 0;
}

.standard-chart-wrap {
    position: relative;
    display: flex;
    width: 100%;
    height: clamp(300px, 34vh, 380px);
    min-height: 300px;
    max-height: 380px;
    box-sizing: border-box;
    overflow: hidden;
    align-items: stretch;
    padding: 10px;
    border: 1px solid rgba(154, 174, 132, .14);
    border-radius: 0;
    background:
        radial-gradient(circle at 12% 8%, rgba(214, 191, 84, .07), transparent 30%),
        linear-gradient(180deg, rgba(8, 11, 12, .24), rgba(8, 11, 12, .10));
}

.standard-chart-wrap--medium {
    height: clamp(320px, 35vh, 400px);
    min-height: 320px;
    max-height: 400px;
}

.standard-chart-wrap--compact {
    height: clamp(260px, 28vh, 320px);
    min-height: 260px;
    max-height: 320px;
}

.standard-chart-wrap canvas {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.standard-chart-tooltip,
.chart-tooltip {
    position: absolute;
    z-index: 20;
    padding: 8px 10px;
    border: 1px solid rgba(209, 193, 137, .24);
    background: #090b09;
    color: var(--text, #e0dccd);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .25);
}

.standard-graph-controls-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    align-content: start;
    min-width: 0;
    min-height: 0;
    padding: 10px;
    border: 1px solid rgba(154, 174, 132, .14);
    border-radius: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 28%),
        rgba(8, 11, 12, .16);
}

.standard-graph-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(154, 174, 132, .12);
}

.standard-graph-tab {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(154, 174, 132, .16);
    border-radius: 0;
    background: rgba(255, 255, 255, .028);
    color: rgba(224, 220, 205, .74);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    cursor: pointer;
}

.standard-graph-tab:hover,
.standard-graph-tab:focus-visible,
.standard-graph-tab.is-active {
    border-color: rgba(127, 166, 107, .52);
    background: rgba(127, 166, 107, .16);
    color: #edf5df;
}

.standard-graph-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-content: start;
}

.standard-graph-card {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 0;
    padding: 6px 8px;
    border: 1px solid rgba(154, 174, 132, .13);
    border-left: 3px solid rgba(154, 174, 132, .28);
    border-radius: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 28%),
        rgba(255, 255, 255, .024);
    color: rgba(224, 220, 205, .80);
    text-align: left;
    cursor: pointer;
}

.standard-graph-card:hover,
.standard-graph-card:focus-visible {
    border-color: rgba(127, 166, 107, .38);
    border-left-color: rgba(127, 166, 107, .66);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .038), rgba(255, 255, 255, 0) 28%),
        rgba(127, 166, 107, .07);
    color: #edf5df;
}

.standard-graph-card.is-active {
    border-color: rgba(127, 166, 107, .52);
    border-left-color: rgba(127, 166, 107, .95);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, 0) 30%),
        rgba(127, 166, 107, .13);
    color: #f0ead5;
}

.standard-graph-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.standard-graph-card-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(204, 199, 178, .52);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .025);
    flex: 0 0 auto;
}

.standard-graph-card-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(224, 220, 205, .86);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .095em;
    text-transform: uppercase;
}

.standard-graph-card-values {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 5px;
    min-width: 0;
    white-space: nowrap;
    text-align: right;
}

.standard-graph-card-values strong {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f0ead5;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.standard-graph-card-values small {
    flex: 0 0 auto;
    color: rgba(204, 199, 178, .58);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .045em;
    line-height: 1.1;
    text-transform: uppercase;
}

.standard-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
}

.standard-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(154, 174, 132, .12);
    border-radius: 0;
    background: rgba(255, 255, 255, .025);
    color: rgba(224, 220, 205, .72);
    font-size: 11px;
}

.standard-chart-legend-item span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}


.standard-graph-select-form {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.standard-graph-select-label {
    color: rgba(204, 199, 178, .62);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.standard-graph-select {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    border: 1px solid rgba(154, 174, 132, .20);
    border-radius: 0;
    background: rgba(8, 11, 12, .68);
    color: rgba(240, 234, 213, .94);
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.standard-graph-select:focus {
    outline: 1px solid rgba(127, 166, 107, .62);
    outline-offset: 1px;
}

.standard-graph-control-note {
    display: grid;
    gap: 5px;
    padding-top: 10px;
    border-top: 1px solid rgba(154, 174, 132, .12);
    color: rgba(204, 199, 178, .64);
    font-size: 11px;
    line-height: 1.35;
}

.standard-graph-control-note strong {
    color: rgba(240, 234, 213, .92);
    font-size: 12px;
}

.standard-graph-control-note span {
    display: block;
}

.standard-graph-summary {
    display: none;
}

@media (min-width: 860px) {
    .standard-graph-layout--nutrition {
        grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    }
}

@media (max-width: 859px) {
    .standard-graph-layout {
        grid-template-columns: 1fr;
    }

    .standard-graph-card-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .standard-chart-wrap {
        height: 260px;
        min-height: 260px;
        max-height: 260px;
    }

    .standard-graph-card {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .standard-graph-card-values {
        justify-content: flex-start;
        text-align: left;
    }
}
