/* Shared visual layer for the portal (search, distribution). Loaded after each page's own styles.
   It only restyles: layout, ids and behaviour are unchanged. On phones every table becomes labelled
   cards (labels come from assets/ui.js, which copies each column header into data-label). */

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff4ff;
    --ink: #0f172a;
    --text-main: #0f172a;
    --text-muted: #5b6577;
    --bg-page: #f4f6fa;
    --bg-card: #ffffff;
    --border-color: #e3e8f0;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.05);
    --shadow-md: 0 1px 3px rgb(15 23 42 / 0.06), 0 6px 16px rgb(15 23 42 / 0.05);
    --shadow-lg: 0 12px 32px rgb(15 23 42 / 0.12);
    --focus: 0 0 0 3px rgb(29 78 216 / 0.18);
}

body {
    font-family: "Noto Sans Gujarati", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--ink);
    font-size: 15px;
}

.container { max-width: 1320px; padding: 20px 20px 48px; }

/* ---- Header ------------------------------------------------------------------------------- */
.app-header {
    background: #0f1f4b;
    background-image: linear-gradient(120deg, #0f1f4b 0%, #1d3fa8 100%);
    border-radius: var(--radius);
    padding: 24px 26px;
    box-shadow: var(--shadow-md);
    margin-bottom: 18px;
}
.header-title h1 { font-size: 23px; line-height: 1.35; margin-bottom: 4px; letter-spacing: 0; }
.header-title p { font-size: 13.5px; color: #c7d4fb; }
.header-badge {
    background: rgb(255 255 255 / 0.12);
    border: 1px solid rgb(255 255 255 / 0.22);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}
a.header-badge, .header-link { text-decoration: none; color: #fff; transition: background .15s; }
a.header-badge:hover, .header-link:hover { background: rgb(255 255 255 / 0.22); }
.header-link-accent { background: #fff; color: #102a7a !important; border-color: #fff; }
.header-link-accent:hover { background: #e8eeff !important; }
.ward-picker select { color: #102a7a; padding: 3px 8px; border-radius: 7px; }

/* ---- Stats ---------------------------------------------------------------------------------- */
.stats-grid { gap: 14px; margin-bottom: 18px; }
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
    gap: 14px;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--primary-light); color: var(--primary);
    font-size: 0;
}
.stat-icon svg { display: block; }
.stat-icon-ok { background: #e8f7ef; color: #15803d; }
.stat-icon-warn { background: #fdf3e2; color: #b45309; }
.stat-info .stat-val { font-size: 24px; letter-spacing: -0.2px; }
.stat-info .stat-label { font-size: 13px; color: var(--text-muted); }

/* ---- Cards, search ---------------------------------------------------------------------------- */
.search-card, .progress-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 18px;
}
.search-mode-tabs { gap: 8px; margin-bottom: 14px; }
.mode-btn, .nav-tab-btn {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
}
.mode-btn:hover, .nav-tab-btn:hover { border-color: #b9c6e8; color: var(--primary); background: #fff; }
.mode-btn.active, .nav-tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.nav-tabs { border-bottom: 1px solid var(--border-color); gap: 8px; flex-wrap: wrap; }

.search-bar-wrap { gap: 10px; }
.search-input, .filter-input, .filter-select {
    border: 1px solid #d5dce8;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.search-input { padding: 13px 14px 13px 44px; font-size: 15px; border-radius: 11px; }
.search-input:focus, .filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.filter-input, .filter-select { padding: 9px 11px; min-height: 40px; }
.filter-select:disabled { background: #f5f7fa; color: #9aa3b2; }
.btn-search {
    background: var(--primary);
    border-radius: 11px;
    font-weight: 700;
    padding: 12px 22px;
    box-shadow: none;
}
.btn-search:hover { background: var(--primary-hover); }
.btn-reset {
    background: #fff;
    border: 1px solid #d5dce8;
    color: #334155;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 8px 14px;
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-reset:hover { background: #f5f7fb; border-color: #c2cbdb; }
.btn-soft-link { background: var(--primary-light); color: var(--primary); border-color: #cfdcfb; }

/* Filter grid: every field combines with the others */
.filters-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 10px; }
.filters-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.all-wards-toggle { font-size: 13.5px; color: #334155; }
.all-wards-toggle input { width: 16px; height: 16px; accent-color: var(--primary); }
.search-filters.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    gap: 12px 14px;
    align-items: end;
    background: #f8fafd;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}
.filter-grid .filter-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-grid .filter-item label { font-size: 12.5px; font-weight: 600; color: #475569; }
.filter-grid .filter-input, .filter-grid .filter-select { width: 100%; }
.pair-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; color: #94a3b8; }
.filter-actions { justify-content: flex-end; }
.filter-actions .btn-reset { width: 100%; min-height: 40px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.active-filters:empty { display: none; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid #cfdcfb; background: var(--primary-light); color: #1e3a8a;
    border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.filter-chip strong { font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip .chip-x { font-size: 15px; line-height: 1; margin-left: 2px; color: #64748b; }
.filter-chip:hover { border-color: var(--primary); }
.filter-chip-clear { background: #fff; color: #b91c1c; border-color: #f3c4c4; }
.search-tips { font-size: 12.5px; color: var(--text-muted); margin-top: 12px; }

/* ---- Results -------------------------------------------------------------------------------- */
.results-header { gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.results-count { font-size: 15px; font-weight: 700; }
.table-responsive {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.voters-table th {
    background: #f6f8fc;
    color: #475569;
    font-size: 12.5px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    padding: 11px 12px;
}
.voters-table th small { font-weight: 500; color: #8a94a6; }
.voters-table td { padding: 12px; border-bottom: 1px solid #edf0f5; font-size: 14px; }
.voters-table tbody tr:hover { background: #fafbfe; }
.person-name-cell { font-weight: 700; }
.area-line { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 3px; }
.station-line { color: #0f766e; font-weight: 600; }
.name-serial { background: #eef2f8; color: #1e293b; border-radius: 6px; }
.badge-page, .badge-ward, .badge-booth, .badge-vibhag, .badge-person-no, .badge-gmc-ward {
    border-radius: 6px; font-weight: 700; font-size: 12px; padding: 3px 8px; border: none;
}
.badge-page { background: var(--primary-light); color: var(--primary); }
.badge-ward { background: #fdf3e2; color: #92400e; }
.badge-booth { background: #ecebfd; color: #3f37c9; }
.voter-id-tag { font-size: 12.5px; border-radius: 6px; }
.guardian-type-tag { border-radius: 5px; }
.badge-deleted { border-radius: 6px; }

/* Row action buttons: one quiet, consistent style */
.btn-download-range, .btn-download-booth, .btn-download-ward, .btn-voter-print, .btn-family {
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 10px;
    justify-content: flex-start;
    box-shadow: none;
}
.btn-download-range { background: #15803d; }
.btn-download-range:hover { background: #166534; }
.btn-download-booth { background: #4338ca; }
.btn-download-booth:hover { background: #3730a3; }
.btn-download-ward { background: #0369a1; }
.btn-download-ward:hover { background: #075985; }
.btn-voter-print { background: #fff; border: 1px solid #d5dce8; color: #334155; }
.btn-family { background: #fff8f0; border: 1px solid #f7d5b0; color: #9a3412; }

.pagination-wrap { padding: 14px; border-top: 1px solid #edf0f5; }
.btn-page { border-radius: 8px; border: 1px solid #d5dce8; background: #fff; font-weight: 600; }
.btn-page.active { background: var(--primary); border-color: var(--primary); }

/* ---- Modals ----------------------------------------------------------------------------------- */
.modal-overlay { background: rgb(15 23 42 / 0.55); backdrop-filter: blur(2px); }
.modal-content { border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); }
/* Long popups (e.g. page range with the voter list): the header stays, the body scrolls. */
.modal-content > div:not(.modal-header) { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { border-radius: 8px; width: 34px; height: 34px; }
.conflict-box { border-radius: 10px; }

/* ---- Distribution page extras -------------------------------------------------------------- */
.progress-bar-bg { border-radius: 999px; }
.progress-bar-fill { border-radius: 999px; }
.page-chip { border-radius: 8px; }
.quick-actions { gap: 10px; flex-wrap: wrap; }

/* ---- Phones ----------------------------------------------------------------------------------- */
@media (max-width: 760px) {
    body { font-size: 14.5px; }
    .container { padding: 12px 12px 40px; }
    .app-header { padding: 18px 16px; border-radius: 12px; }
    .header-title h1 { font-size: 19px; }
    .header-title-wrap > div:last-child { width: 100%; }
    .header-badge { font-size: 13px; padding: 7px 12px; }
    .ward-picker { width: 100%; justify-content: space-between; }

    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
    .stat-icon svg { width: 18px; height: 18px; }
    .stat-info .stat-val { font-size: 19px; }
    .stat-info .stat-label { font-size: 11.5px; line-height: 1.3; }

    .search-card, .progress-box { padding: 14px; border-radius: 12px; }
    .search-mode-tabs, .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
    .search-mode-tabs::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar { display: none; }
    .mode-btn, .nav-tab-btn { white-space: nowrap; flex: none; }
    .search-bar-wrap { flex-direction: column; align-items: stretch; }
    .btn-search { width: 100%; justify-content: center; }
    .search-filters.filter-grid { grid-template-columns: 1fr 1fr; padding: 12px; gap: 10px; }
    .filter-grid .filter-item:first-child, .filter-grid .filter-pair, .filter-grid .filter-actions { grid-column: 1 / -1; }

    .results-header { flex-direction: column; align-items: stretch; }
    .results-header > div { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
    .results-header > div > * { justify-content: center; text-align: center; white-space: normal; }

    /* Tables become labelled cards */
    .table-responsive { background: transparent; border: none; box-shadow: none; overflow: visible; }
    .voters-table, .voters-table tbody, .voters-table tr, .voters-table td { display: block; width: 100%; }
    .voters-table thead { display: none; }
    .voters-table tbody tr {
        background: #fff; border: 1px solid var(--border-color); border-radius: 12px;
        box-shadow: var(--shadow-sm); margin-bottom: 10px; padding: 12px 14px;
        display: flex !important; flex-wrap: wrap; gap: 6px 14px;
    }
    .voters-table tbody tr:hover { background: #fff; }
    .voters-table td {
        border: none; padding: 0; font-size: 14px; width: auto;
        flex: 1 1 calc(50% - 14px); min-width: 0;
    }
    .voters-table td[data-label]::before {
        content: attr(data-label);
        display: block; font-size: 11px; font-weight: 600; color: #8a94a6; margin-bottom: 1px;
    }
    .voters-table td.person-name-cell { order: -1; flex-basis: 100%; font-size: 16px; }
    .voters-table td.person-name-cell::before { display: none; }
    .voters-table td:last-child { flex-basis: 100%; }
    .voters-table td:last-child > div { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px !important; }
    .voters-table td:last-child button, .voters-table td:last-child a { justify-content: center; width: 100%; }
    .voters-table td.state-box { flex-basis: 100%; text-align: center; }
    .voters-table td.state-box::before { display: none; }
    .pagination-wrap { flex-wrap: wrap; justify-content: center; gap: 8px; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; }

    /* Modals become full-width sheets */
    .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
    .modal-content { width: 100% !important; max-width: 100% !important; max-height: 92vh; border-radius: 16px 16px 0 0; overflow-y: auto; }
    .modal-content [style*="grid-template-columns: 1.2fr 1fr"],
    .modal-content [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
    .modal-content > div[style*="padding: 24px"] { padding: 16px !important; }
    .modal-content [style*="justify-content: flex-end"] { flex-direction: column-reverse; align-items: stretch !important; }
    .modal-content [style*="justify-content: flex-end"] > * { width: 100%; justify-content: center; }
}

/* Filter grid alignment (overrides the older centred .filter-item) */
.filter-grid .filter-item { align-items: stretch; text-align: left; }
.filter-grid .filter-item label { text-align: left; }
.pair-inputs { width: 100%; }
.pair-inputs .filter-input { width: 100%; min-width: 0; }

/* ---- Voting dashboard (main screen) ------------------------------------------------------- */
.vote-dash { padding: 16px 20px; }
.vd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.vd-title { font-size: 17px; font-weight: 700; }
.vd-sub { font-size: 12.5px; color: var(--text-muted); }
.vd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vd-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.vd-count { border-radius: 12px; padding: 10px 12px; }
.vd-count b { display: block; font-size: 22px; line-height: 1.2; }
.vd-count span { font-size: 12px; font-weight: 600; }
.vd-codes { margin-top: 8px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.vd-codes .vd-count { background: #eef2ff; color: #1e3a8a; }
.vd-code-cell { white-space: nowrap; font-weight: 700; color: #1e3a8a; }
.vd-green { background: #e7f6ec; color: #15803d; }
.vd-yellow { background: #fef6d8; color: #a16207; }
.vd-red { background: #fde8e8; color: #b91c1c; }
.vd-grey { background: #eef0f3; color: #4b5563; }
.vd-turnout { background: var(--primary-light); color: var(--primary); }
.vd-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #fde8e8; margin-top: 12px; }
.vd-bar i { display: block; height: 100%; }
.vd-details { margin-top: 14px; }
.vd-num { font-weight: 700; }
.vd-num.g { color: #15803d; } .vd-num.y { color: #a16207; } .vd-num.r { color: #b91c1c; } .vd-num.x { color: #6b7280; }
.vd-mini { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: #fde8e8; margin-top: 4px; min-width: 90px; }
.vd-mini i { display: block; height: 100%; }
.vd-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.vd-row-actions .btn-reset { padding: 5px 9px; font-size: 12.5px; }
/* Page-range popup: voter selection */
.rv-box { border: 1px solid var(--border-color, #e3e8f0); border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.rv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.rv-count { background: #e7f6ec; color: #15803d; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.rv-tools { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rv-tools input { flex: 1 1 180px; min-width: 0; padding: 8px 10px; font-size: 13.5px; }
.rv-tools .btn-reset { padding: 6px 10px; font-size: 12.5px; }
.rv-list { max-height: 300px; overflow-y: auto; border-top: 1px solid var(--border-color, #e3e8f0); }
.rv-page { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; background: #f1f5f9; padding: 6px 8px; font-size: 13px; font-weight: 700; z-index: 1; }
.rv-row { display: grid; grid-template-columns: 26px 40px 1fr; gap: 8px; align-items: center; padding: 7px 8px; border-bottom: 1px solid #f1f4f9; cursor: pointer; font-size: 13.5px; }
.rv-row input, .rv-page input { width: 18px; height: 18px; accent-color: #15803d; margin: 0; }
.rv-row .rv-s { font-weight: 700; text-align: center; }
.rv-row small { display: block; color: var(--text-muted); font-size: 12px; }
.rv-row.on { background: #f3fbf5; }
.rv-row.off { opacity: .55; cursor: default; }
.rv-row .rv-held { color: #9a3412; font-weight: 600; }
.rv-empty { color: var(--text-muted); font-size: 13px; padding: 10px 4px; }
.vd-actions select { font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--border, #d5dce8); border-radius: 10px; background: #fff; }
.vd-actions select:disabled { color: #9aa3b2; }
.vd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.vd-panel { border: 1px solid var(--border, #e3e8f0); border-radius: 12px; padding: 12px 14px; background: #fff; min-width: 0; }
.vd-panel.vd-wide { grid-column: 1 / -1; }
.vd-panel h3, .vd-booths-head h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.vd-empty { color: var(--text-muted); font-size: 13px; padding: 10px 0; }
.vd-cols { display: flex; align-items: flex-end; gap: 6px; height: 170px; overflow-x: auto; padding-bottom: 2px; }
.vd-col { flex: 0 0 44px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 11px; }
.vd-col i { display: block; width: 70%; min-height: 2px; background: #16a34a; border-radius: 4px 4px 0 0; }
.vd-col b { font-size: 11.5px; margin-bottom: 2px; }
.vd-col span { color: var(--text-muted); margin-top: 4px; white-space: nowrap; }
.vd-hbar { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.vd-hbar-label { font-weight: 700; }
.vd-hbar-track { height: 10px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.vd-hbar-track i { display: block; height: 100%; background: #16a34a; }
.vd-hbar-val { color: var(--text-muted); white-space: nowrap; font-size: 12.5px; }
.vd-hbar-val b { color: var(--text, #0f172a); }
.vd-booths-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 8px; flex-wrap: wrap; }
.vd-booths-head h3 { margin: 0; }
.vd-booths-head select { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border, #d5dce8); border-radius: 10px; background: #fff; }
.st-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.st-pill.r { background: #fde8e8; color: #b91c1c; } .st-pill.y { background: #fef6d8; color: #a16207; }
@media (max-width: 760px) {
    .vd-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vd-turnout { grid-column: 1 / -1; }
    .vd-grid { grid-template-columns: 1fr; }
    .vd-codes .vd-count:last-child, .vd-actions #vdCalcLink { grid-column: 1 / -1; }
    .vd-actions select { width: 100%; }
    .vd-hbar { grid-template-columns: 56px 1fr; }
    .vd-hbar-val { grid-column: 2; }
    .vd-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
}

/* Serial assignment panel (distribution page) */
.pa-held { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed #e3e8f0; }
.pa-held .btn-page { padding: 3px 8px; font-size: 12px; }
.pa-wa { background: #e7f6ec !important; color: #15803d !important; border-color: #b7e3c6 !important; }
.pa-new { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 6px; }
.pa-new .btn-search { padding: 8px 12px; }
@media (max-width: 760px) { .pa-new { grid-template-columns: 1fr; } }

/* ---- Home screen tiles and views (index.html?view=home|search|reports) ---- */
.home-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.home-tile { display: flex; align-items: center; gap: 16px; padding: 22px 20px; min-height: 104px; background: #fff;
  border: 1px solid var(--border-color); border-radius: 16px; box-shadow: var(--shadow-sm, 0 1px 2px rgb(15 23 42 / .06));
  color: var(--text-main, #0f172a); text-decoration: none; transition: transform .12s, box-shadow .12s, border-color .12s; }
.home-tile:hover { transform: translateY(-2px); border-color: #bfd0fb; box-shadow: 0 8px 24px rgb(29 78 216 / .12); }
.home-tile-icon { flex: 0 0 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary-light, #eef2ff); color: var(--primary, #1d4ed8); }
.home-tile-text strong { display: block; font-size: 18px; line-height: 1.3; }
.home-tile-text small { color: var(--text-muted); font-size: 13px; }
.setup-banner { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: #fef6d8; color: #854d0e; font-size: 13.5px; border: 1px solid #f5d77a; }
.setup-banner a { color: inherit; font-weight: 700; }
.view-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; }
.view-bar strong { font-size: 17px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.user-chip button { font: inherit; font-size: 12.5px; font-weight: 700; border: none; border-radius: 999px; padding: 4px 10px;
  background: rgb(255 255 255 / .18); color: #fff; cursor: pointer; }
body[data-view="home"] #voteDash, body[data-view="home"] #searchSection, body[data-view="home"] #resultsSection { display: none; }
body[data-view="search"] #homeTiles, body[data-view="search"] #voteDash { display: none; }
body[data-view="reports"] #homeTiles, body[data-view="reports"] #searchSection, body[data-view="reports"] #resultsSection { display: none; }
body:not([data-view]) #homeTiles { display: none; }
@media (max-width: 640px) {
  .home-tiles { gap: 10px; }
  .home-tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 14px; min-height: 0; }
  .home-tile-icon { flex-basis: auto; width: 48px; height: 48px; }
  .home-tile-text strong { font-size: 15.5px; }
}

/* hidden always wins over component display rules (role-based tiles, header links) */
[hidden] { display: none !important; }
html[data-role="karyakarta"] .admin-only, html[data-role="booth_admin"] .admin-only { display: none !important; }

/* Search filters: show / hide (hidden by default on phones) */
.filters-toggle { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); background: #fff;
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; }
.filters-toggle:hover { border-color: #bfd0fb; }
.filters-count { background: var(--primary); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 8px; line-height: 20px; }
.filters-caret { color: var(--text-muted); transition: transform .15s; }
.filters-collapsed .filters-caret { transform: rotate(-90deg); }
.filters-collapsed #searchFilters, .filters-collapsed #searchTips { display: none !important; }
