:root {
  --cream: #f5f1e8;
  --maroon: #6b2737;
  --gold: #e8a317;
  --ink: #2a1810;
  --muted: #5a4a3a;
  --border: rgba(42, 24, 16, 0.15);
  --error-bg: #f8d7da;
  --error-fg: #842029;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--maroon);
  color: var(--cream);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 { font-size: 1.25rem; margin: 0; letter-spacing: 0.02em; }
header h1 a { color: inherit; text-decoration: none; }

header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

header .nav-link {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
}
header .nav-link:hover { border-bottom-color: var(--gold); }

header .user-email { font-size: 0.875rem; opacity: 0.85; }

header form { display: inline; margin: 0; }

header button {
  background: var(--gold);
  color: var(--ink);
  border: none;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 4px;
  font-size: 0.875rem;
}

main {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

section h2 { color: var(--maroon); margin-top: 0; }
section h3.month-label {
  color: var(--maroon);
  margin: 2rem 0 0.5rem;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.auth-form {
  max-width: 480px;
  margin: 2rem auto;
  background: var(--card);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(42, 24, 16, 0.08);
}
.auth-form label { display: block; margin: 1rem 0; font-weight: 500; }
.auth-form input,
.auth-form select,
.auth-form textarea {
  display: block;
  margin-top: 0.25rem;
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
}
.auth-form textarea { resize: vertical; }
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  outline: 2px solid var(--maroon);
  outline-offset: -1px;
  border-color: var(--maroon);
}
.auth-form .row {
  display: flex;
  gap: 1rem;
}
.auth-form .row label { flex: 1; }

.auth-form button,
a.button {
  background: var(--maroon);
  color: var(--cream);
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 4px;
  font-size: 1rem;
  display: inline-block;
  text-decoration: none;
  margin-top: 1rem;
}
.auth-form button { width: 100%; }
.auth-form button:hover, a.button:hover { background: #5a1f2c; }

.link-button {
  background: none;
  border: none;
  color: var(--maroon);
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.error {
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

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

.quick-links { list-style: none; padding: 0; }
.quick-links li { margin: 0.5rem 0; }
.quick-links a { color: var(--maroon); font-weight: 500; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  margin-top: 1rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(42, 24, 16, 0.08);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  background: rgba(107, 39, 55, 0.08);
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: none; }

/* --- Member events list --- */

.event-list { list-style: none; padding: 0; margin: 0; }
.event-item { margin: 0.5rem 0; }

.event-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.event-summary:hover { background: #fefbf5; border-color: var(--maroon); }

.event-when {
  color: var(--muted);
  font-size: 0.875rem;
  min-width: 11rem;
  flex-shrink: 0;
}
.event-title { flex: 1; font-weight: 500; }

.event-detail {
  margin: 0 0 0.5rem 1rem;
  border-left: 3px solid var(--gold);
  padding-left: 1rem;
}
.event-detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.4rem;
}
.event-when-full { margin-top: 0; color: var(--muted); font-size: 0.9rem; }
.event-description { white-space: pre-wrap; }

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-meeting { background: #d8e0f0; color: #1f3a6b; }
.badge-social { background: #f5e0d8; color: #6b3a1f; }
.badge-ceremony { background: #f0e0d0; color: #6b4a1f; }
.badge-fundraiser { background: #d0e8d0; color: #1f5b1f; }
.badge-volunteer { background: #e8d0e0; color: #5b1f4a; }
.badge-other { background: #e0e0e0; color: #4a4a4a; }

/* --- M4 additions --- */

.auth-form.wide { max-width: 560px; }

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 !important;
  font-weight: normal !important;
}
.checkbox-row input[type="checkbox"] {
  width: auto !important;
  margin: 0 !important;
}

.reminder-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin: 1.5rem 0 0;
}
.reminder-fieldset legend {
  font-weight: 600;
  color: var(--maroon);
  padding: 0 0.5rem;
}
.reminder-row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0;
}
.reminder-row input[type="text"] {
  margin: 0;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  background: white;
}
.reminder-row input[type="text"]:focus {
  outline: 2px solid var(--maroon);
  outline-offset: -1px;
  border-color: var(--maroon);
}

.success {
  background: #d1e7dd;
  color: #0f5132;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* --- M5 additions: volunteer slot styling --- */

.slot-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.slot-section h4 {
  color: var(--maroon);
  margin: 0 0 0.5rem;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.slot-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.slot-list > li { margin: 0.5rem 0; }

.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}
.slot-info { flex: 1; min-width: 60%; }
.slot-info strong { margin-right: 0.5rem; }
.slot-desc { color: var(--muted); font-size: 0.875rem; display: block; }
.slot-count { color: var(--muted); font-size: 0.875rem; display: block; margin-top: 0.25rem; }

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

.signup-button {
  background: var(--maroon);
  color: var(--cream);
  border: none;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 4px;
  font-size: 0.95rem;
}
.signup-button:hover { background: #5a1f2c; }

.slot-state.signed-up {
  color: #1f5b1f;
  background: #d0e8d0;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}
.slot-state.muted { color: var(--muted); font-size: 0.9rem; }

/* --- Admin volunteer overview --- */

.admin-event-block {
  margin: 2rem 0;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.admin-event-block:last-child { border-bottom: none; }
.admin-event-block h3 { color: var(--maroon); margin-bottom: 0.5rem; }

.slot-admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin: 0.75rem 0;
}
.slot-admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.slot-admin-header strong { color: var(--ink); }

.data-table.compact th, .data-table.compact td {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.cancelled-row td { color: var(--muted); text-decoration: line-through; }
.cancelled-row td:last-child { text-decoration: none; }

.manual-add { margin-top: 0.75rem; }
.manual-add summary { color: var(--maroon); cursor: pointer; font-size: 0.875rem; }
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.inline-form select {
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 16rem;
}
.inline-form button {
  background: var(--maroon);
  color: var(--cream);
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 4px;
  font-size: 0.875rem;
}

.slot-add-form { margin-top: 1rem; }
.slot-add-form .row .capacity-label { flex: 0 0 7rem; }

@media (max-width: 480px) {
  .slot-row { flex-direction: column; align-items: stretch; }
  .slot-action { width: 100%; }
  .slot-action form { width: 100%; }
  .signup-button { width: 100%; }
}

/* --- M6 additions: requests --- */

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.status-submitted { background: #d8e0f0; color: #1f3a6b; }
.status-in_progress { background: #fff3cd; color: #6b4a1f; }
.status-completed { background: #d0e8d0; color: #1f5b1f; }
.status-cancelled { background: #e0e0e0; color: #4a4a4a; }

.status-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.status-pill {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  background: white;
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
}
.status-pill.active { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.status-pill:hover { border-color: var(--maroon); }

.filter-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin: 1rem 0; }
.filter-form label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 500; font-size: 0.875rem; }
.filter-form select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; background: white; min-width: 12rem; }
.filter-form a { color: var(--maroon); font-size: 0.875rem; padding-bottom: 0.4rem; }

.request-meta {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.4rem 1rem;
  margin: 1rem 0;
}
.request-meta dt { color: var(--muted); font-size: 0.875rem; }
.request-meta dd { margin: 0; }

.admin-actions { margin: 1rem 0; }

.field-error {
  color: var(--error-fg);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* --- M7 additions: deadlines --- */

.deadline-section {
  color: var(--maroon);
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}
.overdue-heading { color: var(--error-fg); }
.due-soon-heading { color: #b07a1b; }
.muted-heading { color: var(--muted); }

.status-overdue { background: #f8d7da; color: #842029; }
.status-due_soon { background: #fff3cd; color: #6b4a1f; }
.status-upcoming { background: #d8e0f0; color: #1f3a6b; }

tr.status-row-overdue { background: rgba(248, 215, 218, 0.35); }
tr.status-row-due_soon { background: rgba(255, 243, 205, 0.35); }
tr.status-row-completed td { color: var(--muted); }
