:root {
    --primary: #ff7d14;
    --bg: #f4f6fb;
    --text: #1f2937;
}
body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}
.voter {
    background: #fff;
}
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}
.navbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.navbar-brand {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.nav-links,
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-context {
    display: flex;
    justify-content: center;
    flex: 1 1 220px;
    max-width: 320px;
    min-width: 160px;
}
.nav-organization-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff7d14, #faa661);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 6px 18px rgba(26, 115, 232, 0.25);
    max-width: 100%;
}
.nav-pill-icon {
    font-size: 1rem;
}
.nav-org-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18ch;
}
.voter-header {
    display: flex;
    justify-content: center;
    padding: 1rem 1.5rem;
}
.voter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: linear-gradient(135deg,#ff7d14, #faa661);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(26, 115, 232, 0.3);
    max-width: min(90%, 320px);
}
.voter-badge-icon {
    font-size: 1rem;
}
.voter-badge-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-links a,
.nav-actions a {
    text-decoration: none;
    color: var(--text);
}
.nav-actions form {
    margin: 0;
}
h1 {
    margin-top: 0;
}
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}
.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.inline-form {
    margin: 0;
}
.filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.filter-label {
    font-weight: 600;
}
.table-toggle-cell {
    text-align: center;
}
.table-toggle {
    margin: 0 auto;
}
.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.toggle-label {
    font-weight: 600;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 999px;
    transition: background 0.2s ease;
}
.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}
.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.form-toggle {
    margin: 1rem 0;
}
.form-toggle:first-of-type {
    margin-top: 0.5rem;
}
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.table th, .table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}
.card {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.auth-card {
    display: grid;
    gap: 0.75rem;
}
.verification-banner {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.verification-banner p {
    margin: 0;
}
.verification-banner p + p {
    margin-top: 0.25rem;
}
.auth-header p {
    margin: 0.25rem 0 0;
    color: #4b5563;
}
.auth-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
}
.auth-tab {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    color: inherit;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.auth-tab.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(26, 115, 232, 0.25);
}
.auth-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.auth-form {
    margin-top: 0.25rem;
    max-width: 520px;
    width: 100%;
}
.auth-form[hidden] {
    display: none;
}
.auth-feedback {
    margin: 0;
    color: #374151;
    font-weight: 600;
    min-height: 1.25rem;
}
.auth-feedback[data-tone="error"] {
    color: #b91c1c;
}
.auth-feedback[data-tone="success"] {
    color: #047857;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
form label {
    display: block;
    margin-bottom: 1rem;
}
form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}
form label.confirm {
    display: inline-flex;
    align-items: center;
    gap: 0.6ch;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}
form label.confirm input[type="checkbox"] {
    margin: 0;
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}
form textarea, form select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
}
.choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.choice input[type="checkbox"],
.choice input[type="radio"] {
    width: auto;
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.choice span {
    flex: 1;
    display: block;
}
.choice span strong {
    display: inline-block;
    margin-bottom: 0.25rem;
}
.candidate-photo {
    width: 72px;
    height: 96px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    flex-shrink: 0;
}
.candidate-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.candidate-meta {
    color: #6b7280;
    font-size: 0.85rem;
}
.committee-fieldset {
    border: none;
    margin: 0;
    padding: 0;
}
.committee-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}
.committee-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}
.committee-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.committee-option input[type="checkbox"] {
    width: auto;
    height: auto;
    flex-shrink: 0;
}
.committee-label {
    font-weight: 600;
}
.error {
    color: #b91c1c;
}
.list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 1rem;
}
.form-grid {
    display: grid;
    gap: 1rem;
    max-width: 520px;
}
.photo-preview {
    margin: 0.5rem 0 1rem;
}
.error-panel {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border: 1px solid #fee2e2;
    background: #fff5f5;
}
.error-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fee2e2;
    color: #b91c1c;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.error-body h1 {
    margin-bottom: 0.35rem;
}
.muted {
    color: #6b7280;
    font-size: 0.9rem;
}
button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}
.secondary {
    background: #e5e7eb;
    color: #1f2937;
}
.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.back-link {
    display: inline-block;
    margin-top: 1.5rem;
}
.topic-list {
    display: grid;
    gap: 1rem;
}
.topic-item {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    background: #fff;
}
.primaries-grid {
    display: grid;
    gap: 1.5rem;
}
.scan-options {
    margin-top: 2rem;
    max-width: 520px;
}
.scan-options .secondary {
    margin-bottom: 1rem;
}
.scan-ui {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.scan-preview {
    width: 100%;
    max-height: 320px;
    border-radius: 6px;
    background: #000;
    object-fit: cover;
}
[data-html5qr] {
    width: 100%;
    max-height: 320px;
    border-radius: 6px;
    background: #000;
    overflow: hidden;
    position: relative;
}
[data-html5qr] video,
[data-html5qr] canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 320px;
    border-radius: 6px;
    object-fit: cover;
}
.scan-status {
    margin-top: 0.75rem;
    font-weight: 600;
}
.scan-status[data-tone="error"] {
    color: #b91c1c;
}
.scan-status[data-tone="success"] {
    color: #047857;
}
@media (min-width: 720px) {
    .primaries-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    .card {
        padding: 1rem;
    }
    form input {
        font-size: 1rem;
    }
    .auth-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.candidate-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}
.candidate-btn {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: inherit;
    border-radius: 6px;
}
.candidate-btn:disabled {
    background: #e5e7eb;
    color: #6b7280;
    cursor: not-allowed;
}
.candidate-list.ordered li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}
.remove-btn {
    margin-left: auto;
    background: #fee2e2;
    color: #b91c1c;
}
.link-button {
    background: none;
    color: var(--primary);
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}
