:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #2a2623;
  --muted: #6e665f;
  --accent: #b4532a;
  --border: #e6e0d8;
  --radius: 8px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.site-header {
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.site-main {
  max-width: 48rem;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-header h1 { margin: 0; }
.page-header .subtitle { margin: 0.25rem 0 1.5rem; color: var(--muted); }

.card {
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2 { margin-top: 0; font-size: 1.1rem; }

/* Header and navigation */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.current-user { color: var(--muted); font-size: 0.9rem; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Cards */
.card + .card { margin-top: 1rem; }
.card.narrow { max-width: 24rem; margin: 3rem auto; }

/* Flash messages */
.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
}

.flash-notice { background: #eef6ee; border-color: #b9d8b9; color: #2d5a2d; }
.flash-alert { background: #fbeeee; border-color: #e4b9b9; color: #7a2626; }

/* Forms */
fieldset {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.field input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  font: inherit;
  background: var(--surface);
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field-error input { border-color: #c0392b; }
.error-message { margin: 0.25rem 0 0; color: #c0392b; font-size: 0.85rem; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: calc(var(--radius) / 2);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

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

form.inline { display: inline; }

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

.link-button:hover { color: var(--accent); }

/* Detail lists */
.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* Wider layout for lists */
.site-main { max-width: 64rem; }

h2 { font-size: 1.1rem; margin-top: 0; }

.field textarea,
.filters input,
.filters select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  font: inherit;
  background: var(--surface);
}

.field textarea { width: 100%; resize: vertical; }
.field-error textarea { border-color: #c0392b; }

.field-row {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
}

/* Radio groups */
.radio-group legend {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.radio-options { display: flex; gap: 1.5rem; }
.radio-options label { cursor: pointer; }

/* Hide person-only fields when "Firma" is selected; no JavaScript needed. */
.contact-form:has(input[name="contact[kind]"][value="company"]:checked) .person-only { display: none; }

/* Filters above a list */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filters input[type="search"] { flex: 1; min-width: 14rem; }

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

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.table th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg); }
.table a { color: var(--text); font-weight: 500; }

.empty { color: var(--muted); }

.danger-zone { margin-top: 2rem; }
.link-button.danger { color: #c0392b; }

/* Checkboxes */
.checkbox-field label,
.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-field input,
.filter-checkbox input { width: auto; margin: 0; }

/* General */
.muted, .hint { color: var(--muted); }
.hint { margin-top: 0; font-size: 0.9rem; }
.list-section + .list-section { margin-top: 2rem; }
.page-header .actions { display: flex; gap: 0.5rem; }

.field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  font: inherit;
  background: var(--surface);
}

.field-row.equal { grid-template-columns: 1fr 1fr; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }

.table .number { text-align: right; white-space: nowrap; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border);
}

.badge-open { background: #eef6ee; border-color: #b9d8b9; color: #2d5a2d; }
.badge-full { background: #fdf3e6; border-color: #ecd0a6; color: #7a4d12; }
.badge-cancelled { background: #fbeeee; border-color: #e4b9b9; color: #7a2626; }

/* Workshop days in the form */
.day-rows { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }

.day-row {
  display: grid;
  grid-template-columns: 1fr 8rem 8rem auto;
  align-items: end;
  gap: 0.75rem;
}

.day-row[hidden] { display: none; }
.day-row .error-message { grid-column: 1 / -1; }

.day-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.day-field input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  font: inherit;
  background: var(--surface);
}

.field-error .day-field input { border-color: #c0392b; }
.remove-day { padding: 0.5rem; font-size: 1rem; }
fieldset > .button.secondary { margin-bottom: 1rem; }

/* Workshop page */
.workshop-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.workshop-overview .card + .card { margin-top: 0; }
.day-list { margin: 0 0 0.75rem; padding-left: 1.1rem; }
.day-list li + li { margin-top: 0.25rem; }

@media (max-width: 40rem) {
  .workshop-overview,
  .field-row,
  .field-row.equal,
  .field-row.three { grid-template-columns: 1fr; }
  .day-row { grid-template-columns: 1fr 1fr; }
}

/* Markdown content */
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown table { margin: 0 0 0.75rem; }
.markdown ul, .markdown ol { padding-left: 1.25rem; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
.markdown h1, .markdown h2 { font-size: 1.05rem; }
.markdown a { color: var(--accent); }
.markdown blockquote { padding-left: 1rem; border-left: 3px solid var(--border); color: var(--muted); }
.markdown table { border-collapse: collapse; }
.markdown th, .markdown td { padding: 0.3rem 0.6rem; border: 1px solid var(--border); text-align: left; }
.markdown code, .hint code { padding: 0 0.25rem; border-radius: 3px; background: var(--bg); font-size: 0.9em; }

/* Enrollments */
.badge-confirmed { background: #eef6ee; border-color: #b9d8b9; color: #2d5a2d; }
.badge-waitlisted { background: #fdf3e6; border-color: #ecd0a6; color: #7a4d12; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-header h2 { margin: 0; }
.card h3 { margin: 1.5rem 0 0.75rem; font-size: 1rem; }
.card > .table { border: 0; }
.table.compact th, .table.compact td { padding: 0.45rem 0.6rem; }
.table tr.inactive td { color: var(--muted); }
.table td.notes { color: var(--muted); font-size: 0.9rem; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.inline-form .field { margin-bottom: 0; min-width: 12rem; }
.inline-form .checkbox-field { min-width: 0; padding-bottom: 0.5rem; }
.inline-form .field:first-of-type { flex: 1; }
.danger-zone .hint { margin-top: 0.5rem; }

.flash-warning { background: #fdf3e6; border-color: #ecd0a6; color: #7a4d12; }
.badge-registered { background: var(--bg); }
.badge-paid { background: #e6f0fa; border-color: #b5cde6; color: #234a70; }
.button.small { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.email-preview hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--border); }
.form-actions.spaced { margin-top: 1rem; }
