/* Gaya kongsi — Voter Check-In & Turnout Dashboard (N55 Nangka) */
:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --surface: #fcfcfb;
  --surface-2: #ffffff;
  --line: #e2e1db;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #76756f;
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-track: #cde2fb;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --good-text: #006300;
  --serious: #ec835a;
  --serious-track: #fbe1d6;
  --critical: #d03b3b;
  --critical-track: #f6d6d6;
  --warning: #fab219;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .05);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #222220;
    --line: #353531;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #96958b;
    --accent: #3987e5;
    --accent-strong: #6da7ec;
    --accent-track: #123a6e;
    --accent-ink: #ffffff;
    --good: #0ca30c;
    --good-text: #4fc64f;
    --serious: #ec835a;
    --serious-track: #4f2a1c;
    --critical: #e05252;
    --critical-track: #4d1f1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-strong); }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-utama {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  padding: 13px 18px;
  font-size: 16px;
  justify-content: center;
}
.btn-utama:disabled { opacity: .6; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Log masuk ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
.login .lencana {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--accent-strong);
  background: var(--accent-track);
  padding: 4px 9px;
  border-radius: 999px;
}
.login h1 { font-size: 24px; margin: 12px 0 4px; letter-spacing: -.01em; }
.login p.sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.medan { display: block; margin-bottom: 14px; }
.medan span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.medan input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 16px;
}
.login .btn-utama { width: 100%; margin-top: 4px; }
.ralat { color: var(--critical); font-size: 14px; font-weight: 600; min-height: 20px; margin: 4px 0 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 520px;
  background: #1f1f1d;
  color: #f5f4f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  font-size: 14.5px;
  z-index: 50;
  transform: translateY(calc(100% + 60px));
  visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
}
.toast.tunjuk { transform: none; visibility: visible; transition: transform .22s ease; }
.toast.ralat-toast { background: #8f2020; min-height: 0; margin: 0 auto; }
.toast .teks { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 14px;
}

/* ---------- Titik status sambungan ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--good); display: inline-block; }
.status.putus i { background: var(--critical); }
.status.hidup i { animation: denyut 2s infinite; }
@keyframes denyut {
  0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, .5); }
  70% { box-shadow: 0 0 0 7px rgba(12, 163, 12, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
