*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f4f5;
  color: #18181b;
  line-height: 1.5;
}

.nav {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e4e4e7;
}

.nav a {
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  color: #52525b;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.nav a:hover {
  background: #f4f4f5;
  color: #18181b;
}

.nav a.active {
  background: #18181b;
  color: #fff;
}

.container {
  max-width: 32rem;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
}

.container-wide {
  max-width: 52rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: #71717a;
  font-size: 0.95rem;
}

.section {
  margin-bottom: 2.5rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e4e4e7;
  margin-bottom: 2.5rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-inline {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e4e4e7;
}

.inline-row {
  display: flex;
  gap: 0.5rem;
}

.inline-row input {
  flex: 1;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d4d4d8;
  border-radius: 0.5rem;
  font: inherit;
}

input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d4d4d8;
  border-radius: 0.5rem;
  font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid #3b82f6;
  border-color: #3b82f6;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e4e4e7;
}

.admin-nav a {
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  color: #52525b;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.admin-nav a:hover {
  background: #f4f4f5;
  color: #18181b;
}

.admin-nav a.active {
  background: #18181b;
  color: #fff;
}

.admin-logout {
  margin-left: auto;
}

fieldset {
  border: 1px solid #e4e4e7;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 0;
}

legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.candidate-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 400;
}

.candidate-option:hover {
  background: #f4f4f5;
}

.candidate-option input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #18181b;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  background: #18181b;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #27272a;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: #18181b;
  border: 1px solid #d4d4d8;
}

.btn-secondary:hover {
  background: #f4f4f5;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.hint {
  margin: 0;
  color: #71717a;
  font-size: 0.875rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.result-box {
  padding: 1rem 1.25rem;
  background: #f4f4f5;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.result-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.choice-list {
  margin: 0;
  padding-left: 1.25rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e4e4e7;
  vertical-align: middle;
}

.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #71717a;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input {
  min-width: 10rem;
}

.text-muted {
  color: #71717a;
  font-size: 0.875rem;
  white-space: nowrap;
}

.bar-cell {
  width: 30%;
}

.bar {
  height: 0.5rem;
  background: #18181b;
  border-radius: 999px;
  min-width: 0;
}

@media (max-width: 640px) {
  .container,
  .container-wide {
    margin: 1rem;
    padding: 1.25rem;
  }

  .nav {
    flex-wrap: wrap;
  }

  .inline-row,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .bar-cell {
    display: none;
  }
}
