/* =====================================================================
   COMMUNITY POLL page (2026-08-20, dashboard + feedback 2026-08-21).
   Site-wide tokens come from css/styles.css. The results dashboard
   defines its own chart tokens below (.viz-root), following the
   data-viz guidance: one hue for ranked bars, hairline recessive chrome,
   thin marks (bars <= 24px, 4px rounded data end), text in ink tokens
   (never the series colour), every value also available in the table view.
   ===================================================================== */
.hidden { display: none !important; }

.poll-container { max-width: 980px; }
.poll-sub { color: var(--slate); margin: 6px 0 22px; max-width: 720px; }

.viz-root {
  --viz-surface: #fcfcfb;
  --viz-ink: #0b0b0b;
  --viz-ink-2: #52514e;
  --viz-muted: #898781;
  --viz-grid: #e1e0d9;
  --viz-baseline: #c3c2b7;
  --viz-series: #2a78d6;      /* categorical slot 1 (blue) */
  --viz-track: #cde2fb;       /* same ramp, step 100 */
  --viz-special: #c3c2b7;     /* Undecided / Others: de-emphasis gray */
  --viz-border: rgba(11, 11, 11, 0.10);
}

.poll-notice {
  background: var(--paper-dim);
  border: 1.5px dashed var(--amber);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 14px;
  color: var(--ink);
}

/* ---------- vote form ---------- */
.poll-group {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px 16px;
  margin: 0 0 16px;
  min-width: 0;
}
.poll-group legend { font-weight: 700; font-size: 1.05rem; color: var(--ink); padding: 0 8px; }
.poll-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px 14px;
  margin-top: 6px;
}
.poll-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper, #fff);
  transition: border-color 0.15s, background 0.15s;
}
.poll-option:hover { border-color: var(--amber); }
.poll-option input { accent-color: var(--amber-dark, var(--amber)); margin: 0; }
.poll-option.is-selected { border-color: var(--amber); background: rgba(245,185,60,0.10); }
.poll-option.is-special { color: var(--slate); font-style: italic; }
.poll-others-input { margin-top: 10px; max-width: 340px; }
.poll-others-input input { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; }
.poll-group.is-locked .poll-options { opacity: 0.55; pointer-events: none; }
.poll-voted-note { margin: 8px 0 0; font-size: 13px; color: var(--success, #2E7D5B); font-weight: 600; }

.poll-message { margin: 12px 0 0; font-size: 14px; min-height: 1.2em; }
.poll-message.ok { color: var(--success, #2E7D5B); }
.poll-message.err { color: #B24A2A; }
.poll-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- dashboard: one filter row above everything it scopes ---------- */
.viz-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 8px 0 18px; }
.poll-period-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.period-btn {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  min-height: 36px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--slate);
  cursor: pointer;
}
.period-btn.active { background: var(--gradient-gold, var(--amber)); color: var(--ink); }
.period-note { margin: 0; font-size: 13px; color: var(--viz-ink-2); }

/* stat tiles (KPI row) */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-tile {
  background: var(--viz-surface);
  border: 1px solid var(--viz-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.stat-label { font-size: 13px; color: var(--viz-ink-2); margin: 0 0 4px; }
.stat-value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--viz-ink); margin: 0; }
.stat-sub { font-size: 12.5px; color: var(--viz-muted); margin: 4px 0 0; }

/* ranked-bar cards */
.poll-results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.result-card {
  background: var(--viz-surface);
  border: 1px solid var(--viz-border);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.result-card h3 { margin: 0; font-size: 1.02rem; color: var(--viz-ink); }
.result-lead { margin: 0; font-size: 13.5px; color: var(--viz-ink-2); }
.result-lead strong { color: var(--viz-ink); }
.result-prev { margin: 0; font-size: 12.5px; color: var(--viz-muted); }
.result-empty { color: var(--viz-ink-2); font-size: 14px; padding: 26px 4px; }

.rank-list { display: flex; flex-direction: column; gap: 2px; }
.rank-row {
  display: grid;
  grid-template-columns: minmax(70px, 108px) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 28px;            /* >= 24px hit target */
  padding: 2px 4px;
  border-radius: 6px;
  cursor: default;
  outline: none;
}
.rank-row:hover, .rank-row:focus-visible { background: rgba(11, 11, 11, 0.045); }
.rank-row:focus-visible { box-shadow: 0 0 0 2px var(--viz-series); }
.rank-name { font-size: 13px; color: var(--viz-ink-2); overflow-wrap: anywhere; line-height: 1.2; }
.rank-row.is-leader .rank-name { color: var(--viz-ink); font-weight: 700; }
.rank-track { height: 16px; display: flex; align-items: center; }
.rank-fill { height: 16px; background: var(--viz-series); border-radius: 0 4px 4px 0; min-width: 2px; }  /* square at baseline, 4px data end */
.rank-row.is-special .rank-fill { background: var(--viz-special); }
.rank-row.is-special .rank-name { color: var(--viz-muted); font-style: italic; }
.rank-value { font-size: 12.5px; color: var(--viz-ink-2); white-space: nowrap; }

/* ratings meter list */
.ratings-card { margin-bottom: 14px; }
.meter-list { display: flex; flex-direction: column; gap: 4px; }
.meter-row {
  display: grid;
  grid-template-columns: minmax(110px, 190px) 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  padding: 2px 4px;
  border-radius: 6px;
  outline: none;
}
.meter-row:hover, .meter-row:focus-visible { background: rgba(11, 11, 11, 0.045); }
.meter-row:focus-visible { box-shadow: 0 0 0 2px var(--viz-series); }
.meter-name { font-size: 13.5px; color: var(--viz-ink); }
.meter-name small { color: var(--viz-muted); font-size: 12px; margin-left: 4px; }
.meter-track { height: 8px; background: var(--viz-track); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--viz-series); border-radius: 999px; }
.meter-value { font-size: 13px; color: var(--viz-ink-2); white-space: nowrap; }
.meter-note { margin: 4px 0 0; font-size: 12.5px; color: var(--viz-muted); }

/* tooltip */
.viz-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: #0b0b0b;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.35;
  padding: 7px 10px;
  border-radius: 8px;
  max-width: 260px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* table view */
.viz-table { margin-top: 6px; background: var(--viz-surface); border: 1px solid var(--viz-border); border-radius: var(--radius-md); padding: 12px 18px; }
.viz-table summary { cursor: pointer; font-weight: 600; color: var(--viz-ink); font-size: 14px; }
.viz-table table { width: 100%; border-collapse: collapse; margin: 12px 0 6px; font-size: 13px; }
.viz-table caption { text-align: left; font-weight: 700; color: var(--viz-ink); padding: 6px 0; }
.viz-table th, .viz-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--viz-grid); color: var(--viz-ink-2); }
.viz-table td.num, .viz-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- feedback ---------- */
#feedbackForm { max-width: 640px; }
#feedbackForm .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; border: 0; padding: 0; min-width: 0; }
#feedbackForm .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#feedbackForm label, #feedbackForm legend { font-size: 13px; font-weight: 600; color: var(--slate); padding: 0; }
#feedbackForm input[type=text], #feedbackForm textarea, #feedbackForm select {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  width: 100%;
  background: #fff;
}

/* star input: radios in reverse DOM order so "checked ~ label" fills the lower stars.
   Selectors carry the #feedbackForm id so they beat the generic form-label rule above. */
.help-text { font-size: 12.5px; color: var(--slate-light, #8a8f98); margin: 2px 0 0; }
#feedbackForm .star-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
#feedbackForm .star-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#feedbackForm .star-rating label {
  font-size: 34px;
  line-height: 1;
  font-weight: 400;
  padding: 2px 3px;
  min-width: 38px;
  min-height: 40px;
  text-align: center;
  color: #c3c2b7;
  cursor: pointer;
  transition: color 0.12s;
}
#feedbackForm .star-rating label:hover,
#feedbackForm .star-rating label:hover ~ label,
#feedbackForm .star-rating input:checked ~ label { color: #2a78d6; }
#feedbackForm .star-rating input:focus-visible + label { outline: 2px solid #2a78d6; outline-offset: 1px; border-radius: 6px; }

.feedback-heading { margin: 34px 0 10px; font-size: 1.1rem; }
.comment-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.comment-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; }
.comment-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 4px; }
.comment-stars { font-size: 17px; letter-spacing: 1px; color: #2a78d6; white-space: nowrap; }
.comment-stars .off { color: #c3c2b7; }
.comment-brand { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.comment-verdict { font-size: 12.5px; color: var(--slate); }
.comment-item .comment-meta { font-size: 12.5px; color: var(--slate); margin-top: 6px; }
.comment-item .comment-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .poll-results-grid, .stat-row { grid-template-columns: 1fr; }
  #feedbackForm .field-row { grid-template-columns: 1fr; }
}
