/* ============================================================
   Pilkada Enterprise Dashboard — Stylesheet
   Enterprise Campaign Intelligence System by DIGITALIN
   ============================================================ */

:root {
  --sidebar-w: 264px;
  --radius: 16px;
  --radius-sm: 11px;

  /* Brand */
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Status */
  --green: #10b981;  --green-soft: rgba(16,185,129,.14);
  --yellow: #f59e0b; --yellow-soft: rgba(245,158,11,.16);
  --red: #ef4444;    --red-soft: rgba(239,68,68,.14);

  /* Light theme */
  --bg: #eef1f8;
  --bg-2: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-soft: #64748b;
  --text-faint: #94a3b8;
  --border: #e6e9f2;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 10px 30px -12px rgba(16,24,40,.14);
  --shadow-lg: 0 20px 50px -20px rgba(16,24,40,.35);
  --sidebar-bg: linear-gradient(185deg, #15182b 0%, #1d1b3a 100%);
  --sidebar-text: #c7cbe0;
  --sidebar-active: rgba(255,255,255,.10);
}

[data-theme="dark"] {
  --bg: #0b0e1a;
  --bg-2: #11152400;
  --surface: #151a2c;
  --surface-2: #1b2138;
  --text: #f1f5f9;
  --text-soft: #94a3b8;
  --text-faint: #64748b;
  --border: #252b42;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 18px 40px -18px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --sidebar-bg: linear-gradient(185deg, #0c0f1d 0%, #14122b 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand); color: #fff; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 60;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 18px;
  box-shadow: 0 8px 20px -6px rgba(124,58,237,.7);
  flex-shrink: 0;
}
.brand-title { font-weight: 800; color: #fff; font-size: 15px; letter-spacing: -.2px; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: #8b90b5; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 3px; }

.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: #6e7497; padding: 14px 12px 8px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; border-radius: 11px;
  color: var(--sidebar-text); font-weight: 500;
  margin-bottom: 3px; position: relative;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--brand-grad);
}
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; background: rgba(255,255,255,.12);
  padding: 2px 8px; border-radius: 20px; font-weight: 600;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; }
.user-av { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.user-chip .nm { font-weight: 600; color: #fff; font-size: 13px; }
.user-chip .rl { font-size: 11px; color: #8b90b5; }
.logout-link { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 10px; color: #9aa0c4; font-size: 13px; margin-top: 4px; }
.logout-link:hover { background: rgba(239,68,68,.14); color: #fda4a4; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar / Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 13px 28px;
  display: flex; align-items: center; gap: 18px;
}
.hamburger { display: none; background: none; border: none; color: var(--text); cursor: pointer; }
.page-h1 { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.page-sub { font-size: 12.5px; color: var(--text-soft); }

.candidate-card {
  margin-left: auto; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 8px 7px 14px; border-radius: 14px; box-shadow: var(--shadow);
}
.candidate-card .cand-no { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 800; }
.candidate-card .cand-name { font-weight: 700; font-size: 13.5px; line-height: 1.15; }
.candidate-card .cand-role { font-size: 11px; color: var(--text-soft); }
.campaign-pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 6px 13px; border-radius: 30px; font-weight: 700; font-size: 12.5px;
}
.campaign-pill .dot { width: 8px; height: 8px; border-radius: 50%; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.75)} }
.pill-green  { background: var(--green-soft);  color: var(--green); }
.pill-yellow { background: var(--yellow-soft); color: #b45309; }
.pill-red    { background: var(--red-soft);    color: var(--red); }
.pill-green .dot{background:var(--green)} .pill-yellow .dot{background:var(--yellow)} .pill-red .dot{background:var(--red)}

.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); cursor: pointer;
  display: grid; place-items: center; transition: all .18s; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Content ---------- */
.content { padding: 26px 28px 40px; flex: 1; }
.live-bar {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border); padding: 6px 13px; border-radius: 30px; margin-bottom: 18px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: live 1.6s infinite; }
@keyframes live { 0%{box-shadow:0 0 0 0 rgba(16,185,129,.5)} 70%{box-shadow:0 0 0 7px rgba(16,185,129,0)} 100%{box-shadow:0 0 0 0 rgba(16,185,129,0)} }

/* ============================================================
   CARDS / GRID
   ============================================================ */
.grid { display: grid; gap: 18px; }
.kpi-grid { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.card-title .muted { color: var(--text-soft); font-weight: 500; font-size: 12.5px; }

/* ---------- KPI ---------- */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content:''; position:absolute; right:-30px; top:-30px; width:120px; height:120px; border-radius:50%; background: var(--brand-grad); opacity:.07; }
.kpi-top { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.kpi-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-ico svg { width: 23px; height: 23px; }
.ico-indigo { background: rgba(99,102,241,.13); color: #6366f1; }
.ico-green  { background: var(--green-soft);  color: var(--green); }
.ico-amber  { background: var(--yellow-soft); color: var(--yellow); }
.kpi-label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -1.2px; line-height: 1; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--text-soft); }
.kpi-foot { margin-top: 14px; font-size: 12px; color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.progress { height: 7px; border-radius: 8px; background: var(--surface-2); overflow: hidden; margin-top: 13px; }
.progress > i { display: block; height: 100%; border-radius: 8px; background: var(--brand-grad); transition: width 1s cubic-bezier(.22,1,.36,1); }

/* ---------- Status mini-cards ---------- */
.stat-tri { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.stat-card { position: relative; overflow: hidden; }
.stat-card .bar-top { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.stat-card.s-green .bar-top{background:var(--green)} .stat-card.s-yellow .bar-top{background:var(--yellow)} .stat-card.s-red .bar-top{background:var(--red)}
.stat-card .s-label { font-size: 13px; font-weight: 600; color: var(--text-soft); display:flex; align-items:center; gap:8px; }
.s-tag { width:11px;height:11px;border-radius:4px; }
.s-green .s-tag{background:var(--green)} .s-yellow .s-tag{background:var(--yellow)} .s-red .s-tag{background:var(--red)}
.stat-card .s-num { font-size: 30px; font-weight: 800; letter-spacing:-1px; margin-top: 10px; }
.stat-card .s-pct { font-size: 14px; font-weight: 700; margin-left: 6px; }
.s-green .s-pct{color:var(--green)} .s-yellow .s-pct{color:#b45309} .s-red .s-pct{color:var(--red)}

/* ============================================================
   TABLES
   ============================================================ */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.tbl th { text-align: left; padding: 12px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-soft); font-weight: 700; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .14s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-soft); }
.rank-badge { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--surface-2); color: var(--text-soft); }
.rank-1{background:linear-gradient(135deg,#fbbf24,#f59e0b);color:#fff} .rank-2{background:linear-gradient(135deg,#cbd5e1,#94a3b8);color:#fff} .rank-3{background:linear-gradient(135deg,#d8a47f,#b45309);color:#fff}

.badge-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.b-mendukung { background: var(--green-soft); color: var(--green); }
.b-ragu { background: var(--yellow-soft); color: #b45309; }
.b-tidak { background: var(--red-soft); color: var(--red); }
.b-mendukung .d,.b-ragu .d,.b-tidak .d{width:7px;height:7px;border-radius:50%}
.b-mendukung .d{background:var(--green)} .b-ragu .d{background:var(--yellow)} .b-tidak .d{background:var(--red)}

.minibar { height: 8px; width: 90px; border-radius: 6px; background: var(--surface-2); overflow: hidden; display: inline-block; vertical-align: middle; }
.minibar > i { display: block; height: 100%; border-radius: 6px; }
.mb-green>i{background:var(--green)} .mb-yellow>i{background:var(--yellow)} .mb-red>i{background:var(--red)}

/* ============================================================
   FORMS / BUTTONS
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 17px; border-radius: 11px; font-weight: 600; font-size: 13.2px; cursor: pointer; border: 1px solid transparent; transition: all .17s; font-family: inherit; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(99,102,241,.7); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -8px rgba(99,102,241,.8); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-faint); }
.btn-soft { background: var(--surface-2); color: var(--text-soft); }
.btn-soft:hover { color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 8px; }
.btn-icon svg { margin: 0; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 7px; }
.field label .req { color: var(--red); }
.input, .select, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
textarea.input { resize: vertical; min-height: 78px; }
.input::placeholder { color: var(--text-faint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.toolbar { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-faint); }
.search-box .input { padding-left: 40px; }

/* ---------- Segmented status radios ---------- */
.seg { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.seg label { cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg .opt { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px; border-radius: 11px; border: 1.5px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text-soft); transition: all .15s; }
.seg .opt .d { width: 9px; height: 9px; border-radius: 50%; }
.seg input:checked + .opt.o-green  { border-color: var(--green);  background: var(--green-soft);  color: var(--green); }
.seg input:checked + .opt.o-yellow { border-color: var(--yellow); background: var(--yellow-soft); color: #b45309; }
.seg input:checked + .opt.o-red    { border-color: var(--red);    background: var(--red-soft);    color: var(--red); }
.o-green .d{background:var(--green)} .o-yellow .d{background:var(--yellow)} .o-red .d{background:var(--red)}

/* ============================================================
   HEATMAP
   ============================================================ */
.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 15px; }
.heat-card { border-radius: var(--radius-sm); padding: 18px; color: #fff; position: relative; overflow: hidden; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); transition: transform .2s; }
.heat-card:hover { transform: translateY(-4px) scale(1.015); }
.heat-card::after { content:''; position:absolute; right:-24px; bottom:-24px; width:90px; height:90px; border-radius:50%; background: rgba(255,255,255,.13); }
.heat-green  { background: linear-gradient(135deg, #10b981, #059669); }
.heat-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.heat-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.heat-card .h-name { font-weight: 700; font-size: 15px; }
.heat-card .h-pct { font-size: 34px; font-weight: 800; letter-spacing: -1.5px; }
.heat-card .h-meta { font-size: 11.5px; opacity: .92; }
.heat-card .h-stat { position: absolute; top: 14px; right: 14px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; background: rgba(255,255,255,.22); padding: 3px 9px; border-radius: 20px; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.legend .sw { width: 14px; height: 14px; border-radius: 5px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; gap: 12px; }
.pager .info { font-size: 12.5px; color: var(--text-soft); }
.pages { display: flex; gap: 6px; }
.pages button { min-width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer; font-weight: 600; font-size: 13px; transition: all .15s; }
.pages button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pages button.active { background: var(--brand-grad); color: #fff; border-color: transparent; }
.pages button:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-wrap { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 11px; }
.toast {
  display: flex; align-items: center; gap: 13px; min-width: 290px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 14px 16px; border-radius: 13px; box-shadow: var(--shadow-lg);
  animation: toastIn .35s cubic-bezier(.22,1,.36,1);
}
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { to{opacity:0;transform:translateX(40px)} }
.toast .t-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.toast .t-ico svg { width: 20px; height: 20px; }
.toast.ok .t-ico { background: var(--green-soft); color: var(--green); }
.toast.err .t-ico { background: var(--red-soft); color: var(--red); }
.toast.info .t-ico { background: rgba(99,102,241,.13); color: var(--brand); }
.toast .t-title { font-weight: 700; font-size: 13.5px; }
.toast .t-msg { font-size: 12.5px; color: var(--text-soft); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-bg { position: fixed; inset: 0; background: rgba(8,11,22,.55); backdrop-filter: blur(4px); z-index: 150; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; animation: fadeIn .2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); animation: modalIn .3s cubic-bezier(.22,1,.36,1); overflow: hidden; }
@keyframes modalIn { from{opacity:0;transform:scale(.94) translateY(12px)} to{opacity:1;transform:scale(1)} }
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-x { cursor: pointer; color: var(--text-faint); background: none; border: none; padding: 4px; }
.confirm-ico { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; }
.confirm-ico svg { width: 27px; height: 27px; }
.confirm-ico.ci-danger { background: var(--red-soft); color: var(--red); }
.confirm-ico.ci-info { background: rgba(99,102,241,.13); color: var(--brand); }

/* ---------- Skeleton loading ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; display: inline-block; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(148,163,184,.22), transparent); animation: shimmer 1.3s infinite; }
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 11px; width: 100%; }
.modal-x:hover { color: var(--text); }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 360px; }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; pointer-events: none; }
.donut-center .big { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.donut-center .lbl { font-size: 11.5px; color: var(--text-soft); }
.donut-legend { display: flex; flex-direction: column; gap: 12px; }
.donut-legend .dl-row { display: flex; align-items: center; gap: 11px; }
.donut-legend .dl-sw { width: 12px; height: 12px; border-radius: 4px; }
.donut-legend .dl-name { font-size: 13px; font-weight: 500; }
.donut-legend .dl-val { margin-left: auto; font-weight: 700; font-size: 14px; }
.donut-legend .dl-pct { font-size: 11.5px; color: var(--text-soft); width: 48px; text-align: right; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-art { background: var(--sidebar-bg); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before { content:''; position:absolute; width:460px; height:460px; border-radius:50%; background: var(--brand-grad); filter: blur(80px); opacity:.4; top:-120px; right:-120px; }
.login-art::after { content:''; position:absolute; width:340px; height:340px; border-radius:50%; background: #ec4899; filter: blur(90px); opacity:.25; bottom:-100px; left:-80px; }
.login-art .la-content { position: relative; z-index: 2; }
.login-art .la-badge { display:inline-flex; align-items:center; gap:9px; background: rgba(255,255,255,.1); padding: 8px 15px; border-radius: 30px; font-size: 12.5px; font-weight: 600; }
.login-art h1 { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin: 30px 0 16px; }
.login-art p { color: #b6bbdc; font-size: 15px; max-width: 380px; }
.la-feats { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; }
.la-feat { display: flex; align-items: center; gap: 13px; font-size: 14px; color: #d4d8f0; }
.la-feat .fic { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.la-feat .fic svg { width: 17px; height: 17px; }
.login-form-side { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; }
.login-card .lc-logo { width: 56px; height: 56px; border-radius: 15px; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 24px; box-shadow: 0 12px 28px -8px rgba(124,58,237,.6); margin-bottom: 22px; }
.login-card h2 { font-size: 25px; font-weight: 800; letter-spacing: -.7px; }
.login-card .sub { color: var(--text-soft); margin: 7px 0 28px; }
.login-err { background: var(--red-soft); color: var(--red); padding: 11px 14px; border-radius: 11px; font-size: 13px; font-weight: 500; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }
.login-hint { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-soft); background: var(--surface-2); padding: 11px; border-radius: 11px; }
.login-foot { margin-top: 26px; text-align: center; font-size: 11.5px; color: var(--text-faint); }

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer { padding: 18px 28px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 12.5px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.app-footer b { color: var(--text); font-weight: 700; }

/* ============================================================
   MISC
   ============================================================ */
.section-title { font-size: 16px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 4px; }
.empty { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.empty svg { width: 54px; height: 54px; opacity: .35; margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; } .mt-18 { margin-top: 18px; }
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; } .wrap { flex-wrap: wrap; }
.muted { color: var(--text-soft); }
.tag-soft { background: var(--surface-2); padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }

/* Layout 2 kolom: form + tabel (halaman Data Pemilih) */
.split-form { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.sticky-form { position: sticky; top: 88px; }

/* ============================================================
   RESPONSIVE  —  desktop ▸ tablet ▸ mobile
   ============================================================ */

/* Tablet landscape (≤ 1200px): grafik & form-tabel menumpuk */
@media (max-width: 1200px) {
  .cols-2 { grid-template-columns: 1fr; }
  .split-form { grid-template-columns: 1fr; }
  .sticky-form { position: static; }
}

/* Tablet portrait (≤ 980px): kartu 3-kolom jadi 1, sidebar off-canvas */
@media (max-width: 980px) {
  .cols-3, .kpi-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: grid; place-items: center; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .content { padding: 20px 18px 34px; }
  .topbar { padding: 12px 18px; }
}

/* Mobile (≤ 640px): semua satu kolom, header membungkus */
@media (max-width: 640px) {
  .stat-tri { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .page-h1 { font-size: 16px; }
  .candidate-card { margin-left: auto; order: 3; flex: 1 1 100%; justify-content: space-between; }
  .candidate-card .cand-text { display: block; }
  .kpi-value { font-size: 27px; }
  .heat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .select, .search-box { max-width: none !important; width: 100%; }
  .seg { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .content { padding: 16px 13px 30px; }
  .legend { gap: 10px; }
}

/* Layar sangat kecil (≤ 380px) */
@media (max-width: 380px) {
  .kpi-value { font-size: 24px; }
  .heat-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  .sidebar, .topbar, .app-footer, .sidebar-overlay, .toolbar, .pager, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  body { background: #fff; }
}
