:root{
  --primary-color:#1e6feb;
  --secondary-color:#0f172a;
  --app-bg:linear-gradient(135deg,#0f2b57,#1e6feb);
  --radius:1rem;
}
body.voter-body{
  background:var(--app-bg);
  min-height:100vh;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  color:#0f172a;
}
.glass{
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(10px);
  border-radius:var(--radius);
  box-shadow:0 18px 45px rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.5);
}
.btn-brand{background:var(--primary-color);border-color:var(--primary-color);color:#fff}
.btn-brand:hover,.btn-brand:focus{filter:brightness(.92);color:#fff}
.text-brand{color:var(--primary-color)!important}
.bg-brand{background:var(--primary-color)!important;color:#fff}
.code-input{
  letter-spacing:.5rem;text-align:center;font-size:1.8rem;font-weight:800;
  text-transform:uppercase;padding:1rem .75rem;border-radius:1rem;border:2px solid #e2e8f0;
  background:#f8fafc;transition:border-color .15s ease,box-shadow .15s ease,background .15s ease;
}
.code-input::placeholder{color:#cbd5e1;font-weight:700;letter-spacing:.4rem}
.code-input:focus{background:#fff;border-color:var(--primary-color);box-shadow:0 0 0 .3rem color-mix(in srgb,var(--primary-color) 16%,transparent)}
.code-field-wrap{position:relative}

.school-logo{max-height:88px;object-fit:contain}
.candidate-card{transition:transform .18s ease,box-shadow .18s ease;border:2px solid transparent;border-radius:var(--radius);overflow:hidden}
.candidate-card:hover{transform:translateY(-6px);box-shadow:0 16px 36px rgba(0,0,0,.18);border-color:var(--primary-color)}
.candidate-photo{width:100%;aspect-ratio:var(--cand-ratio,3/4);object-fit:cover;background:#e9ecef}
.ratio-portrait{--cand-ratio:3/4}
.ratio-square{--cand-ratio:1/1}
.ratio-landscape{--cand-ratio:4/3}
.ratio-wide{--cand-ratio:16/9}

.cand-number{
  position:absolute;top:10px;left:10px;background:var(--primary-color);color:#fff;
  width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:1.1rem;box-shadow:0 4px 12px rgba(0,0,0,.3)
}
.event-item{border-radius:.9rem;border:1px solid #e5e7eb;transition:.15s}
.event-item:hover{border-color:var(--primary-color);background:#f8fafc}
.countdown{font-variant-numeric:tabular-nums;font-weight:800;letter-spacing:.15rem}
.qc-bar{height:26px;border-radius:.6rem;background:#eef2f7;overflow:hidden}
.qc-bar>span{display:block;height:100%;background:var(--primary-color);transition:width .6s ease}
.fullscreen-mode .qc-name{font-size:2rem}
.fullscreen-mode .qc-count{font-size:2.6rem}
.stat-card{border:0;border-radius:var(--radius);box-shadow:0 6px 18px rgba(15,23,42,.08)}
.stat-card .icon{width:52px;height:52px;border-radius:.9rem;display:flex;align-items:center;justify-content:center;font-size:1.4rem}
.sidebar{background:var(--secondary-color);min-height:100vh;position:sticky;top:0;height:100vh;overflow-y:auto}
.sidebar .nav-link{color:#cbd5e1;border-radius:.6rem;margin-bottom:2px;font-size:.94rem}
.sidebar .nav-link:hover{background:rgba(255,255,255,.08);color:#fff}
.sidebar .nav-link.active{background:var(--primary-color);color:#fff}
.card-print{width:8.5cm;border:1px dashed #333;border-radius:8px;padding:10px;margin:5px;display:inline-block;vertical-align:top}
.card-print .code{font-size:1.6rem;font-weight:800;letter-spacing:.35rem;text-align:center}
@media print{.no-print{display:none!important}body{background:#fff!important}}

/* ==== Tampilan surat suara (voting) ==== */
.cand-grid{max-width:1100px;margin-inline:auto}
.candidate-card{max-width:340px;box-shadow:0 10px 30px rgba(0,0,0,.12)}
.cand-media{position:relative;display:flex;gap:2px;background:#e9ecef}
.cand-media .candidate-photo{flex:1 1 0;width:auto;min-width:0}
.cand-name{font-size:1.15rem;font-weight:800;line-height:1.25;margin-top:.1rem}
.cand-partner{color:inherit}
.btn-outline-brand{border:1.5px solid var(--primary-color);color:var(--primary-color);background:transparent}
.btn-outline-brand:hover{background:var(--primary-color);color:#fff}

/* ==== Pop-up visi & misi ==== */
.vm-modal{border:0;border-radius:1.1rem;overflow:hidden}
.vm-modal .modal-header{background:var(--primary-color);color:#fff;border:0;padding:1.5rem 1rem 1.25rem}
.vm-photos{display:flex;justify-content:center;flex-wrap:wrap;gap:.75rem;margin-bottom:.75rem}
.vm-photo{width:110px;height:140px;object-fit:cover;border-radius:.8rem;border:3px solid rgba(255,255,255,.85);
  background:#e9ecef;box-shadow:0 8px 20px rgba(0,0,0,.25)}
.vm-no{font-size:.8rem;font-weight:700;letter-spacing:.18rem;opacity:.85}
.vm-name{font-size:1.15rem}
.vm-name+.vm-name{margin-top:.15rem}
.vm-modal .modal-footer{border-top:1px solid #e9edf3;background:#f8fafc}
.vm-modal .btn-close{z-index:10;background-color:rgba(255,255,255,.2);border-radius:50%;padding:.7rem}
.btn-back-list{display:inline-flex;align-items:center;gap:.5rem;background:#fff;color:var(--primary-color);border:2px solid var(--primary-color);font-weight:800;box-shadow:0 6px 16px rgba(0,0,0,.1)}
.btn-back-list:hover{background:var(--primary-color);color:#fff}
.admin-mobilebar{height:56px;background:var(--secondary-color);color:#fff;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:.75rem;padding:.5rem .75rem;position:sticky;top:0;z-index:1025}
.bulk-toolbar{display:flex;align-items:center;gap:.6rem;background:#fff7d6;border:1px solid #f2d66d;border-radius:.75rem;padding:.65rem}.bulk-toolbar select{max-width:260px}
.candidate-edit-overlay{position:fixed;inset:1rem;z-index:1050;overflow:auto;max-width:1100px;margin:auto!important;box-shadow:0 20px 70px rgba(0,0,0,.45)}
body:has(.candidate-edit-overlay)::before{content:"";position:fixed;inset:0;background:rgba(15,23,42,.65);z-index:1040}
@media (max-width:575.98px){
  .vm-photo{width:88px;height:112px}
  .candidate-card{max-width:100%}
  .glass{border-radius:.8rem}.voter-body>.container{padding:.75rem!important}.code-input{font-size:1.3rem;letter-spacing:.18rem}
  .event-item{align-items:stretch!important;flex-direction:column}.event-item .text-nowrap,.event-item .btn{width:100%}
  .voter-welcome{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:.5rem}
  .cand-grid>.col-12{padding-inline:0}.vm-modal .ev-dialog-body{padding:1rem!important}
  .bulk-toolbar{align-items:stretch;flex-direction:column}.bulk-toolbar select{max-width:none}.candidate-edit-overlay{inset:.35rem}
}
@media (max-width:991.98px){.sidebar{position:fixed;height:100vh}.stat-card .card-body{padding:.85rem}.stat-card .icon{width:42px;height:42px}.table{min-width:720px}}


/* ==== Tema Admin (terang, bersih, sederhana) ==== */
body.admin-body{
  background:#f4f6fb;min-height:100vh;color:#1f2a44;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
body.admin-body .card,body.admin-body .stat-card{
  background:#fff;border:1px solid #e6eaf2;color:#1f2a44;border-radius:1rem;
  box-shadow:0 6px 18px rgba(31,42,68,.06);
}
body.admin-body .sidebar{
  background:#fff;border-right:1px solid #e6eaf2;box-shadow:0 0 24px rgba(31,42,68,.05);
}
body.admin-body .sidebar .brand-title{color:#1f2a44}
body.admin-body .sidebar .brand-sub{color:#7b879e}
body.admin-body .sidebar .nav-link{color:#4b5a76;font-weight:500}
body.admin-body .sidebar .nav-link:hover{background:#eef2fb;color:#1f2a44}
body.admin-body .sidebar .nav-link.active{background:var(--primary-color);color:#fff;box-shadow:0 6px 14px color-mix(in srgb,var(--primary-color) 30%,transparent)}
body.admin-body .admin-mobilebar{background:#fff;color:#1f2a44;border-bottom:1px solid #e6eaf2}
body.admin-body .admin-mobilebar .mb-user{color:#7b879e}
body.admin-body .offcanvas{background:#fff}
body.admin-body .page-head h1{color:#1f2a44}
body.admin-body .table{--bs-table-color:#1f2a44;--bs-table-bg:transparent;--bs-table-border-color:#e9edf5;
  --bs-table-striped-bg:#f7f9fd;--bs-table-hover-bg:#eef3fc;}
body.admin-body .table thead th{color:#6b7793;font-size:.78rem;text-transform:uppercase;letter-spacing:.03em;font-weight:700}
body.admin-body .text-muted,body.admin-body .form-text{color:#7b879e!important}
body.admin-body code{color:#0b5ed7;background:#eef3fc;padding:.1rem .35rem;border-radius:.35rem}
body.admin-body .bulk-toolbar{background:#fff8e6;border-color:#f2d66d;color:#7a5d10}
body.admin-body .page-item.active .page-link{background:var(--primary-color);border-color:var(--primary-color)}
body.admin-body .form-control,body.admin-body .form-select{border-color:#dfe5f1}
body.admin-body .form-control:focus,body.admin-body .form-select:focus{
  border-color:var(--primary-color);box-shadow:0 0 0 .2rem color-mix(in srgb,var(--primary-color) 18%,transparent);
}
.stat-tile{display:flex;align-items:center;gap:.85rem}
.stat-tile .icon{background:#eef3fc;color:var(--primary-color)}
.event-mini .h3{line-height:1}
.event-mini .mini-metric{background:#f5f7fc;border:1px solid #eaeff8;border-radius:.8rem;padding:.6rem .75rem;text-align:center}
.event-mini .mini-metric .val{font-weight:800;font-size:1.35rem;line-height:1.1}
.event-mini .mini-metric .lbl{font-size:.72rem;color:#7b879e;text-transform:uppercase;letter-spacing:.04em}

/* Saklar aktif/nonaktif kandidat */
.switch-pill{display:inline-flex;align-items:center;gap:.55rem;background:#f5f7fc;border:1px solid #e3e9f5;
  border-radius:999px;padding:.4rem .8rem;font-weight:600;font-size:.86rem;color:#4b5a76}
.switch-pill .form-check-input{margin:0;width:2.4em;height:1.25em;cursor:pointer}
.switch-pill .form-check-input:checked{background-color:#16a34a;border-color:#16a34a}
.cand-status{position:absolute;top:10px;right:10px;z-index:2;border-radius:999px;padding:.3rem .65rem;
  font-size:.72rem;font-weight:800;letter-spacing:.03em;box-shadow:0 4px 12px rgba(0,0,0,.18)}
.cand-status.on{background:#16a34a;color:#fff}
.cand-status.off{background:#94a3b8;color:#fff}
.cand-admin-media{position:relative}
.cand-admin-media img{filter:none;transition:filter .2s ease}
.cand-off .cand-admin-media img{filter:grayscale(1) opacity(.6)}

/* Pagination sederhana dengan panah */
.pager-arrows{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap}

@media print{body.admin-body{background:#fff!important;color:#000!important}
  body.admin-body .card{background:#fff!important;color:#000!important;box-shadow:none!important}}

/* ==== Ukuran & tata letak halaman vote ====
   --vote-scale mengecilkan/membesarkan elemen surat suara secara proporsional
   agar seluruh kandidat sebisa mungkin muat dalam satu layar tanpa scroll,
   sekaligus tetap menyesuaikan ukuran layar (lebar & tinggi viewport). */
body.voter-body{--vote-scale:1}
body.voter-body.vote-compact{--vote-scale:.85}
body.voter-body.vote-large{--vote-scale:1.15}
body.voter-body.vote-auto{--vote-scale:1}
@media (max-width:1199.98px){body.voter-body.vote-auto{--vote-scale:.92}}
@media (max-width:991.98px){body.voter-body.vote-auto{--vote-scale:.86}}
@media (max-width:767.98px){body.voter-body.vote-auto{--vote-scale:.8}}
@media (max-height:760px){body.voter-body.vote-auto{--vote-scale:.85}}
@media (max-height:640px){body.voter-body.vote-auto{--vote-scale:.75}}
body.voter-body .cand-grid{max-width:calc(1100px * var(--vote-scale))}
body.voter-body .candidate-card{max-width:calc(340px * var(--vote-scale))}
body.voter-body .cand-name{font-size:calc(1.15rem * var(--vote-scale))}
body.voter-body .candidate-card .btn{font-size:calc(1rem * var(--vote-scale));padding-top:calc(.375rem * var(--vote-scale));padding-bottom:calc(.375rem * var(--vote-scale))}
body.voter-body .cand-number{width:calc(44px * var(--vote-scale));height:calc(44px * var(--vote-scale));font-size:calc(1.1rem * var(--vote-scale))}
body.voter-body .vote-shell{padding:calc(1.25rem * var(--vote-scale)) calc(1.25rem * var(--vote-scale))}
@media (min-width:768px){
  body.voter-body .vote-shell{padding:calc(2rem * var(--vote-scale)) calc(2.5rem * var(--vote-scale))}
}
@media (max-height:800px) and (min-width:992px){
  body.voter-body.vote-auto{--vote-scale:.8}
}
@media (max-height:680px) and (min-width:992px){
  body.voter-body.vote-auto{--vote-scale:.7}
}

/* Pusatkan halaman vote secara vertikal & minimalkan kebutuhan scroll,
   namun tetap bisa discroll wajar bila konten memang lebih tinggi dari layar. */
.vote-center-wrap{min-height:calc(100vh - 3rem);display:flex;align-items:center}
@media (min-width:768px){.vote-center-wrap{min-height:calc(100vh - 5rem)}}


/* ==== Dialog ringan (tanpa Bootstrap modal) untuk halaman vote ====
   Struktur: .ev-dialog-box adalah flex-column dengan tinggi dibatasi (max-height).
   Hanya .ev-dialog-scroll (atau .ev-dialog-body langsung, mis. dialog konfirmasi)
   yang discroll; tombol close (pojok kanan atas) dan .ev-dialog-foot SELALU
   berada di luar area scroll sehingga tidak pernah tertutup saat konten
   digulir ke bawah. */
.ev-dialog{position:fixed;inset:0;z-index:1200;display:none;align-items:center;justify-content:center;padding:1rem}
.ev-dialog.open{display:flex}
.ev-dialog-backdrop{position:absolute;inset:0;background:rgba(8,15,30,.6);backdrop-filter:blur(2px)}
.ev-dialog-box{position:relative;z-index:1;background:#fff;color:#0f172a;border-radius:1.1rem;width:100%;
  max-width:680px;max-height:92vh;overflow:hidden;display:flex;flex-direction:column;
  box-shadow:0 30px 80px rgba(0,0,0,.45)}
.ev-dialog-sm .ev-dialog-box{max-width:420px}
.ev-dialog-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}
.ev-dialog-box>.ev-dialog-body{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}
.ev-dialog-head{background:var(--primary-color);color:#fff;padding:1.5rem 1rem 1.25rem;text-align:center;position:relative}
.ev-dialog-close{position:absolute;top:.6rem;right:.6rem;width:38px;height:38px;border-radius:50%;border:0;
  background:rgba(255,255,255,.28);color:#fff;font-size:1.1rem;line-height:1;cursor:pointer;z-index:20;
  box-shadow:0 4px 10px rgba(0,0,0,.25)}
.ev-dialog-close:hover{background:rgba(255,255,255,.44)}
.ev-dialog-body{padding:1.25rem}
.ev-dialog-foot{flex:0 0 auto;display:flex;gap:.5rem;justify-content:center;padding:1rem;border-top:1px solid #e9edf3;background:#f8fafc;flex-wrap:wrap}
body.ev-lock{overflow:hidden}
@media (max-width:575.98px){
  .ev-dialog{padding:.5rem}
  .ev-dialog-foot{display:grid;grid-template-columns:1fr}
  .ev-dialog-foot .btn{width:100%}
}


/* =====================================================================
   v6 — Perbaikan tampilan halaman pemilih
   1) Konten voter benar-benar di tengah (horizontal + vertikal)
   2) Foto kandidat lebih kecil & proporsional
   3) Pop-up visi & misi hampir sebesar layar, tetap ada margin, responsif
   ===================================================================== */

/* --- 1) Pemusatan konten voter --- */
body.voter-body{display:flex;flex-direction:column;min-height:100svh}
body.voter-body>.voter-main{
  flex:1 1 auto;width:100%;display:flex;align-items:center;justify-content:center;
}
body.voter-body>.voter-main>.row{width:100%;margin-inline:auto}
/* .vote-center-wrap lama tidak lagi memaksa tinggi tambahan */
.vote-center-wrap{min-height:0!important;display:block}
@media (min-width:768px){.vote-center-wrap{min-height:0!important}}

/* --- 2) Foto kandidat lebih kecil & proporsional --- */
body.voter-body .candidate-card{max-width:calc(300px * var(--vote-scale))}
body.voter-body .cand-media{
  height:clamp(120px, calc(20vh * var(--vote-scale) + 60px), 200px);
  overflow:hidden;
}
body.voter-body .cand-media .candidate-photo{
  height:100%;width:100%;aspect-ratio:auto;object-fit:cover;object-position:center top;
}
body.voter-body .candidate-card .card-body{padding:.85rem .9rem 1rem}
body.voter-body .cand-name{font-size:calc(1.02rem * var(--vote-scale))}
@media (max-width:575.98px){
  body.voter-body .candidate-card{max-width:320px}
  body.voter-body .cand-media{height:clamp(130px,26vh,190px)}
}

/* --- 3) Pop-up visi & misi --- */
.ev-dialog-box.vm-modal{
  width:90vw;max-width:1100px;height:85vh;max-height:85vh;
}
.vm-modal .ev-dialog-body{padding:1.5rem 1.75rem;font-size:1.02rem;line-height:1.65}
.vm-modal .ev-dialog-head{padding:1.5rem 3.25rem 1.25rem}
@media (max-width:767.98px){
  .ev-dialog-box.vm-modal{width:95vw;height:90vh;max-height:90vh}
  .vm-modal .ev-dialog-body{padding:1rem 1.1rem;font-size:1rem}
}

/* --- Halaman selesai / auto keluar --- */
.autoexit-count{font-variant-numeric:tabular-nums;font-weight:800}
.autoexit-bar{height:6px;border-radius:999px;background:#e2e8f0;overflow:hidden;margin-top:.75rem}
.autoexit-bar>span{display:block;height:100%;background:var(--primary-color);transition:width 1s linear}

/* =====================================================================
   v7 — Pemusatan login, kotak voter simetris & lebih ringkas,
        jarak antar foto kandidat, margin kotak event
   ===================================================================== */

/* --- Login & seluruh halaman voter benar-benar center --- */
body.voter-body>.voter-main{
  align-items:center;justify-content:center;flex-direction:column;
}
body.voter-body>.voter-main>.row{
  width:100%;margin-inline:auto;justify-content:center!important;
}
body.voter-body>.voter-main>.row>[class*="col-"]{margin-inline:auto}

/* --- Kotak voter lebih kecil & simetris di tengah --- */
body.voter-body .vote-shell{
  width:100%;max-width:calc(1000px * var(--vote-scale));margin-inline:auto;
}
body.voter-body .cand-grid{max-width:calc(980px * var(--vote-scale))}
body.voter-body .candidate-card{max-width:calc(260px * var(--vote-scale))}
body.voter-body .cand-grid{--bs-gutter-x:1.75rem;--bs-gutter-y:1.75rem}

/* --- Foto kandidat lebih kecil + ada jarak antar foto pasangan --- */
body.voter-body .cand-media{
  height:clamp(110px, calc(16vh * var(--vote-scale) + 50px), 170px);
  gap:.45rem;padding:.45rem;background:#f1f5f9;
}
body.voter-body .cand-media .candidate-photo{border-radius:.6rem}
body.voter-body .cand-number{top:.55rem;left:.55rem}

/* --- Kotak / daftar event diberi margin & jarak --- */
.event-item{margin-bottom:.85rem;padding:1rem 1.15rem!important}
.event-item:last-child{margin-bottom:0}
.voter-main .glass .d-grid.gap-3{gap:1rem!important;margin-top:.25rem}

@media (max-width:575.98px){
  body.voter-body .candidate-card{max-width:280px}
  body.voter-body .cand-media{height:clamp(120px,22vh,170px);gap:.35rem;padding:.35rem}
  .event-item{padding:.85rem!important}
}

/* --- Admin: pratinjau & editor crop foto kandidat --- */
.photo-preview{max-height:88px;object-fit:cover}
.crop-stage{min-height:260px;max-height:60vh;overflow:hidden}
.crop-stage img{display:block;max-width:100%}

/* =====================================================================
   v8 — Login admin center penuh, kotak voter sedikit lebih besar,
        foto kandidat tidak terpotong, foto pada popup visi & misi besar
   ===================================================================== */

/* --- Login admin benar-benar center vertikal & horizontal --- */
body.voter-body.admin-login{align-items:center;justify-content:center}
body.voter-body>.voter-main.login-main{
  flex:1 1 auto;display:flex;align-items:center;justify-content:center;
  min-height:100svh;
}
body.voter-body>.voter-main.login-main>*{width:100%;margin-inline:auto}

/* --- Kotak voter sedikit lebih besar tapi tetap muat layar --- */
body.voter-body .vote-shell{max-width:min(96vw, calc(1140px * var(--vote-scale)))}
body.voter-body .cand-grid{max-width:min(94vw, calc(1080px * var(--vote-scale)))}
body.voter-body .candidate-card{max-width:calc(300px * var(--vote-scale))}

/* --- Foto kandidat lebih besar & tidak terpotong --- */
body.voter-body .cand-media{
  height:clamp(140px, calc(22vh * var(--vote-scale) + 60px), 215px);
  gap:.5rem;padding:.5rem;background:#f1f5f9;align-items:stretch;
}
body.voter-body .cand-media .candidate-photo{
  height:100%;width:100%;object-fit:contain;object-position:center;
  background:#e9eef5;border-radius:.6rem;
}
@media (max-width:575.98px){
  body.voter-body .candidate-card{max-width:300px}
  body.voter-body .cand-media{height:clamp(150px,26vh,205px)}
}

/* --- Foto pada pop-up visi & misi diperbesar --- */
.vm-photo{width:200px;height:250px;object-fit:contain;background:rgba(255,255,255,.12)}
.vm-photos{gap:1rem}
@media (max-width:767.98px){
  .vm-photo{width:140px;height:180px}
}

/* ==== Scan QR/Barcode di halaman masuk ==== */
.scan-panel{background:#f8fafc;border:1px solid #e2e8f0;border-radius:1rem;padding:.75rem}
.scan-reader{width:100%;min-height:240px;border-radius:.75rem;overflow:hidden;background:#0f172a}
.scan-reader video{width:100%!important;border-radius:.75rem}

/* ==== Tombol pintasan data terpilih ==== */
.btn-pill{display:inline-flex;align-items:center;gap:.4rem;border:1px solid #e5e7eb;background:#f3f4f6;color:#111827;
  border-radius:.5rem;padding:.3rem .7rem;font-size:.9rem;line-height:1.3;cursor:pointer;transition:.12s}
.btn-pill:hover{background:#e5e7eb;border-color:#d1d5db}
.btn-pill:active{transform:translateY(1px)}
