/* Survey Results (results-view.js): shared by the admin app and the client portal, on top of stats-view.css.
 * Agree / disagree grids: red ↔ grey ↔ blue, each step validated for colour-blind readers in light and dark mode
 * (dataviz validator: adjacent CVD ΔE ≥ 15 light / 15 dark, normal vision ≥ 17 / 21); the lighter steps sit under 3:1
 * on the page, so every chart has a legend, values and a table view. Longer scales use one blue ramp in order. */
:root {
  --res-d1: #b8312f; --res-d2: #e8746f; --res-d3: #cfcec9; --res-d4: #6da7ec; --res-d5: #1c5cab;
  --res-s1: #86b6ef; --res-s2: #5598e7; --res-s3: #2a78d6; --res-s4: #1c5cab; --res-s5: #104281; --res-s6: #0d366b; --res-s7: #0a2a55;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --res-d1: #f5a3a0; --res-d2: #cc4b48; --res-d3: #3e3e39; --res-d4: #2f6bd0; --res-d5: #8fb8ff;
    --res-s1: #184f95; --res-s2: #1c5cab; --res-s3: #256abf; --res-s4: #3987e5; --res-s5: #5598e7; --res-s6: #86b6ef; --res-s7: #b7d3f6;
  }
}
:root[data-theme="dark"] {
  --res-d1: #f5a3a0; --res-d2: #cc4b48; --res-d3: #3e3e39; --res-d4: #2f6bd0; --res-d5: #8fb8ff;
  --res-s1: #184f95; --res-s2: #1c5cab; --res-s3: #256abf; --res-s4: #3987e5; --res-s5: #5598e7; --res-s6: #86b6ef; --res-s7: #b7d3f6;
}
.res-d1 { background: var(--res-d1); } .res-d2 { background: var(--res-d2); } .res-d3 { background: var(--res-d3); }
.res-d4 { background: var(--res-d4); } .res-d5 { background: var(--res-d5); }
.res-s1 { background: var(--res-s1); } .res-s2 { background: var(--res-s2); } .res-s3 { background: var(--res-s3); }
.res-s4 { background: var(--res-s4); } .res-s5 { background: var(--res-s5); } .res-s6 { background: var(--res-s6); } .res-s7 { background: var(--res-s7); }

.res-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin: 0 0 16px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.res-filter { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-soft); }
.res-filter input, .res-filter select { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border-2, var(--border));
  border-radius: 8px; padding: 6px 8px; min-height: 34px; }
.res-pair { display: flex; gap: 6px; }
.res-pair select { min-width: 9rem; }
.res-clear { align-self: flex-end; }
.res-questions { display: grid; gap: 16px; }
.res-card { margin: 0; }
.res-updating, .res-foot { margin: 12px 0; }

.res-rating { display: grid; grid-template-columns: minmax(150px, 200px) 1fr; gap: 20px; align-items: end; }
@media (max-width: 640px) { .res-rating { grid-template-columns: 1fr; } }
.res-cols { height: 130px; }

.res-mrows { display: grid; gap: 8px; }
.res-mrow { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 48px; gap: 10px; align-items: center; }
.res-track { position: relative; height: 18px; }
.res-diverging::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px dashed var(--viz-grid); }
.res-seg { position: absolute; top: 0; bottom: 0; box-shadow: 0 0 0 1px var(--surface); }   /* 2px gap between parts */
.res-seg:hover, .res-seg:focus-visible { filter: brightness(1.1); }
.res-seg:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.res-track .res-seg:first-child { border-radius: 4px 0 0 4px; }
.res-track .res-seg:last-child { border-radius: 0 4px 4px 0; }
.res-track .res-seg:only-child { border-radius: 4px; }
@media (max-width: 560px) { .res-mrow { grid-template-columns: 1fr 44px; } .res-mrow .viz-hlabel { grid-column: 1 / -1; } }

.res-textbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.res-search { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; min-width: min(280px, 100%); }
.res-count { margin: 0; }
.res-texts { list-style: none; margin: 0 0 10px; padding: 0; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--border); }
.res-texts:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.res-texts li { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.res-texts li p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.res-texts li span { font-size: 12.5px; }
.res-other { margin-top: 12px; }
.res-other summary { cursor: pointer; color: var(--text-soft); font-size: 13.5px; }

/* the PDF report (Download PDF → print → Save as PDF) */
.res-print { display: none; }
@media print {
  @page { margin: 14mm; }
  /* paper is always light, whatever the screen theme */
  :root:root, :root[data-theme] {
    --res-d1: #b8312f; --res-d2: #e8746f; --res-d3: #cfcec9; --res-d4: #6da7ec; --res-d5: #1c5cab;
    --res-s1: #86b6ef; --res-s2: #5598e7; --res-s3: #2a78d6; --res-s4: #1c5cab; --res-s5: #104281; --res-s6: #0d366b; --res-s7: #0a2a55;
    --viz-fill: #2f6bed; --viz-grid: #d9dee8; --bg: #fff; --surface: #fff; --surface-2: #f3f5f9; --text: #111; --text-soft: #444;
    --text-faint: #666; --border: #ccc; color-scheme: light;
  }
  body { background: #fff !important; color: #111 !important; }
  .site-header, .prod-banner, .demo-banner, .backup-line, .res-filters, .res-head .actions, .res-head .back, .res-head .muted,
  .res-search, .res-textbar .res-search, .res-texts + .btn, .viz-table summary, .res-updating, #message, #toast { display: none !important; }
  .res-print { display: flex; gap: 16px; align-items: center; border-bottom: 3px solid #2f6bed; padding-bottom: 10px; margin-bottom: 14px; }
  .res-print h1 { font-size: 22px; margin: 2px 0; }
  .res-print p { margin: 0; }
  .res-print-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #555; }
  .res-print-meta { font-size: 12px; color: #444; }
  .res-logo { max-height: 56px; max-width: 180px; object-fit: contain; }
  .res-head { display: none !important; }
  .card, .viz-tile { box-shadow: none !important; border-color: #ccc !important; background: #fff !important; }
  .res-card { break-inside: avoid; }
  .res-texts { max-height: none; overflow: visible; }
  .res-other:not([open]) { display: none; }
  .viz-table { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
