:root {
  --blue: #1a73e8;
  --blue-dark: #174ea6;
  --ink: #202124;
  --ink-light: #5f6368;
  --border: #dadce0;
  --bg: #f8f9fa;
  --card: #ffffff;
  --green: #188038;
  --red: #d93025;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Roboto', -apple-system, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 8px;
}

.topbar h1 {
  font-size: 20px;
  margin: 0;
  color: var(--ink);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  border-top: 10px solid var(--blue);
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -20px -20px 16px -20px;
  padding: 20px 20px 0;
}

h2 { font-size: 18px; margin: 0 0 4px; }
.question-text { font-size: 17px; font-weight: 500; margin: 0 0 16px; }
.muted { color: var(--ink-light); font-size: 14px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
}
.btn:hover { background: var(--blue-dark); }
.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--border);
}
.btn-danger { background: var(--red); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

input[type=text], input[type=password], input[type=tel] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 12px;
  font-family: inherit;
}
input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
label { font-size: 13px; color: var(--ink-light); display: block; margin-bottom: 4px; }

.flash-wrap { margin-bottom: 12px; }
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 8px;
}
.flash-error { background: #fce8e6; color: var(--red); }
.flash-ok { background: #e6f4ea; color: var(--green); }

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.person {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 6px;
  border-radius: 8px;
  font-family: inherit;
}
.person:active { background: #f1f3f4; }

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #e8eaed;
}
.avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  font-size: 24px;
  font-weight: 500;
  border: 2px solid var(--border);
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.check-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.person.selected {
  background: #e6f4ea;
  box-shadow: 0 0 0 2px var(--green);
}
.person.selected .avatar,
.person.selected .avatar-fallback {
  border-color: var(--green);
  border-width: 3px;
}
.person.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

@keyframes vote-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.person.just-voted {
  animation: vote-pop 0.35s ease;
}
.person-name { font-size: 12px; line-height: 1.2; }

.closed-banner {
  background: #fef7e0;
  color: #856404;
  border: 1px solid #fdd663;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.vote-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: 20px;
  background: #e6f4ea;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease;
}
.vote-check.is-saved {
  opacity: 1;
  max-height: none;
}
.vote-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

nav.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
nav.admin-nav a {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--ink);
}
nav.admin-nav a.active { background: var(--blue); color: #fff; border-color: var(--blue); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.inline-form { display: inline; }

.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.toggle-status {
  font-weight: 500;
}
.status-open { color: var(--green); }
.status-closed { color: var(--red); }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .avatar, .list-item .avatar-fallback { width: 44px; height: 44px; font-size: 16px; }
.list-item-grow { flex: 1; min-width: 0; }
.list-item-grow form { margin: 0; }

.tally-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tally-bar-wrap { flex: 1; background: #f1f3f4; border-radius: 4px; overflow: hidden; height: 28px; }
.tally-bar { background: var(--blue); height: 100%; display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tally-label { width: 110px; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tally-count { width: 28px; text-align: right; font-size: 13px; color: var(--ink-light); }

.chart-wrap { max-width: 320px; margin: 0 auto 20px; }

.footer-note { text-align: center; margin-top: 24px; }
