/* Poll feature — design tokens */
:root {
    --poll-accent: #4f46e5;
    --poll-accent-hover: #4338ca;
    --poll-accent-light: #6366f1;
    --poll-accent-soft: #eef2ff;
    --poll-accent-muted: #c7d2fe;
    --poll-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 55%, #7c83f6 100%);
    --poll-gradient-hover: linear-gradient(135deg, #4338ca 0%, #4f46e5 55%, #6366f1 100%);
    --poll-surface: #ffffff;
    --poll-page-bg: #f4f6fb;
    --poll-border: #e8ecf4;
    --poll-text: #111827;
    --poll-text-muted: #6b7280;
    --poll-radius-card: 16px;
    --poll-radius-input: 10px;
    --poll-radius-pill: 999px;
    --poll-shadow-card: 0 12px 40px rgba(15, 23, 42, 0.08);
    --poll-shadow-btn: 0 6px 18px rgba(79, 70, 229, 0.28);
    --poll-btn-height: 44px;
}

/* Create poll page */
.poll-create-page {
    background: var(--poll-page-bg);
    min-height: 100vh;
}

.poll-create-page-wrap {
    max-width: 760px;
    margin: 32px auto 48px;
    padding: 0 20px;
    min-width: 0;
    box-sizing: border-box;
}

.poll-create-page-wrap.poll-page-wrap {
    max-width: 760px;
}

.poll-create-form {
    background: #fff;
    padding: 40px 44px;
    border-radius: 16px;
    border: 1px solid #e8ecf4;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
}

.poll-create-header {
    text-align: center;
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eef2f7;
}

.poll-create-form>.poll-message {
    margin-bottom: 20px;
    max-width: 100%;
}

.poll-create-header h1 {
    font-size: 2rem;
    color: #111827;
    margin: 0 0 10px;
    font-weight: 700;
}

.poll-create-header .description-box {
    text-align: left;
    margin: 0;
    padding: 15px;
    background-color: #f0f8ff;
    border: 1px solid #cce5ff;
    border-radius: 8px;
    color: #004085;
    font-size: 0.95em;
    line-height: 1.5;
}

.poll-create-header .description-box p {
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.poll-create-section {
    margin-bottom: 28px;
}

.poll-create-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.poll-create-section-label {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.poll-options-count-hint {
    font-size: 0.85rem;
    color: #9ca3af;
}

.poll-create-options-section {
    background: #f8fafc;
    border: 1px solid #e8edf5;
    border-radius: 12px;
    padding: 20px;
}

.poll-create-settings-section {
    background: linear-gradient(180deg, #f8fafc 0%, #fafbfc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px 22px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.poll-create-settings-section .poll-section-title {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8edf5;
}

.poll-settings-group {
    margin-bottom: 22px;
}

.poll-settings-group:last-child {
    margin-bottom: 0;
}

.poll-settings-group-title {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.poll-setting-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
    line-height: 1.35;
}

.poll-setting-field-stack .poll-setting-label {
    margin-bottom: 10px;
}

.poll-setting-field-stack .poll-settings-select,
.poll-setting-field-stack .poll-protection-select {
    max-width: 280px;
}

.poll-create-settings-section .poll-datetime-group .poll-setting-label {
    margin-bottom: 10px;
}

.poll-create-settings-section .poll-datetime-row {
    margin-top: 0;
}

.poll-create-settings-section .poll-status-display-wrap .poll-setting-label {
    margin-bottom: 10px;
}

.poll-status-display {
    margin: 0;
}

.poll-status-display .poll-status-pill {
    font-size: 0.85rem;
}

.poll-create-settings-section .poll-checkbox-label span {
    line-height: 1.4;
}

.poll-create-form .form-group>label:not(.poll-checkbox-label):not(.poll-datetime-sublabel) {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
}

.poll-create-settings-section .poll-help-text {
    line-height: 1.45;
}

.poll-create-settings-section .poll-checkbox-help {
    display: block;
    max-width: 52ch;
}

.poll-setting-card-flat {
    margin: 0;
}

.poll-create-settings-section.is-editing .poll-settings-schedule-row {
    grid-template-columns: 1fr 1fr;
}

.poll-feature-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.poll-feature-name {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.poll-feature-desc {
    margin: 0;
}

.poll-feature-badge {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.poll-feature-badge.is-on {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.poll-multiple-answer-card {
    background: linear-gradient(135deg, #fafbff 0%, #fff 100%);
    border-color: #e0e7ff;
}

.poll-settings-top-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.poll-create-settings-section.is-editing .poll-settings-top-row {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 639px) {
    .poll-create-settings-section.is-editing .poll-settings-top-row {
        grid-template-columns: 1fr;
    }
}

.poll-settings-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.poll-setting-card {
    margin: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.poll-setting-card:focus-within {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.poll-setting-card .poll-checkbox-label {
    border: none;
    padding: 0;
    background: transparent;
    margin-bottom: 0;
}

.poll-setting-card.poll-checkbox-row .poll-checkbox-help {
    margin: 8px 0 0 30px;
}

.poll-datetime-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
}

.poll-datetime-part {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.poll-datetime-sublabel {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    color: #6b7280;
    min-height: 1.0625rem;
}

.poll-create-form .poll-datetime-group label.poll-datetime-sublabel {
    margin-bottom: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
}

.poll-datetime-control-slot {
    display: flex;
    align-items: center;
    min-height: 48px;
}

.poll-datetime-input {
    width: 100%;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
    color-scheme: light;
    font-variant-numeric: tabular-nums;
}

.poll-datetime-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.65;
    padding: 6px;
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s;
}

.poll-datetime-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: rgba(99, 102, 241, 0.08);
}

.poll-time-select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
}

.poll-time-select {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
}

.poll-time-sep {
    font-size: 1.25rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1;
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .poll-datetime-row {
        grid-template-columns: 1fr;
    }
}

.poll-datetime-group .poll-help-text {
    margin-top: 6px;
}

.poll-settings-select {
    cursor: pointer;
    min-height: 48px;
}

.poll-protection-select {
    max-width: 280px;
}

.poll-create-input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.poll-create-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.poll-slug-field {
    display: flex;
    align-items: stretch;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.poll-slug-field:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.poll-slug-field .poll-slug-prefix {
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.95rem;
    border-right: 1px solid #e5e7eb;
    white-space: nowrap;
}

.poll-slug-input {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.poll-slug-input:focus {
    box-shadow: none !important;
}

.poll-slug-preview-field {
    background: #f9fafb;
}

.poll-slug-preview-field .poll-slug-value {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    color: #111827;
    font-size: 0.95rem;
    word-break: break-word;
}

.poll-label-optional {
    font-weight: 400;
    color: #9ca3af;
    font-size: 0.9em;
}

.poll-options-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.poll-option-row {
    display: grid;
    grid-template-columns: 32px 1fr 40px;
    gap: 10px;
    align-items: center;
}

.poll-option-index {
    color: var(--poll-accent);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
}

.poll-option-input {
    background: #fff;
    text-align: left;
}

.poll-remove-option-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fff5f5;
    color: #dc2626;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.poll-remove-option-btn:hover {
    background: #fee2e2;
    border-color: #f87171;
    transform: scale(1.04);
}

.poll-add-option-btn {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #c7d2fe;
    border-radius: 10px;
    background: #fff;
    color: #4f46e5;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.poll-add-option-btn:hover:not(:disabled):not(.is-disabled) {
    background: #eef2ff;
    border-color: #818cf8;
}

.poll-add-option-btn:disabled,
.poll-add-option-btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: #9ca3af;
    border-color: #e5e7eb;
    background: #f9fafb;
}

.poll-captcha-wrap {
    margin: 16px 0 8px;
}

.poll-vote-hint {
    margin: 0 0 12px;
    color: #6b7280;
    font-size: 0.92rem;
}

.poll-checkbox-row {
    margin-bottom: 0;
}

.poll-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.poll-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #6366f1;
    flex-shrink: 0;
}

.poll-create-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    padding-top: 24px;
    border-top: 1px solid #eef2f7;
}

.poll-publish-btn {
    min-height: var(--poll-btn-height);
    padding: 12px 32px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--poll-radius-pill);
    background: var(--poll-gradient);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.poll-publish-btn:hover {
    background: var(--poll-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--poll-shadow-btn);
}

.poll-publish-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
}

.poll-publish-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #a5b4fc 0%, #c7d2fe 100%);
}

.poll-draft-btn {
    min-height: var(--poll-btn-height);
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--poll-radius-pill);
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.poll-draft-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

.poll-draft-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.poll-draft-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.poll-view-created-btn {
    min-height: var(--poll-btn-height);
    padding: 12px 24px;
    font-size: 0.95rem;
    border-radius: var(--poll-radius-pill);
    line-height: 1.2;
    text-align: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.poll-view-created-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
    transform: translateY(-1px);
}

.poll-create-form .form-group {
    margin-bottom: 22px;
}

.poll-create-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.poll-create-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.poll-create-form .form-row .form-group {
    margin-bottom: 18px;
}

@media (max-width: 768px) {
    .poll-create-form {
        padding: 24px 20px;
    }

    .poll-create-form .form-row {
        grid-template-columns: 1fr;
    }

    .poll-option-row {
        grid-template-columns: 28px 1fr 36px;
    }

    .poll-remove-option-btn {
        width: 36px;
        height: 36px;
    }
}

.poll-page-wrap {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px 48px;
}

.poll-card {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.form-header {
    margin-bottom: 32px;
    text-align: center;
}

.form-header h1 {
    font-size: 2rem;
    color: #222;
    margin-bottom: 8px;
}

.form-header p {
    color: #666;
    margin: 0;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #222;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.btn-submit {
    background: var(--poll-gradient);
    color: #fff;
    border: none;
    padding: 11px 28px;
    min-height: var(--poll-btn-height);
    border-radius: var(--poll-radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-submit:hover {
    background: var(--poll-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--poll-shadow-btn);
}

.btn-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
}

.btn-cancel {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 11px 28px;
    min-height: var(--poll-btn-height);
    border-radius: var(--poll-radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.btn-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
    transform: translateY(-1px);
}

.btn-cancel:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.2);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.poll-slug-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.poll-slug-prefix {
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}

.poll-help-text {
    display: block;
    margin-top: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.poll-message {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.poll-message.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    overflow-x: auto;
}

.poll-message.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.poll-message.warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
    line-height: 1.5;
}

.poll-message.warning strong {
    display: block;
    margin-bottom: 4px;
    color: #b45309;
}

.poll-question {
    margin: 0 0 12px;
    line-height: 1.3;
}

.poll-meta {
    color: #6b7280;
    margin: 0 0 20px;
}

.poll-meta-note {
    color: #6b7280;
    font-weight: 500;
}

.poll-results--preview .poll-result-fill,
.poll-result-row--preview .poll-result-fill {
    display: none;
}

.poll-results--preview .poll-result-bar-area,
.poll-result-row--preview .poll-result-bar-area {
    display: none;
}

.poll-results--preview .poll-result-chart,
.poll-result-row--preview .poll-result-chart {
    min-height: 32px;
}

.poll-results--preview .poll-result-stats,
.poll-result-row--preview .poll-result-stats {
    position: static;
    transform: none;
    left: auto;
    max-width: none;
}

.poll-status-banner {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.poll-status-banner.closed {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.poll-status-banner.owner-preview {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    display: block;
    max-width: 100%;
    line-height: 1.45;
}

.poll-vote-form[hidden],
.poll-results[hidden] {
    display: none !important;
}

.poll-vote-form {
    margin-top: 8px;
}

.poll-options-list {
    border: 0;
    margin: 0 0 20px;
    padding: 0;
}

.poll-option-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.poll-option-choice:hover {
    border-color: var(--poll-accent-muted);
    background: #fafbff;
}

.poll-option-choice:has(input:checked) {
    border-color: var(--poll-accent);
    background: var(--poll-accent-soft);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.poll-option-choice input {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--poll-accent);
}

.poll-option-choice span {
    font-size: 0.98rem;
    color: var(--poll-text);
    line-height: 1.4;
}

.poll-honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    pointer-events: none;
}

.poll-vote-btn {
    margin-top: 8px;
    min-width: 160px;
    padding: 12px 36px;
}

.poll-results {
    margin-top: 24px;
}

.poll-results-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}

.poll-results-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.poll-total-votes {
    margin: 0;
    color: #6b7280;
}

.poll-empty-results {
    color: #6b7280;
    margin: 0 0 16px;
}

.poll-results-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 4px;
}

/* Horizontal bar chart: [label left-aligned] | axis | [bar] [stats] */
.poll-result-row {
    display: grid;
    grid-template-columns: minmax(6.5rem, 30%) minmax(0, 1fr);
    align-items: center;
    gap: 0;
    --vote-pct: 0;
    min-width: 0;
}

.poll-result-label {
    text-align: left;
    padding: 6px 16px 6px 0;
    border-right: 2px solid #d1d5db;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--poll-text);
    line-height: 1.35;
    word-break: break-word;
}

.poll-result-chart {
    --poll-stats-reserve: 10.5rem;
    position: relative;
    padding-left: 16px;
    min-height: 32px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Full-width track; bar = vote % of track; stats sit at bar end (spec layout). */
.poll-result-bar-area {
    width: 100%;
    height: 28px;
    min-width: 0;
}

.poll-result-fill {
    height: 100%;
    width: calc(var(--vote-pct, 0) * 1%);
    max-width: calc(100% - var(--poll-stats-reserve));
    min-width: 0;
    background: var(--poll-gradient);
    border-radius: 0 6px 6px 0;
    transition: width 0.45s ease, max-width 0.45s ease;
}

/* Spec format: 45% - 1 vote — immediately after bar, inside chart */
.poll-result-stats {
    position: absolute;
    top: 50%;
    left: calc(min(var(--vote-pct, 0) * 1%, 100% - var(--poll-stats-reserve)) + 10px);
    transform: translateY(-50%);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
    color: var(--poll-text);
    white-space: nowrap;
    letter-spacing: 0.02em;
    max-width: var(--poll-stats-reserve);
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .poll-result-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .poll-result-label {
        text-align: left;
        border-right: none;
        border-bottom: 2px solid #d1d5db;
        padding: 0 0 6px 0;
    }

    .poll-result-chart {
        padding-left: 0;
    }
}

.poll-manage-warning {
    display: inline-block;
    margin-top: 0;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 0.75rem;
    font-weight: 600;
}

.poll-suspicious-alert {
    margin-bottom: 16px;
}

.poll-status-pill.status-archived {
    background: #ede9fe;
    color: #5b21b6;
}

.poll-action-archive {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.poll-action-archive:hover {
    background: #ede9fe;
}

.poll-share-block {
    margin-top: 20px;
    padding: 16px 0 0;
    border-top: 1px solid #e5e7eb;
    background: transparent;
}

.poll-share-title {
    font-weight: 600;
    margin-bottom: 10px;
}

.poll-share-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.poll-share-row .form-control {
    padding: 12px 14px;
    border-radius: var(--poll-radius-input);
    border-color: #d1d5db;
    font-size: 0.92rem;
    color: var(--poll-text-muted);
    background: #f9fafb;
}

.poll-share-row .btn-cancel {
    padding: 11px 20px;
    min-height: auto;
    white-space: nowrap;
    background: var(--poll-accent-soft);
    border-color: var(--poll-accent-muted);
    color: var(--poll-accent);
}

.poll-share-row .btn-cancel:hover {
    background: #e0e7ff;
    border-color: var(--poll-accent-light);
    color: var(--poll-accent-hover);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 768px) {

    .form-row,
    .poll-share-row {
        grid-template-columns: 1fr;
    }

    .poll-create-form,
    .poll-card {
        padding: 20px;
    }

    .poll-detail-page-wrap {
        padding-left: 16px;
        padding-right: 16px;
    }

    .poll-detail-page .poll-card {
        padding: 24px 20px;
    }
}

.poll-tool-page {
    background: var(--poll-page-bg);
    min-height: 100vh;
}

.poll-create-topbar,
.poll-detail-back {
    margin-bottom: 16px;
}

.poll-create-section.is-locked .poll-create-input:not(:disabled),
.poll-create-section.is-locked .poll-settings-select:not(:disabled),
.poll-settings-group.is-locked .poll-create-input:not(:disabled),
.poll-settings-group.is-locked .poll-settings-select:not(:disabled) {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

.poll-setting-card.is-locked {
    opacity: 0.88;
}

.poll-create-section.is-locked .poll-add-option-btn {
    display: none;
}

.poll-slug-field.is-locked {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.poll-slug-field.is-locked .poll-slug-prefix {
    background: #e5e7eb;
    color: #9ca3af;
}

.poll-slug-field.is-locked .poll-slug-input {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.poll-manage-question,
.poll-manage-question-text {
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
    margin: 0;
}

.poll-manage-question-cell {
    min-width: 0;
}

.poll-manage-warning-row {
    min-height: 26px;
    margin-top: 6px;
    line-height: 1.2;
}

.poll-manage-warning-spacer {
    display: block;
    min-height: 22px;
}

.poll-manage-slug {
    font-size: 0.85rem;
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.poll-manage-votes {
    font-weight: 600;
    color: #4f46e5;
}

.poll-tool-page .poll-card {
    border: 1px solid #e8ecf4;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.poll-tool-page .poll-page-wrap {
    margin-top: 32px;
}

.poll-list-page .poll-list-card:not(.poll-list-item) {
    text-align: center;
    color: #6b7280;
    padding: 32px 20px;
}

.poll-list-item,
a.poll-list-item {
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

a.poll-list-item {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.poll-list-item:hover,
a.poll-list-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

a.poll-list-item:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.poll-list-item-actions {
    margin-top: auto;
}

.poll-list-item-actions .poll-header-btn,
.poll-list-open-cta {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    display: inline-block;
    pointer-events: none;
}

a.poll-list-item:hover .poll-list-open-cta {
    filter: brightness(1.03);
}

.poll-card-header {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .poll-manage-table td:first-child {
        max-width: 220px;
    }
}


body.poll-list-page {
    background: var(--poll-page-bg);
    min-height: 100vh;
}

body.poll-list-page>header {
    position: relative;
    z-index: 3000;
}

.poll-list-page-wrap {
    max-width: 1400px;
    width: 100%;
    margin: 40px auto 48px;
    padding: 0 20px;
    box-sizing: border-box;
}

.poll-list-back {
    margin-bottom: 16px;
}

.poll-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

body.poll-list-page .poll-list-header .page-title.accent {
    margin-bottom: 4px;
}

body.poll-list-page .poll-list-subtitle.muted {
    color: var(--poll-text-muted);
    font-size: 0.95rem;
}

.poll-list-cta-primary {
    background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
    border-radius: 32px;
    font-weight: 600;
}

.poll-list-cta-secondary {
    background: #fff;
    border-radius: 32px;
    font-weight: 600;
}

.poll-list-subtitle {
    color: #6b7280;
    margin: 8px 0 0;
}

.poll-list-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.poll-header-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--poll-btn-height);
    padding: 10px 22px;
    font-size: 0.94rem;
    white-space: nowrap;
}

.poll-create-topbar .poll-header-btn,
.poll-detail-back .poll-header-btn {
    min-height: 38px;
    padding: 8px 16px;
    font-size: 0.88rem;
    background: #fff;
}

.poll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.poll-list-item-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.poll-list-item-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.35;
}

.poll-list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #6b7280;
    font-size: 0.92rem;
    margin-bottom: 16px;
}

.poll-list-item-actions {
    display: flex;
    gap: 10px;
}

.poll-status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.poll-status-pill.status-published {
    background: #dcfce7;
    color: #166534;
}

.poll-status-pill.status-closed {
    background: #fee2e2;
    color: #991b1b;
}

.poll-status-pill.status-draft {
    background: #f3f4f6;
    color: #4b5563;
}

.poll-page-overlay {
    z-index: 2000;
}

/* Keep poll UI inside containers — no horizontal spill or overlap */
.poll-tool-page .poll-page-wrap {
    min-width: 0;
    box-sizing: border-box;
}

/* Poll detail view — original wide layout (view/results page) */
.poll-detail-page-wrap {
    max-width: 1100px;
    width: 100%;
    margin: 40px auto 48px;
    padding: 0 20px 48px;
    min-width: 0;
    box-sizing: border-box;
}

.poll-detail-page .poll-detail-page-wrap.poll-page-wrap {
    max-width: 1100px;
}

.poll-tool-page .poll-card {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
}

.poll-create-section,
.poll-settings-group,
.poll-passcode-setup,
.poll-setting-card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.poll-manage-page {
    background: #f3f4f6;
    min-height: 100vh;
}

.poll-manage-page-wrap {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.poll-manage-page-wrap.poll-page-wrap {
    max-width: 1400px;
}

.poll-manage-container {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    margin-top: 20px;
}

.poll-manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.poll-manage-header h1 {
    font-size: 2rem;
    color: #222;
    margin: 0;
    font-weight: 700;
}

.poll-manage-create-btn {
    background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 32px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.poll-manage-create-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    color: #fff;
}

.poll-manage-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px 120px 120px;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.poll-manage-search {
    width: 100%;
    min-width: 0;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #222;
    background: #fff;
    box-sizing: border-box;
}

.poll-manage-search:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.poll-manage-select {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.95rem;
    min-width: 0;
    color: #222;
    background: #fff;
    cursor: pointer;
}

.poll-manage-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.poll-manage-search-btn {
    min-width: 120px;
    height: 48px;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    color: #fff;
    border: none;
    border-radius: 32px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.poll-manage-search-btn:hover {
    background: linear-gradient(90deg, #06b6d4 0%, #10b981 100%);
}

.poll-manage-clear-btn {
    min-width: 120px;
    height: 48px;
    font-size: 1.1rem;
    font-weight: 700;
    background: #f3f4f6;
    color: #222;
    border: none;
    border-radius: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.poll-manage-clear-btn:hover {
    background: #e5e7eb;
}

.poll-table-wrap {
    overflow-x: auto;
}

.poll-manage-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px;
    margin-top: 4px;
}

.poll-manage-table col.poll-col-question {
    width: 28%;
}

.poll-manage-table col.poll-col-status {
    width: 12%;
}

.poll-manage-table col.poll-col-votes {
    width: 8%;
}

.poll-manage-table col.poll-col-created {
    width: 16%;
}

.poll-manage-table col.poll-col-actions {
    width: 36%;
}

.poll-manage-table th,
.poll-manage-table td {
    padding: 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

.poll-manage-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #222;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: normal;
}

.poll-manage-table tbody tr:hover {
    background-color: #f8f9fa;
}

.poll-manage-table tbody tr:last-child td {
    border-bottom: 1px solid #e5e7eb;
}

.poll-manage-table td:first-child {
    color: #222;
    overflow-wrap: anywhere;
}

.poll-manage-created {
    white-space: nowrap;
    font-size: 0.9rem;
    color: #4b5563;
}

.poll-manage-table td:nth-child(3) {
    font-weight: 500;
    color: #222;
}

.poll-manage-table .poll-status-pill {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.poll-manage-actions {
    display: grid;
    grid-template-columns: 52px 44px 84px 80px 72px;
    gap: 8px;
    align-items: center;
    width: max-content;
    max-width: 100%;
}

.poll-action-slot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 32px;
}

.poll-action-placeholder {
    display: block;
    width: 72px;
    height: 32px;
    flex-shrink: 0;
}

.poll-manage-table th:last-child,
.poll-manage-table td:last-child {
    min-width: 0;
}

.poll-action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.2s;
    white-space: nowrap;
}

.poll-action-btn:hover {
    transform: none;
    box-shadow: none;
}

.poll-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.poll-action-view,
.poll-action-copy {
    background-color: #f3f4f6;
    color: #4b5563;
}

.poll-action-view:hover,
.poll-action-copy:hover {
    background-color: #e5e7eb;
}

.poll-action-edit {
    background-color: #e0f2fe;
    color: #0369a1;
}

.poll-action-edit:hover {
    background-color: #bae6fd;
}

.poll-action-close,
.poll-action-reopen {
    background-color: #fff7ed;
    color: #c2410c;
}

.poll-action-close:hover,
.poll-action-reopen:hover {
    background-color: #ffedd5;
}

.poll-action-archive,
.poll-action-unarchive {
    background-color: #f5f3ff;
    color: #6d28d9;
}

.poll-action-archive:hover,
.poll-action-unarchive:hover {
    background-color: #ede9fe;
}

.poll-manage-container .poll-message {
    margin-bottom: 16px;
}

.poll-suspicious-alert {
    margin-bottom: 16px;
}

.text-center {
    text-align: center;
    color: #666;
    padding: 28px 16px !important;
}

@media (max-width: 768px) {
    .poll-manage-page-wrap {
        margin: 20px auto;
        padding: 0 12px;
    }

    .poll-manage-container {
        padding: 24px 18px;
    }

    .poll-manage-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .poll-manage-create-btn {
        text-align: center;
        width: 100%;
    }

    .poll-manage-filters {
        grid-template-columns: 1fr;
    }

    .poll-manage-search,
    .poll-manage-select,
    .poll-manage-search-btn,
    .poll-manage-clear-btn {
        width: 100%;
        min-width: 0;
    }

    .poll-manage-actions {
        gap: 6px;
    }

    .poll-action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Cross-page polish — titles, cards, loading states, mobile buttons          */
/* -------------------------------------------------------------------------- */

.poll-list-header .page-title.accent {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--poll-text);
    margin: 0;
    line-height: 1.2;
}

.poll-tool-page .poll-question.page-title.accent {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--poll-text);
}

.poll-list-card {
    background: var(--poll-surface);
    border: 1px solid var(--poll-border);
    border-radius: var(--poll-radius-card);
    padding: 22px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.poll-list-page .poll-list-card:not(.poll-list-item) {
    font-size: 0.95rem;
}

.poll-create-form,
.poll-manage-container,
.poll-tool-page .poll-card {
    border-radius: var(--poll-radius-card);
}

.poll-add-option-btn {
    padding: 13px 16px;
    border-radius: var(--poll-radius-input);
    font-size: 0.94rem;
}

.poll-add-option-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.poll-status-pill {
    padding: 5px 11px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.poll-message {
    border-radius: var(--poll-radius-input);
    font-size: 0.94rem;
}

.poll-results-header h2 {
    color: var(--poll-text);
    font-weight: 700;
}

.poll-share-title {
    color: var(--poll-text);
    font-size: 0.95rem;
}

.poll-create-actions {
    gap: 10px;
}

.poll-list-header-actions .btn-cancel.poll-header-btn {
    background: #fff;
}

.poll-list-item-actions .poll-header-btn {
    width: 100%;
}

@media (max-width: 768px) {
    .poll-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-list-header-actions {
        width: 100%;
    }

    .poll-list-header-actions .poll-header-btn {
        flex: 1;
        text-align: center;
    }

    .poll-vote-btn {
        width: 100%;
        min-width: 0;
    }

    .poll-create-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-create-actions .poll-publish-btn,
    .poll-create-actions .poll-draft-btn,
    .poll-create-actions .poll-view-created-btn {
        width: 100%;
    }

    .poll-manage-actions {
        gap: 6px;
    }

    .poll-action-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Spec-aligned layout polish (sections, callouts, manage subtitle)           */
/* -------------------------------------------------------------------------- */

.poll-section-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--poll-text);
}

.poll-create-section .poll-section-title {
    margin-bottom: 14px;
}

.poll-create-section-head .poll-section-title {
    margin-bottom: 0;
}

.poll-info-callout {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    color: #3730a3;
    font-size: 0.92rem;
    line-height: 1.45;
}

.poll-results-display-group .poll-toggle-list {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.poll-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.poll-toggle-row:last-child {
    border-bottom: none;
}

.poll-toggle-text {
    flex: 1;
    min-width: 0;
}

.poll-toggle-label {
    display: block;
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
    line-height: 1.35;
}

.poll-toggle-help {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.poll-toggle {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 48px;
    height: 28px;
    margin: 0;
    cursor: pointer;
}

.poll-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.poll-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.poll-toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.poll-toggle-input:checked+.poll-toggle-slider {
    background: #22c55e;
}

.poll-toggle-input:checked+.poll-toggle-slider::before {
    transform: translateX(20px);
}

.poll-toggle-input:disabled+.poll-toggle-slider {
    opacity: 0.55;
}

.poll-toggle-input:disabled~.poll-toggle-slider,
.poll-toggle-input:disabled+.poll-toggle-slider {
    cursor: not-allowed;
}

.poll-toggle:has(.poll-toggle-input:disabled) {
    cursor: not-allowed;
}

.poll-toggle-input:focus-visible+.poll-toggle-slider {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.poll-toggle-row.is-locked {
    opacity: 0.88;
}

.poll-checkbox-help {
    display: block;
    margin-top: 6px;
    margin-left: 28px;
}

.poll-create-danger-zone {
    margin-top: 28px;
    padding: 20px 22px 22px;
    background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.poll-create-danger-zone .poll-section-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #111827;
}

.poll-create-danger-zone > .poll-help-text {
    margin: 0 0 18px;
    max-width: 62ch;
    color: #6b7280;
    line-height: 1.55;
    font-size: 0.9rem;
}

.poll-create-danger-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.poll-create-danger-zone .poll-action-btn {
    padding: 10px 20px;
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.poll-create-danger-zone .poll-action-archive {
    background: #f5f3ff;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.poll-create-danger-zone .poll-action-archive:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #4c1d95;
}

.poll-create-danger-zone .poll-action-delete {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.poll-create-danger-zone .poll-action-delete:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

@media (max-width: 520px) {
    .poll-create-danger-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-create-danger-zone .poll-action-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

.poll-manage-subtitle {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.poll-manage-header-text {
    flex: 1;
    min-width: 200px;
}

.poll-list-state-card {
    background: #fff;
    border: 1px solid var(--poll-border);
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    color: var(--poll-text-muted);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.poll-vote-heading {
    margin-bottom: 8px;
}

.poll-detail-page .poll-card {
    display: block;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 32px 36px;
    overflow-x: clip;
    box-sizing: border-box;
}

.poll-detail-page .poll-card-header,
.poll-detail-page .poll-meta,
.poll-detail-page .poll-results,
.poll-detail-page .poll-share-block {
    min-width: 0;
    max-width: 100%;
}

.poll-not-found-body {
    padding: 48px 24px 40px;
    text-align: center;
}

.poll-not-found-message {
    margin: 0 0 28px;
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--poll-text, #1f2937);
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.poll-not-found-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 28px;
    border-radius: 32px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.poll-not-found-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.32);
}

.poll-not-found-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}

.poll-detail-page .poll-results {
    margin-bottom: 0;
}

.poll-detail-page .poll-results-list {
    margin-bottom: 0;
}

.poll-detail-page .poll-share-block {
    margin-top: 20px;
    padding-top: 16px;
    padding-bottom: 0;
    overflow: hidden;
}

.poll-detail-page .poll-share-row .form-control {
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.poll-share-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.poll-copy-link-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.poll-view-link-btn {
    border-color: var(--poll-accent-muted);
    color: var(--poll-accent);
}

.poll-action-delete {
    background-color: #fee2e2;
    color: #dc2626;
}

.poll-action-delete:hover {
    background-color: #fecaca;
}

/* Poll passcode modal (detail page) — above loading overlay, content contained */
.poll-passcode-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.poll-passcode-modal[hidden] {
    display: none !important;
}

.poll-passcode-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.poll-passcode-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    max-width: 100%;
    max-height: calc(100vh - 40px);
    padding: 24px 22px 22px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
}

.poll-passcode-modal-dialog .poll-message {
    margin: 0 0 14px;
    max-width: 100%;
}

body.poll-passcode-modal-open {
    overflow: hidden;
}

body.poll-passcode-modal-open .poll-page-overlay {
    display: none !important;
}

.poll-passcode-modal-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: #111827;
}

.poll-passcode-modal-text {
    margin: 0 0 16px;
    color: #6b7280;
    line-height: 1.5;
    font-size: 0.95rem;
}

.poll-passcode-modal-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.poll-passcode-modal-input {
    width: 100%;
    margin-bottom: 16px;
    min-height: 48px;
}

.poll-passcode-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 4px;
}

.poll-passcode-submit-btn {
    min-width: 120px;
}

.poll-passcode-cancel-btn {
    min-width: 120px;
    text-decoration: none;
    text-align: center;
}

.poll-passcode-setup {
    margin-top: 12px;
}

.poll-passcode-current-wrap {
    margin-bottom: 14px;
}

.poll-passcode-mask-display {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: var(--poll-radius-input);
    background: #f3f4f6;
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    line-height: 1.2;
    color: #374151;
    box-sizing: border-box;
    user-select: none;
}

.poll-passcode-setup.is-locked .poll-passcode-input {
    letter-spacing: 0.12em;
}

.poll-passcode-setup .poll-setting-label {
    display: block;
    margin-bottom: 8px;
}

/* Public polls list — search & pagination */
.poll-list-search-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.poll-list-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    height: 48px;
    box-sizing: border-box;
}

.poll-list-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.poll-list-search-btn,
.poll-list-clear-btn {
    min-width: 110px;
    height: 48px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 32px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.poll-list-search-btn {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.poll-list-search-btn:hover {
    background: linear-gradient(90deg, #06b6d4 0%, #10b981 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
}

.poll-list-clear-btn {
    background: #f3f4f6;
    color: #222;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.poll-list-clear-btn:hover {
    background: #e5e7eb;
}

.poll-list-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
    padding: 16px 0 8px;
    border-top: 1px solid #e8ecf4;
}

.poll-list-pagination-info {
    color: #6b7280;
    font-size: 0.9rem;
}

.poll-list-pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.poll-list-page-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.poll-list-page-btn,
.poll-list-page-number {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-size: 0.875rem;
    font-family: inherit;
}

.poll-list-page-number {
    min-width: 40px;
    text-align: center;
}

.poll-list-page-btn:hover:not(:disabled),
.poll-list-page-number:hover:not(.active):not(:disabled) {
    background-color: #f3f4f6;
}

.poll-list-page-number.active {
    background-color: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.poll-list-page-btn:disabled,
.poll-list-page-number:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

.poll-list-page-size {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    min-width: 120px;
}

.poll-list-page-size:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

@media (max-width: 640px) {
    .poll-list-search-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-list-search-btn,
    .poll-list-clear-btn {
        width: 100%;
    }

    .poll-list-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-list-pagination-controls {
        justify-content: center;
    }

    .poll-list-page-wrap {
        padding-left: 12px;
        padding-right: 12px;
        margin-top: 24px;
    }
}

/* -------------------------------------------------------------------------- */
/* Manage My Polls / Manage Admin (legacy table markup) — mobile                */
/* -------------------------------------------------------------------------- */

body.poll-manage-legacy-page {
    background: var(--poll-page-bg);
    min-width: 0;
    overflow-x: clip;
}

body.poll-manage-legacy-page > .container {
    max-width: 1400px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

body.poll-manage-legacy-page .manage-polls-container {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

body.poll-manage-legacy-page .manage-polls-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

body.poll-manage-legacy-page .polls-table .actions-cell .btn-action {
    min-height: 36px;
}

@media (max-width: 768px) {
    body.poll-manage-legacy-page > .container {
        margin: 20px auto;
        padding: 0 12px;
    }

    body.poll-manage-legacy-page .manage-polls-container {
        padding: 20px 16px;
        margin-top: 12px;
    }

    body.poll-manage-legacy-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    body.poll-manage-legacy-page .page-header h1 {
        font-size: 1.45rem;
    }

    body.poll-manage-legacy-page .page-header-actions {
        justify-content: stretch;
    }

    body.poll-manage-legacy-page .btn-create {
        display: flex;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }

    body.poll-manage-legacy-page .search-filter {
        flex-direction: column;
        gap: 12px;
    }

    body.poll-manage-legacy-page .search-input,
    body.poll-manage-legacy-page .filter-select {
        flex: none;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    body.poll-manage-legacy-page .poll-question-cell {
        max-width: none;
    }

    body.poll-manage-legacy-page .pagination-container {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    body.poll-manage-legacy-page .pagination-controls {
        justify-content: center;
        width: 100%;
    }

    body.poll-manage-legacy-page .pagination-controls .filter-select {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 520px) {
    .poll-feature-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .poll-captcha-wrap {
        overflow-x: auto;
        max-width: 100%;
    }

    .poll-share-row .poll-copy-link-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .poll-passcode-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .poll-passcode-submit-btn,
    .poll-passcode-cancel-btn {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    body.poll-manage-legacy-page .polls-table {
        min-width: 640px;
    }

    body.poll-manage-legacy-page .action-buttons .btn-action {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        text-align: center;
        justify-content: center;
    }
}