:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #5c6660;
  --line: #dde2dc;
  --brand: #1f7a4d;
  --brand-dark: #165c3a;
  --going: #1f7a4d;
  --going-bg: #e3f3ea;
  --wait: #9a6500;
  --wait-bg: #fff3d6;
  --no: #7a3030;
  --no-bg: #f8e6e6;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151917; --card: #1f2522; --text: #e8ece9; --muted: #a2aca6; --line: #33403a;
    --brand: #3fb07a; --brand-dark: #67c897;
    --going: #67c897; --going-bg: #1d3a2b; --wait: #f0c065; --wait-bg: #3b3020; --no: #f0a0a0; --no-bg: #402424;
  }
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--brand); }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding-top: .6rem; padding-bottom: .6rem; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.lang { display: flex; gap: 4px; }
.lang button { border: 1px solid var(--line); background: transparent; color: var(--text); padding: .25rem .6rem; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.lang button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding-bottom: .6rem; font-size: .95rem; align-items: center; }
.nav a { text-decoration: none; }
.badge { background: #c0392b; color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; }
h1 { font-size: 1.6rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; background: var(--card); border: 1px solid var(--line); }
.msg.success { background: var(--going-bg); border-color: var(--going); }
.msg.error { background: var(--no-bg); border-color: var(--no); }
.msg.warning { background: var(--wait-bg); border-color: var(--wait); }

/* Buttons */
.btn, button.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: .6rem 1.1rem; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn.danger { background: #b03a2e; }
.btn.big { font-size: 1.1rem; padding: .8rem 1.4rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.linklike { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
form.inline { display: inline; }

/* Forms */
form.stacked div { margin-bottom: .9rem; }
form.stacked label { display: block; font-weight: 600; margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; max-width: 32rem; padding: .55rem .65rem; font-size: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
form.stacked .helptext { display: block; color: var(--muted); font-size: .85rem; }
form.stacked ul.errorlist, .errorlist { color: var(--no); margin: .2rem 0; padding-left: 1rem; }
/* Checkbox rows: the whole row is tappable */
form.stacked label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: normal; cursor: pointer; }
input[type=checkbox] { width: 1.3rem; height: 1.3rem; margin: .15rem 0 0; flex: none; accent-color: var(--brand); }
.checkbox-list > div { columns: 2 14rem; }
.checkbox-list > div > div { margin: 0; break-inside: avoid; }
.checkbox-list > div label { display: flex; gap: .6rem; align-items: center; font-weight: normal; padding: .3rem 0; cursor: pointer; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Events */
.event-row { display: flex; justify-content: space-between; gap: .5rem 1rem; align-items: center; text-decoration: none; color: inherit; }
.event-status { text-align: right; }
.event-row:hover { border-color: var(--brand); }
.event-title { font-weight: 700; font-size: 1.05rem; }
.pill { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill.going { background: var(--going-bg); color: var(--going); }
.pill.waitlist { background: var(--wait-bg); color: var(--wait); }
.pill.not_going, .pill.cancelled { background: var(--no-bg); color: var(--no); }
.pill.none { background: var(--line); color: var(--muted); }
.spots { font-size: 1.4rem; font-weight: 700; }
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.people li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; font-size: .9rem; }
.people li.me { border-color: var(--brand); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.card > :first-child { margin-top: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); }
.table-scroll { overflow-x: auto; }
td select { width: auto; padding: .3rem; }

.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.dot { width: .9rem; height: .9rem; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: #2e9e5e; }
.dot.bad { background: #d0392b; }
.mt { margin-top: .75rem; }
.mb { margin-bottom: 1rem; }

/* Admin: per-member status list */
.member-status, .member-list { list-style: none; padding: 0; margin: 0; }
.member-status li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9.5rem, 16rem); gap: .75rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.member-status form { min-width: 0; }
.member-status select { padding: .4rem .5rem; }
.member-list li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.member-list .name { font-weight: 600; }
.member-list li:last-child, .member-status li:last-child { border-bottom: 0; }
.search-row { display: flex; gap: .5rem; flex: 1 1 18rem; }
.search-row input { flex: 1; min-width: 0; }
.nav-profile-logout { display: none; }

/* Phones */
@media (max-width: 600px) {
  html { font-size: 17px; }
  h1 { font-size: 1.45rem; }
  .card { padding: .9rem 1rem; }
  .event-row { flex-direction: column; align-items: flex-start; }
  .event-status { text-align: left; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
  .btn.big, form.stacked > .btn { width: 100%; text-align: center; }
  .member-status li { grid-template-columns: minmax(0, 1fr) minmax(9.5rem, 1.3fr); }
  .nav form.nav-logout { display: none; }
  .nav-profile-logout { display: block; }
}

/* Review page before creating an event */
dl.review { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: .6rem 1rem; margin: 1rem 0 0; }
dl.review dt { font-weight: 600; }
dl.review dd { margin: 0; }
@media (max-width: 30rem) {
  dl.review { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  dl.review dd { margin-bottom: .6rem; }
}
