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

:root {
  --bg: #f6f4f1;
  --surface: #fff;
  --text: #1c1b19;
  --muted: #5c5854;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --danger: #9b2226;
  --border: #e0dcd6;
  --radius: 10px;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-size: 20px;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* Always show a dotted underline on map links, even when not hovered */
.event-address a {
  text-decoration: underline;
  text-decoration-style: dotted;
}

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

.site-header nav {
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.site-header a {
  font-weight: 600;
}

.logout-form {
  margin-left: auto;
}

.logout-form button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.logout-form button:hover {
  border-color: var(--muted);
}

main, .site-footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

h1.lists-title {
  margin: 0;
}

h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--muted);
  font-weight: 600;
}

h2:first-child {
  margin-top: 0;
}

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

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.65rem;
}

.event-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

.event-meta {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.event-address {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.event-card .event-notes {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.event-actions {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.event-actions form {
  display: inline;
}

.event-actions .btn {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
}

.btn {
  display: inline-block;
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #fff5f5;
  text-decoration: none;
}

.empty-state {
  color: var(--muted);
  padding: 1rem 0;
}

.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="datetime-local"],
.form-row select,
.form-row textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.form-row input[type="datetime-local"] {
  /* Needed so it doesn't overflow the margins on iOS */
  -webkit-appearance: none;
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.flash {
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.flash-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
}

.flash-error {
  background: #ffebee;
  border: 1px solid #ef9a9a;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-panel {
  width: 100%;
  max-width: 22rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
}

.login-panel h1 {
  text-align: center;
  margin-bottom: 1.25rem;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

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

.user-table th {
  color: var(--muted);
  font-weight: 600;
}

.form-error-banner {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: var(--danger);
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.site-footer {
  color: var(--muted);
}