:root {
  --club-accent: #3b82f6;
  --club-accent-contrast: #ffffff;

  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-danger: #b00020;
  --color-danger-surface: #fdecec;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;

  --radius: 8px;
  --border: 1px solid var(--color-border);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-border: #334155;
    --color-danger: #ff6b6b;
    --color-danger-surface: #3a1c1c;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  max-width: 840px;
  margin: 0 auto;
  padding: 0 var(--space-3) var(--space-5);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

h1, h2, h3 {
  color: var(--color-text);
  line-height: 1.25;
}

h1 { font-size: 1.75rem; margin: var(--space-4) 0 var(--space-3); }
h2 { font-size: 1.25rem; margin: var(--space-4) 0 var(--space-2); }
h3 { font-size: 1.05rem; margin: var(--space-3) 0 var(--space-2); }

a {
  color: var(--club-accent);
}

.error {
  color: var(--color-danger);
  background: var(--color-danger-surface);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

/* Site header / nav (views/partials/header.ejs) */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: var(--border);
  margin-bottom: var(--space-4);
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.site-header .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.site-header form {
  display: inline;
}

/* Forms */
form.stacked {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
}

form.stacked label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.radio-row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  font-size: 0.95rem;
  color: var(--color-text);
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

input[type="color"] {
  width: 3rem;
  height: 2.25rem;
  padding: 2px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

textarea {
  min-height: 6rem;
  font-family: inherit;
}

/* Quill's "snow" theme is a light-UI widget with no dark-mode support of
   its own -- kept as a light "island" regardless of page theme rather than
   fighting its internal styles. */
.quill-editor {
  height: 300px;
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--radius);
}

/* Buttons */
button, .button {
  display: inline-block;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  background: var(--club-accent);
  color: var(--club-accent-contrast);
}

button:hover, .button:hover {
  filter: brightness(0.92);
}

button.secondary, .button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: var(--border);
}

button.danger, .button.danger {
  background: var(--color-danger-surface);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* Cards */
.club-card {
  border: var(--border);
  border-left: 4px solid var(--club-accent);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

.table-scroll table {
  min-width: 480px;
}

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

th, td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border);
  white-space: nowrap;
}

th {
  color: var(--color-text-muted);
  font-weight: 600;
}

section.panel {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  form.stacked {
    max-width: 100%;
  }

  form.stacked > button,
  form.stacked > .button {
    width: 100%;
    text-align: center;
  }

  .actions {
    flex-wrap: wrap;
  }

  .actions button, .actions .button {
    flex: 1 1 auto;
  }

  th, td {
    white-space: normal;
  }
}
