:root {
    --green: #0e4d32;
    --green-2: #146b43;
    --ink: #17211c;
    --muted: #5d6b64;
    --paper: #f4f1e8;
    --card: #fffdf8;
    --line: #ddd4c4;
    --gold: #b6893d;
    --red: #9d2433;
    --blue: #1d4e89;
    --ok: #e5f4ea;
    --bad: #fde8e8;
    --shadow: 0 16px 40px rgba(23, 33, 28, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Figtree, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
}
a { color: var(--green-2); }
img { max-width: 100%; }

.topbar {
    background: var(--green);
    color: #f7f3ea;
    border-bottom: 4px solid var(--gold);
}
.topbar-inner, .shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar-inner { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 0; }
.brand small { display: block; letter-spacing: 0.14em; font-size: 11px; opacity: 0.8; }
.brand strong { font-family: Newsreader, Georgia, serif; font-size: 22px; font-weight: 600; }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.link {
    color: #f7f3ea;
    text-decoration: none;
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    padding: 0;
}
.nav a.active { border-bottom: 2px solid var(--gold); }

.shell { padding: 28px 0 64px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
h1, h2, h3 { font-family: Newsreader, Georgia, serif; font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 40px; line-height: 1; }
.muted { color: var(--muted); }
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px;
}
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.gates { grid-template-columns: repeat(5, 1fr); }
.stat { display: flex; flex-direction: column; gap: 12px; }
.stat span { display: block; }
.stat b, .gate-card b { display: block; font-size: 34px; font-variant-numeric: tabular-nums; line-height: 1; margin: 0; }
.gate-card { text-decoration: none; color: inherit; display: block; }
.gate-card:hover { border-color: var(--green-2); }
.bar { height: 8px; background: #efe8da; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; background: var(--green-2); }

.banner { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.banner.ok { background: var(--ok); }
.banner.bad { background: var(--bad); color: var(--red); }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
input, select, button { font: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="file"], select {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
}
.row { display: flex; gap: 10px; align-items: end; }
.row > * { flex: 1; }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 12px 16px;
    background: var(--green);
    color: white;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}
.btn.secondary { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.danger { background: var(--red); }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }

.hero-count { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.hero-count b { font-size: 64px; font-variant-numeric: tabular-nums; line-height: 0.9; }
.search-row input { font-size: 22px; letter-spacing: 0.04em; }
.number-entry {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
    overflow: hidden;
}
.number-entry select {
    width: auto;
    min-width: 132px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: #f7f3ea;
    font-weight: 700;
}
.number-entry .fixed-prefix {
    display: grid;
    place-items: center;
    padding: 0 2px 0 14px;
    color: var(--blue);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.number-entry input {
    width: auto;
    flex: 1;
    min-width: 0;
    border: 0;
    border-radius: 0;
    font-size: 22px;
    letter-spacing: 0.06em;
}

.voter {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; font-size: 14px; }
.avatar, .photo {
    width: 84px; height: 84px; border-radius: 12px;
    display: grid; place-items: center;
    background: #e7f2eb; color: var(--green); font-weight: 800; font-size: 24px;
    object-fit: cover;
}
.badge { display: inline-block; border-radius: 99px; padding: 3px 8px; font-size: 12px; font-weight: 800; }
.badge.member { background: #e5f4ea; color: var(--green); }
.badge.fellow { background: #f8edd8; color: #8a5a12; }
.membership { color: var(--blue); font-weight: 800; font-size: 20px; margin: 4px 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filters a { text-decoration: none; border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px; color: var(--ink); background: white; }
.filters a.on { background: var(--green); color: white; border-color: var(--green); }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.login-card { width: min(460px, 100%); margin: 48px auto; }
.creds { font-size: 14px; background: #f7f3ea; border-radius: 12px; padding: 12px; }
.stack { display: grid; gap: 12px; }
.danger-zone { border-color: #e7c2c6; }

.display-body { background: #071910; color: #f4f1e8; }
.display { width: min(1200px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }
.display h1 { font-size: 48px; }
.display .stats b { font-size: 56px; }
.display .panel { background: #10281c; color: #f4f1e8; border-color: #234536; }
.live-dot { color: #8dcea8; }

.operator-form { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 140px auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; }

@media print {
    .no-print, .topbar { display: none !important; }
    body { background: white; }
    .panel { box-shadow: none; }
}

@media (max-width: 900px) {
    .stats, .gates { grid-template-columns: 1fr 1fr; }
    .operator-form, .voter, .row { grid-template-columns: 1fr; display: grid; }
    h1 { font-size: 32px; }
    .hero-count b { font-size: 48px; }
}
