/* The Supergraph - every stream held for one study on one time axis.
   Shared by /admin/supergraph and the customer page /supergraph, which both
   link it from their content.html; it was the admin page's <style> block
   until the customer page arrived, and one file keeps the two from drifting.
   Canon everywhere a component exists: .hub-wrap, .hero--george, the
   .hub-savebar study picker (blStudySavebar, controlled mode), .insp-toolbar,
   .seg, .insp-range, .tab-bar, .insp-panel, .insp-stats of .stat-card,
   .chip-group--multi, .info-tip, .notif-banner, .empty-state, .skeleton,
   .data-table, .toggle, .tag and blModal. What is here is the chart itself
   (nothing canon draws a multi-series line chart with axes, crosshair and
   events), the GSC-style metric cards that double as its legend, the event
   lane under the chart, the before-and-after panel it opens, and layout, all
   under the page's own sg- prefix and on tokens only. */

/* Series colour slots. Eight hues derived from the four brand tokens, order
   validated for colour-blind separation with the dataviz validator
   (2026-09-24: worst adjacent pair CVD 10.7 light / 9.7 dark, normal-vision
   floor 18.2 / 16.1). The brand tokens themselves sit below the validator's
   chroma floor, which a page cannot change, so identity never rests on hue
   alone: legend, tooltip and lane labels all name the series. Colour follows
   the series: a slot is kept for as long as its line is on. */
.sg-wrap {
    --sg-c1: var(--c-blue);
    --sg-c2: var(--c-accent);
    --sg-c3: color-mix(in oklab, var(--c-blue) 62%, var(--c-text));
    --sg-c4: var(--c-amber);
    --sg-c5: color-mix(in oklab, color-mix(in oklab, var(--c-blue) 50%, var(--c-green)) 62%, var(--c-text));
    --sg-c6: color-mix(in oklab, var(--c-accent) 50%, var(--c-amber));
    --sg-c7: color-mix(in oklab, var(--c-blue) 50%, var(--c-green));
    --sg-c8: color-mix(in oklab, color-mix(in oklab, var(--c-accent) 50%, var(--c-amber)) 62%, var(--c-text));
    /* The race's other brands: the same slots, washed toward the panel so
       this study's accent line reads first. */
    --sg-m1: color-mix(in oklab, var(--sg-c1) 62%, var(--c-bg-raised));
    --sg-m3: color-mix(in oklab, var(--sg-c3) 62%, var(--c-bg-raised));
    --sg-m4: color-mix(in oklab, var(--sg-c4) 62%, var(--c-bg-raised));
    --sg-m5: color-mix(in oklab, var(--sg-c5) 62%, var(--c-bg-raised));
    --sg-m6: color-mix(in oklab, var(--sg-c6) 62%, var(--c-bg-raised));
    --sg-m7: color-mix(in oklab, var(--sg-c7) 62%, var(--c-bg-raised));
    --sg-m8: color-mix(in oklab, var(--sg-c8) 62%, var(--c-bg-raised));
}
/* Dark mode mixes less text in: --c-text is light there, and 62% pushed the
   derived slots past the dark lightness band. */
[data-theme="dark"] .sg-wrap {
    --sg-c3: color-mix(in oklab, var(--c-blue) 72%, var(--c-text));
    --sg-c5: color-mix(in oklab, color-mix(in oklab, var(--c-blue) 50%, var(--c-green)) 72%, var(--c-text));
    --sg-c8: color-mix(in oklab, color-mix(in oklab, var(--c-accent) 50%, var(--c-amber)) 72%, var(--c-text));
}

/* Event lanes: the colour is the lane's, the icon is the event type's, and
   every row is named, so no colour carries meaning alone. Amber is pulled
   toward the text colour so a 12px icon on the raised ground stays legible. */
.sg-ev--baseline { --ec: var(--c-accent); }
.sg-ev--site { --ec: var(--c-blue); }
.sg-ev--world { --ec: color-mix(in oklab, var(--c-amber) 80%, var(--c-text)); }
.sg-ev--note { --ec: var(--c-text-secondary); }

/* -- Header -- */
.sg-slot { display: contents; }
.sg-owner { display: inline-flex; align-items: center; height: 28px; font-family: var(--ff-mono); font-size: var(--fs-xs); color: var(--c-text-secondary); background: var(--c-bg-sunken); border-radius: var(--r-pill); padding: 0 var(--sp-3); }
.sg-owner:empty { display: none; }
.sg-find { flex: 0 1 240px; min-width: 180px; }
.sg-find .input { width: 100%; }
/* The owner rides each picker row after the chip, via the savebar's
   decorate hook; the trigger already has the pill beside it. */
#sg-savebar .custom-select-option .sg-opt-owner { order: 2; margin-left: auto; padding-left: var(--sp-3); font-family: var(--ff-mono); font-size: 11px; color: var(--c-text-tertiary); white-space: nowrap; }
#sg-savebar .custom-select-trigger .sg-opt-owner { display: none; }
#sg-savebar .custom-select-menu { max-height: 360px; }

.sg-toolbar { gap: var(--sp-3) var(--sp-5); }
.sg-ctl { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.sg-ctl .hub-savebar-label { white-space: nowrap; }
.sg-client-ctl { cursor: pointer; }
.sg-client-ctl .toggle-label { white-space: nowrap; }
.sg-client-note { margin-bottom: var(--sp-4); }
.sg-client-note:empty { display: none; }
.sg-client-note .notif-banner { align-items: center; }
.sg-range-pop { flex-wrap: wrap; width: max-content; max-width: calc(100vw - 32px); }
.sg-range-err { flex-basis: 100%; }
.sg-tabs { margin-bottom: var(--sp-4); }

/* -- Metric cards: the GSC strip -- */
.sg-strip-wrap { position: relative; margin-bottom: var(--sp-4); }
.sg-strip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.sg-strip-count { font-size: var(--fs-xs); color: var(--c-text-tertiary); }
.sg-strip-nav { display: inline-flex; gap: var(--sp-1); }
.sg-strip { display: flex; align-items: stretch; gap: var(--sp-5); overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px var(--sp-3); scrollbar-width: thin; }
.sg-strip-wrap::after { content: ''; position: absolute; right: 0; top: 30px; bottom: var(--sp-3); width: 48px; pointer-events: none; background: linear-gradient(to left, var(--c-bg), transparent); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.sg-strip-wrap.has-more-right::after { opacity: 1; }
.sg-group { flex: none; display: flex; flex-direction: column; gap: var(--sp-2); scroll-snap-align: start; }
.sg-group-label { display: flex; align-items: center; gap: var(--sp-2); font-size: 10px; font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-tertiary); }
.sg-group-label::after { content: ''; flex: 1; min-width: var(--sp-4); height: 1px; background: var(--c-border-subtle); }
.sg-group-cards { display: flex; align-items: stretch; gap: var(--sp-2); flex: 1; }

.sg-card { position: relative; flex: 0 0 172px; display: flex; background: var(--c-bg-raised); border: 1px solid var(--c-border-subtle); border-radius: var(--r-lg); overflow: hidden; transition: box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.sg-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--sc, transparent); }
.sg-card:not(.is-na):hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sg-card.is-on { border-color: color-mix(in oklab, var(--sc) 40%, var(--c-border-subtle)); background: color-mix(in oklab, var(--sc) 6%, var(--c-bg-raised)); }
.sg-card-inner { display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0; padding: var(--sp-3) var(--sp-3) var(--sp-2); text-align: left; }
.sg-card-btn { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer; }
.sg-card-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; border-radius: var(--r-lg); }
.sg-card-head { display: flex; align-items: center; gap: 7px; min-width: 0; padding-right: 18px; }
.sg-card-head > i { font-size: 14px; color: var(--c-text-tertiary); }
.sg-card-box { flex: none; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--c-border); display: inline-flex; align-items: center; justify-content: center; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.sg-card-box i { font-size: 10px; color: var(--c-bg-raised); opacity: 0; }
.sg-card.is-on .sg-card-box { background: var(--sc); border-color: var(--sc); }
.sg-card.is-on .sg-card-box i { opacity: 1; }
.sg-card-label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--c-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-card.is-on .sg-card-label { color: var(--c-text); }
.sg-card-value { font-size: var(--fs-xl); font-weight: var(--fw-semi); color: var(--c-text); line-height: 1.15; letter-spacing: -0.02em; margin-top: 2px; }
.sg-card-none { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-tertiary); }
.sg-card-sub { min-height: 18px; font-size: var(--fs-xs); }
.sg-card-meta { color: var(--c-text-tertiary); }
.sg-spark { display: block; width: 100%; height: 24px; margin-top: auto; overflow: visible; }
.sg-spark path { fill: none; stroke: var(--c-border); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sg-card.is-on .sg-spark path { stroke: var(--sc); }
.sg-spark--run path { stroke-width: 1; stroke-dasharray: 2 2; }
.sg-card-tip { position: absolute; top: 10px; right: 8px; }
/* Unavailable: muted, never a toggle, and it says why. */
.sg-card.is-na { background: var(--c-bg); border-style: dashed; border-color: var(--c-border); }
.sg-card.is-na .sg-card-inner { gap: var(--sp-1); padding-bottom: var(--sp-3); }
.sg-card.is-na .sg-card-label { color: var(--c-text-tertiary); white-space: normal; }
.sg-card.is-na.is-wide { flex-basis: 236px; }
.sg-card.is-group { flex-basis: 312px; }
.sg-card-reason { font-size: var(--fs-xs); color: var(--c-text-secondary); line-height: 1.45; }
.sg-card-names { font-size: 11px; color: var(--c-text-tertiary); line-height: 1.45; }
.sg-card-fix { align-self: flex-start; margin-top: auto; }

/* The floating copy of the canon bubble (see wireFloatTips). */
.sg-float { position: fixed; z-index: 400; max-width: 260px; background: var(--c-bg-raised); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--c-text-secondary); line-height: 1.5; pointer-events: none; }

/* Deltas: up/down by arrow and word, colour only by good or bad. */
/* Inline, not inline-flex: a flex parent would blockify the word span and
   the design probe would read "vs previous period" as a sentence of its own. */
.sg-delta { display: inline; font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap; }
.sg-delta i { font-size: 12px; vertical-align: -1px; margin-right: 2px; }
.sg-delta.is-good { color: color-mix(in srgb, var(--c-green), var(--c-text) 28%); }
.sg-delta.is-bad { color: color-mix(in srgb, var(--c-accent), var(--c-text) 22%); }
.sg-delta.is-flat { color: var(--c-text-secondary); }
.sg-delta-word { font-weight: var(--fw-regular); color: var(--c-text-tertiary); }

/* -- Chart panel -- */
.sg-panel { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.sg-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.sg-panel-head .insp-panel-title { margin: 0; }
.sg-panel-ctl { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.sg-meta { font-size: var(--fs-xs); color: var(--c-text-tertiary); margin: 0 0 var(--sp-3); }
.sg-hint { margin-bottom: var(--sp-3); align-items: center; }
.sg-hint-actions { display: inline-flex; gap: var(--sp-2); flex-shrink: 0; }
.sg-legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); font-size: var(--fs-xs); color: var(--c-text-secondary); margin-bottom: var(--sp-2); min-height: 18px; }
.sg-legend:empty { display: none; }
.sg-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sg-legend-item.is-off { color: var(--c-text-tertiary); }
.sg-legend-note { font-size: 10px; font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-tertiary); }
.sg-key { display: inline-block; flex: none; width: 16px; height: 0; border-top: 2px solid var(--sc); border-radius: 1px; }
.sg-key--run { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--sc); }
.sg-key--step { width: 14px; height: 6px; border-top: 2px solid var(--sc); border-right: 2px solid var(--sc); border-radius: 0; }
.sg-key--cmp { border-top: 2px dashed var(--c-text-tertiary); }
.sg-chart { position: relative; }
.sg-chart-empty { padding-block: var(--sp-7); }
.sg-plot { position: relative; outline: none; border-radius: var(--r-md); }
.sg-plot:focus-visible { box-shadow: 0 0 0 2px var(--c-accent-soft), 0 0 0 1px var(--c-accent); }
.sg-svg { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sg-grid line { stroke: var(--c-border-subtle); stroke-width: 1; shape-rendering: crispEdges; }
.sg-base100 { stroke: var(--c-border); }
.sg-tick { font-family: var(--ff-mono); font-size: 10px; fill: var(--c-text-tertiary); }
.sg-axis-title { font-family: var(--ff-product); font-size: 10px; font-weight: var(--fw-semi); fill: var(--c-text-tertiary); }
.sg-line { fill: none; stroke: var(--sc); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sg-step { stroke-linejoin: miter; stroke-linecap: square; }
.sg-series.is-strong .sg-line, .sg-series.is-strong .sg-conn { stroke-width: 2.75; opacity: 1; }
.sg-line--cmp { stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.5; }
.sg-line--partial { stroke-dasharray: 3 3; }
.sg-area { fill: var(--sc); opacity: 0.08; }
.sg-conn { fill: none; stroke: var(--sc); stroke-width: 1.25; opacity: 0.55; }
.sg-conn--cmp { stroke-dasharray: 3 3; opacity: 0.35; }
.sg-dot { fill: var(--sc); stroke: var(--c-bg-raised); stroke-width: 2; }
.sg-dot--cmp { fill: var(--c-bg-raised); stroke: var(--sc); stroke-width: 1.5; opacity: 0.6; }
.sg-hover-dot { fill: var(--sc); stroke: var(--c-bg-raised); stroke-width: 2.5; }
.sg-ring { fill: none; stroke: var(--sc); stroke-width: 2; }
.sg-cross { stroke: var(--c-text-tertiary); stroke-width: 1; shape-rendering: crispEdges; }
.sg-guide { stroke: var(--c-text-secondary); stroke-width: 1; stroke-dasharray: 2 3; }
.sg-sel { fill: var(--c-blue-soft); stroke: var(--c-blue); stroke-width: 1; }
.sg-hit { fill: transparent; cursor: crosshair; }
.sg-hit.is-link { cursor: pointer; }
.sg-band { fill: var(--ec); opacity: 0.08; }
.sg-cmpwin { fill: var(--c-text); opacity: 0.05; }
.sg-cmpspan { fill: var(--ec); opacity: 0.16; }
.sg-cmpline { stroke: var(--ec); stroke-width: 2; }
.sg-band--ongoing { opacity: 1; }
.sg-fade-a { stop-color: var(--ec); stop-opacity: 0.12; }
.sg-fade-b { stop-color: var(--ec); stop-opacity: 0; }
.sg-lane-base { stroke: var(--c-border); shape-rendering: crispEdges; }
.sg-lane-top { stroke: var(--c-border-subtle); stroke-dasharray: 2 4; }
.sg-lane-key { stroke: var(--sc); stroke-width: 2.5; stroke-linecap: round; }
.sg-lane-name { font-family: var(--ff-product); font-size: 12px; font-weight: var(--fw-semi); fill: var(--c-text); }
.sg-lane-val { font-family: var(--ff-mono); font-size: 11px; fill: var(--c-text-secondary); }

/* Hover card: values lead, names follow. */
.sg-tip { position: absolute; z-index: 60; min-width: 220px; max-width: 340px; background: var(--c-bg-raised); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); pointer-events: none; }
.sg-tip-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.sg-tip-date { font-weight: var(--fw-semi); color: var(--c-text); }
.sg-tip-cmp { color: var(--c-text-tertiary); white-space: nowrap; }
.sg-tip-note { display: flex; align-items: center; gap: 4px; color: var(--c-text-tertiary); margin: -4px 0 var(--sp-2); }
.sg-tip-rows { display: grid; grid-template-columns: 16px auto 1fr auto auto; column-gap: var(--sp-2); row-gap: 5px; align-items: baseline; }
.sg-tip-row { display: contents; }
.sg-tip-row .sg-key { align-self: start; margin-top: 7px; }
.sg-tip-row .sg-key--run { margin-top: 4px; }
.sg-tip-val { font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; text-align: right; }
.sg-tip-label { color: var(--c-text-secondary); min-width: 0; }
.sg-tip-extra { display: block; font-size: 11px; color: var(--c-text-tertiary); }
.sg-tip-cv { color: var(--c-text-tertiary); font-variant-numeric: tabular-nums; text-align: right; }
.sg-tip-dp { font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; text-align: right; min-width: 3em; }
.sg-tip-row:not(.has-cmp) .sg-tip-label { grid-column: span 3; }
.sg-tip-dp.is-good { color: color-mix(in srgb, var(--c-green), var(--c-text) 28%); }
.sg-tip-dp.is-bad { color: color-mix(in srgb, var(--c-accent), var(--c-text) 22%); }
.sg-tip-foot { display: flex; align-items: center; gap: 4px; margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--c-border-subtle); color: var(--c-text-secondary); font-weight: var(--fw-semi); }

/* -- Event lane: one row per lane, sharing the chart's x-axis. The rows
   sit inside the plot's left and right padding, so a marker lands on the
   same x as the day it names. -- */
.sg-evlanes { position: relative; margin-top: var(--sp-2); }
.sg-evrow { position: relative; z-index: 1; }
.sg-evrow + .sg-evrow { margin-top: var(--sp-1); }
.sg-evrow-head { display: flex; align-items: center; gap: 6px; height: 16px; white-space: nowrap; }
.sg-evrow-key { flex: none; width: 14px; height: 0; border-top: 2.5px solid var(--ec); border-radius: 2px; }
.sg-evrow-name { font-size: 12px; font-weight: var(--fw-semi); color: var(--c-text); }
.sg-evrow-n { font-family: var(--ff-mono); font-size: 11px; color: var(--c-text-secondary); }
.sg-evrow-empty { font-size: 11px; color: var(--c-text-tertiary); overflow: hidden; text-overflow: ellipsis; }
.sg-evrow-track { position: relative; height: 30px; }
.sg-evrow--thin .sg-evrow-track { height: 24px; }
.sg-evrow-rule { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--c-border-subtle); }
.sg-evlane-band { position: absolute; top: calc(50% - 2px); height: 5px; border-radius: 3px; background: color-mix(in oklab, var(--ec) 38%, transparent); }
.sg-evlane-band.is-ongoing { border-radius: 3px 0 0 3px; -webkit-mask-image: linear-gradient(to right, var(--c-text) 35%, transparent); mask-image: linear-gradient(to right, var(--c-text) 35%, transparent); min-width: 14px; }
.sg-evlanes-off { font-size: 11px; color: var(--c-text-tertiary); padding: var(--sp-2) 0; }
.sg-ev { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ec); background: var(--c-bg-raised); color: var(--ec); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.sg-evrow--thin .sg-ev { width: 18px; height: 18px; font-size: 10px; }
.sg-ev:hover { background: color-mix(in oklab, var(--ec) 16%, var(--c-bg-raised)); box-shadow: var(--shadow-sm); z-index: 2; }
.sg-ev:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; z-index: 2; }
.sg-ev.is-hidden { border-style: dashed; }
.sg-ev.is-sel { background: var(--ec); border-color: var(--ec); color: var(--c-bg-raised); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ec) 24%, transparent); z-index: 3; }
.sg-ev-count { position: absolute; top: -7px; right: -9px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--c-text); color: var(--c-bg-raised); font-family: var(--ff-mono); font-size: 9px; font-weight: var(--fw-semi); line-height: 15px; text-align: center; }
.sg-evrow--thin .sg-ev-count { top: -6px; right: -8px; min-width: 13px; height: 13px; line-height: 13px; }

/* The compare window, carried down from the chart through the rows: a
   neutral wash for the days on each side, the event day in its lane colour,
   and a dimension line naming how many days each side holds. */
.sg-evshade { position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none; background: color-mix(in oklab, var(--c-text) 5%, transparent); }
.sg-evshade--ev { background: color-mix(in oklab, var(--ec) 16%, transparent); }
.sg-evshade-line { position: absolute; top: 0; bottom: 0; z-index: 0; width: 2px; margin-left: -1px; pointer-events: none; background: var(--ec); }
.sg-evruler { position: relative; z-index: 1; height: 20px; }
.sg-evruler-seg { position: absolute; bottom: 3px; height: 7px; border: 1px solid var(--c-text-tertiary); border-top: 0; }
.sg-evruler-seg span { position: absolute; left: 0; right: 0; bottom: 5px; font-size: 10px; font-weight: var(--fw-semi); line-height: 12px; color: var(--c-text-secondary); text-align: center; white-space: nowrap; }

.sg-evpop { position: absolute; z-index: 70; width: min(340px, 100%); max-height: 360px; overflow-y: auto; overscroll-behavior: contain; background: var(--c-bg-raised); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: var(--sp-3); font-size: var(--fs-xs); }
.sg-evpop-item + .sg-evpop-item { border-top: 1px solid var(--c-border-subtle); margin-top: var(--sp-3); padding-top: var(--sp-3); }
.sg-evpop-head { display: flex; align-items: center; gap: 6px; }
.sg-evpop-head > i { color: var(--ec); font-size: 14px; }
.sg-evpop-type { font-weight: var(--fw-semi); color: var(--c-text-secondary); }
.sg-evpop-when { margin-left: auto; font-family: var(--ff-mono); font-size: 11px; color: var(--c-text-tertiary); white-space: nowrap; }
.sg-evpop-label { margin-top: var(--sp-1); font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--c-text); line-height: 1.35; overflow-wrap: anywhere; }
.sg-evpop-label a { color: inherit; text-decoration: none; }
.sg-evpop-label a:hover { color: var(--c-blue); }
.sg-evpop-label a i { font-size: 12px; color: var(--c-text-tertiary); }
.sg-evpop-live { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--sp-1); font-weight: var(--fw-semi); color: color-mix(in srgb, var(--c-amber), var(--c-text) 40%); }
.sg-evpop-detail { margin-top: var(--sp-1); color: var(--c-text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.sg-evpop-list { margin: var(--sp-2) 0 0; padding-left: var(--sp-4); color: var(--c-text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.sg-evpop-list a { color: var(--c-blue); text-decoration: none; }
.sg-evpop-list a:hover { text-decoration: underline; }
.sg-evpop-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin-top: var(--sp-2); color: var(--c-text-tertiary); font-size: 11px; line-height: 1.45; }
.sg-evpop-hint { display: flex; align-items: center; gap: 4px; margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--c-border-subtle); color: var(--c-text-tertiary); font-size: 11px; }

/* Admin controls on one event: hide or show it to the client, delete it.
   Deleting asks in place; the question replaces the buttons. */
.sg-evadmin { margin-top: var(--sp-2); }
.sg-evadmin-btns { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.sg-evadmin-q { flex-basis: 100%; font-size: var(--fs-xs); color: var(--c-text); line-height: 1.45; }
.sg-evadmin-err:empty { display: none; }
.sg-evadmin-err { margin-top: var(--sp-2); }

/* The filters under the lane: a checkbox per row, then that row's types. */
.sg-evbar { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--c-border-subtle); }
.sg-evbar:empty { display: none; }
.sg-evbar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.sg-evbar-label { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--c-text-secondary); }
.sg-evfs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); align-items: center; }
.sg-evf { display: contents; }
.sg-evf-lane .chip { color: var(--c-text); white-space: nowrap; }
.sg-evf-lane .chip.is-on { color: var(--c-text); }
.sg-evf-lane .sg-evrow-key { width: 12px; }
.sg-evf.is-off .sg-evf-lane .chip { color: var(--c-text-tertiary); }
.sg-evf.is-off .sg-evf-lane .sg-evrow-key { border-top-style: dotted; }
.sg-evf.is-off .sg-evchips { opacity: 0.45; }
.sg-evchips .chip i { color: var(--ec); }
.sg-evchips .chip:disabled { cursor: default; }
.sg-chip-n { font-family: var(--ff-mono); font-size: 10px; font-weight: var(--fw-medium); color: var(--c-text-tertiary); margin-left: 2px; }
.sg-evbar-warn { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--c-text-secondary); }
.sg-evbar-warn i { color: var(--c-amber); }
.sg-muted { color: var(--c-text-tertiary); font-size: var(--fs-xs); }

/* -- Before and after: the days either side of one event. A sunken sheet
   under the lane, topped with the event's lane colour like the cards. -- */
.sg-cmp { position: relative; margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5) var(--sp-5); background: var(--c-bg); border: 1px solid var(--c-border-subtle); border-radius: var(--r-lg); overflow: hidden; }
.sg-cmp::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ec); }
.sg-cmp[hidden] { display: none; }
.sg-cmp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.sg-cmp-ev { min-width: 0; flex: 1; max-width: 760px; }
.sg-cmp-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); color: var(--c-text-secondary); }
.sg-cmp-kicker > i { font-size: 15px; color: var(--ec); }
.sg-cmp-fam { font-weight: var(--fw-semi); color: var(--c-text); }
.sg-cmp-when { font-family: var(--ff-mono); font-size: 11px; color: var(--c-text-tertiary); }
.sg-cmp-title { margin-top: var(--sp-2); font-size: var(--fs-lg); font-weight: var(--fw-semi); color: var(--c-text); line-height: 1.3; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sg-cmp-title a { color: inherit; text-decoration: none; }
.sg-cmp-title a:hover { color: var(--c-blue); }
.sg-cmp-title a i { font-size: 14px; color: var(--c-text-tertiary); }
.sg-cmp-detail { margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--c-text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.sg-cmp-ev .sg-evpop-list { font-size: var(--fs-xs); }
.sg-cmp-items { margin-top: var(--sp-3); max-width: 560px; }
.sg-cmp-items > summary { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-3); }
.sg-cmp-items > summary i { color: var(--c-text-tertiary); }
.sg-cmp-items > div { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.sg-cmp-items .sg-evpop-list { margin: 0; columns: 2 200px; column-gap: var(--sp-6); }
.sg-cmp-items .sg-evpop-list li { break-inside: avoid; }
.sg-cmp-tools { display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; }
.sg-cmp-step { display: inline-flex; align-items: center; gap: var(--sp-1); }
.sg-cmp-stepn { font-family: var(--ff-mono); font-size: 11px; color: var(--c-text-secondary); white-space: nowrap; }
.sg-cmp-sec { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--c-border-subtle); }
.sg-cmp-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.sg-cmp-heading { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--c-text); }
.sg-cmp-heading i { color: var(--c-text-tertiary); }
.sg-cmp-span { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--c-text-secondary); line-height: 1.5; }
.sg-cmp-cut { margin-top: var(--sp-3); }
.sg-cmp-tiles { margin: var(--sp-4) 0 0; }
.sg-ba { display: flex; flex-direction: column; min-width: 0; }
.sg-ba .stat-card-label { display: flex; align-items: center; gap: 6px; }
.sg-ba .stat-card-label .sg-key { width: 12px; }
.sg-ba-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--sp-2); }
.sg-ba-was { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--c-text-tertiary); }
.sg-ba-value > i { align-self: center; font-size: 14px; color: var(--c-text-tertiary); }
.sg-ba .stat-card-sub { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--sp-2); line-height: 1.5; }
.sg-ba-abs { color: var(--c-text-secondary); font-variant-numeric: tabular-nums; }
.sg-ba-how { font-size: 11px; color: var(--c-text-tertiary); line-height: 1.45; margin-top: 2px; }
.sg-ba-why { font-size: var(--fs-xs); color: var(--c-text-secondary); line-height: 1.45; }
.sg-ba-spark { display: block; width: 100%; height: 40px; margin-top: auto; padding-top: var(--sp-3); overflow: visible; box-sizing: content-box; }
.sg-ba-spark--row { width: 132px; height: 24px; padding-top: 0; margin: 0; }
.sg-ba-spark path, .sg-ba-spark line { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.sg-ba-pre { stroke: var(--c-text-tertiary); stroke-width: 1.25; opacity: 0.6; }
.sg-ba-post { stroke: var(--sc); stroke-width: 1.25; opacity: 0.6; }
.sg-ba-lvl { stroke-width: 2.25; }
.sg-ba-lvl--pre { stroke: var(--c-text-secondary); }
.sg-ba-lvl--post { stroke: var(--sc); }
.sg-ba-ev { stroke: var(--ec); stroke-width: 1.5; }
.sg-ba-dot { stroke: var(--c-text-tertiary); stroke-width: 5; }
.sg-ba-dot--post { stroke: var(--sc); }
.sg-ba-dot--key { stroke-width: 8; }
.sg-cmp-tbl { margin-top: var(--sp-4); }
.sg-cmp-tbl td { vertical-align: middle; }
.sg-cmp-agg { display: block; font-size: 11px; color: var(--c-text-tertiary); }
.sg-cmp-why { font-size: var(--fs-xs); color: var(--c-text-secondary); white-space: normal; }
.sg-cmp-tbl .sg-delta { font-size: var(--fs-xs); }
.sg-cmp-trend { width: 148px; }
.sg-cmp-caveat { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-4) 0 0; font-size: var(--fs-xs); color: var(--c-text-secondary); line-height: 1.5; }
.sg-cmp-caveat i { margin-top: 2px; color: var(--c-text-tertiary); }
.sg-cmp-skel { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.sg-cmp-skel .skeleton-card { gap: var(--sp-2); }
.sg-cmp-err { margin-top: var(--sp-3); }

/* -- Lenses -- */
.sg-lens-tiles { margin-bottom: var(--sp-4); }
.sg-stat .stat-card-sub { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); line-height: 1.5; }
.sg-unmeasured { color: var(--c-text-tertiary); font-size: var(--fs-md); font-weight: var(--fw-medium); }
.sg-google-empty, .sg-race-empty { background: var(--c-bg); }
.sg-brand-chip .sg-swatch, .sg-brand .sg-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--sc); }
.sg-brand-chip.is-self { font-weight: var(--fw-semi); }
.sg-race-chips { margin-bottom: var(--sp-3); }
.sg-race-table { margin-top: var(--sp-4); }
.sg-brand { display: inline-flex; align-items: center; gap: var(--sp-2); }
.sg-row-self td { font-weight: var(--fw-semi); }
.sg-word { font-family: var(--ff-product); }

/* The operator card and its list. */
.sg-card--fam { background: var(--c-bg-raised); }
.sg-card--fam.is-open { border-color: var(--c-border); box-shadow: var(--shadow-sm); }
.sg-card-unit { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-secondary); letter-spacing: 0; }
.sg-fam-foot { display: flex; align-items: center; gap: 5px; margin-top: auto; padding-top: var(--sp-1); font-size: 11px; color: var(--c-text-tertiary); min-height: 24px; }
.sg-fam-foot .sg-key { width: 12px; }
.sg-fam-caret { margin-left: auto; font-size: 13px; transition: transform var(--dur-fast) var(--ease-out); }
.sg-card--fam.is-open .sg-fam-caret { transform: rotate(180deg); }
.sg-fams-find { width: 220px; }
.sg-fams-find .input { width: 100%; }
.sg-fam-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0 var(--sp-6); max-height: 400px; overflow-y: auto; padding-right: var(--sp-1); }
.sg-fam-row { display: grid; grid-template-columns: 18px 14px minmax(110px, 1fr) 80px 52px 52px 64px; align-items: center; gap: var(--sp-3); padding: 7px var(--sp-2); border-bottom: 1px solid var(--c-border-subtle); font-size: var(--fs-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.sg-fam-row:hover { background: var(--c-bg-hover); }
.sg-fam-row .sg-key { width: 14px; }
.sg-fam-row:not(.is-on) .sg-key { opacity: 0; }
.sg-fam-name { min-width: 0; overflow-wrap: anywhere; color: var(--c-text); }
.sg-fam-track { height: 6px; border-radius: 3px; background: var(--c-bg-sunken); overflow: hidden; }
.sg-fam-track .h-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--c-blue); }
.sg-fam-row.is-on .sg-fam-track .h-bar-fill { background: var(--sc); }
.sg-fam-val, .sg-fam-share { font-family: var(--ff-mono); font-size: var(--fs-xs); text-align: right; color: var(--c-text-secondary); }
.sg-fam-val { color: var(--c-text); }
.sg-fam-delta { text-align: right; }

/* Before a stream was held: hatched, labelled, never a zero. */
.sg-hatch-line { stroke: var(--c-border); stroke-width: 1.5; }
.sg-nodata { opacity: 0.9; }
.sg-nodata-edge { stroke: var(--c-border); stroke-width: 1; stroke-dasharray: 3 3; }
.sg-nodata-label { font-family: var(--ff-product); font-size: 11px; font-weight: var(--fw-medium); fill: var(--c-text-tertiary); paint-order: stroke; stroke: var(--c-bg-raised); stroke-width: 5px; stroke-linejoin: round; }
.sg-start { fill: var(--c-bg-raised); stroke: var(--sc); stroke-width: 2; }

/* The race table: every brand, sortable, a tick to draw each one. */
.sg-race-scroll { max-height: 520px; overflow: auto; }
.sg-race-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--c-bg-raised); }
.sg-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.sg-sort i { font-size: 11px; color: var(--c-text-tertiary); }
.sg-sort.is-on, .sg-sort:hover { color: var(--c-text); }
.sg-sort.is-on i { color: var(--c-text); }
th.num .sg-sort { justify-content: flex-end; }
.sg-col-draw { width: 44px; }
.sg-th-draw { font-weight: inherit; }
.sg-sov { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); width: 100%; }
.sg-sov-track { flex: 0 1 120px; height: 6px; border-radius: 3px; background: var(--c-bg-sunken); overflow: hidden; }
.sg-sov-track .h-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--sc); }
.sg-sov-val { min-width: 3.6em; }
.sg-swatch.is-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c-border); }
.sg-brand-chip i { font-size: 11px; color: var(--c-text-tertiary); }
.sg-race-more { align-self: center; }

/* The log-work dialog: canon .field controls on a two-column grid. */
.sg-note-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4) var(--sp-3); margin: var(--sp-4) 0 var(--sp-5); }
.sg-note-wide { grid-column: 1 / -1; }
.sg-note-form > * { min-width: 0; }
.sg-note-detail { resize: vertical; min-height: 72px; }
.sg-note-hint { font-size: var(--fs-xs); }
.sg-lw-links { display: flex; flex-direction: column; gap: var(--sp-2); }
.sg-lw-links:empty { display: none; }
.sg-lw-link { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: var(--sp-2); align-items: center; }
.sg-lw-add { align-self: flex-start; }
.sg-lw-vis .toggle-wrap { cursor: pointer; }
.sg-lw-vis .toggle:disabled { cursor: not-allowed; opacity: 0.55; }

/* Refetch keeps the frame: the last render holds, dimmed, until the new
   answer lands - no skeleton flash and no layout jump. */
#sg-body.is-busy .sg-strip, #sg-body.is-busy .sg-chart, #sg-body.is-busy .insp-stats { opacity: 0.5; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); }

.sg-skel-cards { display: flex; gap: var(--sp-2); overflow: hidden; margin-bottom: var(--sp-4); }
.sg-skel-cards .skeleton-card { flex: 0 0 172px; gap: var(--sp-2); }

@media (max-width: 720px) {
    .sg-find { flex: 1 1 100%; }
    .sg-evfs { grid-template-columns: minmax(0, 1fr); gap: var(--sp-1); }
    .sg-evf-lane { margin-top: var(--sp-2); }
    .sg-cmp { padding: var(--sp-4) var(--sp-3); }
    .sg-cmp-head { flex-direction: column-reverse; gap: var(--sp-2); }
    .sg-cmp-tools { align-self: stretch; justify-content: space-between; }
    .sg-cmp-title { font-size: var(--fs-md); }
    .sg-note-form { grid-template-columns: 1fr; }
    .sg-lw-link { grid-template-columns: minmax(0, 1fr) auto; }
    .sg-lw-link .sg-lw-url { grid-column: 1; grid-row: 2; }
    .sg-toolbar { gap: var(--sp-3); }
    .sg-ctl { flex-wrap: wrap; }
    .sg-panel { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
    .sg-strip-nav { display: none; }
    .sg-hint { flex-wrap: wrap; }
    .sg-hint-actions { margin-left: calc(15px + var(--sp-2)); }
    .sg-fams-find { width: 100%; }
    .sg-fam-list { grid-template-columns: 1fr; }
    .sg-fam-row { grid-template-columns: 18px 14px minmax(0, 1fr) 52px 48px; gap: var(--sp-2); }
    .sg-fam-track, .sg-fam-delta { display: none; }
    .sg-sov-track { display: none; }
}
/* At phone width the strip stays a strip: 55 streams as a two-column grid
   ran to two full screens of cards before the chart (compared 2026-09-24),
   so the cards scroll sideways with snap and the chart stays one scroll away. */
@media (max-width: 560px) {
    .sg-strip { scroll-snap-type: x mandatory; gap: var(--sp-4); }
    .sg-log-modal .seg-btn i { display: none; }
    .sg-card { flex-basis: 152px; }
    .sg-card.is-na.is-wide { flex-basis: 220px; }
    .sg-card.is-group { flex-basis: 260px; }
    .sg-card-value { font-size: var(--fs-lg); }
    .sg-group { scroll-snap-align: none; }
    .sg-card { scroll-snap-align: start; }
    .sg-evrow-track { height: 28px; }
    .sg-evrow--thin .sg-evrow-track { height: 22px; }
    .sg-cmp-trend { display: none; }
    .sg-cmp-tbl .sg-cmp-hide-sm { display: none; }
}
