/* Sponsor Satisfaction Survey dashboard — /dept/cs?tab=surveys
 *
 * Every colour here resolves from the theme tokens in themes.css, so the
 * surface is correct on the dark themes AND the light ones (brand / sage /
 * pastel / demo). Two conventions carry that:
 *
 *   --svy-tone   a semantic colour set by a .svy-tone-* class; bars use it
 *                raw, ink mixes it toward --text-primary so it darkens on
 *                light canvases and brightens on dark ones.
 *   opacity      the satisfaction ramp varies intensity by opacity rather
 *                than by mixing hues, which keeps the 5-point scale legible
 *                whatever the theme's success/error hues are.
 */

#panel-surveys,
#svy-drawer {
  --svy-tone: var(--accent);
  --svy-ink: color-mix(in srgb, var(--svy-tone) 78%, var(--text-primary));
  --svy-tint: color-mix(in srgb, var(--svy-tone) 15%, transparent);
  --svy-nested: var(--bg-secondary);
  --svy-track: color-mix(in srgb, var(--text-muted) 18%, transparent);
}

.svy-tone-good   { --svy-tone: var(--success); }
.svy-tone-warn   { --svy-tone: var(--warning); }
.svy-tone-bad    { --svy-tone: var(--error); }
.svy-tone-flat   { --svy-tone: var(--text-muted); }
.svy-tone-accent { --svy-tone: var(--accent); }
.svy-tone-purple { --svy-tone: var(--purple); }
.svy-tone-cyan   { --svy-tone: var(--cyan); }

/* --svy-ink / --svy-tint are substituted where they are DECLARED, so a
   tone class further down the tree has to re-derive them — inheriting the
   panel-level pair would paint every pill and headline the accent colour
   no matter what score it carries. */
.svy-tone-good, .svy-tone-warn, .svy-tone-bad, .svy-tone-flat,
.svy-tone-accent, .svy-tone-purple, .svy-tone-cyan {
  --svy-ink: color-mix(in srgb, var(--svy-tone) 78%, var(--text-primary));
  --svy-tint: color-mix(in srgb, var(--svy-tone) 15%, transparent);
}

/* ══ toolbar: view switch, filters, active scope ═══════════════════════ */
#panel-surveys .dept-section-header { flex-wrap: wrap; row-gap: 10px; }
.svy-views {
  display: inline-flex;
  margin-left: auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
}
.svy-view-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.svy-view-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.svy-view-btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
}

.svy-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.svy-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.svy-field-head { display: flex; align-items: center; }
.svy-field.grow { flex: 1 1 220px; }
.svy-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.svy-select,
.svy-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 7px 11px;
  font: inherit;
  font-size: 12.5px;
  max-width: 100%;
}
.svy-select { max-width: 230px; }
.svy-select:hover,
.svy-input:hover { border-color: var(--border-light); }
.svy-select:focus,
.svy-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.svy-btn {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.svy-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-on-subtle); }
.svy-btn:disabled { opacity: .45; cursor: default; }

.svy-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.svy-scope-count { color: var(--text-primary); font-weight: 600; }
.svy-chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: var(--accent-bg-subtle);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent-on-subtle);
  font-size: 11.5px;
  font-weight: 600;
}
.svy-chip-filter button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: .7;
}
.svy-chip-filter button:hover { opacity: 1; }

/* ══ hero: the headline read ═══════════════════════════════════════════ */
.svy-hero {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.svy-hero-score,
.svy-hero-side {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--svy-nested);
  padding: 16px 18px;
}
.svy-hero-score { display: flex; flex-direction: column; gap: 10px; }
.svy-hero-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.svy-hero-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--svy-ink);
  font-variant-numeric: tabular-nums;
}
.svy-hero-value .unit { font-size: 16px; font-weight: 600; color: var(--text-muted); }
.svy-hero-meta { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; }

.svy-gauge {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--svy-track);
  overflow: hidden;
}
.svy-gauge-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--svy-tone);
  transition: width .5s cubic-bezier(.22, .61, .36, 1);
}
.svy-gauge-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.svy-nps-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--svy-track);
}
.svy-nps-bar span { display: block; }
.svy-nps-bar .det { background: var(--error); }
.svy-nps-bar .pas { background: var(--text-muted); opacity: .55; }
.svy-nps-bar .pro { background: var(--success); }
.svy-nps-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-secondary);
}
.svy-nps-legend .val { color: var(--text-primary); font-weight: 600; }
.svy-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
  background: var(--svy-tone);
}

.svy-hero-side { display: flex; flex-direction: column; gap: 14px; }
.svy-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px 18px;
}
.svy-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.svy-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.svy-stat-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--svy-ink);
  font-variant-numeric: tabular-nums;
}
.svy-stat-value .unit { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.svy-stat-note { font-size: 10.5px; color: var(--text-secondary); line-height: 1.35; }

/* The bar heights are percentages, so they need a plot slot of their own —
   a definite box that excludes the axis label. Sizing the column instead
   makes a full-height bar overflow by the label's height, and lets the hero
   grid squash the whole chart when the other card is taller. */
.svy-trend { margin-top: auto; flex: 0 0 auto; }
.svy-trend-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.svy-trend-bars { display: flex; align-items: flex-end; gap: 4px; }
.svy-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.svy-trend-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 44px;
}
.svy-trend-bar {
  width: 100%;
  max-width: 26px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  transition: height .5s cubic-bezier(.22, .61, .36, 1);
}
.svy-trend-col:hover .svy-trend-bar { background: var(--accent); }
.svy-trend-x {
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

/* ══ blocks + cards ═══════════════════════════════════════════════════ */
.svy-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--svy-nested);
  margin-bottom: 16px;
  overflow: hidden;
}
.svy-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}
.svy-block-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.svy-block-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.svy-block-note.push { margin-left: auto; }
.svy-block-body { padding: 16px 18px; }
.svy-block-body.flush { padding: 0; }

.svy-grid {
  display: grid;
  /* min() so the track can go narrower than the ideal card on a phone —
     a bare minmax(320px, 1fr) overflows its container and gets clipped. */
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 14px;
}
.svy-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.svy-card.span { grid-column: 1 / -1; }
.svy-card-head { display: flex; flex-direction: column; gap: 5px; }
.svy-card-q {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.svy-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.svy-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--svy-tint);
  color: var(--svy-ink);
}
.svy-pill {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--svy-tint);
  /* Small bold text on a 15% tint needs more of the text colour mixed in
     than the display numerals do, in both directions (dark ink on the light
     themes, light ink on the dark ones). */
  color: color-mix(in srgb, var(--svy-tone) 58%, var(--text-primary));
  font-variant-numeric: tabular-nums;
}
.svy-headline-num {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--svy-ink);
  font-variant-numeric: tabular-nums;
}
.svy-headline-num .unit { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.svy-inline-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* ══ satisfaction matrix — one stacked row per rated dimension ═════════ */
.svy-matrix { display: flex; flex-direction: column; }
.svy-matrix-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.5fr) minmax(120px, 3fr) 62px 60px;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
}
.svy-matrix-row:last-child { border-bottom: none; }
.svy-matrix-row.head {
  padding-top: 10px;
  padding-bottom: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.svy-matrix-row:not(.head):hover { background: var(--bg-card-hover); }
.svy-matrix-q {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.35;
}
.svy-matrix-n { font-size: 10.5px; color: var(--text-muted); }
.svy-matrix-num,
.svy-matrix-top2 { text-align: right; font-variant-numeric: tabular-nums; }
.svy-matrix-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.svy-matrix-num .unit { font-size: 10px; font-weight: 500; color: var(--text-muted); }

.svy-stack {
  display: flex;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--svy-track);
}
.svy-sat { display: block; min-width: 0; transition: width .45s ease; }
.svy-sat.s1 { background: var(--error); }
.svy-sat.s2 { background: var(--error); opacity: .5; }
.svy-sat.s3 { background: var(--text-muted); opacity: .45; }
.svy-sat.s4 { background: var(--success); opacity: .55; }
.svy-sat.s5 { background: var(--success); }
/* N/A is the absence of an opinion, not a neutral one — hatch it so it can't
   be misread as the middle of the scale (flat greys are too close on dark). */
.svy-sat.na {
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--text-muted) 45%, transparent) 0 3px,
    transparent 3px 6px);
}

.svy-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
}
.svy-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.svy-swatch {
  width: 11px; height: 11px;
  border-radius: 3px;
  display: inline-block;
}

/* ══ ranked bars ══════════════════════════════════════════════════════ */
.svy-bars { display: flex; flex-direction: column; gap: 8px; }
.svy-bar-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 11.5px;
}
.svy-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.svy-bar-lbl {
  color: var(--text-primary);
  line-height: 1.35;
  min-width: 0;
}
.svy-bar-val {
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.svy-bar-val b { color: var(--text-primary); }
.svy-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--svy-track);
  overflow: hidden;
}
.svy-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--svy-tone);
  min-width: 2px;
  transition: width .45s ease;
}

/* ══ numeric histogram ════════════════════════════════════════════════ */
.svy-histo { display: flex; align-items: flex-end; gap: 5px; }
.svy-histo-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.svy-histo-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 96px;
  border-bottom: 1px solid var(--svy-track);
}
/* A bucket nobody chose reads as a gap on the axis, not a hairline bar. */
.svy-histo-col.empty .svy-histo-x { opacity: .45; }
.svy-histo-col.empty .svy-histo-bar { min-height: 0; }
.svy-histo-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--svy-tone);
  opacity: .8;
  transition: height .45s ease, opacity .15s ease;
}
.svy-histo-col:hover .svy-histo-bar { opacity: 1; }
.svy-histo-x { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ══ verbatims ════════════════════════════════════════════════════════ */
.svy-verbatim-group + .svy-verbatim-group { margin-top: 18px; }
.svy-verbatim-q {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.svy-verbatim-q .count { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.svy-verbatims {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 10px;
}
.svy-quote {
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 4px 10px 10px 4px;
  background: var(--bg-card);
  padding: 11px 13px;
  font: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.svy-quote:hover {
  border-left-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.svy-quote-text {
  display: block;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.5;
}
.svy-quote-attr {
  display: block;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.svy-more {
  margin-top: 10px;
  border: 1px dashed var(--border-light);
  background: none;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.svy-more:hover { color: var(--accent-on-subtle); border-color: var(--accent); }

/* ══ tables (submissions + by-event) ══════════════════════════════════ */
.svy-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.svy-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 9px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--svy-nested);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.svy-table th.num, .svy-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.svy-table th.mid, .svy-table td.mid { text-align: center; }
.svy-table td {
  padding: 9px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--text-secondary);
  vertical-align: middle;
}
.svy-table td.strong { color: var(--text-primary); font-weight: 600; }
.svy-table td.dim { color: var(--text-muted); font-size: 11.5px; }
.svy-th { cursor: pointer; user-select: none; }
.svy-th:hover { color: var(--text-primary); }
.svy-th .arrow { opacity: 0; margin-left: 3px; font-size: 9px; }
.svy-th.sorted { color: var(--accent-on-subtle); }
.svy-th.sorted .arrow { opacity: 1; }
.svy-row { cursor: pointer; }
.svy-row:hover td { background: var(--accent-bg-subtle); }
.svy-scroll { max-height: 62vh; overflow: auto; }

.svy-meter {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 92px;
}
.svy-meter-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--svy-track);
  overflow: hidden;
}
.svy-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--svy-tone);
}
.svy-meter-num { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.svy-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-secondary);
}
.svy-pager .spacer { margin-left: auto; }

/* ══ drawer ═══════════════════════════════════════════════════════════ */
.svy-drawer { position: fixed; inset: 0; z-index: 1200; }
.svy-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(2px);
}
.svy-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(600px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: svy-slide .22s ease;
}
@keyframes svy-slide {
  from { transform: translateX(24px); opacity: .5; }
  to { transform: none; opacity: 1; }
}
.svy-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.svy-drawer-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.svy-drawer-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 5px; line-height: 1.5; }
.svy-drawer-close {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  padding: 2px 8px 5px;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
}
.svy-drawer-close:hover { color: var(--text-primary); border-color: var(--border); }
.svy-drawer-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--svy-nested);
}
.svy-drawer-body { padding: 8px 20px 24px; overflow-y: auto; }

.svy-qa { padding: 13px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.svy-qa:last-child { border-bottom: none; }
.svy-qa-q { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.45; }
.svy-qa-a { font-size: 13.5px; color: var(--text-primary); font-weight: 500; line-height: 1.5; }
.svy-qa-a.quote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
  padding-left: 11px;
  font-weight: 400;
  color: var(--text-primary);
}
.svy-qa-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.svy-qa-tag {
  background: var(--accent-bg-subtle);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent-on-subtle);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
}
.svy-dots { display: inline-flex; gap: 4px; vertical-align: -1px; margin-left: 8px; }
.svy-dots i {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--svy-track);
}
.svy-dots i.on { background: var(--svy-tone); }

/* ══ empty / loading ══════════════════════════════════════════════════ */
.svy-empty {
  padding: 26px 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.svy-empty-mini { font-size: 11.5px; color: var(--text-muted); font-style: italic; }
.svy-skeleton {
  height: 90px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(90deg,
    var(--svy-nested) 0%,
    var(--bg-card-hover) 50%,
    var(--svy-nested) 100%);
  background-size: 220% 100%;
  animation: svy-shimmer 1.3s ease-in-out infinite;
}
@keyframes svy-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -20% 0; }
}

/* ══ help affordance + floating tooltip ═══════════════════════════════
   Visually the same component as .cs-help on the CS expand cards, but the
   bubble is a single fixed-position node parented to <body> rather than an
   ::after on the trigger. It has to be: .svy-block sets overflow:hidden and
   .svy-scroll sets overflow:auto, so a pseudo-element bubble is clipped by
   the card or the table scroller it is explaining — worst exactly where the
   copy matters most (the table headers and the bottom row of a card). */
.svy-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  padding: 0;
  margin-left: 5px;
  background: var(--svy-track);
  color: var(--text-muted);
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  cursor: help;
  vertical-align: 1px;
  transition: background .15s ease, color .15s ease;
}
.svy-help:hover,
.svy-help:focus-visible {
  background: var(--accent);
  color: var(--text-on-accent);
  outline: none;
}
/* The trigger sits inside sort headers and click-to-scope rows, so it must
   not read as part of that hit area. */
.svy-th .svy-help,
.svy-row .svy-help { cursor: help; }

#svy-tip {
  position: fixed;
  z-index: 3000;
  max-width: 300px;
  padding: 9px 11px;
  border: 1px solid var(--border-light, var(--border));
  border-radius: 8px;
  background: var(--bg-elevated, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow-lg, 0 6px 24px rgba(0, 0, 0, .45));
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
#svy-tip.on { opacity: 1; }
#svy-tip b { color: var(--text-primary); font-weight: 600; }
/* Arrow x is set inline from the trigger's centre, so it keeps pointing at
   the trigger even when the bubble is clamped against a viewport edge. */
#svy-tip::after {
  content: '';
  position: absolute;
  left: var(--svy-tip-arrow, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
}
#svy-tip.below::after {
  bottom: 100%;
  border-bottom-color: var(--border-light, var(--border));
}
#svy-tip.above::after {
  top: 100%;
  border-top-color: var(--border-light, var(--border));
}

/* ══ responsive ═══════════════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .svy-hero { grid-template-columns: 1fr; }
  .svy-matrix-row { grid-template-columns: minmax(120px, 1.4fr) 2fr 56px 54px; gap: 8px; }
}
@media (max-width: 720px) {
  .svy-toolbar { gap: 8px; }
  .svy-select { max-width: none; }
  .svy-field, .svy-field.grow { flex: 1 1 100%; }
  .svy-matrix-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "q num" "bar top2";
    row-gap: 6px;
  }
  .svy-matrix-row.head { display: none; }
  .svy-matrix-q { grid-area: q; }
  .svy-matrix-track-cell { grid-area: bar; }
  .svy-matrix-num { grid-area: num; }
  .svy-matrix-top2 { grid-area: top2; text-align: left; }
  .svy-hero-value { font-size: 36px; }
  .svy-drawer-panel { width: 100vw; }
  /* The view switch is the primary control on this page — at phone width it
     takes its own full-width row rather than running off the right edge. */
  .svy-views { margin-left: 0; width: 100%; }
  .svy-view-btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .svy-gauge-fill, .svy-bar-fill, .svy-sat,
  .svy-histo-bar, .svy-trend-bar { transition: none; }
  .svy-drawer-panel { animation: none; }
  .svy-quote:hover { transform: none; }
  .svy-skeleton { animation: none; }
  #svy-tip { transition: none; }
}
