/* ── Theme Variables ── */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);

  /* tag colors */
  --tag-prospect-bg: #fef3c7; --tag-prospect-text: #92400e;
  --tag-member-bg: #dbeafe;   --tag-member-text: #1e40af;
  --tag-admin-bg: #fee2e2;    --tag-admin-text: #991b1b;
  --tag-president-bg: #fce7f3;--tag-president-text: #9d174d;
  --tag-active-bg: #dcfce7;   --tag-active-text: #166534;
  --tag-passive-bg: #fef3c7;  --tag-passive-text: #92400e;
  --tag-inactive-bg: #e5e7eb; --tag-inactive-text: #374151;

  /* calendar accent colors */
  --cal-party: #f59e0b;
  --cal-party-hover: #d97706;
  --cal-meeting: #10b981;
  --cal-bar: #f59e0b;
  --cal-bar-hover: #d97706;

  /* dues */
  --dues-paid: #16a34a;
  --dues-unpaid: #cbd5e1;
  --saved-border: #16a34a;

  /* misc */
  --btn-secondary-hover: #d1d5db;
  --cal-other-month-bg: #f9fafb;
  --modal-bg: rgba(0,0,0,0.4);
  --modal-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* ── Dark Theme (Bike Club) ── */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --text: #e8e6e3;
  --muted: #8a8a8a;
  --border: #2a2a2a;
  --accent: #e85d04;
  --accent-hover: #f48c06;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --shadow: 0 1px 3px rgba(0,0,0,0.5);

  /* tag colors — dark backgrounds, brighter text */
  --tag-prospect-bg: #451a03; --tag-prospect-text: #fcd34d;
  --tag-member-bg: #172554;   --tag-member-text: #93c5fd;
  --tag-admin-bg: #450a0a;    --tag-admin-text: #fca5a5;
  --tag-president-bg: #4a044e;--tag-president-text: #f0abfc;
  --tag-active-bg: #052e16;   --tag-active-text: #86efac;
  --tag-passive-bg: #451a03;  --tag-passive-text: #fcd34d;
  --tag-inactive-bg: #1f1f1f; --tag-inactive-text: #a3a3a3;

  /* calendar */
  --cal-party: #d97706;
  --cal-party-hover: #b45309;
  --cal-meeting: #059669;
  --cal-bar: #d97706;
  --cal-bar-hover: #b45309;

  /* dues */
  --dues-paid: #22c55e;
  --dues-unpaid: #525252;
  --saved-border: #22c55e;

  /* misc */
  --btn-secondary-hover: #404040;
  --cal-other-month-bg: #0f0f0f;
  --modal-bg: rgba(0,0,0,0.7);
  --modal-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

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

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

/* Nav */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
}
.nav-logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  border-radius: 4px;
  background-color: transparent !important;
}
.nav-logo.hidden {
  display: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

.nav-user { display: flex; align-items: center; gap: 0.75rem; }
.nav-user span { font-size: 0.85rem; color: var(--muted); }
.nav-user-mobile { display: none; }

/* Views */
.view { padding: 1.5rem; max-width: 960px; margin: 0 auto; }
.view.hidden { display: none; }

.hidden { display: none !important; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card.centered {
  max-width: 380px;
  margin: 10vh auto;
  text-align: center;
}
.card h1 { margin-bottom: 1.5rem; font-size: 1.5rem; }
.card h2 { margin-bottom: 1rem; font-size: 1.25rem; }

/* Forms */
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}
.date-display {
  display: block;
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ---------- RSVP ---------- */
.rsvp-capacity { margin-bottom: 0.5rem; }
.capacity-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.capacity-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}
.capacity-text {
  font-size: 0.8rem;
  color: var(--muted);
}
.rsvp-counts {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.rsvp-count { color: var(--muted); }
.rsvp-count.going { color: var(--success); font-weight: 600; }
.rsvp-count.maybe { color: var(--warning, #f59e0b); font-weight: 600; }
.rsvp-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.rsvp-buttons button {
  margin: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.rsvp-buttons button.active {
  background: var(--accent);
  color: #fff;
}
.rsvp-list {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Weather ---------- */
.weather-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.weather-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.weather-icon {
  font-size: 2rem;
  line-height: 1;
}
.weather-temp {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}
.weather-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
  color: var(--muted);
}
input.input-error, select.input-error { border-color: var(--danger); }
input.input-error:focus, select.input-error:focus { border-color: var(--danger); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  nav { flex-wrap: nowrap; padding: 0.5rem 1rem; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    z-index: 100;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.5rem 0; font-size: 1rem; border-bottom: 1px solid var(--border); }
  .nav-links a:last-of-type { border-bottom: none; }
  .nav-user { display: none; }
  .nav-user-mobile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  transition: background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--btn-secondary-hover); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  background: var(--border);
  color: var(--text);
}
.btn-small:hover { background: var(--btn-secondary-hover); }

.actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

.hint { margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.hint a { color: var(--accent); text-decoration: none; }

.error { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }
.success { color: var(--success); font-size: 0.85rem; margin-top: 0.5rem; }

/* Profile */
#profile-display label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
  margin-top: 0.75rem;
}
#profile-display .value {
  font-size: 0.95rem;
  word-break: break-word;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  background: var(--bg);
}

th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.25rem;
}

th.sortable::after {
  content: '↕';
  position: absolute;
  right: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

th.sortable.asc::after {
  content: '↑';
  color: var(--accent);
}

th.sortable.desc::after {
  content: '↓';
  color: var(--accent);
}

tr:hover td { background: var(--bg); }

td .btn-small { margin-right: 0.25rem; }

/* Actions cell */
.actions-cell {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.actions-cell .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.actions-cell select {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  margin-bottom: 0;
  width: auto;
}

/* Table columns */
#members-table th:nth-child(1),
#members-table td:nth-child(1) { width: 10%; }
#members-table th:nth-child(2),
#members-table td:nth-child(2) { width: 14%; }
#members-table th:nth-child(3),
#members-table td:nth-child(3) { width: 18%; }
#members-table th:nth-child(4),
#members-table td:nth-child(4) { width: 12%; }
#members-table th:nth-child(5),
#members-table td:nth-child(5) { width: 10%; }
#members-table th:nth-child(6),
#members-table td:nth-child(6) { width: 8%; }
#members-table th:nth-child(7),
#members-table td:nth-child(7) { width: 8%; }
#members-table th:nth-child(8),
#members-table td:nth-child(8) { width: 20%; }

@media (max-width: 900px) {
  #members-table { display: block; overflow-x: auto; white-space: nowrap; }
  #members-table th:nth-child(3),
  #members-table td:nth-child(3) { min-width: 180px; }
  #members-table th:nth-child(8),
  #members-table td:nth-child(8) { min-width: 160px; }
}

td .tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.tag-prospect { background: var(--tag-prospect-bg); color: var(--tag-prospect-text); }
.tag-member { background: var(--tag-member-bg); color: var(--tag-member-text); }
.tag-admin { background: var(--tag-admin-bg); color: var(--tag-admin-text); }
.tag-president { background: var(--tag-president-bg); color: var(--tag-president-text); }

.tag-active { background: var(--tag-active-bg); color: var(--tag-active-text); }
.tag-passive { background: var(--tag-passive-bg); color: var(--tag-passive-text); }
.tag-inactive { background: var(--tag-inactive-bg); color: var(--tag-inactive-text); }

/* Bar Duty */
.bar-duty-card {
  margin-bottom: 1rem;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
}
.bar-duty-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.bar-duty-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.9;
}
.bar-duty-value {
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
}
.bar-duty-dates {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Calendar */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.calendar-header h2 {
  margin: 0;
  font-size: 1.25rem;
}
.calendar-subscribe {
  text-align: right;
  margin-bottom: 0.75rem;
}
.calendar-subscribe a {
  text-decoration: none;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-day-label {
  background: var(--bg);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem;
}
.cal-day {
  background: var(--surface);
  min-height: 90px;
  padding: 0.4rem;
  position: relative;
  cursor: pointer;
}
.cal-day:hover {
  background: var(--bg);
}
.cal-day.other-month {
  color: var(--muted);
  background: var(--cal-other-month-bg);
}
.cal-day .cal-date {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.cal-day.today .cal-date {
  color: var(--accent);
}
.cal-event {
  font-size: 0.7rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cal-event:hover {
  background: var(--accent-hover);
}
.cal-event.type-ride {
  background: var(--accent);
}
.cal-event.type-party {
  background: var(--cal-party);
}
.cal-event.type-meeting {
  background: var(--cal-meeting);
}
.cal-event.type-general {
  background: var(--accent);
}
.cal-event.type-club_closed {
  background: var(--danger);
  opacity: 0.7;
}
.cal-bar {
  font-size: 0.7rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  background: var(--cal-bar);
  color: #fff;
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cal-bar:hover {
  background: var(--cal-bar-hover);
}

/* Bar Duty */
.bar-duty-layout {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
}
.bar-duty-sidebar {
  min-width: 260px;
  max-width: 360px;
}
.bar-duty-sidebar h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.crew-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.bike-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.bike-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.bike-item .bike-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.bike-item .bike-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.bike-item .bike-details {
  font-size: 0.75rem;
  color: var(--muted);
}
.bike-item .bike-actions-inline {
  display: flex;
  gap: 0.3rem;
}
.bike-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.4rem;
  margin: 0.5rem 0;
  width: 100%;
}
.bike-gallery-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
}
.bike-gallery-thumb:hover {
  opacity: 0.85;
}
.bike-gallery-wrap {
  position: relative;
  display: inline-block;
}
.bike-gallery-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
  display: none;
  padding: 0;
}
.bike-gallery-wrap:hover .bike-gallery-del {
  display: block;
}
.bike-photo-preview {
  max-width: 100%;
  max-height: 150px;
  border-radius: var(--radius);
  margin: 0.5rem 0;
}

/* ---------- Profile Avatars ---------- */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.profile-avatar-actions {
  display: flex;
  gap: 0.5rem;
}
.member-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 0.5rem;
}
.detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  margin-bottom: 0.5rem;
}

.crew-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crew-item .crew-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.crew-item .crew-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.crew-item .crew-members {
  font-size: 0.75rem;
  color: var(--muted);
}
.crew-item .crew-actions-inline {
  display: flex;
  gap: 0.3rem;
}
.crew-item .crew-actions-inline button {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}
.crew-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.crew-members-select {
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--bg);
}
.crew-member-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}
.crew-member-option input {
  margin: 0;
}
.generate-area {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.special-events-area {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.special-events-area h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.special-events-area input[type="date"],
.special-events-area select {
  width: 100%;
  margin-bottom: 0.5rem;
}
.special-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}
.special-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.crew-members-select {
  width: 100%;
  min-height: 100px;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  background: var(--surface);
  font-size: 0.85rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--modal-shadow);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
#modal-detail .modal-content {
  max-width: 460px;
}
.modal-content h3 { margin-bottom: 1rem; }

/* Detail modal */
#detail-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.detail-header .detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.detail-header .detail-badges {
  display: flex;
  gap: 0.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 120px;
}

.detail-row .detail-value {
  font-size: 0.95rem;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.modal-content label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
  margin-top: 0.6rem;
}
.modal-content input {
  margin-bottom: 0.3rem;
}
.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Ride Stats */
.ride-stats {
  display: flex;
  gap: 2rem;
  margin-top: 0.5rem;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* Event Detail Modal */
.event-detail-content {
  max-width: 480px;
}
.event-detail-body {
  margin-bottom: 1rem;
}
.event-detail-body p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.event-detail-body .event-meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.maps-link {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}
.maps-link:hover {
  text-decoration: underline;
}
.attendance-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--bg);
}
.attendance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.attendance-row:last-child {
  border-bottom: none;
}
.attendance-row input[type="checkbox"] {
  margin: 0;
}
.attendance-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
}
.attendance-row .attendance-name {
  font-weight: 500;
}
.attendance-row .attendance-count {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Announcements ---------- */
.announce-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.announce-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
}
.announce-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.announce-head h3 {
  margin: 0;
  font-size: 1rem;
}
.announce-body {
  margin: 0.4rem 0;
  white-space: pre-wrap;
  color: var(--text);
}
.announce-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}
#form-announce textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
}

/* ---------- Home / Landing ---------- */
.club-closed-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  margin-bottom: 1rem;
}
.club-closed-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fca5a5;
}
.club-closed-icon {
  font-size: 1.5rem;
}

.verify-banner {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
}
.verify-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.verify-banner-content span {
  color: #fde047;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem 2rem;
  min-height: 50vh;
}
.landing-logo {
  max-height: 150px;
  max-width: 300px;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
}
.landing-hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.landing-age {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.landing-desc {
  color: var(--muted);
  max-width: 500px;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.landing-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.landing-actions button {
  min-width: 120px;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.home-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.home-hero h1 {
  margin: 0;
}
.home-club-age {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-weight: 500;
}
.settings-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.settings-group label {
  min-width: 100px;
  font-weight: 500;
}

.home-founded-edit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.home-founded-edit label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.home-grid .card {
  margin: 0;
}
.home-gallery-card {
  grid-column: 1 / -1;
}
.home-list {
  display: flex;
  flex-direction: column;
}
.home-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.home-row:last-child {
  border-bottom: none;
}
.home-row-primary {
  font-weight: 500;
}
.home-row-secondary {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ---------- Treasury ---------- */
.treasury-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.treasury-charge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.treasury-charge label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
#treasury-table .fee-input {
  width: 90px;
  padding: 0.25rem 0.4rem;
}
#treasury-table .fee-input.saved {
  border-color: var(--saved-border);
}
.bal-owes { color: var(--danger); font-weight: 600; }
.bal-credit { color: var(--success); font-weight: 600; }

.home-dues {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.home-dues-balance {
  font-size: 1.6rem;
  font-weight: 700;
}
.home-dues-balance.owes { color: var(--danger); }
.home-dues-balance.credit { color: var(--success); }

.ledger-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.ledger-balance { font-weight: 600; }
.ledger-record {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}
.ledger-record input { flex: 1; min-width: 100px; }
#ledger-table { width: 100%; }
#ledger-table td, #ledger-table th { padding: 0.4rem 0.5rem; font-size: 0.85rem; }

/* ---------- Dues grid ---------- */
.treasury-months { display: flex; align-items: center; gap: 0.5rem; }
.treasury-months label { margin: 0; font-size: 0.8rem; color: var(--muted); }
.dues-grid-wrap { overflow-x: auto; }
#dues-grid { width: 100%; border-collapse: collapse; }
#dues-grid th, #dues-grid td { padding: 0.4rem 0.6rem; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
#dues-grid th:nth-child(1), #dues-grid td:nth-child(1),
#dues-grid th:nth-child(2), #dues-grid td:nth-child(2) { text-align: left; }
#dues-grid .fee-input { width: 90px; padding: 0.25rem 0.4rem; }
#dues-grid .fee-input.saved { border-color: var(--saved-border); }
.dues-cell { cursor: pointer; font-weight: 700; user-select: none; }
.dues-cell.paid { color: var(--dues-paid); }
.dues-cell.unpaid { color: var(--dues-unpaid); }
.dues-cell:hover { background: var(--bg); }
.dues-cell.dues-skip { cursor: default; opacity: 0.2; }
.dues-cell.dues-skip:hover { background: transparent; }

/* ---------- Minutes ---------- */
.minutes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.minutes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}
.minute-item {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.minute-item:hover {
  background: var(--bg);
  border-color: var(--accent);
}
.minute-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: var(--fg);
}
.minute-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.minute-preview {
  font-size: 0.9rem;
  color: var(--fg);
  opacity: 0.85;
  line-height: 1.5;
  max-height: 3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.minute-detail {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.95rem;
}
.minute-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.minutes-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Minutes attendees */
.minute-attendees {
  font-size: 0.85rem;
  color: var(--fg);
  margin-top: 0.5rem;
}
.minute-attendees-label {
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Attachments ---------- */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.attachment-item a {
  color: var(--accent);
  text-decoration: none;
  flex: 1;
}
.attachment-item a:hover {
  text-decoration: underline;
}
.attachment-size {
  font-size: 0.8rem;
  color: var(--muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0.5rem 0;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ---------- Attendee checkboxes ---------- */
.attendee-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--card);
  margin: 0.5rem 0 1rem;
}
.attendee-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0;
}
.attendee-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Audit Log ---------- */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
.audit-entry {
  display: grid;
  grid-template-columns: 140px 1fr 120px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.audit-entry-time {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.audit-entry-action {
  font-weight: 600;
  color: var(--accent);
}
.audit-entry-detail {
  color: var(--fg);
  opacity: 0.9;
}
.audit-entry-actor {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

/* ---------- Home bar duty ---------- */
.bar-duty-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.bar-duty-slot:last-child {
  border-bottom: none;
}
.bar-duty-slot-date {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.bar-duty-slot-crew {
  color: var(--fg);
  text-align: right;
}

/* ---------- Member count ---------- */
.member-count {
  text-align: center;
  padding: 0.5rem 0;
}
.member-count-total {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.member-count-breakdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.member-count-breakdown span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.member-count-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.member-count-dot.active { background: var(--success); }
.member-count-dot.passive { background: var(--warning); }
.member-count-dot.inactive { background: var(--danger); }

/* ---------- Home audit ---------- */
.home-audit-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  gap: 0.5rem;
}
.home-audit-entry:last-child {
  border-bottom: none;
}
.home-audit-action {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.home-audit-target {
  color: var(--fg);
  flex: 1;
  text-align: center;
}
.home-audit-actor {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.8rem;
}

/* ---------- Club logo ---------- */
.home-hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.home-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--radius);
  background-color: transparent !important;
}
.home-logo.hidden {
  display: none;
}
.login-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin: 0 auto 1rem;
  display: block;
  border-radius: var(--radius);
  background-color: transparent !important;
}
.login-logo.hidden {
  display: none;
}

/* ---------- Markdown rendering for minutes ---------- */
.markdown-body {
  line-height: 1.7;
  color: var(--text);
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.markdown-body h1 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { margin: 0.75rem 0; }
.markdown-body ul,
.markdown-body ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.markdown-body li { margin: 0.25rem 0; }
.markdown-body a { color: var(--accent); text-decoration: underline; }
.markdown-body a:hover { color: var(--accent-hover); }
.markdown-body code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.9em;
}
.markdown-body pre {
  background: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.75rem 0;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
}
.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.75rem 0;
  padding-left: 1rem;
  color: var(--muted);
}
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.markdown-body strong { color: var(--text); }

/* ---------- Treasury bulk fee ---------- */
.treasury-bulk-fee {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.treasury-bulk-fee label {
  font-size: 0.85rem;
  color: var(--muted);
}
.treasury-bulk-fee input {
  width: 100px;
  padding: 0.35rem 0.5rem;
}

/* ---------- Payment history ---------- */
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.history-row:last-child { border-bottom: none; }
.history-period { color: var(--muted); min-width: 80px; }
.history-status { font-weight: 600; }
.history-status.success { color: var(--success); }
.history-status.danger { color: var(--danger); }
.history-amount { font-weight: 600; color: var(--text); }

/* ---------- Member detail payment history ---------- */
.detail-history {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.detail-history h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--accent);
}

/* ---------- Photo Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden {
  display: none !important;
}
.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2001;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-bar {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0,0,0,0.6);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  z-index: 2001;
}
