/* ============================================================================
   UV GRAPHS  ·  prefix: uvg-  ·  feature CSS (linked after mds.css)
   The UV washing-water / wall-wash analysis view: medium chips, the SVG
   spectrum chart (legend chips, grid, crosshair, tooltip), the measurement
   list + entry form. Tokens only — no raw colors except the series strokes,
   which arrive inline from the view (validated palette).
   ============================================================================ */

/* ---- layout: chart is the hero — both cards stacked full width ------------ */
.uvg-stack { display: grid; gap: var(--mds-space-4); max-width: 1100px; }

/* ---- medium switch (chip row, cleaning-stdchip pattern) ------------------ */
.uvg-media { margin: var(--mds-space-2) 0 var(--mds-space-3); }
.uvg-mchip {
    display: inline-block; margin-right: var(--mds-space-1);
    padding: 3px 12px; border: 1px solid var(--mds-line); border-radius: 999px;
    background: var(--mds-surface); color: var(--mds-text);
    font: inherit; font-size: var(--mds-text-xs); cursor: pointer;
}
.uvg-mchip.is-active {
    background: var(--mds-tint); border-color: var(--mds-accent);
    color: var(--mds-accent-ink); font-weight: 600;
}

/* ---- chart ---------------------------------------------------------------- */
.uvg-chart { margin-top: var(--mds-space-2); }

.uvg-legend { display: flex; flex-wrap: wrap; gap: var(--mds-space-1); margin-bottom: var(--mds-space-2); }
.uvg-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border: 1px solid var(--mds-line); border-radius: 999px;
    background: var(--mds-surface); color: var(--mds-text);
    font: inherit; font-size: var(--mds-text-xs); cursor: pointer;
}
.uvg-chip:hover { border-color: var(--mds-accent); }
.uvg-chip.is-off { opacity: .45; }
.uvg-chip.is-off span { text-decoration: line-through; }
.uvg-chip__swatch { width: 28px; height: 8px; flex: none; }

.uvg-plotwrap { position: relative; }
.uvg-svg { display: block; width: 100%; height: auto; }
.uvg-svg * { pointer-events: none; }   /* events land on the svg → ClientX mapping is stable */

.uvg-grid { stroke: var(--mds-line); stroke-width: 1; shape-rendering: crispEdges; }
.uvg-axis { stroke: var(--mds-muted); stroke-width: 1; shape-rendering: crispEdges; }
.uvg-tick { fill: var(--mds-muted); font-family: var(--mds-font); font-size: 11px; }
.uvg-label { fill: var(--mds-title); font-family: var(--mds-font); font-size: 12px; font-weight: 600; }

.uvg-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.uvg-saturation { stroke: var(--mds-warning); stroke-width: 1; stroke-dasharray: 6 4; opacity: .6; }
.uvg-saturation__text { fill: var(--mds-warning); font-family: var(--mds-font); font-size: 10px; }

.uvg-crosshair { stroke: var(--mds-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.uvg-dot { stroke: var(--mds-surface); stroke-width: 2; }

.uvg-tooltip {
    position: absolute; top: 12px; z-index: var(--mds-z-combo);
    min-width: 170px; padding: var(--mds-space-2) var(--mds-space-2-5);
    background: var(--mds-surface); border: 1px solid var(--mds-line);
    border-radius: var(--mds-radius); box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    font-size: var(--mds-text-xs); pointer-events: none;
}
.uvg-tooltip__title { font-weight: 700; color: var(--mds-title); margin-bottom: var(--mds-space-1); }
.uvg-tooltip__row { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.uvg-tooltip__mark { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.uvg-tooltip__name { color: var(--mds-muted); flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uvg-tooltip__value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- measurements list + entry form --------------------------------------- */
.uvg-measurements__mark { width: 24px; }
.uvg-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.uvg-measurements__meta { color: var(--mds-muted); font-size: var(--mds-text-xs); white-space: nowrap; }
.uvg-measurements__actions { text-align: right; }
.uvg-delete { color: var(--mds-danger); }

.uvg-none { color: var(--mds-muted); margin: var(--mds-space-2) 0; }

.uvg-form { margin-top: var(--mds-space-3); display: grid; gap: var(--mds-space-2); }
.uvg-form__label { display: block; font-size: var(--mds-text-xs); color: var(--mds-muted); margin-bottom: 4px; }
.uvg-form__labelfield { max-width: 360px; }
.uvg-form__paste { font-family: ui-monospace, Consolas, monospace; resize: vertical; max-width: 640px; min-height: 110px; }
.uvg-form__ok { color: var(--mds-success); font-size: var(--mds-text-xs); margin: 0; }
.uvg-form__error { color: var(--mds-danger); font-size: var(--mds-text-xs); margin: 0; }
.uvg-form__actions { display: flex; align-items: center; gap: var(--mds-space-3); }
.uvg-form__hint { font-size: var(--mds-text-xs); color: var(--mds-muted); }
