/* ===== Panel admin (melengkapi style.css) ===== */
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.admin h1, .login h1 { font: 800 1.5rem/1.1 var(--font-head); margin: 0; }
.admin h2 { font: 800 1.2rem/1.2 var(--font-head); margin: 0 0 14px; }
.admin .wrap { padding-top: max(16px, env(safe-area-inset-top)); }

.bar-top { --r: 22px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; }
.bar-top p { margin: 4px 0 0; }
.bar-top__actions { display: flex; gap: 8px; align-items: center; }
.bar-top__actions form { margin: 0; }
.btn--sm { width: auto; min-height: 44px; margin: 0; padding: .55rem 1rem; font-size: .95rem; border-radius: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.btn--danger { --accent: #ff6b6b; background: #ff6b6b; }

.alert { margin: 14px 0 0; padding: .8rem 1rem; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.08); }
.alert--ok   { border-color: #4ade80; background: rgba(74,222,128,.14); }
.alert--err  { border-color: #f87171; background: rgba(248,113,113,.16); }
.alert--warn { border-color: #fbbf24; background: rgba(251,191,36,.16); }
.alert--info { margin: 0 0 18px; }

.tabs { display: flex; gap: 8px; margin: 18px 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; text-align: center; text-decoration: none; padding: .75rem 1.2rem; min-height: 46px; border-radius: 14px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.05); }
.tabs a[aria-selected="true"] { color: #07131f; background: #fff; border-color: #fff; }
.panel[hidden] { display: none; }

.grid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat { --r: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat strong { font: 800 2rem/1 var(--font-head); font-variant-numeric: tabular-nums; }
.stat .stat--small { font-size: 1rem; line-height: 1.3; font-family: var(--font-body); font-weight: 600; }
.stat:last-child { grid-column: 1 / -1; }

.rank, .chart-box, .card { --r: 24px; padding: 20px; margin-bottom: 14px; }
.rank__row { display: flex; gap: 14px; align-items: center; padding: 12px 0; }
.rank__row + .rank__row { border-top: 1px solid var(--line); }
.rank__row img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); flex: none; }
.rank__main { flex: 1; min-width: 0; }
.rank__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.rank__top strong { overflow-wrap: anywhere; }
.rank__top > span { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank__top b { color: var(--accent); font-size: 1.1rem; }

.chart-box__head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: baseline; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; color: var(--muted); }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 4px; margin-right: .4rem; background: var(--accent); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding-top: 10px; }
.chart__col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.chart__bars { width: 100%; flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.chart__bars i { flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); transition: height .5s; }
.chart__bars i[data-n="0"] { opacity: .25; }
.chart__lbl { font-size: .62rem; color: var(--muted); height: 14px; margin-top: 4px; white-space: nowrap; }

.cand-forms { display: grid; gap: 14px; align-items: start; }
.stack { display: grid; gap: 14px; }
.stack .card { margin-bottom: 0; }
.card h2 { margin-bottom: 16px; }
.card .btn { margin-top: 8px; }
.card.danger { border-color: rgba(255,107,107,.5); }

.admin label, .login label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.admin input:not([type=checkbox]):not([type=file]), .admin textarea, .admin select,
.login input { display: block; width: 100%; margin-top: 6px; padding: .8rem 1rem; min-height: 48px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(8,14,26,.45); color: var(--ink); font: 400 16px var(--font-body); }
.admin textarea { resize: vertical; }
.admin select option { color: #111; }
.admin input:focus, .admin textarea:focus, .admin select:focus, .login input:focus { outline: 3px solid var(--c1); outline-offset: 1px; }
label.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
label.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--c1); }
.photo-pick { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.photo-pick img { width: 120px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 16px; border: 2px solid var(--accent); flex: none; }
label.file { display: inline-flex; align-items: center; min-height: 44px; padding: .55rem 1rem; margin-bottom: 8px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,.12); border: 1px solid var(--line); }
label.file input { max-width: 190px; margin-left: .6rem; font-size: .85rem; }
.photo-pick p { margin: 0 0 8px; }

/* Halaman login */
.login { display: grid; place-items: center; padding: 20px; }
.login__box { --r: 28px; --blur: 22px; width: min(420px, 100%); padding: 28px; }
.login__box .muted { margin: 6px 0 18px; }
.login__box .btn { margin-top: 4px; }

@media (min-width: 720px) {
  .grid-stats { grid-template-columns: repeat(3, 1fr); }
  .stat:last-child { grid-column: auto; }
  .cand-forms { grid-template-columns: 1fr 1fr; }
  .tabs a { flex: 0 0 auto; }
  .chart { height: 200px; }
  .chart__lbl { font-size: .72rem; }
}


/* ===== Skeleton (admin) ===== */
.rank__row img, .photo-pick img { background: var(--sk) 0 0 / 200% 100%, rgba(255,255,255,.06); animation: shimmer 1.4s linear infinite; }
.is-loading .rank__row img { opacity: 0; }
.is-loading .chart { background: var(--sk) 0 0 / 200% 100%; border-radius: 14px; animation: shimmer 1.4s linear infinite, skFade .3s .2s backwards; }
.is-loading .chart * { visibility: hidden; }
.is-loading .bar i { opacity: 0; }

/* ===== Penyesuaian ukuran layar (admin) ===== */
@media (max-width: 480px) {
  .admin .wrap { padding-left: 12px; padding-right: 12px; }
  .bar-top { padding: 12px 14px; }
  .bar-top__actions { width: 100%; }
  .bar-top__actions > * { flex: 1; }
  .bar-top__actions .btn { width: 100%; justify-content: center; }
  .stat strong { font-size: 1.7rem; }
  .rank, .chart-box, .card { padding: 16px; }
  .rank__row img { width: 46px; height: 46px; }
  .photo-pick { flex-direction: column; }
  .photo-pick img { width: 100%; max-width: 200px; }
  label.file { flex-direction: column; align-items: flex-start; }
  label.file input { max-width: 100%; margin: .4rem 0 0; }
  .tabs a { padding: .7rem 1rem; }
}
@media (min-width: 1024px) {
  .admin .wrap { width: min(1120px, 100%); }
  .rank__row img { width: 64px; height: 64px; }
  .chart { height: 240px; }
  .card h2, .rank h2, .chart-box h2 { font-size: 1.3rem; }
}
