@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
    --vdms-ink: #1a2332;
    --vdms-muted: #5c6b7a;
    --vdms-surface: #f3f6f4;
    --vdms-card: #ffffff;
    --vdms-accent: #0f6b4c;
    --vdms-accent-2: #c45c26;
    --vdms-line: #d7e0db;
    --vdms-sidebar: #12241c;
    --vdms-radius: 12px;
    --font-display: "Fraunces", "Georgia", serif;
    --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--vdms-ink);
    background:
        radial-gradient(circle at 10% -10%, #d9ebe2 0%, transparent 40%),
        radial-gradient(circle at 100% 0%, #f7e6d8 0%, transparent 35%),
        var(--vdms-surface);
    min-height: 100vh;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        linear-gradient(135deg, rgba(18,36,28,.92), rgba(15,107,76,.75)),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-wrap { width: min(420px, 100%); }
.auth-card {
    background: var(--vdms-card);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.auth-card h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: .25rem;
}
.auth-card .brand-sub { color: var(--vdms-muted); margin-bottom: 1.5rem; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 260px;
    background: var(--vdms-sidebar);
    color: #e8f2ec;
    flex-direction: column;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}
@media (max-width: 991.98px) {
    .app-sidebar {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        height: 0;
        padding: 0 !important;
        overflow: hidden;
        pointer-events: none;
    }
    html, body, .app-shell {
        max-width: 100%;
        overflow-x: hidden;
    }
}
.sidebar-brand {
    display: flex; gap: .75rem; align-items: center;
    padding: .5rem .75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
}
.brand-mark {
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--vdms-accent);
    display: grid; place-items: center;
    font-weight: 700; font-family: var(--font-display);
}
.sidebar-brand small { display: block; opacity: .65; font-size: .75rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar-nav .nav-link,
.sidebar-account .nav-link {
    color: #c9ddd2; border-radius: 10px; padding: .7rem .9rem;
    display: flex; gap: .65rem; align-items: center; text-decoration: none;
    border: 0; background: transparent; width: 100%; font: inherit; cursor: pointer;
    text-align: left;
}
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active,
.sidebar-account .nav-link:hover, .sidebar-account .nav-link.active {
    background: rgba(255,255,255,.08); color: #fff;
}
.sidebar-foot { padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-account { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .85rem; }
.sidebar-account form { margin: 0; }
.user-chip { padding: .35rem .9rem; }
.user-chip strong { display: block; font-size: .95rem; }
.user-chip small { opacity: .65; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; gap: 1rem; flex-wrap: wrap;
    border-bottom: 1px solid var(--vdms-line);
    background: rgba(255,255,255,.7); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 20;
}
.page-title {
    font-family: var(--font-display);
    font-size: 1.45rem; margin: 0;
}
.header-actions { display: flex; gap: .75rem; align-items: center; }
.app-content { padding: 1.25rem 1.5rem 5rem; min-width: 0; width: 100%; }

.card-soft {
    background: var(--vdms-card);
    border: 1px solid var(--vdms-line);
    border-radius: var(--vdms-radius);
    padding: 1.25rem;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.kpi-card {
    background: var(--vdms-card);
    border: 1px solid var(--vdms-line);
    border-radius: var(--vdms-radius);
    padding: 1rem 1.1rem;
}
.kpi-card .label { color: var(--vdms-muted); font-size: .85rem; }
.kpi-card .value {
    font-family: var(--font-display);
    font-size: 1.7rem; font-weight: 700; margin-top: .2rem;
}
.kpi-card.accent { border-color: #b7d7c8; background: linear-gradient(180deg, #f4fbf7, #fff); }

/* Dashboard breakdown widgets */
.dash-widget {
    height: 300px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dash-widget--tall {
    height: 390px; /* +30% */
    max-height: 390px;
}
.dash-widget-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: .65rem;
    color: var(--vdms-ink);
    flex: 0 0 auto;
}
.dash-widget-scroll {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.dash-widget-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge legacy */
}
.dash-widget-body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.dash-widget-scroll-hint {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.35rem .35rem .35rem;
    text-align: center;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--vdms-accent);
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.92) 45%, #fff 100%);
}
.dash-widget-scroll-hint.is-visible {
    display: block;
}
.dash-widget-scroll-hint i {
    display: block;
    font-size: .85rem;
    line-height: 1;
    animation: dash-scroll-bounce 1.2s ease-in-out infinite;
}
@keyframes dash-scroll-bounce {
    0%, 100% { transform: translateY(0); opacity: .55; }
    50% { transform: translateY(3px); opacity: 1; }
}
.dash-stat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.dash-stat-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--vdms-line);
    font-size: .95rem;
}
.dash-stat-list li:last-child { border-bottom: 0; }
.dash-stat-list li > span,
.dash-stat-list li > button {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-stat-count {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--vdms-accent);
    text-decoration: none;
    min-width: 2.5rem;
    text-align: right;
    padding: .1rem .35rem;
    border-radius: 6px;
    border: 1px solid transparent;
    flex: 0 0 auto;
}
.dash-stat-count:hover {
    background: rgba(15, 107, 76, .08);
    border-color: rgba(15, 107, 76, .25);
    color: #0c563d;
}
.dash-widget-total {
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid var(--vdms-line);
    font-size: .9rem;
    color: var(--vdms-muted);
    flex: 0 0 auto;
}
.dash-widget-total strong {
    color: var(--vdms-ink);
    font-family: var(--font-display);
    font-size: 1.1rem;
}
.dash-caste-filter {
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.dash-caste-filter:hover,
.dash-caste-filter.is-active {
    color: var(--vdms-accent);
    font-weight: 600;
}

.btn-vdms {
    background: var(--vdms-accent); color: #fff; border: none;
}
.btn-vdms:hover { background: #0c563d; color: #fff; }

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
.table-actions .btn {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.table-actions form.d-inline { display: inline-flex !important; margin: 0; }

.voters-list-card .voter-epic-sub,
#votersTable .voter-epic-sub {
    color: var(--vdms-muted);
    font-size: .8rem;
    font-weight: 400;
    margin-top: .12rem;
    line-height: 1.3;
}
#votersTable td.td-name {
    font-weight: 600;
}
#votersTable .td-added-by .voter-added-name,
#votersTable .td-updated-by .voter-updated-date {
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.3;
}
#votersTable .td-added-by .voter-added-date,
#votersTable .td-updated-by .voter-updated-name {
    font-size: .75rem;
    margin-top: .1rem;
    line-height: 1.3;
}

.voters-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .65rem .85rem 0;
}
.voters-table-toolbar .dataTables_length {
    margin: 0;
    padding: 0;
}
.voters-col-dropdown .dropdown-menu {
    min-width: 14rem;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
}
.voters-col-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
}
.voters-col-item:hover { background: #f3f6f4; }

/* Voters / Users toolbars */
.voters-toolbar {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.voters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.voters-actions .btn { flex: 1 1 auto; }
@media (min-width: 768px) {
    .voters-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
        gap: .85rem 1rem;
    }
    .voters-actions {
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
    .voters-actions .btn { flex: 0 0 auto; }
}

.voters-geo-filters .form-label {
    font-size: .8rem;
    margin-bottom: .2rem;
}
.voters-geo-filters #geoFilterPanel.show,
.voters-geo-filters #geoFilterPanel.collapsing {
    margin-top: .35rem;
}

@media (max-width: 575.98px) {
    .app-content { padding: 1rem .85rem 5.5rem; }
    .card-soft { padding: 1rem; }

    .voters-table-wrap,
    .users-table-wrap {
        overflow-x: hidden;
        max-width: 100%;
    }

    .voters-list-card,
    .users-list-card {
        padding: .65rem;
        background: transparent;
        border: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .voters-dt-length {
        flex: 1 1 auto;
        min-width: 0;
    }
    .voters-dt-length .dataTables_length,
    .voters-dt-length label {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: .4rem;
        margin: 0;
        font-size: .9rem;
    }
    .voters-dt-length select {
        min-height: 40px;
        min-width: 4.75rem;
        font-size: 1rem;
        padding: .35rem .5rem;
    }

    .dataTables_wrapper,
    .dataTables_wrapper > .row,
    .dataTables_wrapper [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0;
        padding-right: 0;
    }

    table.dataTable,
    .desktop-table,
    .desktop-table tbody {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    table.dataTable colgroup { display: none; }
    .desktop-table th,
    .desktop-table td {
        width: auto !important;
        max-width: none !important;
    }
    .desktop-table thead { display: none; }
    .desktop-table tbody tr {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0 0 .75rem;
        border: 1px solid var(--vdms-line);
        border-radius: 12px;
        background: #fff;
        padding: .85rem .9rem;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    }
    .desktop-table tbody tr.odd,
    .desktop-table tbody tr.even {
        background: #fff;
    }
    .desktop-table td {
        display: grid;
        grid-template-columns: 110px minmax(0, 1fr);
        align-items: start;
        gap: .5rem .75rem;
        border: 0 !important;
        padding: .4rem 0 !important;
        text-align: left !important;
        white-space: normal;
        word-break: break-word;
        width: 100% !important;
    }
    .desktop-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: .78rem;
        color: var(--vdms-muted);
        line-height: 1.35;
    }
    .desktop-table td.td-check {
        grid-template-columns: auto 1fr;
        padding-bottom: .55rem !important;
        margin-bottom: .35rem;
        border-bottom: 1px solid var(--vdms-line) !important;
    }
    .desktop-table td.td-check::before { content: none; }
    .desktop-table td.td-name {
        font-weight: 700;
        font-size: 1.02rem;
    }
    .desktop-table td.td-name .voter-epic-sub {
        font-weight: 400;
        font-size: .8rem;
        margin-top: .15rem;
        line-height: 1.3;
        white-space: normal;
    }
    .desktop-table td.td-actions {
        display: block;
        padding-top: .65rem !important;
        margin-top: .35rem;
        border-top: 1px solid var(--vdms-line) !important;
    }
    .desktop-table td.td-actions::before {
        display: block;
        margin-bottom: .45rem;
    }
    .desktop-table .table-actions {
        width: 100%;
    }
    .desktop-table .table-actions .btn {
        min-width: 42px;
        min-height: 42px;
        padding: .35rem .55rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        display: none !important;
    }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        font-size: .85rem;
        padding: .35rem 0;
    }
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: .35rem .55rem !important;
    }

    .voters-actions .btn-label { display: none; }
    .voters-actions .btn {
        flex: 1 1 calc(33.33% - .4rem);
        justify-content: center;
    }
}

.dashboard-loading .spinner-border {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--vdms-accent);
}

.remark-offcanvas {
    width: min(420px, 96vw) !important;
}
.remark-offcanvas .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
}
.remark-offcanvas form {
    min-height: 0;
}
.remark-offcanvas .offcanvas-body {
    overflow-y: auto;
}

/* Update history offcanvas — right */
.log-offcanvas {
    width: min(560px, 96vw) !important;
}
.log-offcanvas .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
}
.log-item {
    padding: .75rem 0;
    border-bottom: 1px solid var(--vdms-line);
}
.log-item:last-child { border-bottom: 0; }
.log-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    color: var(--vdms-muted);
    font-size: .8rem;
    margin-bottom: .25rem;
}
.log-field {
    font-weight: 700;
    font-size: .92rem;
    color: var(--vdms-ink);
    margin-bottom: .2rem;
}
.log-change {
    font-size: .9rem;
    line-height: 1.4;
    word-break: break-word;
}
.log-old { color: var(--vdms-muted); }
.log-arrow {
    margin: 0 .35rem;
    color: var(--vdms-accent);
    font-weight: 700;
}
.log-new { color: var(--vdms-ink); font-weight: 600; }

/* Voter view offcanvas — right side, compact label/value rows */
.voter-view-offcanvas {
    width: min(760px, 96vw) !important;
}
.voter-view-offcanvas .offcanvas-header {
    padding: 1rem 1.35rem;
    background: #fff;
}
.voter-view-offcanvas .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
}
.voter-view-offcanvas .offcanvas-body {
    padding: 1rem 1.35rem 1.5rem;
    background: #fff;
}
.voter-view-section {
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--vdms-line);
}
.voter-view-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}
.voter-view-section h6 {
    font-weight: 700;
    font-size: .9rem;
    color: var(--vdms-accent);
    margin: 0 0 .45rem;
}
.voter-view-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
    row-gap: .2rem;
}
.voter-view-field {
    min-width: 0;
    display: grid;
    grid-template-columns: 118px 1fr;
    gap: .15rem .65rem;
    align-items: baseline;
    padding: .15rem 0;
}
.voter-view-field--full { grid-column: 1 / -1; }
.voter-view-label {
    color: var(--vdms-muted);
    font-size: .82rem;
    font-weight: 600;
}
.voter-view-value {
    color: var(--vdms-ink);
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}
.voter-view-offcanvas .offcanvas-footer {
    background: #fff;
    padding: .85rem 1.35rem;
}
@media (max-width: 575.98px) {
    .voter-view-offcanvas { width: 100% !important; }
    .voter-view-grid { grid-template-columns: 1fr; }
    .voter-view-field { grid-template-columns: 100px 1fr; }
}

.form-label { font-weight: 600; font-size: .9rem; }
.section-card { margin-bottom: 1rem; }
.section-card .card-header {
    background: #f7faf8; font-weight: 700; cursor: pointer;
}

/* Masters */
.masters-home { max-width: 980px; }
.masters-section { margin-bottom: 2rem; }
.masters-heading {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}
.masters-subhead {
    font-weight: 700;
    font-size: .95rem;
    color: var(--vdms-accent);
    margin-bottom: .75rem;
}
.masters-level-list,
.masters-lookup-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--vdms-line);
}
.masters-level-link,
.masters-lookup-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 0;
    border-bottom: 1px solid var(--vdms-line);
    color: var(--vdms-ink);
    text-decoration: none;
}
.masters-level-link:hover,
.masters-lookup-link:hover {
    color: var(--vdms-accent);
}
.masters-level-name small { color: var(--vdms-muted); font-weight: 400; }
.masters-lookup-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: grid; place-items: center;
    background: rgba(15, 107, 76, .1);
    color: var(--vdms-accent);
    flex-shrink: 0;
}
.masters-form .form-control,
.masters-form .form-select { max-width: 100%; }
.masters-table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--vdms-muted);
    font-weight: 700;
}
.masters-filter { max-width: 900px; }
.status-pill {
    display: inline-block;
    font-size: .78rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 999px;
}
.status-pill--active {
    background: rgba(15, 107, 76, .12);
    color: var(--vdms-accent);
}
.status-pill--inactive {
    background: #eee;
    color: #6b7280;
}

.td-user-location {
    min-width: 14rem;
    max-width: 28rem;
}
.user-alloc-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.user-alloc-item {
    line-height: 1.25;
}
.user-alloc-level {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--vdms-muted);
}
.user-alloc-path {
    display: block;
    font-size: .86rem;
    color: var(--vdms-ink, #1f2937);
    word-break: break-word;
}

/* Geo tree view */
.geo-tree-wrap { max-width: 920px; }
.geo-tree,
.geo-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.geo-tree-children {
    margin-left: 1.15rem;
    padding-left: .75rem;
    border-left: 1px solid var(--vdms-line);
}
.geo-tree-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .25rem;
    border-radius: 6px;
}
.geo-tree-row:hover { background: rgba(15, 107, 76, .06); }
.geo-tree-toggle {
    border: 0;
    background: transparent;
    color: var(--vdms-muted);
    width: 1.5rem;
    height: 1.5rem;
    display: grid;
    place-items: center;
    padding: 0;
    flex-shrink: 0;
}
.geo-tree-toggle:hover { color: var(--vdms-accent); }
.geo-tree-toggle.is-loading { opacity: .45; }
.geo-tree-label {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
}
.geo-tree-level {
    font-size: .75rem;
    color: var(--vdms-muted);
    text-transform: capitalize;
}
.geo-tree-manage {
    color: var(--vdms-muted);
    padding: .15rem .35rem;
    opacity: 0;
}
.geo-tree-row:hover .geo-tree-manage { opacity: 1; color: var(--vdms-accent); }
.geo-tree-empty { font-size: .85rem; padding: .25rem 0 .25rem 1.6rem; }
.geo-tree-filtered-out { display: none !important; }
.geo-tree-node.is-open > .geo-tree-row .geo-tree-toggle { color: var(--vdms-accent); }

.geo-offcanvas {
    width: min(420px, 96vw) !important;
}
.geo-offcanvas .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
}
.geo-offcanvas form {
    min-height: 0;
}
.geo-offcanvas .offcanvas-body {
    overflow-y: auto;
}
#geoUnitsTable_wrapper .dataTables_filter input {
    min-width: 220px;
}

/* Export offcanvas */
.export-offcanvas {
    width: min(480px, 96vw) !important;
}
.export-offcanvas .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
}
.export-offcanvas form { min-height: 0; }
.export-offcanvas .offcanvas-body { overflow-y: auto; }

/* Bottom nav */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--vdms-line);
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
}
.bottom-nav a {
    text-decoration: none; color: var(--vdms-muted);
    display: flex; flex-direction: column; align-items: center;
    gap: .15rem; font-size: .7rem; padding: .4rem; min-height: 44px;
}
.bottom-nav .add-fab {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--vdms-accent); color: #fff;
    display: grid; place-items: center; margin: -1.1rem auto 0;
    font-size: 1.25rem; box-shadow: 0 6px 16px rgba(15,107,76,.35);
}
.bottom-nav .add-fab span { display: none; }

/* Mobile More menu */
.more-menu {
    border-radius: 18px 18px 0 0;
    height: auto;
    max-height: 85vh;
}
.more-menu.show {
    height: auto;
    max-height: 85vh;
}
.more-menu .offcanvas-body {
    overflow-y: auto;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.more-menu .offcanvas-title {
    font-family: var(--font-display);
    font-weight: 700;
}
.more-menu-list {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding-bottom: .5rem;
}
.more-menu-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    padding: .9rem 1rem;
    border: 1px solid var(--vdms-line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #f7faf8);
    color: var(--vdms-ink);
    text-decoration: none;
    font-weight: 600;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(18, 36, 28, .04);
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.more-menu-item:hover,
.more-menu-item:focus {
    background: #eef6f1;
    border-color: #b7d7c8;
    color: var(--vdms-ink);
}
.more-menu-item:active { transform: scale(.98); }
.more-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(15, 107, 76, .1);
    color: var(--vdms-accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.more-menu-item--danger {
    border-color: #f0d4d4;
    background: linear-gradient(180deg, #fff, #fdf5f5);
}
.more-menu-item--danger .more-menu-icon {
    background: rgba(196, 92, 38, .12);
    color: #b42318;
}
.more-menu-item--danger:hover,
.more-menu-item--danger:focus {
    background: #fdf0f0;
    border-color: #e8b4b4;
    color: #b42318;
}
.more-menu form { margin: 0; }

.progress-thin { height: 8px; }
.progress-upload {
    height: 12px;
    border-radius: 999px;
    background: #e8efeB;
    overflow: hidden;
}
.progress-upload .progress-bar {
    background-color: var(--vdms-accent);
}
.upload-progress {
    padding: .75rem .85rem;
    border: 1px solid var(--vdms-line);
    border-radius: 10px;
    background: #f7faf8;
}

.field-error {
    font-size: .8rem;
    min-height: 1.1em;
    margin-top: .2rem;
}
.field-error:empty { display: none; }
input.is-invalid, select.is-invalid {
    border-color: #dc3545;
}

/* Select2 (searchable dropdowns) */
.select2-container--bootstrap-5 .select2-selection {
    min-height: calc(1.5em + .75rem + 2px);
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}
select.is-invalid + .select2-container .select2-selection {
    border-color: #dc3545;
}
.accordion-body .select2-container {
    z-index: 2;
}
.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 1060;
}

@media (max-width: 991.98px) {
    #voter-form select.form-select {
        min-height: 48px;
        font-size: 1rem;
        padding-top: .65rem;
        padding-bottom: .65rem;
    }
}

/* Help */
.help-intro h1 { font-family: var(--font-display); }
.help-meta { text-align: right; }
.help-toc-label {
    font-size: .8rem;
    color: var(--vdms-muted);
    margin-bottom: .55rem;
}
.help-toc-links {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.help-toc-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--vdms-line);
    background: #f7faf8;
    color: inherit;
    text-decoration: none;
    font-size: .82rem;
}
.help-toc-chip:hover {
    border-color: var(--vdms-accent);
    color: var(--vdms-accent);
}
.help-topics {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.help-topic-head {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--vdms-line);
}
.help-topic-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: rgba(15, 107, 76, .1);
    color: var(--vdms-accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}
.help-topic-hi {
    color: var(--vdms-muted);
    font-size: .9rem;
    margin-top: .15rem;
}
.help-bilingual {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 900px) {
    .help-bilingual {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
}
.help-lang-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--vdms-accent);
    background: rgba(15, 107, 76, .1);
    padding: .15rem .45rem;
    border-radius: 6px;
    margin-bottom: .5rem;
}
.help-summary {
    margin-bottom: .65rem;
    line-height: 1.55;
}
.help-summary:last-of-type { margin-bottom: .85rem; }
.help-how {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--vdms-muted);
    margin: .85rem 0 .4rem;
}
.help-how--tips { color: var(--vdms-accent); }
.help-steps {
    margin: 0 0 .5rem;
    padding-left: 1.15rem;
    line-height: 1.55;
}
.help-steps li { margin-bottom: .55rem; }
.help-steps li:last-child { margin-bottom: 0; }
.help-tips {
    margin: 0;
    padding-left: 1.15rem;
    line-height: 1.55;
    color: #3a4a42;
}
.help-tips li { margin-bottom: .4rem; }
.help-tips li:last-child { margin-bottom: 0; }

.perm-privacy-item {
    background: #fff4d6;
    border: 1px solid #e0a106;
    border-radius: 8px;
    padding: .55rem .75rem;
    margin-bottom: .35rem;
}
.perm-privacy-item .form-check-label {
    font-weight: 700;
    color: #8a4b00;
}
