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

:root {
  --navy:       #1a3055;
  --navy-dark:  #142440;
  --orange:     #f97316;
  --green:      #22c55e;
  --yellow:     #eab308;
  --red:        #ef4444;
  --bg:         #ffffff;
  --surface:    #ffffff;
  --text:       #111111;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: white;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.logo-event {
  font-weight: 300;
}
.header-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ── Layout ── */
.container      { max-width: 680px;  margin: 2.5rem auto; padding: 0 1.25rem; }
.container-wide { max-width: 1100px; margin: 2.5rem auto; padding: 0 1.25rem; }

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
}

/* ── Form elements ── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

select,
input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--navy);
}
select:disabled { opacity: 0.45; }

/* ── Vote counters — NDC navy card style ── */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.vote-counter {
  background: var(--navy);
  border-radius: 10px;
  padding: 1.25rem 0.5rem 1rem;
  text-align: center;
  border-bottom: 4px solid transparent;
}
.vote-counter.green  { border-color: var(--green); }
.vote-counter.yellow { border-color: var(--yellow); }
.vote-counter.red    { border-color: var(--red); }

.vote-label {
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.875rem;
}

.vote-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

input.vote-display {
  font-size: 2rem;
  font-weight: 800;
  width: 3rem;
  line-height: 1;
  color: white;
  text-align: center;
  border: none;
  background: transparent;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
input.vote-display::-webkit-outer-spin-button,
input.vote-display::-webkit-inner-spin-button { -webkit-appearance: none; }
input.vote-display:focus { outline: none; }

.vote-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1;
  touch-action: manipulation;
}
.vote-btn:active         { transform: scale(0.85); }
.vote-btn.minus          { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.65); }
.vote-btn.minus:active   { background: rgba(255,255,255,0.2); }

.vote-counter.green  .vote-btn.plus { background: var(--green);  color: white; }
.vote-counter.yellow .vote-btn.plus { background: var(--yellow); color: white; }
.vote-counter.red    .vote-btn.plus { background: var(--red);    color: white; }

/* ── Buttons — pill style ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 100px;
  border: 1.5px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn:active         { transform: scale(0.97); }
.btn-primary        { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover  { background: var(--navy-dark); border-color: var(--navy-dark); }
.btn-secondary      { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text); }
.btn:disabled       { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Remember row ── */
.remember-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.625rem;
}
.remember-row input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--navy);
  cursor: pointer;
  flex-shrink: 0;
}
.remember-row label {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Alerts ── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.875rem;
  display: none;
}
.alert.show    { display: block; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Dashboard ── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.dash-title      { font-size: 1.75rem; font-weight: 900; letter-spacing: -0.02em; }
.dash-event-name { font-weight: 300; font-size: 1.75rem; }
.dash-meta       { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: white;
}
td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

.vote-count   { font-weight: 800; font-size: 1rem; }
.green-count  { color: #16a34a; }
.yellow-count { color: #ca8a04; }
.red-count    { color: #dc2626; }
.total-count  { color: var(--text-muted); }

.dist-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
  background: var(--border);
}
.dist-bar .g { background: var(--green); }
.dist-bar .y { background: var(--yellow); }
.dist-bar .r { background: var(--red); }

.talk-title { font-weight: 700; }
.talk-meta  { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.volunteer-tag {
  display: inline-block;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  margin-right: 2px;
}

/* Google sign-in button */
.google-btn {
  background: white;
  color: #3c4043;
  border: 1.5px solid var(--border);
  font-weight: 600;
  gap: 0.75rem;
  justify-content: center;
}
.google-btn:hover { background: #f8fafc; border-color: #c0c0c0; }

/* Totals bar */
.totals-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.total-pill {
  flex: 1;
  min-width: 100px;
  background: var(--navy);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border-bottom: 4px solid;
}
.total-pill.green-pill  { border-color: var(--green); }
.total-pill.yellow-pill { border-color: var(--yellow); }
.total-pill.red-pill    { border-color: var(--red); }
.total-pill-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.375rem;
}
.total-pill-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: white;
}

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}
.sort-btn {
  padding: 0.35rem 0.875rem;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  touch-action: manipulation;
}
.sort-btn:hover  { border-color: var(--navy); color: var(--navy); }
.sort-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

/* Crew manager */
.volunteer-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.volunteer-row:last-child { border-bottom: none; }
.vol-name { font-weight: 600; flex: 1; min-width: 120px; }
.vol-code {
  font-family: ui-monospace, monospace;
  background: #f1f5f9;
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.875rem;
}
.delete-vol {
  padding: 0.3rem 0.875rem;
  font-size: 0.8rem;
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
  border-radius: 100px;
}
.delete-vol:hover { border-color: #dc2626; }

/* ── Password gate ── */
.password-gate-wrap { max-width: 420px; margin: 5rem auto; padding: 0 1.25rem; }
.password-gate-wrap h2 { font-size: 1.75rem; font-weight: 900; margin-bottom: 0.375rem; }
.password-error { color: #dc2626; font-size: 0.875rem; min-height: 1.25rem; margin-bottom: 0.75rem; }

/* ── Landing ── */
.landing         { text-align: center; padding: 7rem 1rem; }
.landing h2      { font-size: 2.5rem; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.landing p       { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1.05rem; }
.landing-buttons { display: flex; gap: 0.875rem; justify-content: center; flex-wrap: wrap; }

/* ── Nav ── */
.nav-link       { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.nav-link:hover { color: var(--text); }

.loading-text {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
  font-size: 0.9rem;
}

.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile ── */
@media (max-width: 600px) {
  header { padding: 1rem; }
  .container, .container-wide { margin: 1.5rem auto; }
  .card { padding: 1.25rem; }
  .dash-title, .dash-event-name { font-size: 1.35rem; }
}
