/* Poll-specific presentation. Shared shell dimensions and tokens remain owned by the master. */
.poll-page { color: var(--text-body); padding-block: 8px 28px; }
.poll-page h1 { font-size: 28px; color: var(--accent-primary); margin: 0; line-height: 1.25; }
.poll-page h2 { font-size: 23px; line-height: 1.35; margin: 0; }
.poll-page h3 { margin: 0 0 12px; font-size: 21px; }
.poll-page p { line-height: 1.6; }
.poll-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.poll-display-controls, .poll-view-switch, .poll-chart-switch { display: flex; align-items: center; gap: 7px; }
.poll-display-controls { gap: 16px; flex-wrap: wrap; }
.poll-chart-switch[hidden], .poll-view-switch[hidden], .poll-grid[hidden], .poll-table-wrap[hidden] { display: none; }
.poll-display-controls .ui-button, .poll-chart-switch .ui-button { width: 40px; height: 36px; padding: 7px; }
.poll-display-controls [aria-pressed="true"], .poll-chart-switch [aria-pressed="true"] { background: var(--accent-primary); color: var(--desk-gold-ink); }
.poll-detail-controls { display: flex; justify-content: flex-end; margin-bottom: 18px; }
/* Match Media History navigation's 8px inset and 40px action row. */
.poll-detail-actions { display: flex; align-items: center; gap: 12px; padding-block-start: 8px; min-height: 40px; }
.poll-fields input, .poll-fields textarea { font: inherit; color: var(--text-body); background: var(--surface); border: 1px solid var(--control-border); border-radius: 7px; padding: 8px 10px; box-sizing: border-box; }
.poll-page :is(button,a,input,textarea):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.poll-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.poll-card { min-width: 0; background: var(--surface); border: 1px solid var(--line-subtle); border-radius: var(--panel-radius); padding: 20px; display: flex; flex-direction: column; }
.poll-featured { grid-column: 1 / -1; border-color: var(--accent-border); background: linear-gradient(135deg, #fffdf7, #fff); }
.poll-card-heading { margin-bottom: 14px; }
.poll-card-heading h2 a { color: var(--accent-primary); text-decoration: none; }
.poll-card-heading h2 a:hover { text-decoration: underline; }
.poll-page .poll-total { color: var(--text-muted); font-size: 14px; margin: 8px 0 0; }
.poll-card-body { flex: 1; min-width: 0; }
.poll-featured .poll-card-body, .poll-full .poll-card-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, 1fr); gap: 28px; }
.poll-chart-host { min-width: 0; }
.poll-chart-values { list-style: none; padding: 0; margin: 0; }
.poll-chart-columns .poll-chart-values { display: flex; align-items: stretch; gap: 10px; min-height: 205px; }
.poll-chart-columns .poll-chart-value { flex: 1; min-width: 0; display: grid; grid-template-rows: 145px auto auto; align-content: start; gap: 7px; text-align: center; }
.poll-chart-track { display: block; background: var(--panel-bg); border-radius: 4px; overflow: hidden; }
.poll-chart-columns .poll-chart-track { display: flex; align-items: flex-end; justify-content: center; }
.poll-chart-fill { display: block; background: var(--answer-color); }
.poll-chart-columns .poll-chart-fill { width: 65%; height: var(--answer-share); border-radius: 4px 4px 0 0; }
.poll-answer-label { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.poll-answer-value { font-size: 15px; font-weight: 700; white-space: nowrap; }
.poll-answer-count { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.poll-chart-bars .poll-chart-value { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; margin-bottom: 16px; }
.poll-chart-bars .poll-chart-track { grid-column: 1 / -1; grid-row: 2; height: 12px; }
.poll-chart-bars .poll-chart-fill { height: 100%; width: var(--answer-share); border-radius: 4px; }
.poll-chart-bars .poll-answer-label { grid-row: 1; }
.poll-chart-bars .poll-answer-value { grid-row: 1; }
.poll-chart-pie { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.poll-pie { width: min(100%, 210px); aspect-ratio: 1; border-radius: 50%; flex-shrink: 0; }
.poll-chart-pie .poll-chart-values { width: 100%; }
.poll-chart-pie .poll-chart-value { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.poll-chart-pie .poll-chart-track { background: var(--answer-color); width: 12px; height: 12px; border-radius: 3px; }
.poll-card-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-subtle); }
.poll-comment-link { color: var(--accent-primary); font-size: 14px; }
.poll-card-footer .ui-button { white-space: normal; margin-inline-start: auto; order: 1; align-items: center; line-height: 1; }
.poll-voting { border-inline-start: 1px solid var(--line-subtle); padding-inline-start: 25px; }
.poll-voting fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.poll-voting legend { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.poll-vote-option { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; cursor: pointer; line-height: 1.4; }
.poll-vote-option input { margin-top: 5px; accent-color: var(--accent-primary); flex-shrink: 0; }
.poll-vote-status { font-size: 15px; }
/* Match Media search table chrome and row rhythm; the smaller poll schema fits mobile. */
.poll-table-wrap { overflow-x: auto; }
.poll-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: right; table-layout: fixed; }
.poll-table th, .poll-table td { padding: 12px 10px; border-bottom: 1px solid var(--line-subtle); vertical-align: middle; overflow-wrap: anywhere; }
.poll-table th { background: var(--toolbar-bg); white-space: nowrap; }
.poll-table tbody td { padding-block: 10px; line-height: 20px; }
.poll-table tbody tr { height: 53px; }
.poll-table th:not(:first-child), .poll-table td:not(:first-child) { width: 80px; text-align: center; font-variant-numeric: tabular-nums; }
.poll-table tr:hover td { background: var(--surface-interactive); }
.poll-table a { color: var(--accent-primary); text-decoration: none; }
.poll-table a:hover { text-decoration: underline; }
.poll-table-question { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.poll-table-question > a { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poll-table-answers { flex: 1 1 0; min-width: 0; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poll-detail > h1 { margin-bottom: 22px; }
/* Reserve the main result region before JS; only secondary discussion waits for mounting. */
.poll-detail-loading .poll-detail #pollGrid { min-height: 520px; }
.poll-detail-loading :is(.poll-discussion, .poll-comment-editor) { visibility: hidden; }
.poll-full .poll-chart-columns .poll-chart-value { grid-template-rows: 230px auto auto; }
.poll-full .poll-chart-columns .poll-chart-values { min-height: 320px; }
.poll-discussion, .poll-comment-editor { margin-top: 28px; padding: 24px; background: var(--surface); border: 1px solid var(--line-subtle); border-radius: var(--panel-radius); }
.poll-discussion h2, .poll-comment-editor h2 { margin-bottom: 16px; }
/* Same row rhythm and border treatment as the Media results table. */
.poll-comments-wrap { overflow-x: auto; }
.poll-comments-table { width: 100%; min-width: 700px; table-layout: fixed; border-collapse: collapse; font-size: 14px; text-align: right; }
.poll-comments-table th, .poll-comments-table td { padding: 10px; border-bottom: 1px solid var(--line-subtle); vertical-align: middle; line-height: 20px; }
.poll-comments-table th { padding-block: 12px; background: var(--toolbar-bg); font-weight: 600; }
.poll-comments-table th:first-child { width: 36px; box-sizing: border-box; }
.poll-comments-table th:nth-child(2) { width: 17%; box-sizing: border-box; }
.poll-comments-table th:nth-child(3) { width: 25%; box-sizing: border-box; }
.poll-comments-table th:last-child { width: 110px; box-sizing: border-box; }
.poll-comment-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.poll-comments-table tbody tr { height: 53px; scroll-margin-top: 25px; }
.poll-comments-table tbody tr:hover td { background: var(--surface-interactive); }
.poll-comments-table tbody tr:last-child td { border-bottom: 0; }
.poll-comment-location { color: var(--text-muted); }
.poll-comment-content-line { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.poll-comment-body { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 20px; }
.poll-comment-body p { margin: 0; line-height: 20px; }
.poll-comment-body.is-collapsed { max-height: 20px; overflow: hidden; }
.poll-comment-expand { flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; display: grid; place-items: center; background: transparent; border: 0; padding: 0; color: var(--accent-primary); cursor: pointer; font: inherit; line-height: 20px; }
.poll-comment-expand:hover { background: var(--surface-interactive); border-radius: 4px; }
.poll-comment-expand svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.poll-comment-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.poll-comment-expand[hidden] { display: none; }
.poll-comments-table time { white-space: nowrap; }
.poll-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.poll-fields label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.poll-fields input, .poll-fields textarea { width: 100%; }
.poll-fields textarea { resize: vertical; }
.poll-comment-editor { padding: 14px 18px; margin-top: 16px; max-width: 512px; margin-inline: auto; box-sizing: border-box; }
.poll-field-error { color: var(--accent-primary); font-size: 13px; }
.poll-field-error:empty { display: none; }
.poll-comment-editor [aria-invalid="true"] { border-color: var(--accent-primary); }
.poll-comment-editor .poll-fields input[name="pollHuman"] { width: 3ch; min-width: 26px; padding-inline: 3px; text-align: center; }
.poll-comment-editor:not(:has(#pollCommentPanel:not([hidden]))) { padding: 0; background: transparent; border: 0; text-align: center; }
.poll-moderation-note { margin: 10px 0; font-size: 14px; color: var(--text-muted); }
.poll-comment-editor .poll-fields input, .poll-comment-editor .poll-fields textarea { padding: 5px 8px; }
.poll-comment-editor .poll-fields label { gap: 3px; font-size: 14px; }
#pollCommentStatus:empty { display: none; }
.poll-comment-actions { display: flex; align-items: center; gap: 8px; }
#pollCommentToggle[hidden] { display: none; }
.poll-field-wide { grid-column: 1 / -1; }
.poll-fields .poll-honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.poll-suggestion { text-align: center; margin-top: 28px; }
.poll-empty { font-size: 14px; color: var(--text-muted); }
@media (max-width: 800px) {
  .poll-detail-loading .poll-detail #pollGrid { min-height: 800px; }
  .poll-featured .poll-card-body, .poll-full .poll-card-body { grid-template-columns: minmax(0, 1fr); }
  .poll-voting { border-inline-start: 0; border-top: 1px solid var(--line-subtle); padding-inline-start: 0; padding-top: 20px; }
}
@media (max-width: 600px) {
  .poll-grid { grid-template-columns: minmax(0, 1fr); }
  .poll-card, .poll-discussion, .poll-comment-editor { padding: 18px; }
  .poll-page-heading { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .poll-display-controls { margin-inline-start: auto; }
  .poll-table th, .poll-table td { padding: 8px; font-size: 14px; }
  .poll-table th:not(:first-child), .poll-table td:not(:first-child) { width: 48px; }
  .poll-fields { grid-template-columns: minmax(0, 1fr); }
  .poll-answer-count { display: block; }
}

@media (max-width: 700px) { .poll-page h1 { font-size: 24px; } }

.poll-view-switch .ui-button svg, .poll-chart-switch .ui-button svg { width: 18px; height: 18px; }

.poll-card[hidden], .poll-paging[hidden] { display: none; }
.poll-paging { display: flex; align-items: center; justify-content: center; gap: 14px; margin-block: 16px; }
.poll-paging-toolbar label { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.poll-paging-toolbar select { font: inherit; padding: 8px; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--surface); color: var(--text-body); }
.poll-paging-toolbar .poll-paging { margin: 0; flex-wrap: wrap; }
.poll-paging-toolbar > .collection-page-jump { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.poll-open-label { display: block; line-height: 1.25; }
.poll-pie path:focus { outline: none; stroke: none; }
