:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #18212b;
    --muted: #66717c;
    --line: #e3e7eb;
    --accent: #1769aa;
    --accent-soft: #eaf3fb;
    --success: #2e7d32;
    --warning: #9a6700;
    --danger: #b42318;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

body {
    min-width: 320px;
}

.app {
    width: min(1100px, calc(100% - 24px));
    margin: 18px auto 28px;
}

.top {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: var(--accent);
    margin-bottom: 6px;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 5px;
    font-size: clamp(23px, 4vw, 34px);
}

.subtitle {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.status {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    background: #fafbfc;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9aa3ab;
}

.status.online .dot { background: var(--success); }
.status.warning .dot { background: var(--warning); }
.status.error .dot { background: var(--danger); }

.summary {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 14px;
}

.progress-card, .stats, .results, .notice {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.progress-card { padding: 18px; }

.progress-head, .progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.progress-head {
    font-size: 14px;
    margin-bottom: 10px;
}

.progress {
    height: 10px;
    overflow: hidden;
    background: #edf0f2;
    border-radius: 999px;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .4s ease;
}

.progress-meta {
    margin-top: 9px;
    font-size: 11px;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: hidden;
}

.stats div {
    padding: 15px 12px;
    border-right: 1px solid var(--line);
}

.stats div:last-child { border-right: 0; }

.stats span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.stats strong {
    font-size: 17px;
}

.notice {
    margin-top: 14px;
    padding: 12px 15px;
    color: var(--warning);
    background: #fff9e8;
    border-color: #f0dfaa;
    font-size: 13px;
}

.notice.hidden { display: none; }

.results {
    margin-top: 14px;
    overflow: hidden;
}

.results-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.results-head h2 {
    margin: 0;
    font-size: 18px;
}

.results-head span {
    font-size: 11px;
    color: var(--muted);
}

.candidate {
    display: grid;
    grid-template-columns: 42px 72px minmax(180px, 1fr) 130px 100px;
    gap: 12px;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}

.candidate:last-child { border-bottom: 0; }

.rank {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
}

.photo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #eef1f4;
}

.name {
    font-size: 15px;
    font-weight: 700;
}

.meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.votes {
    text-align: right;
    font-size: 17px;
    font-weight: 700;
}

.votes small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}

.badge {
    justify-self: end;
    font-size: 10px;
    font-weight: 700;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

.badge.elected {
    background: #eaf7ec;
    color: var(--success);
}

.loading, .empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

footer {
    margin-top: 12px;
    text-align: center;
    color: #7a838c;
    font-size: 10px;
}

@media (max-width: 760px) {
    .top { align-items: flex-start; flex-direction: column; }
    .summary { grid-template-columns: 1fr; }
    .candidate {
        grid-template-columns: 34px 58px 1fr;
        gap: 9px;
    }
    .photo { width: 54px; height: 54px; }
    .votes { text-align: left; grid-column: 3; }
    .badge { justify-self: start; grid-column: 3; }
}

@media (max-width: 480px) {
    .app { width: min(100% - 12px, 1100px); margin-top: 6px; }
    .top { padding: 16px; }
    .stats strong { font-size: 14px; }
}

.candidate-list {
    display: block;
}

.candidate .votes small {
    opacity: .9;
}

.candidate img {
    display: block;
}

@media (min-width: 761px) {
    .candidate {
        min-height: 88px;
    }
}
