/* Quick Count Pemilihan Kepala Desa — tema terang indigo (kartu kaca) */
:root {
    --bg: #F3F0FF;
    --ink: #1F1B3A;
    --ink-soft: #3B3660;
    --muted: #635F82;
    --indigo: #4F46E5;
    --violet: #8B5CF6;
    --line: rgba(79, 70, 229, .12);
    --glass: rgba(255, 255, 255, .64);
    --glass-strong: rgba(255, 255, 255, .84);
    --radius: 20px;
    --shadow: 0 20px 46px -26px rgba(79, 70, 229, .55);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(50rem 32rem at 8% -6%, rgba(99, 102, 241, .30), transparent 62%),
        radial-gradient(42rem 30rem at 100% 4%, rgba(236, 72, 153, .20), transparent 60%),
        radial-gradient(46rem 34rem at 82% 100%, rgba(14, 165, 233, .18), transparent 62%),
        radial-gradient(40rem 30rem at 0% 92%, rgba(139, 92, 246, .20), transparent 60%);
}

h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--indigo); }
a:hover { color: var(--violet); }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.only-mobile { display: none !important; }
.link-strong { font-weight: 600; text-decoration: none; }
.link-strong:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ layout */
.app {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 26px 20px 22px;
    background: rgba(255, 255, 255, .55);
    border-right: 1px solid rgba(255, 255, 255, .8);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    box-shadow: 14px 0 40px -34px rgba(31, 27, 58, .5);
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #4F46E5, #8B5CF6);
    box-shadow: 0 12px 24px -12px rgba(79, 70, 229, .9);
    flex: 0 0 auto;
}

.brand-mark .icon { width: 22px; height: 22px; stroke-width: 2.6; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: .01em; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 12px;
    color: var(--ink-soft);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.nav-link .icon { width: 18px; height: 18px; opacity: .8; }

.nav-link:hover { background: rgba(255, 255, 255, .8); color: var(--indigo); }

.nav-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, #4F46E5, #8B5CF6);
    box-shadow: 0 14px 26px -14px rgba(79, 70, 229, .95);
}

.nav-link.is-active .icon { opacity: 1; }

.nav-link-publik {
    margin-top: 10px;
    border-top: 1px dashed rgba(79, 70, 229, .18);
    border-radius: 0 0 12px 12px;
    padding-top: 16px;
    color: var(--muted);
}

.nav-link-publik .icon:last-child { margin-left: auto; width: 14px; height: 14px; }

.sidebar-foot {
    display: grid;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid rgba(79, 70, 229, .12);
}

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    flex: 0 0 auto;
}

.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { font-size: 11px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px clamp(18px, 3vw, 36px) 8px;
}

.topbar-title { flex: 1; min-width: 0; }
.page-title { font-size: clamp(20px, 2.2vw, 25px); font-weight: 800; }
.topbar-sub { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.content {
    padding: 14px clamp(18px, 3vw, 36px) 56px;
    display: grid;
    gap: 22px;
    align-content: start;
    max-width: 1240px;
    width: 100%;
}

/* ------------------------------------------------------------------ kartu */
.card {
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: var(--radius);
    padding: 24px 26px;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--shadow);
    min-width: 0;
}

.card-head { margin-bottom: 20px; display: grid; gap: 4px; }
.card-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
}
.card-head h2 .icon { color: var(--indigo); }
.card-head p { font-size: 12.5px; color: var(--muted); }

.stack { display: grid; gap: 22px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }

/* ------------------------------------------------------------------ hero */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    padding: clamp(22px, 3vw, 34px);
    color: #fff;
    background: linear-gradient(135deg, #4338CA 0%, #4F46E5 38%, #7C3AED 72%, #A78BFA 100%);
    box-shadow: 0 30px 64px -32px rgba(79, 70, 229, .95);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 26px;
}

.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.hero::before {
    width: 380px;
    height: 380px;
    right: -110px;
    top: -180px;
    background: radial-gradient(circle, rgba(255, 255, 255, .32), transparent 66%);
}

.hero::after {
    width: 260px;
    height: 260px;
    left: -90px;
    bottom: -150px;
    background: radial-gradient(circle, rgba(236, 72, 153, .38), transparent 68%);
}

.hero-main { position: relative; z-index: 1; display: grid; gap: 10px; justify-items: start; }
.hero-eyebrow {
    font-size: 10.5px;
    letter-spacing: .2em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(255, 255, 255, .78);
}
.hero h2 { color: #fff; font-size: clamp(22px, 3vw, 32px); font-weight: 800; letter-spacing: -.03em; line-height: 1.18; }
.hero-meta { font-size: 13.5px; color: rgba(255, 255, 255, .82); }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.hero-side {
    position: relative;
    z-index: 1;
    min-width: 216px;
    padding: 18px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .3);
    display: grid;
    gap: 10px;
}
.hero-side small { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .78); font-weight: 700; }
.hero-side strong { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.hero-side strong span { font-size: 18px; font-weight: 600; opacity: .8; }
.hero-progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.hero-progress i { display: block; height: 100%; border-radius: 999px; background: #fff; }
.hero-side-foot { font-size: 12px; color: rgba(255, 255, 255, .85); }

.hero .pill {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .34);
    color: #fff;
}
.hero .pill .icon { color: #fff; }

/* ------------------------------------------------------------------ pill / badge */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.2;
}
.pill .icon { width: 14px; height: 14px; }
.pill-live { background: rgba(16, 185, 129, .13); color: #047857; border-color: rgba(16, 185, 129, .28); }
.pill-lock { background: rgba(245, 158, 11, .15); color: #B45309; border-color: rgba(245, 158, 11, .3); }
.pill-indigo { background: rgba(79, 70, 229, .1); color: var(--indigo); border-color: rgba(79, 70, 229, .2); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
}
.badge-ok { background: rgba(16, 185, 129, .14); color: #047857; }
.badge-warn { background: rgba(245, 158, 11, .18); color: #B45309; }
.badge-indigo { background: rgba(79, 70, 229, .12); color: var(--indigo); }
.badge-muted { background: rgba(99, 95, 130, .12); color: var(--muted); }
.badge-pink { background: rgba(236, 72, 153, .12); color: #BE185D; }

/* ------------------------------------------------------------------ tombol */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, #4F46E5, #8B5CF6);
    color: #fff;
    box-shadow: 0 12px 24px -12px rgba(79, 70, 229, .95);
}
.btn-primary:hover { color: #fff; box-shadow: 0 16px 30px -14px rgba(79, 70, 229, 1); }
.btn-ghost { background: rgba(255, 255, 255, .76); border-color: rgba(79, 70, 229, .16); color: var(--ink); }
.btn-ghost:hover { background: #fff; border-color: rgba(79, 70, 229, .32); color: var(--indigo); }
.btn-danger { background: rgba(225, 29, 72, .08); border-color: rgba(225, 29, 72, .2); color: #BE123C; }
.btn-danger:hover { background: rgba(225, 29, 72, .14); color: #9F1239; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 50px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, .16);
    background: rgba(255, 255, 255, .78);
    color: var(--ink);
    cursor: pointer;
}
.icon-btn:hover { color: var(--indigo); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ statistik */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 18px; }

.stat-card {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 20px 22px;
    border-radius: 18px;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, .8);
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    box-shadow: 0 16px 38px -26px rgba(79, 70, 229, .6);
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -40px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--tone-soft, rgba(79, 70, 229, .1));
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--tone, var(--indigo));
    background: var(--tone-soft, rgba(79, 70, 229, .12));
}
.stat-icon .icon { width: 17px; height: 17px; }
.stat-value { position: relative; z-index: 1; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-sub { position: relative; z-index: 1; font-size: 12px; color: var(--muted); }

.tone-indigo { --tone: #4F46E5; --tone-soft: rgba(79, 70, 229, .12); }
.tone-sky { --tone: #0284C7; --tone-soft: rgba(14, 165, 233, .14); }
.tone-pink { --tone: #DB2777; --tone-soft: rgba(236, 72, 153, .13); }
.tone-emerald { --tone: #047857; --tone-soft: rgba(16, 185, 129, .14); }
.tone-amber { --tone: #B45309; --tone-soft: rgba(245, 158, 11, .16); }
.tone-violet { --tone: #7C3AED; --tone-soft: rgba(139, 92, 246, .14); }

/* ------------------------------------------------------------------ hasil calon */
.ribbon { display: flex; gap: 4px; height: 16px; border-radius: 999px; overflow: hidden; background: rgba(79, 70, 229, .08); }
.ribbon span { height: 100%; border-radius: 999px; min-width: 4px; transition: width .6s ease; }

.ribbon-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.ribbon-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ribbon-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.cand-list { display: grid; gap: 14px; margin-top: 18px; }

.cand {
    display: grid;
    gap: 12px;
    padding: 15px 18px;
    border-radius: 16px;
    border: 1px solid rgba(79, 70, 229, .1);
    background: rgba(255, 255, 255, .56);
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.cand:hover { transform: translateY(-1px); box-shadow: 0 16px 34px -26px rgba(79, 70, 229, .7); }
.cand.is-lead { border-color: rgba(79, 70, 229, .28); background: linear-gradient(120deg, rgba(255, 255, 255, .9), rgba(243, 240, 255, .72)); }
.cand-top { display: flex; align-items: center; gap: 14px; }
.cand-no {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 10px 20px -12px rgba(31, 27, 58, .65);
    flex: 0 0 auto;
}
.cand-nama { flex: 1; min-width: 0; }
.cand-nama strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.3; }
.cand-nama small { font-size: 11.5px; color: var(--muted); }
.cand-vote { text-align: right; flex: 0 0 auto; }
.cand-vote strong { display: block; font-size: 23px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cand-vote small { font-size: 12px; color: var(--muted); font-weight: 600; }
.cand-bar { height: 9px; border-radius: 999px; background: rgba(79, 70, 229, .1); overflow: hidden; }
.cand-bar span { display: block; height: 100%; border-radius: 999px; min-width: 3px; transition: width .6s ease; }

/* ------------------------------------------------------------------ progres & info */
.progress { height: 10px; border-radius: 999px; background: rgba(79, 70, 229, .12); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4F46E5, #8B5CF6); transition: width .6s ease; }

.meta-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(79, 70, 229, .1);
}
.meta-box div { display: grid; gap: 2px; min-width: 0; }
.meta-box small { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.meta-box strong { font-size: 14px; font-weight: 700; }

.tip-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tip-list li {
    position: relative;
    padding-left: 24px;
    font-size: 12.8px;
    color: var(--ink-soft);
    line-height: 1.6;
}
.tip-list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5, #8B5CF6);
}

.empty {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
    padding: 34px 22px;
    border: 1px dashed rgba(79, 70, 229, .26);
    border-radius: 16px;
    background: rgba(255, 255, 255, .42);
}
.empty .icon { width: 28px; height: 28px; color: var(--indigo); }
.empty strong { font-size: 14.5px; }
.empty p { font-size: 12.5px; color: var(--muted); max-width: 46ch; }

/* ------------------------------------------------------------------ form */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.fields.single { grid-template-columns: minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.fields .span-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field-label em { font-style: normal; color: #E11D48; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: rgba(255, 255, 255, .84);
    border: 1px solid rgba(79, 70, 229, .16);
    border-radius: 12px;
    padding: 11px 14px;
    min-height: 44px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23635F82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    background: #fff;
    border-color: rgba(79, 70, 229, .55);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}
input::placeholder, textarea::placeholder { color: #9C98B6; }

.input-pass { position: relative; display: block; }
.input-pass input { padding-right: 44px; }
.pass-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
}
.pass-toggle:hover { color: var(--indigo); background: rgba(79, 70, 229, .08); }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions .btn { flex: 0 0 auto; }

/* input suara */
.vote-list { display: grid; gap: 12px; }
.vote-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(79, 70, 229, .1);
    background: rgba(255, 255, 255, .6);
}
.vote-who { min-width: 0; }
.vote-who strong { display: block; font-size: 14px; font-weight: 700; line-height: 1.3; }
.vote-who small { font-size: 11.5px; color: var(--muted); }
.vote-input-wrap { display: flex; align-items: center; gap: 10px; }
input.vote-input {
    width: 118px;
    text-align: right;
    font-size: 19px;
    font-weight: 700;
    height: 46px;
    font-variant-numeric: tabular-nums;
    padding: 8px 14px;
}
.vote-pct { width: 56px; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(79, 70, 229, .16);
    font-size: 13px;
}
.summary-line:last-of-type { border-bottom: none; }
.summary-line strong { font-variant-numeric: tabular-nums; }
.summary-total { font-size: 14px; }
.summary-total strong { font-size: 19px; letter-spacing: -.02em; }
.warn-inline {
    display: none;
    gap: 8px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, .14);
    border: 1px solid rgba(245, 158, 11, .3);
    color: #92400E;
    font-size: 12.5px;
}
.warn-inline.is-on { display: flex; }
.warn-inline .icon { width: 16px; height: 16px; margin-top: 1px; }

/* ------------------------------------------------------------------ tabel */
.table-scroll { overflow-x: auto; border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left;
    padding: 0 12px 10px;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
    border-bottom: 1px solid rgba(79, 70, 229, .14);
}
.table td {
    padding: 12px;
    border-bottom: 1px solid rgba(79, 70, 229, .07);
    vertical-align: middle;
}
.table tbody tr:hover { background: rgba(255, 255, 255, .55); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .num strong { font-weight: 700; }
.table .tps-nama { display: flex; flex-direction: column; gap: 1px; }
.table .tps-nama small { color: var(--muted); font-size: 11px; }
.table-wrap-sm { overflow-x: auto; }

/* ------------------------------------------------------------------ alert & flash */
.flash-wrap { display: grid; gap: 10px; }
.flash {
    padding: 13px 16px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.flash-ok { background: rgba(16, 185, 129, .13); border-color: rgba(16, 185, 129, .28); color: #065F46; }
.flash-err { background: rgba(225, 29, 72, .1); border-color: rgba(225, 29, 72, .26); color: #9F1239; }
.flash-info { background: rgba(79, 70, 229, .1); border-color: rgba(79, 70, 229, .24); color: #3730A3; }

.alert { padding: 14px 16px; border-radius: 13px; font-size: 12.8px; border: 1px solid transparent; }
.alert-err { background: rgba(225, 29, 72, .08); border-color: rgba(225, 29, 72, .22); color: #9F1239; }
.alert-ok { background: rgba(16, 185, 129, .1); border-color: rgba(16, 185, 129, .24); color: #065F46; }
.alert-info { background: rgba(79, 70, 229, .08); border-color: rgba(79, 70, 229, .2); color: #3730A3; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert li { margin: 2px 0; }

/* ------------------------------------------------------------------ login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: clamp(18px, 4vw, 48px) 20px; }

.login-wrap {
    width: min(1000px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .78);
    box-shadow: 0 46px 100px -46px rgba(31, 27, 58, .55);
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(30px, 4vw, 46px);
    color: #fff;
    background: linear-gradient(150deg, #4338CA 0%, #4F46E5 38%, #7C3AED 74%, #A78BFA 100%);
    display: flex;
    flex-direction: column;
    gap: 22px;
    justify-content: center;
}
.login-hero::before {
    content: '';
    position: absolute;
    width: 330px;
    height: 330px;
    right: -120px;
    top: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 66%);
}
.login-hero::after {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    left: -100px;
    bottom: -140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 72, 153, .4), transparent 68%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand { color: #fff; }
.login-hero .brand-mark { background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35); box-shadow: none; }
.login-hero .brand-text small { color: rgba(255, 255, 255, .78); }
.login-hero h2 { color: #fff; font-size: clamp(22px, 2.7vw, 30px); font-weight: 800; line-height: 1.24; letter-spacing: -.03em; }
.login-hero p { color: rgba(255, 255, 255, .82); font-size: 13.5px; }
.hero-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.hero-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .9); }
.hero-list .icon { width: 16px; height: 16px; color: rgba(255, 255, 255, .85); }

.login-card {
    padding: clamp(28px, 4vw, 46px);
    background: rgba(255, 255, 255, .84);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: center;
}
.login-card h1 { font-size: clamp(20px, 2.4vw, 24px); font-weight: 800; }
.login-card form { display: grid; gap: 14px; margin-top: 4px; }
.login-note {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid rgba(79, 70, 229, .12);
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.6;
}

/* ------------------------------------------------------------------ halaman publik */
.publik-body { padding-bottom: 0; }

.publik-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(243, 240, 255, .74);
    border-bottom: 1px solid rgba(79, 70, 229, .1);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
}
.publik-topbar-in {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.publik-topbar-aksi { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.publik-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 22px 56px;
    display: grid;
    gap: 24px;
    align-content: start;
}

.publik-foot {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 22px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}
.publik-foot div { display: grid; gap: 2px; }
.publik-foot strong { color: var(--ink-soft); font-size: 12.5px; }

.publik-calons { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }

.publik-calon {
    position: relative;
    padding: 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .66);
    border: 1px solid rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px) saturate(175%);
    -webkit-backdrop-filter: blur(18px) saturate(175%);
    box-shadow: 0 18px 40px -30px rgba(79, 70, 229, .65);
    display: grid;
    gap: 14px;
    overflow: hidden;
}
.publik-calon.is-lead { border-color: rgba(79, 70, 229, .3); box-shadow: 0 22px 46px -26px rgba(79, 70, 229, .8); }
.publik-calon::after {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--grad, linear-gradient(90deg, #4F46E5, #8B5CF6));
}
.publik-calon-top { display: flex; align-items: center; gap: 12px; }
.publik-calon .cand-no { width: 42px; height: 42px; border-radius: 13px; }
.publik-calon-nama { font-size: 16px; font-weight: 700; line-height: 1.3; }
.publik-calon-nomor { font-size: 11.5px; color: var(--muted); }
.publik-calon-suara { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.publik-calon-suara strong { font-size: 34px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.publik-calon-suara span { font-size: 18px; font-weight: 800; }
.publik-calon-foot { font-size: 11.5px; color: var(--muted); }

.lock-card {
    max-width: 580px;
    margin: clamp(24px, 8vh, 80px) auto;
    text-align: center;
    padding: clamp(32px, 5vw, 52px);
    display: grid;
    gap: 14px;
    justify-items: center;
}
.lock-mark {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #4F46E5, #8B5CF6);
    box-shadow: 0 20px 40px -20px rgba(79, 70, 229, .9);
}
.lock-mark .icon { width: 34px; height: 34px; }
.lock-card h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.03em; }
.lock-card p { color: var(--muted); font-size: 13.5px; max-width: 44ch; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.section-title h2 .icon { color: var(--indigo); }

.addon-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(79, 70, 229, .07);
    border: 1px solid rgba(79, 70, 229, .14);
    font-size: 12.3px;
    color: var(--ink-soft);
    line-height: 1.55;
}
.addon-note .icon { width: 16px; height: 16px; color: var(--indigo); margin-top: 1px; }

/* ------------------------------------------------------------------ animasi */
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.content > *, .publik-main > * { animation: rise .34s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ responsif */
@media (max-width: 1100px) {
    .two-col { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { grid-template-columns: minmax(0, 1fr); }
    .hero-side { min-width: 0; }
}

@media (max-width: 960px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .only-mobile { display: grid !important; }
    .only-desktop { display: none !important; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(286px, 86vw);
        height: 100vh;
        transform: translateX(-102%);
        transition: transform .24s ease;
        background: rgba(255, 255, 255, .92);
        box-shadow: 30px 0 70px -40px rgba(31, 27, 58, .8);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(31, 27, 58, .35);
        backdrop-filter: blur(2px);
    }
    .topbar { padding: 16px 18px 6px; }
    .content { padding: 12px 18px 48px; gap: 18px; }
    .login-wrap { grid-template-columns: minmax(0, 1fr); }
    .login-hero { gap: 16px; padding: 30px; }
    .hero-list { display: none; }
    .publik-topbar-in, .publik-main, .publik-foot { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 680px) {
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .fields { grid-template-columns: minmax(0, 1fr); }
    .span-2, .span-3 { grid-column: auto; }
    .card { padding: 20px 18px; border-radius: 18px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 24px; }
    .stat-label { font-size: 10.5px; }
    .topbar-actions .pill { display: none; }
    .cand-vote strong { font-size: 20px; }
    .vote-row { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
    .vote-input-wrap { grid-column: 2; }
    input.vote-input { width: 100%; flex: 1; }
    .vote-pct { width: 52px; }
    .publik-calon-suara strong { font-size: 30px; }
    .hero-side strong { font-size: 28px; }
    .lock-card { margin-top: 20px; }
}

@media (max-width: 420px) {
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ cetak */
@media print {
    .bg-glow, .publik-topbar, .publik-foot .btn, .no-print { display: none !important; }
    body { background: #fff; }
    .card, .stat-card, .publik-calon, .hero {
        box-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .publik-main { max-width: none; padding: 0; gap: 16px; }
    .publik-foot { max-width: none; padding: 12px 0 0; }
    .content > *, .publik-main > * { animation: none !important; }
}

/* Tombol di atas panel gradien */
.hero .btn-ghost {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .42);
    color: #fff;
}
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .28); color: #fff; }

.table tfoot td {
    padding: 13px 12px;
    border-top: 1px solid rgba(79, 70, 229, .18);
    font-size: 13px;
}
