.cem-card {
    max-width: 720px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
}

.cem-card h2 {
    color: #0b3d66;
    margin-top: 0;
    font-size: 1.5rem;
}

.cem-card h3 {
    color: #0b3d66;
    margin-top: 1.75rem;
}

.cem-sub {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.cem-card fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
}

.cem-card legend {
    padding: 0 0.5rem;
    font-weight: 600;
    color: #0b3d66;
    font-size: 0.9rem;
}

.cem-card label {
    display: block;
    margin-bottom: 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
}

.cem-card input[type=text],
.cem-card input[type=email],
.cem-card input[type=tel],
.cem-card input[type=password],
.cem-card input[type=number],
.cem-card input[type=file],
.cem-card select,
.cem-card textarea {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.cem-card input:focus,
.cem-card select:focus,
.cem-card textarea:focus {
    outline: none;
    border-color: #0b3d66;
    box-shadow: 0 0 0 3px rgba(11, 61, 102, 0.12);
}

.cem-btn-primary {
    background: #0b3d66;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-block;
    text-decoration: none;
}
.cem-btn-primary:hover { background: #0a3357; color: #fff; }
.cem-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.cem-btn-secondary {
    background: #eef2f7;
    color: #0b3d66;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1rem;
}

.cem-hint { font-size: 0.85rem; margin-top: -0.5rem; }

.cem-message {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: cem-message-pop 0.3s ease;
}
.cem-message::before { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.cem-message.cem-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #34d399;
    box-shadow: 0 2px 12px rgba(6, 95, 70, 0.18);
}
.cem-message.cem-success::before { content: "\2713"; }
.cem-message.cem-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #f87171;
    box-shadow: 0 2px 12px rgba(185, 28, 28, 0.18);
}
.cem-message.cem-error::before { content: "\26A0"; }

@keyframes cem-message-pop {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .cem-message { animation: none; }
}

.cem-register-success {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
}
.cem-register-success-icon { font-size: 3rem; line-height: 1; margin-bottom: 0.5rem; }
.cem-register-success h2 { color: #065f46; margin-top: 0; }
.cem-register-success p { color: #065f46; font-size: 1.05rem; max-width: 480px; margin-left: auto; margin-right: auto; }
.cem-register-success .cem-btn-primary { margin-top: 0.5rem; }

.cem-notice {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 1rem;
    border-radius: 6px;
}

.cem-notice-lock {
    font-weight: 700;
    font-size: 1rem;
    background: #fff7ed;
    color: #9a3412;
    border: 2px solid #fb923c;
    box-shadow: 0 2px 12px rgba(194, 65, 12, 0.15);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Offline-queue indicator — "saved on this device, will send once you're
   back online" is normal/expected during a signal dropout, not an error,
   so this stays calm and blue rather than the amber/red used elsewhere. */
.cem-notice-offline {
    font-weight: 600;
    font-size: 0.95rem;
    background: #eff6ff;
    color: #1e40af;
    border: 2px solid #93c5fd;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.cem-status { padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.cem-status-approved { background: #ecfdf5; color: #065f46; }
.cem-status-pending { background: #fffbeb; color: #92400e; }
.cem-status-rejected { background: #fef2f2; color: #b91c1c; }
.cem-status-suspended { background: #ffedd5; color: #c2410c; }
.cem-status-deleted { background: #f1f5f9; color: #64748b; }
.cem-status-submitted { background: #eff6ff; color: #1d4ed8; }
.cem-status-verified { background: #ecfdf5; color: #065f46; }
.cem-status-flagged { background: #fef2f2; color: #b91c1c; }
.cem-status-completed { background: #ecfdf5; color: #065f46; }
.cem-status-failed { background: #fef2f2; color: #b91c1c; }
.cem-status-reversed { background: #fef2f2; color: #b91c1c; }

.cem-election-type-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #ede9fe;
    color: #5b21b6;
    white-space: nowrap;
}

.cem-scope-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 1rem; margin: 1rem 0; }
.cem-scope-form label { display: flex; flex-direction: column; font-size: 0.8rem; font-weight: 600; color: #475569; gap: 0.25rem; }
.cem-scope-form select { min-width: 160px; }

.cem-party-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.cem-party-row input { margin-top: 0; }

.cem-result-list { list-style: none; padding: 0; }
.cem-result-list li { padding: 0.6rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }

.cem-hint-inline { font-weight: 400; color: #64748b; font-size: 0.8rem; }

.cem-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 2px solid #e2e8f0;
    margin: 1.25rem 0 1.5rem;
}
.cem-tab-link {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
}
.cem-tab-link:hover { color: #1e293b; }
.cem-tab-link.active { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.cem-tab-panel { display: none; }
.cem-tab-panel.active { display: block; }

@media (max-width: 600px) {
    .cem-tab-nav { border-bottom: none; }
    .cem-tab-link {
        flex: 1 1 45%;
        text-align: center;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        margin-bottom: 0.25rem;
    }
    .cem-tab-link.active { background: #eff6ff; }
}

.cem-tab-badge {
    display: inline-block;
    background: #b91c1c;
    color: #fff;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.cem-inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.cem-inbox-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.85rem 1rem; background: #fff; }
.cem-inbox-item-unread { border-left: 4px solid #1d4ed8; background: #eff6ff; }
.cem-inbox-item-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cem-inbox-audience { font-size: 0.72rem; background: #f1f5f9; color: #475569; padding: 0.1rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.cem-inbox-body { margin: 0.4rem 0; white-space: pre-wrap; word-break: break-word; }
.cem-inbox-meta { font-size: 0.78rem; color: #64748b; margin: 0; }

/* Party vote breakdown + chart — shared markup with the admin
   Results Summary page (see the matching block in cem-admin.css). */
.cem-results-breakdown { margin: 1rem 0 1.5rem; }
.cem-results-breakdown h4 { margin: 0 0 0.5rem; }
.cem-results-stats { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0.5rem 0 1rem; font-size: 0.85rem; color: #475569; }
.cem-results-stats strong { color: #0f172a; font-size: 1rem; }
.cem-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.cem-chart-row { display: grid; grid-template-columns: 200px 1fr 130px; align-items: center; gap: 0.75rem; font-size: 0.85rem; }
.cem-chart-row-leader .cem-chart-label { font-weight: 700; }
.cem-chart-label { color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cem-chart-leader-tag { display: inline-block; background: #ecfdf5; color: #065f46; font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 999px; margin-left: 0.35rem; vertical-align: middle; }
.cem-chart-row-candidate { align-items: flex-start; }
.cem-chart-row-candidate .cem-chart-label { white-space: normal; overflow: visible; text-overflow: unset; }
.cem-chart-candidate { display: flex; align-items: center; gap: 0.5rem; }
.cem-chart-candidate-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid #e2e8f0; background: #fff; }
.cem-chart-candidate-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cem-chart-candidate-name { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cem-chart-candidate-party { font-size: 0.75rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cem-chart-bar-track { background: #f1f5f9; border-radius: 999px; height: 14px; overflow: hidden; }
.cem-chart-bar { background: linear-gradient(90deg,#1d4ed8,#3b82f6); height: 100%; border-radius: 999px; min-width: 2px; }
.cem-chart-row-leader .cem-chart-bar { background: linear-gradient(90deg,#065f46,#10b981); }
.cem-chart-value { text-align: right; color: #475569; white-space: nowrap; }

.cem-results-level { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid #e2e8f0; }
.cem-results-level:last-child { border-bottom: none; }
.cem-results-level h4.cem-level-heading { margin: 0 0 0.75rem; color: #0b3d66; font-size: 1.05rem; }

@media (max-width: 600px) {
    .cem-chart-row { grid-template-columns: 1fr; gap: 0.2rem; }
    .cem-chart-value { text-align: left; }
}

/* [cem_results] card can run a bit wider than the default .cem-card
   720px — a party-tally chart reads better with more room. */
.cem-public-results { max-width: 900px; }

/* [cem_incident_reports] live feed */
.cem-public-reports { max-width: 900px; }
.cem-reports-live-indicator { color: #059669; font-weight: 600; }
.cem-reports-feed { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.cem-report-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem 1.25rem; background: #fff; }
.cem-report-item-new { animation: cem-report-flash 2.5s ease-out; }
@keyframes cem-report-flash {
    0% { background: #fef9c3; border-color: #fbbf24; }
    100% { background: #ffffff; border-color: #e2e8f0; }
}
.cem-report-item-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.cem-report-category { font-weight: 600; color: #0b3d66; }
.cem-report-time { color: #64748b; font-size: 0.8rem; margin-left: auto; }
.cem-report-location { color: #475569; font-size: 0.85rem; margin: 0 0 0.5rem; }
.cem-report-desc { white-space: pre-wrap; margin: 0 0 0.6rem; }
.cem-report-media img,
.cem-report-media video { max-width: 100%; max-height: 380px; border-radius: 6px; display: block; }
.cem-reports-empty,
.cem-reports-loading { text-align: center; color: #64748b; padding: 1.5rem 0; list-style: none; }

.cem-status-low { background: #f1f5f9; color: #475569; }
.cem-status-medium { background: #fffbeb; color: #92400e; }
.cem-status-high { background: #ffedd5; color: #c2410c; }
.cem-status-critical { background: #fef2f2; color: #b91c1c; }

.cem-login-form { max-width: 420px; }
.cem-login-form h2 { margin-top: 0; }
.cem-login-form #cem-forgot-panel a,
.cem-login-form #cem-login-forgot-link { font-size: 0.9rem; }
.cem-inline-label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.5rem 0 1rem; font-weight: 400; }

.cem-report-flagged-notice { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.85rem; margin: 0 0 0.6rem; }

.cem-report-share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9; }
.cem-report-share-label { font-size: 0.8rem; color: #64748b; font-weight: 600; margin-right: 0.15rem; }
.cem-share-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; text-decoration: none; padding: 0.3rem 0.65rem; border-radius: 999px; border: 1px solid #e2e8f0; color: #1e293b; background: #f8fafc; }
.cem-share-btn:hover { background: #eef2f7; }
.cem-share-whatsapp:hover { background: #dcfce7; border-color: #86efac; }
.cem-share-twitter:hover { background: #e2e8f0; border-color: #94a3b8; }
.cem-share-facebook:hover { background: #dbeafe; border-color: #93c5fd; }
.cem-share-telegram:hover { background: #dbeafe; border-color: #93c5fd; }
.cem-share-copy:hover { background: #f1f5f9; border-color: #cbd5e1; }


.cem-id-tag-download { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0; }
.cem-id-tag-download h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }

/* Invite Others / referral tab */
.cem-invite-stats { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.cem-invite-stats > div { flex: 1 1 140px; background: #ecfdf5; border: 2px solid #6ee7b7; border-radius: 10px; padding: 0.9rem 1rem; text-align: center; }
.cem-invite-num { display: block; font-size: 2rem; font-weight: 800; color: #065f46; line-height: 1.1; }
.cem-invite-label { font-size: 0.85rem; color: #047857; }
.cem-invite-field-label { display: block; font-weight: 600; margin-top: 0.5rem; }
.cem-invite-copy-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.35rem 0; }
.cem-invite-copy-row input { flex: 1 1 220px; font-size: 1rem; padding: 0.6rem; }
.cem-invite-code { font-family: monospace; font-size: 1.1rem; letter-spacing: 0.1em; background: #f1f5f9; padding: 0.1rem 0.45rem; border-radius: 4px; }
.cem-invite-share { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.cem-share-btn { display: inline-block; padding: 0.7rem 1.1rem; border-radius: 8px; color: #fff !important; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; font-size: 0.95rem; }
.cem-share-whatsapp { background: #25d366; }
.cem-share-x { background: #111827; }
.cem-share-facebook { background: #1877f2; }
.cem-share-telegram { background: #229ed9; }
.cem-share-sms { background: #6b7280; }
.cem-share-email { background: #b45309; }
.cem-share-native { background: #7c3aed; }
.cem-share-btn:hover { opacity: 0.9; }
.cem-invite-preview { background: #f8fafc; border-left: 4px solid #94a3b8; padding: 0.75rem 1rem; border-radius: 4px; }
.cem-invite-board li { margin: 0.25rem 0; }
.cem-invite-me { font-weight: 700; color: #065f46; }
.cem-notice-invited { background: #ecfdf5; border: 2px solid #6ee7b7; color: #065f46; font-size: 1rem; margin-bottom: 1rem; }

.cem-invite-table-wrap { overflow-x: auto; }
.cem-invite-referred { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.cem-invite-referred th, .cem-invite-referred td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #e2e8f0; }
.cem-invite-referred th { background: #f1f5f9; font-weight: 700; }

.cem-pager { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin:.6rem 0 0; font-size:.9rem; }
.cem-pager[hidden] { display:none; }
.cem-pager button { padding:.4rem .8rem; border:1px solid #cbd5e1; background:#fff; border-radius:6px; cursor:pointer; }
.cem-pager button:disabled { opacity:.45; cursor:default; }

.cem-pvc-optional-note { margin:0 0 .75rem; padding:.6rem .8rem; background:#fef9c3; border-left:4px solid #ca8a04; border-radius:4px; font-size:1rem; }
