/* Sistem E-Undi MPP BBA — gaya dikongsi */
/* Warna tema Yayasan Pendidikan Rakyat (YPR): biru tua, merah, kuning. Gaya ringkas ala Apple. */
:root {
  --ypr-navy: #41427b;
  --ypr-red: #ec3237;
  --ypr-yellow: #ffe51c;
  --ypr-gray: #636466;
  --brand-ink: #41427b;

  --brand-900: #1d1e45;
  --brand-800: #2a2b5c;
  --brand-700: #36376c;
  --brand-600: #41427b;
  --brand-500: #5b5da8;
  --brand-100: #e6e7f3;
  --brand-50: #f3f3f9;
  --red: #ec3237;
  --red-soft: #fde8e8;
  --accent: #ffd21f;
  --accent-ink: #1d1e45;
  --accent-soft: #fff7cc;
  --ok: #248a3d;
  --ok-soft: #e3f5e8;
  --warn: #b25000;
  --warn-soft: #fff2dd;
  --bad: #d70015;
  --bad-soft: #fde8ea;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --glass: #ffffff;
  --text: #161a2e;
  --text-2: #5b6072;
  --text-3: #8a8fa0;
  --line: #e4e6eb;
  --card-line: #e4e6eb;
  --ring: rgba(65, 66, 123, .22);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-ink: #c9cbf2;
    --brand-ink: #c9cbf2;
  --bg: #0e0f14;
    --surface: #15161c;
    --surface-2: #1e2029;
    --glass: #15161c;
    --text: #f5f5f7;
    --text-2: #aeaeb2;
    --text-3: #8e8e93;
    --line: #2a2d38;
    --card-line: #2a2d38;
    --brand-700: #4f51a0;
    --brand-600: #7577cf;
    --brand-500: #8c8ee0;
    --brand-100: #26274a;
    --brand-50: #17182f;
    --ring: rgba(140, 142, 224, .3);
    --ok: #30d158; --ok-soft: #0f3319;
    --warn: #ff9f0a; --warn-soft: #3a2600;
    --bad: #ff453a; --bad-soft: #3d1210;
    --red-soft: #3d1210;
    --accent-soft: #3a3200;
    --shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-ink: #c9cbf2;
  --bg: #0e0f14;
  --surface: #15161c;
  --surface-2: #1e2029;
  --glass: #15161c;
  --text: #f5f5f7;
  --text-2: #aeaeb2;
  --text-3: #8e8e93;
  --line: #2a2d38;
  --card-line: #2a2d38;
  --brand-700: #4f51a0;
  --brand-600: #7577cf;
  --brand-500: #8c8ee0;
  --brand-100: #26274a;
  --brand-50: #17182f;
  --ring: rgba(140, 142, 224, .3);
  --ok: #30d158; --ok-soft: #0f3319;
  --warn: #ff9f0a; --warn-soft: #3a2600;
  --bad: #ff453a; --bad-soft: #3d1210;
  --red-soft: #3d1210;
  --accent-soft: #3a3200;
  --shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.5; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: var(--brand-600); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.022em; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--text-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Bar kemajuan global (setiap loading) ---------- */
#loadbar { position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .3s; }
#loadbar.on { opacity: 1; }
#loadbar .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ypr-red), var(--ypr-yellow), var(--brand-500)); box-shadow: 0 0 12px rgba(236, 50, 55, .5); transition: width .25s var(--ease); }
#loadpill {
  position: fixed; top: 14px; left: 50%; transform: translate(-50%, -20px); z-index: 1001; opacity: 0; pointer-events: none;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: var(--text); border: 1px solid var(--card-line); box-shadow: var(--shadow-lg);
  border-radius: 999px; padding: 8px 14px 8px 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600;
  transition: transform .35s var(--ease), opacity .3s; min-width: 220px; max-width: calc(100vw - 32px);
}
#loadpill.on { opacity: 1; transform: translate(-50%, 0); }
#loadpill .track { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 70px; }
#loadpill .track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-600), var(--ypr-red)); transition: width .25s var(--ease); }
#loadpill b { font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; color: var(--brand-600); }
#loadpill .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-100); border-top-color: var(--brand-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skrin pembuka */
#splash { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: radial-gradient(900px 500px at 50% 0%, #4b4c8c, #1d1e45 70%); color: #fff; transition: opacity .5s, visibility .5s; }
#splash.done { opacity: 0; visibility: hidden; }
#splash .box { width: min(320px, 80vw); text-align: center; }
#splash .logo { width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 24px; background: #fff; display: grid; place-items: center; padding: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.35); animation: pulse 1.8s var(--ease) infinite; }
#splash .logo img { width: 100%; height: 100%; object-fit: contain; }
#splash .track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; margin: 18px 0 8px; }
#splash .track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ypr-red), var(--ypr-yellow)); transition: width .3s var(--ease); }
#splash .pct { font-variant-numeric: tabular-nums; font-weight: 700; opacity: .9; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* ---------- Butang & borang ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; cursor: pointer;
  padding: 10px 18px; border-radius: 980px; font-weight: 600; font-size: 14px; letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), background-color .3s var(--ease), filter .2s, opacity .2s; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.95); transition-duration: .1s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(65, 66, 123, .3); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(236, 50, 55, .35); }
.btn-accent { background: var(--ypr-yellow); color: var(--accent-ink); }
.btn-accent:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(255, 210, 31, .4); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--bad); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .25s; outline: none;
}
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--ring); }
.input.invalid { border-color: var(--bad); }
textarea.input { min-height: 96px; resize: vertical; }
.input-lg { font-size: 18px; padding: 14px 16px; letter-spacing: .03em; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand-600); flex: none; margin-top: 2px; }

/* ---------- Kad & susun atur ---------- */
.card { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .5s var(--ease), box-shadow .5s var(--ease), background-color .5s var(--ease); }
.card-pad { padding: clamp(18px, 2.4vw, 26px); }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 28px); transition: padding .5s var(--ease); }
.grid { display: grid; gap: clamp(12px, 1.8vw, 20px); transition: gap .5s var(--ease), grid-template-columns .5s var(--ease); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.section { padding-block: clamp(28px, 5vw, 64px); transition: padding .5s var(--ease); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: clamp(22px, 2.6vw, 28px); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-brand { background: var(--brand-100); color: var(--brand-600); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot-live { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- Tab & sub-tab ---------- */
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none; position: relative; isolation: isolate; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: color .3s var(--ease), background-color .3s var(--ease); display: inline-flex; gap: 6px; align-items: center; position: relative; z-index: 1; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 3px 8px rgba(0,0,0,.05); }
.tabs.has-ind .tab.active { background: transparent; box-shadow: none; }
.tab-ind { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 9px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 3px 8px rgba(0,0,0,.05); transition: transform .5s var(--ease), width .5s var(--ease); pointer-events: none; }
.tab .count { background: var(--brand-100); color: var(--brand-600); border-radius: 99px; padding: 0 7px; font-size: 11px; }

/* ---------- Menu titik tiga & dropdown ---------- */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 190px; padding: 6px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--card-line); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.96); transform-origin: top right; pointer-events: none; transition: opacity .2s, transform .35s var(--spring); }
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; font-size: 14px; color: var(--text); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.kebab { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.kebab:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Modal & panel slaid ---------- */
.overlay { position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .25s; display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay.open { opacity: 1; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); transform: translateY(24px) scale(.94); opacity: 0; transition: transform .5s var(--spring), opacity .3s var(--ease); }
.overlay.open .modal { transform: none; opacity: 1; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
.modal-lg { max-width: 760px; }

.sheet-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s; }
.sheet-overlay.open { opacity: 1; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 501; overflow-y: auto; transform: translateX(100%); transition: transform .6s var(--ease); box-shadow: var(--shadow-lg); border-radius: 26px 0 0 26px; }
@media (max-width: 600px) { .sheet { top: auto; height: 92vh; width: 100vw; border-radius: 26px 26px 0 0; transform: translateY(100%); } }
.sheet.open { transform: none; }
.sheet-close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2; background: rgba(0,0,0,.45); color: #fff; border: 0; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: var(--text); border: 1px solid var(--card-line); padding: 12px 18px; border-radius: 16px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: toastIn .4s var(--ease); width: 100%; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Peralihan halaman ---------- */
.view { animation: viewIn .7s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(16px) scale(.99); filter: blur(4px); } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.stagger > * { animation: viewIn .7s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(7) { animation-delay: .3s; }
.stagger > *:nth-child(8) { animation-delay: .35s; } .stagger > *:nth-child(n+9) { animation-delay: .4s; }

/* Skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Bar kemajuan dalam kandungan */
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand-600), var(--brand-500)); transition: width 1.2s var(--ease); }
.progress.ok > i { background: linear-gradient(90deg, var(--ok), #34c759); }
.progress.ypr > i { background: linear-gradient(90deg, var(--ypr-red), #f98a2b 55%, var(--ypr-yellow)); }
.progress-lg { height: 16px; }

/* Jadual */
.table-wrap { overflow-x: auto; border: 1px solid var(--card-line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; padding: 12px 14px; background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr { transition: background .15s; }
.table tbody tr:hover { background: var(--brand-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Nombor calon (mesti jelas) */
.cand-no { display: inline-grid; place-items: center; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 16px; background: #41427b; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; box-shadow: 0 6px 16px rgba(29, 30, 69, .35), inset 0 -3px 0 var(--ypr-yellow); }
.cand-no.sm { min-width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
.cand-no.xl { min-width: 76px; height: 76px; font-size: 40px; border-radius: 20px; }

.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar-ph { display: grid; place-items: center; font-weight: 800; color: var(--brand-600); background: var(--brand-100); }

.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty .ico { font-size: 40px; margin-bottom: 8px; }

.stars { display: inline-flex; gap: 4px; }
.stars button { border: 0; background: none; font-size: 30px; cursor: pointer; color: var(--line); transition: transform .15s, color .15s; padding: 0; line-height: 1; }
.stars button.on { color: #ffcc00; }
.stars button:hover { transform: scale(1.15); }

.social { display: flex; gap: 8px; flex-wrap: wrap; }
.social a { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); transition: transform .2s var(--ease), background .2s; }
.social a:hover { transform: translateY(-2px); background: var(--brand-100); color: var(--brand-600); }
.social svg { width: 18px; height: 18px; }

/* Maklum balas terapung */
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 300; border-radius: 999px; padding: 12px 16px; box-shadow: var(--shadow-lg); background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: var(--text); border: 1px solid var(--card-line); transition: bottom .5s var(--ease), padding .5s var(--ease), transform .35s var(--spring); }
@media (max-width: 760px) { .fab { bottom: 84px; padding: 12px; } .fab .lbl { display: none; } }

/* Konfeti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1500; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  #loadbar, #loadpill, .fab, .no-print, nav, header, aside { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------- Interaksi ala Apple ---------- */
.card, .cand-card, .howto .st, .ballot-item, .tl-item .box, .ann, .result-row { position: relative; }
.card::after, .cand-card::after, .howto .st::after, .ballot-item::after, .tl-item .box::after, .ann::after, .result-row::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s var(--ease);
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(65, 66, 123, .08), transparent 60%);
}
@media (hover: hover) {
  .card:hover::after, .cand-card:hover::after, .howto .st:hover::after, .ballot-item:hover::after, .tl-item .box:hover::after, .ann:hover::after, .result-row:hover::after { opacity: 1; }
}
:root[data-theme="dark"] .card::after, :root[data-theme="dark"] .cand-card::after { background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .06), transparent 60%); }
.cand-card { will-change: transform; }
/* Teks berubah saiz dengan lancar */
h1, h2, h3, .section-title h2, .stat .v, .turnout .big { transition: font-size .45s var(--ease), letter-spacing .45s var(--ease); }
/* Elak animasi berat semasa tetingkap sedang diubah saiz */
.resizing .view, .resizing .stagger > * { animation: none !important; }
::selection { background: rgba(255, 229, 28, .55); color: #1d1e45; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.empty h2, .empty h3 { color: var(--text); }
.card > h3:first-child, .card-pad > h3:first-child { margin-bottom: 14px; }

/* ---------- Ikon garis halus ---------- */
.ic-wrap { display: inline-flex; align-items: center; justify-content: center; vertical-align: -0.18em; line-height: 1; }
.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn .ic-wrap, .menu .ic-wrap, .badge .ic-wrap { vertical-align: 0; }
.menu button > span:first-child { width: 20px; display: inline-flex; justify-content: center; color: var(--text-2); }
.empty .ico { color: var(--text-3); }
.empty .ico .i { width: 44px; height: 44px; stroke-width: 1.3; }
.link-more { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-600); font-weight: 500; text-decoration: none; font-size: 17px; background: none; border: 0; padding: 0; cursor: pointer; }
.link-more span { transition: transform .4s var(--spring); display: inline-block; }
.link-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-more:hover span { transform: translateX(3px); }
.btn-light { background: #fff; color: #1d1e45; }
.btn-light:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.section-title h2 { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.03em; }
.section:empty { display: none; }

/* =========================================================
   Gaya korporat: rata, minimalis, profesional
   ========================================================= */
body { letter-spacing: -.005em; }
h1, h2, h3, h4 { letter-spacing: -.015em; font-weight: 700; }
.btn { border-radius: 8px; font-weight: 600; transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s; }
.btn:active { transform: none; }
.btn-primary:hover:not(:disabled), .btn-red:hover:not(:disabled), .btn-accent:hover:not(:disabled), .btn-light:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-red:hover:not(:disabled) { background: #d42a2f; }
.btn-accent { background: var(--brand-600); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--brand-700); }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-icon { border-radius: 8px; }
.input, select.input, textarea.input { border-radius: 8px; }
.card { box-shadow: var(--shadow); border-color: var(--card-line); }
.card::after, .cand-card::after, .howto .st::after, .ballot-item::after, .tl-item .box::after, .ann::after, .result-row::after { display: none; }
.tabs { border-radius: 8px; padding: 3px; }
.tab, .tab-ind { border-radius: 6px; }
.badge { border-radius: 6px; font-weight: 600; }
.menu { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); border-radius: 10px; }
.modal { border-radius: 14px; transform: translateY(12px); transition: transform .3s var(--ease), opacity .25s; }
.sheet { border-radius: 0; }
@media (max-width: 600px) { .sheet { border-radius: 14px 14px 0 0; } }
.toast { background: var(--text); color: var(--bg); border: 0; backdrop-filter: none; border-radius: 10px; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--bad); color: #fff; }
.view { animation: viewIn .35s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.reveal { transform: translateY(10px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.stagger > * { animation: viewIn .4s var(--ease) both; }
.cand-no { border-radius: 8px; background: var(--ypr-navy); box-shadow: none; font-weight: 700; }
.avatar { border-radius: 8px; }
.social a { border-radius: 8px; background: var(--surface-2); }
.social a:hover { transform: none; }
.table-wrap { border-radius: 12px; box-shadow: var(--shadow); }
.fab { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.link-more { font-size: 15px; font-weight: 600; }
.section-title h2 { font-size: clamp(20px, 2.2vw, 26px); letter-spacing: -.015em; }
#splash { background: #fff; color: var(--text); }
#splash .logo { box-shadow: none; animation: none; background: none; width: 72px; height: 72px; padding: 0; }
#splash .track { background: #eceef2; height: 4px; }
#splash .track i { background: var(--ypr-navy); }
#loadbar .fill { background: var(--ypr-navy); box-shadow: none; }
#loadpill { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); border-radius: 8px; }
#loadpill .track i { background: var(--ypr-navy); }
.progress, .progress > i { border-radius: 4px; }
.progress > i { background: var(--ypr-navy); }
.progress.ypr > i { background: var(--ypr-navy); }
.stars button.on { color: var(--brand-ink); }
