:root {
  --bg-color: #f7f9fa;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --border-color: #d1d5db;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #b91c1c;
  --success: #15803d;
  --focus-ring: #93c5fd;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  padding: 1rem;
}

.site-header {
  max-width: 600px;
  margin: 0 auto 1.5rem auto;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.main-content {
  max-width: 600px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

h1, h2, h3 {
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p {
  margin-bottom: 0.75rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.code-input {
  font-family: monospace;
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Radio buttons & choices */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.choice-label {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  background: #fafafa;
}

.choice-label:hover {
  background: #f3f4f6;
}

.choice-label input[type="radio"] {
  margin-right: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: #ffffff;
  background-color: var(--primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #6b7280;
}

.btn-secondary:hover {
  background-color: #4b5563;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.alert-error {
  background-color: #fee2e2;
  border: 1px solid #f87171;
  color: var(--danger);
}

.alert-success {
  background-color: #dcfce7;
  border: 1px solid #86efac;
  color: var(--success);
}

/* Visibility helpers and ballot/review components */
.hidden {
  display: none !important;
}

.noscript-note {
  margin-top: 1rem;
}

.noscript-btn {
  margin-top: 0.5rem;
}

.review-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.review-actions {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.turnout-box {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f9fafb;
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.table-full-width {
  width: 100%;
}

.card-helpdesk-code {
  background-color: #fff9db;
  border: 2px solid #f59f00;
  padding: 1.5rem;
  margin-top: 1rem;
}

.code-display-large {
  font-size: 2rem;
  font-family: monospace;
  font-weight: bold;
  letter-spacing: 0.15em;
  color: #d9480f;
  margin: 1rem 0;
}

.ballot-position-card {
  border: 1px solid #ccc;
  padding: 1rem;
  margin-bottom: 1rem;
}

.textarea-monospace-full {
  font-family: monospace;
  width: 100%;
}

.codes-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.codes-card-secondary {
  margin: 0;
  background-color: var(--surface-secondary, #f8f9fa);
}

.text-danger-bold {
  color: var(--color-danger, #e03131);
  font-weight: bold;
}

.text-success-bold {
  color: #2b8a3e;
  font-weight: bold;
}

.card-batch-status {
  margin-bottom: 1.5rem;
  background-color: #e7f5ff;
  border: 1px solid #74c0fc;
}

.alert-mt-half {
  margin-top: 0.5rem;
}

.card-send-action {
  border: 2px solid var(--border-color, #dee2e6);
}

.dashboard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-1-5 {
  margin-top: 1.5rem;
}

.site-footer {
  max-width: 600px;
  margin: 2rem auto 0 auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}
