/* =========================================================
   PILKETOS - Panel Panitia (admin)
   Lokasi: public/assets/css/admin.css
   Berdiri sendiri (tidak butuh home.css), palet sama dengan sisi pemilih.
   Komponen umum (.card, .table, .btn, .field, .pill) dipakai ulang
   oleh halaman admin lain (kandidat, pemilih, pengaturan, dst).
   ========================================================= */

:root{
  --red:#DC3B33; --red-dark:#B42A22; --red-tint:#FDECEB;
  --green-tint:#E8F5EC; --green-text:#2F855A;
  --blue-tint:#EAF1FB;  --blue-text:#2B6CB0;
  --amber-tint:#FFF6E0; --amber-text:#B7791F;
  --ink:#1B2430; --muted:#6B7280; --line:#EDEAEA;
  --paper:#FFFFFF; --paper-soft:#FBF7F7;
  --side-w:252px;
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body.admin, body.auth-admin{
  margin:0; font-family:'Plus Jakarta Sans', sans-serif; color:var(--ink);
  background:var(--paper); -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,p{ margin:0; }
a{ color:inherit; text-decoration:none; }
img{ max-width:100%; }
svg{ display:block; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible{
  outline:2px solid var(--red); outline-offset:2px;
}

/* ---------- Tombol ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 18px; min-height:42px; border-radius:10px; font:inherit; font-weight:700; font-size:14px;
  border:1.5px solid transparent; cursor:pointer; white-space:nowrap;
  -webkit-tap-highlight-color:transparent;
}
.btn-primary{ background:var(--red); color:#fff; box-shadow:0 8px 20px -10px rgba(220,59,51,.6); }
.btn-primary:hover{ background:var(--red-dark); }
.btn-ghost{ background:#fff; color:var(--red); border-color:var(--red); }
.btn-ghost:hover{ background:var(--red-tint); }
.btn-plain{ background:#fff; color:var(--ink); border-color:var(--line); }
.btn-plain:hover{ border-color:var(--red); color:var(--red); }
.btn-sm{ padding:6px 12px; min-height:34px; font-size:13px; border-radius:8px; }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

/* ---------- Alert ---------- */
.alert{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding:12px 16px; border-radius:12px; margin-bottom:12px;
  font-size:14px; font-weight:500; line-height:1.5;
}
.alert ul{ margin:0; padding-left:18px; }
.alert-error{ background:var(--red-tint); color:var(--red-dark); border:1px solid #F3C9C6; }
.alert-success{ background:var(--green-tint); color:var(--green-text); border:1px solid #BFE0CB; }
.alert-x{ border:0; background:transparent; color:inherit; font-size:22px; line-height:1; cursor:pointer; opacity:.6; padding:0 2px; }
.alert-x:hover{ opacity:1; }

/* ---------- Form ---------- */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; font-weight:700; margin-bottom:6px; }
.field .hint{ font-size:12px; color:var(--muted); margin-top:5px; }
.input, .field input[type=text], .field input[type=password], .field input[type=number],
.field input[type=url], .field input[type=search], .field input[type=datetime-local], .field select, .field textarea{
  width:100%; padding:11px 14px; min-height:46px; border:1.5px solid var(--line); border-radius:10px;
  font:inherit; font-size:14.5px; background:#fff; color:var(--ink);
}
.field textarea{ min-height:110px; resize:vertical; line-height:1.55; }
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--red); outline:none; box-shadow:0 0 0 3px var(--red-tint); }

/* ---------- Pill / status ---------- */
.pill{
  display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:999px;
  font-size:12px; font-weight:700; white-space:nowrap;
}
.pill .dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill-green{ background:var(--green-tint); color:var(--green-text); }
.pill-amber{ background:var(--amber-tint); color:var(--amber-text); }
.pill-red{ background:var(--red-tint); color:var(--red-dark); }
.pill-gray{ background:#F1F2F4; color:var(--muted); }

/* =========================================================
   HALAMAN LOGIN PANITIA
   ========================================================= */
.auth-wrap{
  min-height:100vh; display:grid; place-items:center; padding:24px 16px;
  background:
    radial-gradient(700px 320px at 100% 0%, var(--red-tint), transparent 70%),
    radial-gradient(520px 260px at 0% 100%, var(--red-tint), transparent 70%),
    var(--paper-soft);
}
.auth-box{
  width:100%; max-width:410px; background:#fff; border:1px solid var(--line); border-radius:18px;
  padding:30px 26px 24px; box-shadow:0 30px 60px -34px rgba(20,20,30,.35);
}
.auth-brand{ display:flex; align-items:center; gap:12px; margin-bottom:22px; }
.auth-brand .logo{
  width:44px; height:44px; border-radius:12px; background:var(--red);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.auth-brand img{ width:46px; height:46px; object-fit:contain; }
.auth-brand strong{ display:block; font-size:16px; font-weight:800; line-height:1.15; }
.auth-brand strong em{ font-style:normal; color:var(--red); }
.auth-brand small{ display:block; font-size:12px; color:var(--muted); margin-top:2px; }
.auth-box h1{ font-size:22px; font-weight:800; margin-bottom:6px; }
.auth-box .lead{ color:var(--muted); font-size:14px; line-height:1.55; margin-bottom:20px; }
.input-wrap{ position:relative; }
.input-wrap .i-left{ position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--muted); pointer-events:none; }
.input-wrap input{ padding-left:42px !important; }
.input-wrap .eye{
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  width:36px; height:36px; border:0; background:transparent; color:var(--muted); cursor:pointer; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
}
.input-wrap .eye:hover{ color:var(--red); }
.input-wrap .eye .eye-off{ display:none; }
.input-wrap .eye.on .eye-on{ display:none; }
.input-wrap .eye.on .eye-off{ display:block; }
.input-wrap.has-eye input{ padding-right:46px !important; }
.auth-box .btn-primary{ width:100%; min-height:48px; font-size:15px; }
.auth-foot{ display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-top:18px; font-size:13px; color:var(--muted); }
.auth-foot a{ color:var(--red); font-weight:700; }

/* =========================================================
   KERANGKA PANEL (sidebar + topbar)
   ========================================================= */
.sidebar{
  position:fixed; top:0; bottom:0; left:0; width:var(--side-w); z-index:40;
  background:#fff; border-right:1px solid var(--line);
  display:flex; flex-direction:column;
  transform:translateX(-100%); transition:transform .2s ease;
}
body.nav-open .sidebar{ transform:none; box-shadow:0 0 40px rgba(0,0,0,.2); }
.scrim{ display:none; position:fixed; inset:0; background:rgba(20,24,32,.45); z-index:35; }
body.nav-open .scrim{ display:block; }

.side-head{ padding:18px 18px 14px; border-bottom:1px solid var(--line); }
.side-brand{ display:flex; align-items:center; gap:10px; }
.side-brand .logo{ width:38px; height:38px; border-radius:10px; background:var(--red); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.side-brand img{ width:40px; height:40px; object-fit:contain; }
.side-brand strong{ display:block; font-size:14.5px; font-weight:800; line-height:1.1; }
.side-brand strong em{ font-style:normal; color:var(--red); }
.side-brand small{ display:block; font-size:11.5px; color:var(--muted); margin-top:2px; }

.side-nav{ flex:1; overflow-y:auto; padding:10px 12px 16px; }
.nav-group{ margin-top:14px; }
.nav-title{ font-size:10.5px; font-weight:800; letter-spacing:.07em; color:var(--muted); padding:0 10px 6px; text-transform:uppercase; }
.nav-item{
  display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:10px;
  font-size:14px; font-weight:600; color:#3A4350; margin-bottom:2px;
  -webkit-tap-highlight-color:transparent;
}
.nav-item svg{ flex-shrink:0; color:var(--muted); }
.nav-item:hover{ background:var(--paper-soft); }
.nav-item.active{ background:var(--red-tint); color:var(--red-dark); font-weight:800; }
.nav-item.active svg{ color:var(--red); }

.side-foot{ padding:12px; border-top:1px solid var(--line); }
.side-foot .nav-item{ color:var(--red-dark); margin:0; }
.side-foot .nav-item svg{ color:var(--red); }

.main{ min-width:0; }
.topbar{
  position:sticky; top:0; z-index:30; background:rgba(255,255,255,.97); backdrop-filter:blur(6px);
  border-bottom:1px solid var(--line); padding:10px 16px; padding-top:calc(10px + env(safe-area-inset-top));
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.menu-btn{
  width:40px; height:40px; border:1.5px solid var(--line); background:#fff; border-radius:10px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; color:var(--ink); flex-shrink:0;
}
.top-title{ font-size:16px; font-weight:800; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.admin-chip{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.admin-avatar{
  width:36px; height:36px; border-radius:50%; background:var(--red-tint); color:var(--red-dark);
  font-weight:800; font-size:14px; display:flex; align-items:center; justify-content:center;
}
.admin-info{ display:none; flex-direction:column; line-height:1.2; }
.admin-info b{ font-size:13px; max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-info small{ font-size:11.5px; color:var(--muted); }

.page{ width:100%; max-width:none; margin:0; padding:20px 16px 48px; }
.page-head{ display:flex; flex-direction:column; gap:12px; margin-bottom:20px; }
.page-head h1{ font-size:22px; font-weight:800; }
.page-head p{ color:var(--muted); font-size:14px; margin-top:4px; line-height:1.55; }
.page-actions{ display:flex; gap:10px; flex-wrap:wrap; }

@media (min-width:640px){
  .admin-info{ display:flex; }
  .page-head{ flex-direction:row; align-items:flex-end; justify-content:space-between; }
  .page{ padding:26px 24px 56px; }
}
@media (min-width:960px){
  .sidebar{ transform:none; }
  body.nav-open .sidebar{ box-shadow:none; }
  body.nav-open .scrim{ display:none; }
  .main{ margin-left:var(--side-w); }
  .menu-btn{ display:none; }
  .topbar{ padding-left:24px; padding-right:24px; }
}
@media (min-width:1400px){
  .page{ padding-left:32px; padding-right:32px; }
  .topbar{ padding-left:32px; padding-right:32px; }
}

/* ---------- Kartu & grid ---------- */
.card{ background:#fff; border:1px solid var(--line); border-radius:14px; }
.card-pad{ padding:18px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:16px 18px; border-bottom:1px solid var(--line); }
.card-head h2{ font-size:15.5px; font-weight:800; }
.card-head a{ font-size:13px; font-weight:700; color:var(--red); }
.grid-2{ display:grid; gap:16px; grid-template-columns:1fr; margin-top:16px; }
@media (min-width:1100px){ .grid-2{ grid-template-columns:1.3fr 1fr; } }

/* ---------- Dashboard ---------- */
.status-card{
  display:flex; flex-direction:column; gap:14px; padding:18px; border-radius:14px;
  background:#fff; border:1px solid var(--line); margin-bottom:16px;
}
.status-card h2{ font-size:15.5px; font-weight:800; margin-bottom:4px; }
.status-card .when{ color:var(--muted); font-size:13.5px; line-height:1.6; }
.status-card .big{ font-size:13px; font-weight:800; color:var(--red); margin-top:4px; }
@media (min-width:640px){ .status-card{ flex-direction:row; align-items:center; justify-content:space-between; } }

.stats{ display:grid; grid-template-columns:repeat(2, 1fr); gap:12px; }
@media (min-width:860px){ .stats{ grid-template-columns:repeat(4, 1fr); gap:16px; } }
.stat{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px; }
.stat .ic{ width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:12px; }
.stat .ic.red{ background:var(--red-tint); color:var(--red); }
.stat .ic.green{ background:var(--green-tint); color:var(--green-text); }
.stat .ic.blue{ background:var(--blue-tint); color:var(--blue-text); }
.stat .ic.amber{ background:var(--amber-tint); color:var(--amber-text); }
.stat .num{ font-size:26px; font-weight:800; line-height:1; }
.stat .lbl{ font-size:12px; font-weight:700; color:var(--muted); margin-top:6px; }
.stat .sub{ font-size:12px; color:var(--muted); margin-top:4px; }

.bar{ height:8px; background:var(--line); border-radius:999px; overflow:hidden; }
.bar > i{ display:block; height:100%; background:var(--red); border-radius:999px; }
.bar.green > i{ background:var(--green-text); }

.table-wrap{ overflow-x:auto; }
.table{ width:100%; border-collapse:collapse; }
.table th, .table td{ padding:11px 18px; text-align:left; border-bottom:1px solid var(--line); font-size:13.5px; vertical-align:middle; }
.table th{ font-size:11.5px; font-weight:800; letter-spacing:.04em; color:var(--muted); text-transform:uppercase; background:var(--paper-soft); }
.table tr:last-child td{ border-bottom:0; }
.table .num{ text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.table .bar-cell{ min-width:130px; }

.empty{ text-align:center; padding:30px 18px; color:var(--muted); font-size:14px; }

.check-list{ list-style:none; margin:0; padding:6px 18px 14px; display:grid; gap:2px; }
.check-list li{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; }
.check-list li:last-child{ border-bottom:0; }
.check-list .mark{
  width:24px; height:24px; border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  background:#F1F2F4; color:var(--muted);
}
.check-list li.ok .mark{ background:var(--green-tint); color:var(--green-text); }
.check-list li.no .mark{ background:var(--red-tint); color:var(--red); }
.check-list a{ margin-left:auto; font-size:13px; font-weight:700; color:var(--red); white-space:nowrap; }

.log-list{ list-style:none; margin:0; padding:4px 18px 10px; }
.log-list li{ padding:11px 0; border-bottom:1px solid var(--line); display:flex; flex-direction:column; gap:3px; }
.log-list li:last-child{ border-bottom:0; }
.log-list .t{ font-size:13.5px; line-height:1.45; }
.log-list .m{ font-size:12px; color:var(--muted); display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

.quick{ display:grid; grid-template-columns:repeat(2, 1fr); gap:12px; margin-top:16px; }
@media (min-width:860px){ .quick{ grid-template-columns:repeat(4, 1fr); } }
.quick a{
  display:flex; align-items:center; gap:10px; padding:14px; border-radius:12px;
  background:#fff; border:1px solid var(--line); font-size:13.5px; font-weight:700;
}
.quick a:hover{ border-color:var(--red); color:var(--red); }
.quick svg{ color:var(--red); flex-shrink:0; }

.panel-foot{ text-align:center; color:var(--muted); font-size:12px; padding:0 16px 24px; }

@media (prefers-reduced-motion:reduce){ .sidebar{ transition:none; } }

/* =========================================================
   KOMPONEN TAMBAHAN (dipakai ulang di banyak halaman)
   ========================================================= */
.btn-danger{ background:var(--red-tint); color:var(--red-dark); border-color:#F3C9C6; }
.btn-danger:hover{ background:var(--red); color:#fff; border-color:var(--red); }
.btn-danger-solid{ background:var(--red); color:#fff; }
.btn-danger-solid:hover{ background:var(--red-dark); }
.muted{ color:var(--muted); }
.hint{ font-size:12px; color:var(--muted); }
.error-text{ font-size:12.5px; color:var(--red-dark); margin-top:5px; }
.field .is-invalid{ border-color:var(--red); }
.field-title{ font-size:13px; font-weight:700; margin-bottom:8px; }
.field-row{ display:grid; gap:0 16px; grid-template-columns:minmax(0,1fr); }
@media (min-width:560px){ .field-row{ grid-template-columns:repeat(2, minmax(0,1fr)); } }

/* modal konfirmasi (elemen <dialog>) */
.modal{
  width:min(92vw, 400px); padding:0; border:0; border-radius:16px; background:#fff; color:var(--ink);
  box-shadow:0 24px 60px -20px rgba(20,20,30,.45);
}
.modal::backdrop{ background:rgba(20,24,32,.5); }
.modal-body{ padding:22px 22px 8px; }
.modal-icon{ width:44px; height:44px; border-radius:50%; display:grid; place-items:center; background:var(--red-tint); color:var(--red); margin-bottom:14px; }
.modal h2{ font-size:17px; font-weight:800; margin-bottom:6px; }
.modal p{ font-size:14px; line-height:1.55; color:var(--muted); }
.modal p strong{ color:var(--ink); }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; padding:18px 22px 22px; }
@media (max-width:480px){
  .modal-actions{ flex-direction:column-reverse; }
  .modal-actions .btn{ width:100%; }
}

/* =========================================================
   KANDIDAT (admin/candidates: index + form)
   ========================================================= */

/* ---------- daftar ---------- */
.cand-cell{ display:flex; align-items:center; gap:10px; min-width:0; }
.cand-text{ min-width:0; }
.num-badge{ font-size:12.5px; font-weight:800; color:var(--red-dark); background:var(--red-tint); padding:2px 8px; border-radius:999px; flex:none; }
.thumb{ width:40px; height:40px; border-radius:10px; object-fit:cover; flex:none; background:var(--paper-soft); }
.thumb-ph{ display:grid; place-items:center; font-weight:800; font-size:15px; color:var(--red-dark); background:var(--red-tint); }
.cell-title{ font-weight:700; line-height:1.3; overflow-wrap:anywhere; }
.cell-sub{ font-size:12.5px; color:var(--muted); max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell-warn{ font-size:12.5px; color:var(--amber-text); margin-top:2px; }
.cand-meta{ font-size:13px; color:var(--muted); }
.row-actions{ display:flex; gap:8px; justify-content:flex-end; }
.row-actions form{ margin:0; }
.limit-note{ font-size:14px; color:var(--muted); }

/* HP: baris tabel jadi kartu */
@media (max-width:720px){
  .table.cand-table, .cand-table tbody{ display:block; width:100%; }
  .cand-table thead{ display:none; }
  .cand-table tr{
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px;
    grid-template-areas:"cand status" "kelas kelas" "lengkap lengkap" "aksi aksi";
    padding:14px 16px; border-bottom:1px solid var(--line);
  }
  .cand-table tr:last-child{ border-bottom:0; }
  .table.cand-table td{ display:block; padding:0; border:0; }
  .cand-table .c-cand{ grid-area:cand; }
  .cand-table .c-status{ grid-area:status; align-self:start; }
  .cand-table .c-kelas{ grid-area:kelas; }
  .cand-table .c-lengkap{ grid-area:lengkap; }
  .cand-table .c-aksi{ grid-area:aksi; margin-top:4px; }
  .cell-sub{ max-width:100%; }
  .row-actions form, .row-actions .btn{ flex:1; }
  .row-actions form .btn{ width:100%; }
  .cand-page .page-actions .btn{ width:100%; }
}

/* ---------- form ---------- */
.cand-grid, .form-split{ display:grid; gap:16px; grid-template-columns:minmax(0,1fr); grid-template-areas:"side" "main"; }
.cand-side, .split-side{ grid-area:side; }
.cand-main, .split-main{ grid-area:main; }
@media (min-width:900px){
  .cand-grid, .form-split{ grid-template-columns:minmax(0,1fr) 280px; grid-template-areas:"main side"; align-items:start; }
  .cand-side, .split-side{ position:sticky; top:84px; }
}
@media (max-width:639px){
  .cand-page .field input[type=text], .cand-page .field input[type=number],
  .cand-page .field select, .cand-page .field textarea,
  .voter-page .field input[type=text], .voter-page .field input[type=search], .voter-page .field input[type=number],
  .voter-page .field select, .voter-page .field textarea{ font-size:16px; } /* cegah zoom otomatis di iOS */
}

/* foto */
.photo-row{ display:flex; align-items:center; gap:14px; margin-bottom:12px; }
.photo-preview{ width:96px; height:96px; border-radius:14px; object-fit:cover; background:var(--paper-soft); border:1px solid var(--line); flex:none; }
.photo-ph{ display:grid; place-items:center; font-size:12px; color:var(--muted); }
.photo-preview[hidden]{ display:none; }
.file-btn{ position:relative; cursor:pointer; }
.file-btn input{ position:absolute; width:1px; height:1px; opacity:0; }
.file-btn:focus-within{ outline:2px solid var(--red); outline-offset:2px; }

/* toggle aktif */
.switch{ display:flex; align-items:center; gap:12px; cursor:pointer; margin-top:16px; padding-top:16px; border-top:1px solid var(--line); }
.switch input{ position:absolute; opacity:0; width:1px; height:1px; }
.switch-track{ width:42px; height:24px; border-radius:999px; background:#CBD0D6; position:relative; flex:none; transition:background .15s; }
.switch-track::after{ content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .15s; }
.switch input:checked + .switch-track{ background:var(--green-text); }
.switch input:checked + .switch-track::after{ transform:translateX(18px); }
.switch input:focus-visible + .switch-track{ outline:2px solid var(--red); outline-offset:2px; }
.switch strong{ display:block; font-size:14px; }

.form-actions{ display:flex; gap:10px; justify-content:flex-end; padding-top:4px; }
@media (max-width:559px){
  .form-actions{ flex-direction:column-reverse; }
  .form-actions .btn{ width:100%; }
}

/* misi / program kerja / pendukung */
.sec{ margin-top:16px; scroll-margin-top:84px; }
.count-chip{ font-size:12px; font-weight:700; padding:2px 10px; border-radius:999px; background:var(--paper-soft); color:var(--muted); }
.item-list{ list-style:none; margin:0 0 16px; padding:0; border:1px solid var(--line); border-radius:12px; }
ol.item-list{ counter-reset:n; }
.item-list li{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 12px; }
.item-list li + li{ border-top:1px solid var(--line); }
ol.item-list li::before{ counter-increment:n; content:counter(n) "."; color:var(--muted); min-width:1.4em; font-size:14px; }
.item-body{ flex:1; min-width:0; overflow-wrap:anywhere; font-size:14px; line-height:1.45; }
.item-body small{ display:block; color:var(--muted); font-size:12.5px; margin-top:2px; }
.item-list form{ margin:0; flex:none; }
.item-empty{ padding:14px; font-size:14px; color:var(--muted); border:1px dashed var(--line); border-radius:12px; margin-bottom:16px; }
.add-form{ display:grid; gap:12px; }
.add-form .field{ margin-bottom:0; }
.add-form > .btn{ align-self:end; }
@media (min-width:560px){
  .add-form.cols-2{ grid-template-columns:minmax(0,1fr) auto; }
  .add-form.cols-3{ grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) auto; }
}


/* =========================================================
   PEMILIH / DPT (admin/voters: index, form, import)
   ========================================================= */
.voter-page .stats{ margin-bottom:16px; }
.stat .bar{ margin-top:10px; }

/* filter */
.filter-bar{ display:grid; gap:12px; grid-template-columns:minmax(0,1fr); padding:16px; margin-bottom:16px; }
.filter-bar .field{ margin-bottom:0; }
.filter-actions{ display:flex; gap:8px; align-items:flex-end; }
.filter-actions .btn{ flex:1; }
@media (min-width:560px){ .filter-bar{ grid-template-columns:repeat(2, minmax(0,1fr)); } }
@media (min-width:560px) and (max-width:1099px){
  .filter-bar .f-search, .filter-actions{ grid-column:1 / -1; }
}
@media (min-width:1100px){
  .filter-bar{ grid-template-columns:minmax(0,2fr) repeat(4, minmax(0,1fr)) auto; }
}

/* tabel */
.voter-table .c-nis{ font-variant-numeric:tabular-nums; white-space:nowrap; }
.token-cell{ display:flex; align-items:center; gap:6px; }
.token{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight:700; font-size:13.5px; letter-spacing:.08em; padding:3px 9px; border-radius:8px;
  background:var(--paper-soft); border:1px solid var(--line);
}
.copy-btn{
  border:0; background:transparent; color:var(--red); font:inherit; font-size:12.5px; font-weight:700;
  cursor:pointer; padding:4px 8px; border-radius:6px; min-width:58px;
}
.copy-btn:hover{ background:var(--red-tint); }
.td-label{ display:none; }

/* HP: baris tabel jadi kartu */
@media (max-width:720px){
  .table.voter-table, .voter-table tbody{ display:block; width:100%; }
  .voter-table thead{ display:none; }
  .voter-table tr{
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; align-items:center;
    grid-template-areas:"nama status" "nis kelas" "token token" "aksi aksi";
    padding:14px 16px; border-bottom:1px solid var(--line);
  }
  .voter-table tr:last-child{ border-bottom:0; }
  .table.voter-table td{ display:block; padding:0; border:0; }
  .voter-table .c-nama{ grid-area:nama; }
  .voter-table .c-status{ grid-area:status; align-self:start; }
  .voter-table .c-nis{ grid-area:nis; font-size:13px; color:var(--muted); }
  .voter-table .c-kelas{ grid-area:kelas; font-size:13px; color:var(--muted); text-align:right; }
  .voter-table .c-token{ grid-area:token; }
  .voter-table .c-aksi{ grid-area:aksi; margin-top:4px; }
  .td-label{ display:inline; }
  .voter-table .row-actions .btn, .voter-table .row-actions form{ flex:1; }
  .voter-table .row-actions form .btn{ width:100%; }
  .voter-page .page-actions .btn{ flex:1; }
}

/* halaman (pagination) */
.pager{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; flex-wrap:wrap; }
.pager-info{ font-size:13px; color:var(--muted); }
.pager-list{ display:flex; gap:6px; list-style:none; margin:0; padding:0; }
.pager-list a, .pager-list span{
  min-width:34px; height:34px; padding:0 8px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:8px; font-size:13px; font-weight:700; border:1.5px solid var(--line); background:#fff;
}
.pager-list a:hover{ border-color:var(--red); color:var(--red); }
.pager-list .current{ background:var(--red); border-color:var(--red); color:#fff; }
.pager-list .gap{ border:0; background:transparent; color:var(--muted); min-width:20px; padding:0; }
.pager .is-disabled{ opacity:.45; pointer-events:none; }
@media (max-width:639px){
  .pager{ justify-content:center; }
  .pager-list{ display:none; }
  .pager-info{ order:-1; width:100%; text-align:center; }
}

/* info token di form */
.token-box{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.token-box .token{ font-size:16px; padding:6px 12px; }
.meta-list{ list-style:none; margin:0 0 14px; padding:0; font-size:13px; color:var(--muted); display:grid; gap:4px; }
.side-actions{ display:grid; gap:8px; }
.side-actions form{ margin:0; }
.side-actions .btn{ width:100%; }

/* import */
.upload-box{ display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:16px; border:1.5px dashed var(--line); border-radius:12px; margin-bottom:16px; }
.upload-name{ font-size:14px; color:var(--muted); min-width:0; overflow-wrap:anywhere; }
.check{ display:flex; gap:10px; align-items:flex-start; font-size:14px; line-height:1.5; cursor:pointer; margin-bottom:16px; }
.check input{ margin-top:3px; width:18px; height:18px; accent-color:var(--red); flex:none; }
.check .hint{ display:block; }
.guide-list{ margin:0 0 14px; padding-left:20px; font-size:14px; line-height:1.7; }
.report-notes{ margin:12px 0 0; padding-left:18px; font-size:13.5px; line-height:1.6; color:var(--muted); }
.import-grid{ display:grid; gap:16px; grid-template-columns:minmax(0,1fr); }
@media (min-width:1100px){ .import-grid{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:start; } }
@media (min-width:640px){ .pager-info{ display:none; } }

/* =========================================================
   HASIL & LAPORAN (admin/results, admin/reports)
   Tempel di paling bawah public/assets/css/admin.css
   ========================================================= */

/* ---------- peringkat ---------- */
.rank-badge{
  display:inline-grid; place-items:center; width:30px; height:30px; border-radius:50%; flex:none;
  font-weight:800; font-size:13px; background:var(--paper-soft); color:var(--muted); border:1px solid var(--line);
}
.rank-badge.first{ background:var(--red); color:#fff; border-color:var(--red); }
.bar.lg{ height:10px; }
.bar.rest > i{ background:#B9C0CA; }
.pct-text{ display:block; font-weight:800; font-size:13px; margin-bottom:6px; font-variant-numeric:tabular-nums; }

/* ---------- halaman hasil ---------- */
.result-page .stats{ margin-bottom:16px; }
.res-head{ padding:0 0 12px; border-bottom:0; flex-wrap:wrap; }
.res-grid{ display:grid; gap:16px; grid-template-columns:minmax(0,1fr); }
@media (min-width:700px){ .res-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); } }
@media (min-width:1200px){ .res-grid{ grid-template-columns:repeat(3, minmax(0,1fr)); } }
.res-card{ padding:18px; display:flex; flex-direction:column; gap:14px; }
.res-card.is-leader{ border-color:var(--red); box-shadow:0 18px 40px -28px rgba(220,59,51,.55); }
.res-top{ display:flex; align-items:center; gap:12px; min-width:0; }
.res-photo{ width:56px; height:56px; border-radius:14px; object-fit:cover; flex:none; background:var(--paper-soft); }
.res-name{ font-weight:800; font-size:15.5px; line-height:1.25; overflow-wrap:anywhere; }
.res-sub{ font-size:12.5px; color:var(--muted); margin-top:4px; display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.res-score{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.res-votes{ font-size:32px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; }
.res-votes small{ font-size:13px; font-weight:700; color:var(--muted); margin-left:6px; }
.res-pct{ font-size:18px; font-weight:800; color:var(--red-dark); font-variant-numeric:tabular-nums; }
.res-refresh{ margin-top:16px; }

/* ---------- halaman laporan ---------- */
.report-stack > * + *{ margin-top:16px; }
.report-grid{ margin-top:16px; align-items:start; }
.report-col > * + *{ margin-top:16px; }
.report-meta{ margin-bottom:16px; font-size:13.5px; }
.report-meta b{ color:var(--ink); }
.report-verdict{ font-size:14px; line-height:1.7; border-top:1px solid var(--line); }
.report-dl{ display:flex; gap:8px; flex-wrap:wrap; padding:0; }
.table tfoot td{ border-top:2px solid var(--line); border-bottom:0; background:var(--paper-soft); }
@media (max-width:639px){
  .report-page .page-actions .btn{ width:100%; }
}

/* ---------- cetak ---------- */
.print-only{ display:none; }
.print-head{ text-align:center; margin-bottom:16px; }
.print-head h1{ font-size:20px; font-weight:800; margin-bottom:4px; }
.sign-grid{ grid-template-columns:repeat(2, 1fr); gap:48px; margin-top:40px; text-align:center; }
.sign-role{ font-size:13px; font-weight:700; }
.sign-line{ height:72px; border-bottom:1px solid var(--ink); }

@media print{
  @page{ margin:14mm; }
  .sidebar, .topbar, .scrim, .no-print, .panel-foot, .menu-btn{ display:none !important; }
  .main{ margin-left:0 !important; }
  .page{ padding:0 !important; max-width:none !important; }
  .print-only{ display:block; }
  .sign-grid.print-only{ display:grid; }
  body.admin{ background:#fff; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .card, .stat{ break-inside:avoid; box-shadow:none; }
  .grid-2{ grid-template-columns:1fr !important; }
  .table-wrap{ overflow:visible; }
  .table th, .table td{ padding:7px 10px; font-size:12px; }
}

/* =========================================================
   TAMBAHAN: Log Aktivitas, Pengaturan, Master Data
   Tempel di paling bawah public/assets/css/admin.css
   ========================================================= */

/* input tanggal belum ada di gaya .field bawaan */
.field input[type=date]{
  width:100%; padding:11px 14px; min-height:46px; border:1.5px solid var(--line); border-radius:10px;
  font:inherit; font-size:14.5px; background:#fff; color:var(--ink);
}
.field input[type=date]:focus{ border-color:var(--red); outline:none; box-shadow:0 0 0 3px var(--red-tint); }

/* ---------- log ---------- */
.log-page .stats{ margin-bottom:16px; }
.log-table .c-waktu{ white-space:nowrap; font-variant-numeric:tabular-nums; }
.log-desc{ max-width:440px; overflow-wrap:anywhere; line-height:1.45; }
.log-code{ font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:11.5px; }
.log-ip{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12.5px; color:var(--muted);
  background:var(--paper-soft); border:1px solid var(--line); border-radius:6px; padding:2px 7px;
}
.log-table .c-pelaku .cell-sub{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; max-width:none; white-space:normal; }
.log-table .c-pelaku .pill{ padding:2px 8px; font-size:11px; }

/* HP: baris tabel jadi kartu */
@media (max-width:720px){
  .table.log-table, .log-table tbody{ display:block; width:100%; }
  .log-table thead{ display:none; }
  .log-table tr{
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 12px; align-items:start;
    grid-template-areas:"aksi waktu" "pelaku pelaku" "ket ket" "ip ip";
    padding:14px 16px; border-bottom:1px solid var(--line);
  }
  .log-table tr:last-child{ border-bottom:0; }
  .table.log-table td{ display:block; padding:0; border:0; }
  .log-table .c-aksi{ grid-area:aksi; }
  .log-table .c-waktu{ grid-area:waktu; text-align:right; font-size:13px; color:var(--muted); }
  .log-table .c-pelaku{ grid-area:pelaku; }
  .log-table .c-ket{ grid-area:ket; }
  .log-table .c-ip{ grid-area:ip; }
  .log-desc{ max-width:100%; }
}

/* cegah zoom otomatis di iOS (input < 16px) */
@media (max-width:639px){
  .log-page .field input[type=search], .log-page .field input[type=date], .log-page .field select,
  .setting-page .field input[type=text], .setting-page .field input[type=datetime-local],
  .master-page .field input[type=text], .master-page .field input[type=number]{ font-size:16px; }
}

/* =========================================================
   KELOLA ADMIN (admin/admins)
   Tempel di paling bawah public/assets/css/admin.css
   ========================================================= */

.admin-table .c-login{ white-space:nowrap; color:var(--muted); font-size:13px; }
.admin-table .cell-title .num-badge{ margin-left:6px; vertical-align:1px; }
.admin-table .cell-sub{ max-width:none; }

/* HP: baris tabel jadi kartu */
@media (max-width:720px){
  .table.admin-table, .admin-table tbody{ display:block; width:100%; }
  .admin-table thead{ display:none; }
  .admin-table tr{
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; align-items:center;
    grid-template-areas:"nama status" "peran login" "aksi aksi";
    padding:14px 16px; border-bottom:1px solid var(--line);
  }
  .admin-table tr:last-child{ border-bottom:0; }
  .table.admin-table td{ display:block; padding:0; border:0; }
  .admin-table .c-nama{ grid-area:nama; }
  .admin-table .c-status{ grid-area:status; align-self:start; }
  .admin-table .c-peran{ grid-area:peran; }
  .admin-table .c-login{ grid-area:login; text-align:right; }
  .admin-table .c-aksi{ grid-area:aksi; margin-top:4px; }
  .admin-table .row-actions .btn, .admin-table .row-actions form{ flex:1; }
  .admin-table .row-actions form .btn{ width:100%; }
  .admin-page .page-actions .btn{ width:100%; }
}

/* cegah zoom otomatis di iOS (input < 16px) */
@media (max-width:639px){
  .admin-page .field input[type=text], .admin-page .field input[type=password], .admin-page .field select{ font-size:16px; }
}