:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e6ea;
  --text: #1c2430;
  --muted: #6b7683;
  --brand: #2f6b4f;
  --brand-ink: #ffffff;
  --brand-soft: #e6f2ec;
  --accent: #c9772e;
  --danger: #c0392b;
  --ok: #2f8f5b;
  --warn: #b9770a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 20px rgba(20, 30, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171d26;
    --surface-2: #1e2732;
    --border: #2a3441;
    --text: #e7ecf2;
    --muted: #93a1b0;
    --brand: #4fae82;
    --brand-ink: #06120c;
    --brand-soft: #16281f;
    --accent: #e0954c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.app-header h1 { margin: 0; font-size: 1.15rem; letter-spacing: .2px; }
.app-header .sub { font-size: .8rem; opacity: .85; margin-top: 2px; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  position: sticky;
  top: 56px;
  z-index: 19;
  overflow-x: auto;
}
.tab {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  padding: 12px 14px;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 920px; margin: 0 auto; padding: 18px 14px 80px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.card h3 { margin: 0 0 8px; font-size: .95rem; }
.card .hint { color: var(--muted); font-size: .82rem; margin: 0 0 12px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=date], textarea, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 54px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 9px; font-size: .8rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .8rem;
  cursor: pointer;
  user-select: none;
}
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chip.static { cursor: default; }
.chip.mini { padding: 2px 8px; font-size: .72rem; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); margin: 0 4px 4px 0;
}
.tag.diet { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

.list-item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.list-item:first-child { border-top: none; }
.list-item .meta { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.list-item .name { font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.spacer { height: 6px; }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700;
}
.pill.planning { background: var(--surface-2); color: var(--muted); }
.pill.finalized { background: var(--brand-soft); color: var(--brand); }

.rec-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; background: var(--surface);
}
.rec-item.top { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.rec-item.ineligible { opacity: .6; }
.rec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rec-name { font-weight: 700; }
.rec-score { font-size: .78rem; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.reasons { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.reasons .good::before { content: "✓ "; color: var(--ok); }
.reasons .bad::before { content: "⚠ "; color: var(--warn); }
.reasons span { display: inline-block; margin-right: 10px; }

.avail-grid { width: 100%; }
.avail-row {
  display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.avail-row:first-child { border-top: none; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: var(--surface-2); color: var(--muted); padding: 6px 10px; font-size: .8rem; cursor: pointer; }
.seg button.on-yes { background: var(--ok); color: #fff; }
.seg button.on-maybe { background: var(--warn); color: #fff; }
.seg button.on-no { background: var(--danger); color: #fff; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px,1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat .n { font-size: 1.4rem; font-weight: 700; }
.stat .l { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: .85rem; box-shadow: var(--shadow); z-index: 50; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
details.venue-form { margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.disclaimer { font-size: .78rem; color: var(--warn); background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
pre.wa {
  white-space: pre-wrap; word-break: break-word; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: .85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.inline-actions { display: flex; gap: 6px; align-items: center; }

/* Home — how-it-works steps */
.step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.step:first-of-type { border-top: none; }
.step-n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.step-h { font-weight: 700; margin-bottom: 2px; }

/* Home — role cards */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .role-grid { grid-template-columns: 1fr; } }
.role-card {
  appearance: none; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.role-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.role-emoji { font-size: 1.6rem; }
.role-title { font-weight: 700; font-size: 1rem; }
.role-sub { font-size: .82rem; color: var(--muted); }

/* Attend — larger status segmented control + confirmation */
.seg.seg-lg { display: flex; width: 100%; }
.seg.seg-lg button { flex: 1; padding: 12px 0; font-size: .95rem; font-weight: 600; }
.saved-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: .88rem;
}

/* Attention callout (e.g. large-group reservation prompt) */
.callout { display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid var(--accent); }
.callout-icon { font-size: 1.4rem; line-height: 1.2; flex: 0 0 auto; }
.callout-title { font-weight: 700; margin-bottom: 2px; }

/* Roster */
.month-head {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  color: var(--muted); margin: 14px 0 4px; padding-top: 8px; border-top: 1px solid var(--border);
}
.month-head:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.roster-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.roster-date { font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.roster-flag {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
}
.roster-flag.auto { background: var(--surface-2); color: var(--muted); }
.roster-flag.set { background: var(--brand-soft); color: var(--brand); }
.roster-pick { display: flex; align-items: center; gap: 6px; }
.roster-pick select { min-width: 120px; padding: 7px 8px; }
.r-reset { padding: 4px 8px; font-size: 1rem; line-height: 1; }
.pool-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.pool-row .p-name { flex: 1; }
