/* Results dashboard (views/resultsDashboard.php). Everything is scoped to .rd. */
.rd {
	--rd-ink: #1B2430;
	--rd-muted: #4A5563;
	--rd-line: #E1E4E8;
	--rd-line-strong: #D5D9DF;
	--rd-bg: #F4F5F7;
	--rd-track: #EEF0F3;
	--rd-shared: #2456C7;
	--rd-divisive: #E0782F;
	--rd-opposed: #A7B0BC;
	--rd-dashed: #6B7684;
	color: var(--rd-ink);
	background: var(--rd-bg);
	border-radius: 12px;
	padding: 24px 16px 32px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	text-align: left;
	box-sizing: border-box;
}
.rd *, .rd *::before, .rd *::after { box-sizing: border-box; }
.rd h2, .rd h3 { margin: 0; color: var(--rd-ink); font-family: inherit; }
.rd h3 { font-size: 18px; font-weight: 600; }
.rd p { margin: 0; }
.rd [hidden] { display: none !important; }
.rd-sub { display: block; font-size: 13px; color: var(--rd-muted); line-height: 1.4; }

/* Header */
.rd-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.rd-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rd-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rd-muted); }
.rd-title { font-size: 28px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.rd-meta { font-size: 14px; color: var(--rd-muted); }
.rd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rd-actions-bottom { justify-content: center; padding-top: 8px; }

/* Buttons. They also carry the classes the tab handlers in question.php listen to,
   so undo the site-wide styles those classes bring. */
.rd button.rd-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; width: auto; margin: 0; padding: 0 16px; float: none; position: static;
	border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
	text-transform: none; letter-spacing: normal; box-shadow: none; cursor: pointer;
}
.rd button.rd-btn::before, .rd button.rd-btn::after { content: none; display: none; }
.rd button.rd-btn-secondary { background: #FFFFFF; color: var(--rd-ink); border: 1px solid var(--rd-ink); }
.rd button.rd-btn-primary { background: var(--rd-shared); color: #FFFFFF; border: 1px solid var(--rd-shared); }
.rd button.rd-btn:hover { filter: brightness(.95); }
.rd button:focus-visible, .rd .rd-more:focus-visible { outline: 3px solid #1A3F94; outline-offset: 2px; }

/* KPI row */
.rd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rd-kpi { background: #FFFFFF; border: 1px solid var(--rd-line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.rd-kpi-label { font-size: 13px; color: var(--rd-muted); }
.rd-kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rd-kpi-sub { font-size: 12px; color: var(--rd-muted); }

/* Cards and rows */
.rd-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.rd-card { background: #FFFFFF; border: 1px solid var(--rd-line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rd-cloud-card { flex: 999 1 560px; }
.rd-detail { flex: 1 1 320px; gap: 16px; }
.rd-chart-card { flex: 1 1 480px; }
.rd-discussion-card { flex: 1 1 380px; }
.rd-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.rd-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rd-empty { font-size: 14px; color: var(--rd-muted); padding: 24px 0; }

/* Size toggle */
.rd-toggle { display: flex; align-items: center; gap: 8px; }
.rd-seg { display: flex; border: 1px solid #C9CED6; border-radius: 8px; overflow: hidden; }
.rd-seg button { border: none; margin: 0; padding: 8px 14px; min-height: 36px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; background: #FFFFFF; color: var(--rd-ink); }
.rd-seg button[aria-pressed="true"] { background: var(--rd-ink); color: #FFFFFF; font-weight: 600; }

/* Idea cloud */
.rd-cloud { position: relative; height: 470px; min-width: 640px; }
.rd-bubble-wrap {
	position: absolute; width: 130px; margin-left: -65px;
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	transition: left .45s ease, top .45s ease;
}
.rd-bubble {
	border-radius: 50%; padding: 0; margin: 0; cursor: pointer; border: none;
	display: flex; align-items: center; justify-content: center;
	font: inherit; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
	transition: width .45s ease, height .45s ease, box-shadow .2s ease;
}
.rd-bubble-label { font-size: 12px; line-height: 1.25; text-align: center; font-weight: 500; color: var(--rd-ink); }
.rd-bubble-wrap.is-selected .rd-bubble-label { font-weight: 700; }
.rd-bubble.is-selected { box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 6px var(--rd-ink); }
.rd .shared { background: var(--rd-shared); color: #FFFFFF; }
.rd .divisive { background: var(--rd-divisive); color: var(--rd-ink); }
.rd .opposed { background: var(--rd-opposed); color: var(--rd-ink); }
.rd .too_few { background: #FFFFFF; color: var(--rd-ink); border: 2px dashed var(--rd-dashed); }
.rd-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; border-top: 1px solid var(--rd-line); padding-top: 12px; align-items: center; }
.rd-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.rd-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.rd-dot.too_few { width: 12px; height: 12px; }
.rd-legend .rd-sub { display: inline; }

/* Detail panel */
.rd-pill { align-self: flex-start; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; }
.rd-pill.shared { background: #EAF0FB; color: #1A3F94; }
.rd-pill.divisive { background: #FDF1E8; color: #9A4A12; }
.rd-pill.opposed, .rd-pill.too_few { background: #F1F2F4; color: #3A4350; border: none; }
.rd-detail-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
.rd-detail-note { font-size: 14px; color: var(--rd-muted); line-height: 1.4; }
.rd-detail-top { display: flex; flex-direction: column; gap: 8px; }
.rd-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rd-tile { background: var(--rd-bg); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rd-tile span:first-child { font-size: 12px; color: var(--rd-muted); }
.rd-tile span:last-child { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rd-block { display: flex; flex-direction: column; gap: 8px; }
.rd-includes { font-size: 13px; line-height: 1.45; color: var(--rd-muted); }
.rd-includes .rd-block-h { color: var(--rd-ink); }
.rd-block-h { font-size: 13px; font-weight: 600; }
.rd-block-h span { font-weight: 400; color: var(--rd-muted); }
.rd-bar-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-size: 12px; }
.rd-bar-row > span:first-child { color: var(--rd-muted); }
.rd-bar-row > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.rd-track { height: 12px; background: var(--rd-track); border-radius: 3px; overflow: hidden; }
.rd-fill { height: 12px; border-radius: 3px; transition: width .4s; }
.rd-quote { font-size: 14px; line-height: 1.45; background: var(--rd-bg); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; }
.rd button.rd-link { align-self: flex-start; background: none; border: none; padding: 4px 0; margin: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--rd-shared); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.rd button.rd-link:hover { color: #1A3F94; }

/* Agreement chart */
.rd-chart-grid { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; min-width: 440px; }
.rd-axis-y { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; color: var(--rd-muted); text-align: center; }
.rd-chart { position: relative; height: 340px; border: 1px solid var(--rd-line-strong); border-radius: 6px; }
.rd-zone { position: absolute; }
.rd-zone-divisive { left: 0; right: 0; top: 0; height: 58.333%; background: #FDF1E8; border-radius: 6px 6px 0 0; }
.rd-zone-opposed { left: 0; width: 50%; bottom: 0; height: 41.667%; background: #F1F2F4; border-radius: 0 0 0 6px; }
.rd-zone-shared { right: 0; width: 50%; bottom: 0; height: 41.667%; background: #EAF0FB; border-radius: 0 0 6px 0; }
.rd-zone-label { position: absolute; font-size: 12px; font-weight: 600; }
.rd-zl-divisive { left: 10px; top: 8px; color: #9A4A12; }
.rd-zl-opposed { left: 10px; bottom: 8px; color: var(--rd-muted); }
.rd-zl-shared { right: 10px; bottom: 8px; color: #1A3F94; }
.rd-qdot { position: absolute; width: 28px; height: 28px; transform: translate(-50%, -50%); z-index: 1; transition: left .4s, top .4s; }
.rd-qdot.is-selected { z-index: 3; }
.rd-qdot button { width: 28px; height: 28px; border-radius: 50%; padding: 0; margin: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; border: 1px solid #FFFFFF; }
.rd-qdot button.too_few { border: 2px dashed var(--rd-dashed); }
.rd-qdot.is-selected button { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--rd-ink); }
.rd-qdot-label { position: absolute; left: 34px; top: 4px; white-space: nowrap; font-size: 12px; font-weight: 600; background: var(--rd-ink); color: #FFFFFF; border-radius: 4px; padding: 2px 6px; pointer-events: none; }
.rd-qdot.flip .rd-qdot-label { left: auto; right: 34px; }
.rd-axis-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--rd-muted); }
.rd-note { font-size: 12px; color: var(--rd-muted); line-height: 1.4; }
.rd-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; font-size: 12px; color: var(--rd-muted); border-top: 1px solid var(--rd-line); padding-top: 10px; }
.rd button.rd-key-item { background: none; border: none; margin: 0; padding: 2px 4px; font: inherit; font-size: 12px; color: var(--rd-muted); text-align: left; cursor: pointer; border-radius: 4px; }
.rd button.rd-key-item:hover { color: var(--rd-ink); background: var(--rd-bg); }
.rd button.rd-key-item.is-selected { color: var(--rd-ink); font-weight: 600; background: var(--rd-bg); }

/* Discussion */
.rd-disc { display: flex; flex-direction: column; gap: 4px; }
.rd-disc-head, .rd button.rd-disc-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 64px 70px; align-items: center; gap: 10px; }
.rd-disc-head { font-size: 12px; font-weight: 600; color: var(--rd-muted); padding: 0 10px; }
.rd-disc-head span:nth-child(n+3) { text-align: right; }
.rd button.rd-disc-row { width: 100%; min-height: 44px; padding: 6px 10px; margin: 0; border-radius: 8px; cursor: pointer; color: var(--rd-ink); text-align: left; font: inherit; background: transparent; border: 1px solid transparent; }
.rd button.rd-disc-row.is-selected { border-color: var(--rd-ink); background: var(--rd-bg); }
.rd-disc-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-disc-track { height: 10px; background: var(--rd-track); border-radius: 3px; display: block; }
.rd-disc-bar { display: block; height: 10px; border-radius: 3px; }
.rd-disc-bar.too_few { border-width: 1px; }
.rd-disc-n { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rd-disc-w { font-size: 12px; color: var(--rd-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Ranked list: the existing cards, plus a theme tag and the theme filter */
.rd-ranked #recentAwnsers2 > article { margin-left: 0; margin-right: 0; }
.rd-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.rd-chip { display: inline-flex; align-items: center; gap: 8px; background: #EAF0FB; color: #1A3F94; border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 600; }
.rd-chip button { border: none; background: #FFFFFF; color: #1A3F94; border-radius: 999px; min-width: 28px; min-height: 28px; padding: 0 8px; font: inherit; font-weight: 600; cursor: pointer; }
.rd-more { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--rd-shared); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; background: none; padding: 4px 0; }
.rd-theme-tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: #3A4350; background: #F1F2F4; border-radius: 999px; padding: 3px 10px; }
.rd-theme-tag-k { font-weight: 400; color: var(--rd-muted); }

@media (max-width: 600px) {
	.rd { padding: 16px 12px 24px; border-radius: 0; }
	.rd-title { font-size: 22px; }
	.rd-card { padding: 16px; }
	.rd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.rd-kpi-value { font-size: 24px; }
	.rd-disc-head, .rd button.rd-disc-row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 48px 52px; gap: 8px; }
	.rd-actions { width: 100%; }
	.rd-actions .rd-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
	.rd * { transition: none !important; }
}
