:root {
  --primary: #047857;
  --primary-dark: #064e3b;
  --primary-light: #10b981;
  --primary-subtle: #ecfdf5;
  --gold: #d97706;
  --gold-light: #f59e0b;
  --gold-subtle: #fffbeb;
  --bg: #f8fafc;
  --card: #ffffff;
  --tx: #0f172a;
  --tx-muted: #64748b;
  --bd: #e2e8f0;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--tx);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
}
main.wrap {
  padding-top: 24px;
  padding-bottom: 48px;
  min-height: calc(100vh - 180px);
}

/* TOP NAVBAR */
.top {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 45%, #047857 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.2s;
}
.brand:hover {
  opacity: 0.95;
}
.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fbbf24;
  line-height: 1.2;
}
.brand-sub {
  font-size: 12px;
  color: #d1fae5;
  font-weight: 500;
  letter-spacing: 0.3px;
}
nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
nav a {
  color: #d1fae5;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}
.nav-btn-logout {
  background: rgba(220, 38, 38, 0.25) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.nav-btn-logout:hover {
  background: rgba(220, 38, 38, 0.45) !important;
  color: #ffffff !important;
}

/* TYPOGRAPHY & HEADINGS */
h1 { font-size: 26px; font-weight: 800; margin: 0 0 16px; color: #0f172a; letter-spacing: -0.3px; }
h2 { font-size: 20px; font-weight: 700; margin: 24px 0 12px; color: #1e293b; }
h3 { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: #1e293b; }
.muted { color: var(--tx-muted); }
.small { font-size: 13px; }

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.card:hover {
  box-shadow: var(--shadow);
}

/* HERO BANNER LANDING PAGE */
.hero-banner {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.94) 0%, rgba(4, 120, 87, 0.88) 100%),
              url('img/gedung.jpg') center/cover no-repeat;
  color: #fff;
  border-radius: 18px;
  padding: 42px 24px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 20%, rgba(251, 191, 36, 0.12) 0%, transparent 60%);
  pointer-events: none;
}
.hero-logo {
  height: 96px;
  width: auto;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fef08a;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 16px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.hero-badge .dot {
  width: 7px;
  height: 7px;
  background: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 6px #fbbf24;
}
.hero-title {
  font-size: 30px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 8px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.3px;
}
.hero-sub {
  color: #d1fae5;
  font-size: 15px;
  max-width: 580px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* TOKEN BOX */
.tokenbox {
  max-width: 380px;
  margin: 0 auto;
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.25);
  color: var(--tx);
  border: 2px solid #a7f3d0;
}
.tokenbox input {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace;
  padding: 12px;
  border: 2px solid #059669;
  border-radius: 10px;
  background: #f0fdf4;
  color: #064e3b;
  width: 100%;
  transition: all 0.2s;
}
.tokenbox input:focus {
  border-color: var(--gold);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2);
  outline: none;
}
.tokenbox .btn {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  font-size: 16px;
  letter-spacing: 0.5px;
}
.hero-features {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
  color: #e2e8f0;
}
.hero-feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.5;
}
.alert.ok { background: var(--ok-bg); border-color: #86efac; color: #14532d; }
.alert.err { background: var(--err-bg); border-color: #fca5a5; color: #7f1d1d; }
.alert.warn { background: var(--warn-bg); border-color: #fde047; color: #854d0e; }

/* FORMS */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 13.5px; color: #334155; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea, input[type=file] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.18);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, #065f46 100%);
  color: #fff;
  border: 0;
  padding: 9px 18px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(4, 120, 87, 0.25);
  transition: all 0.2s;
}
.btn:hover {
  background: linear-gradient(135deg, #059669 0%, var(--primary-dark) 100%);
  box-shadow: 0 4px 8px rgba(4, 120, 87, 0.35);
  transform: translateY(-1px);
  color: #fff;
}
.btn:active { transform: translateY(0); }
.btn.sec {
  background: #f1f5f9;
  color: #334155;
  box-shadow: none;
  border: 1px solid #cbd5e1;
}
.btn.sec:hover { background: #e2e8f0; color: #0f172a; }
.btn.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}
.btn.red:hover { background: #b91c1c; }
.btn.gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}
.btn.gold:hover { background: #b45309; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn.lg { padding: 12px 24px; font-size: 16px; border-radius: 10px; }

/* GRID & ACTIONS */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
form.inline { display: inline; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
th { color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; background: #f8fafc; font-weight: 700; }
.tbl { overflow-x: auto; border-radius: 8px; border: 1px solid var(--bd); }

/* BADGES */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #e2e8f0; color: #334155; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.err { background: #fee2e2; color: #991b1b; }
.token { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: 0.12em; color: var(--primary); }

/* CANDIDATE VOTING CARDS */
.cands {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}
.cand {
  display: block;
  cursor: pointer;
  position: relative;
}
.cand input { position: absolute; opacity: 0; }
.cand .box {
  background: #ffffff;
  border: 2px solid var(--bd);
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  height: 100%;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cand:hover .box {
  border-color: var(--primary-light);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -4px rgba(4, 120, 87, 0.15);
}
.cand input:checked + .box {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 3px #10b981, 0 12px 24px -4px rgba(4, 120, 87, 0.2);
}
.cand input:focus-visible + .box {
  outline: 3px solid var(--primary-light);
}
.num {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold) 0%, #b45309 100%);
  color: #fff;
  border-radius: 99px;
  padding: 4px 16px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.25);
}
.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  display: block;
  background: #ecfdf5;
  border: 4px solid #10b981;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}
.avatar.sm { width: 48px; height: 48px; margin: 0; flex: none; border-width: 2px; }
.avatar.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  font-weight: 800;
  color: var(--primary);
}
.avatar.sm.ph { font-size: 20px; }
.cand h3 { margin: 6px 0 2px; font-size: 19px; color: #0f172a; }
.cand .vm {
  width: 100%;
  text-align: left;
  font-size: 13px;
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #334155;
  white-space: pre-line;
}
.cand .vm b {
  display: block;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}
.cand .vm b:first-child { margin-top: 0; }

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 600px) { .stats { grid-template-columns: 1fr; } }
.stats div {
  background: #fff;
  border: 1px solid var(--bd);
  border-top: 4px solid var(--primary);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stats b { display: block; font-size: 24px; color: var(--primary-dark); font-weight: 800; }
.stats span { font-size: 13px; color: var(--tx-muted); font-weight: 500; }

/* RESULTS BARS */
.res {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.res.win {
  border-color: var(--gold);
  background: #fffbeb;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
}
.res-body { flex: 1; min-width: 0; }
.res-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.res-n { margin-left: auto; font-weight: 800; color: #0f172a; font-size: 14px; }
.bar {
  height: 14px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, var(--primary) 100%);
  border-radius: 99px;
}
.res.win .bar i {
  background: linear-gradient(90deg, #fbbf24 0%, var(--gold) 100%);
}

/* CARDS TOKEN PRINT */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tcard {
  border: 2px dashed #94a3b8;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  background: #fff;
  break-inside: avoid;
}
.tcard .t {
  font: 800 28px ui-monospace, Consolas, monospace;
  letter-spacing: 0.18em;
  margin: 8px 0;
  color: var(--primary);
}
.tcard small { color: #475569; display: block; }

/* FOOTER */
.foot {
  color: #64748b;
  font-size: 13px;
  text-align: center;
  padding: 24px 16px 36px;
  border-top: 1px solid var(--bd);
  margin-top: 40px;
  line-height: 1.6;
}
.foot a { color: var(--primary); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; }

@media print {
  .top, .noprint, .foot { display: none !important; }
  body { background: #fff; }
  main.wrap { padding: 0; }
  .cards { gap: 8px; }
}
