:root {
  --ground: #EEF1EA;
  --paper: #FFFFFF;
  --ink: #16241C;
  --muted: #4B5A50;
  --line: #CFD8CB;
  --fairway: #1F5A3F;
  --fairway-dark: #143D2A;
  --fairway-soft: #DCE8DF;
  --flag: #F2CF4A;
  --danger: #9B2C1F;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --tabbar-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.5 var(--body);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--fairway); text-underline-offset: 3px; }
a:hover { color: var(--fairway-dark); }
:focus-visible { outline: 3px solid var(--fairway); outline-offset: 2px; border-radius: 6px; }

.loading { padding: 40px 20px; text-align: center; color: var(--muted); }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); min-height: 100dvh; justify-content: center; }

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 2.5rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}
h2 { margin: 8px 0 10px; font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
h2.label { margin: 0 0 8px; font-family: var(--body); font-weight: 700; font-size: 0.95rem; color: var(--muted); }
p { margin: 0; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 34em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--fairway-dark); }
.demo {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--flag);
  font-size: 0.85rem;
  font-weight: 700;
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 140px; }

/* Knoppen */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border: 2px solid var(--fairway);
  border-radius: 14px;
  background: var(--fairway);
  color: #FFFFFF;
  font: 700 1rem var(--body);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--fairway-dark); border-color: var(--fairway-dark); color: #FFFFFF; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-ghost { background: var(--paper); color: var(--fairway); }
.btn-ghost:hover { background: var(--fairway-soft); color: var(--fairway-dark); }
.btn-small { min-height: 44px; padding: 0 16px; }
.btn-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: #F6E3E0; border-color: transparent; color: var(--danger); }
.linklike {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fairway);
  font: 700 0.95rem var(--body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-left: -6px;
  font-weight: 700;
  text-decoration: none;
}

/* Formulieren */
.field { display: flex; flex-direction: column; gap: 6px; }
label, legend { font-weight: 700; font-size: 0.95rem; }
.hint { font-size: 0.85rem; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid #AAB6AC;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 1rem var(--body);
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--fairway); outline-offset: 0; border-color: var(--fairway); }
fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; }
legend { padding: 0; margin-bottom: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--fairway); flex-shrink: 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn, .chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid #AAB6AC;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 1rem var(--body);
  cursor: pointer;
}
.chip-btn[aria-pressed="true"], .chip input:checked + span {
  background: var(--fairway);
  border-color: var(--fairway);
  color: #FFFFFF;
  font-weight: 700;
}
.chip { position: relative; font-weight: 400; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip input:focus-visible + span { outline: 3px solid var(--fairway); outline-offset: 2px; }

.filters { display: flex; flex-direction: column; gap: 6px; }
.filters .chips { margin-bottom: 8px; }

/* Lijsten en kaarten */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.player {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}
.player:hover { color: var(--ink); border-color: var(--fairway); }
.player-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-main strong { font-size: 1.1rem; }
.player-main .muted { font-size: 0.92rem; }

.avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--fairway-soft);
  color: var(--fairway-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.avatar-lg { width: 84px; height: 84px; font-size: 1.6rem; }

/* De vlag: handicap als wimpel, het herkenbare element van de app */
.pennant {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 70px;
  padding: 6px 26px 6px 12px;
  background: var(--flag);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 78% 50%, 100% 100%, 0 100%);
  line-height: 1.05;
}
.pennant-num { font-family: var(--display); font-weight: 800; font-size: 1.35rem; }
.pennant-lbl { font-size: 0.75rem; font-weight: 700; }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.facts div { background: var(--paper); padding: 12px 14px; }
.facts dt { font-size: 0.85rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; }

.note {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fairway-soft);
  line-height: 1.5;
}

.invite, .flight {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.invite-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.when { font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; }
.status {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #E6E9E3;
}
.status-open { background: var(--flag); }
.status-aanvaard { background: var(--fairway); color: #FFFFFF; }
.status-afgewezen { background: #E6E9E3; color: var(--muted); }

.contact { display: flex; gap: 8px; flex-wrap: wrap; }
.contact .btn { min-height: 44px; }

details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--fairway); }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.people li { display: flex; flex-direction: column; gap: 6px; }

.empty {
  padding: 24px;
  border: 1.5px dashed #AAB6AC;
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
}

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notice-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.account { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }

.prose h2 { margin-top: 12px; margin-bottom: 0; }
.prose p { max-width: 36em; }

/* Tabbalk */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 2px env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tab {
  min-height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.tab[aria-current="page"] { color: var(--fairway); }
.tab:hover { color: var(--fairway-dark); }
.tab-icon { position: relative; display: flex; }
.badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #FFFFFF;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Melding */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 12px);
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #FFFFFF;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* Chat per flight */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.chat-screen { gap: 12px; }
.chat-head h1 { font-size: 1.5rem; }
.messages {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  align-self: flex-start;
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: var(--paper);
}
.msg-mine {
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  background: var(--fairway);
  border-color: var(--fairway);
  color: #FFFFFF;
}
.msg-name { font-size: 0.8rem; font-weight: 700; color: var(--fairway); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time { font-size: 0.75rem; color: var(--muted); align-self: flex-end; }
.msg-mine .msg-time { color: #D6E4DA; }
.chat-form {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.chat-form textarea { min-height: 44px; max-height: 120px; border-radius: 10px; }
.chat-form .btn { flex-shrink: 0; }

/* Golfmaten */
.friends { display: flex; flex-direction: column; gap: 8px; }
.friend-row { list-style: none; margin: 0; padding: 2px 0; display: flex; gap: 8px; overflow-x: auto; }
.friend-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.95rem;
}
.friend-chip:hover { color: var(--ink); border-color: var(--fairway); }
.avatar-sm { width: 34px; height: 34px; font-size: 0.85rem; }
.chat-head .row { margin-top: 4px; }

/* Scorekaart */
.card-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card-table th, .card-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.card-table thead th { font-size: 0.85rem; color: var(--muted); background: #E9EDE6; }
.card-table tbody tr:last-child th, .card-table tbody tr:last-child td { border-bottom: 0; }
.card-table tbody th { width: 48px; font-family: var(--display); font-size: 1.1rem; }
.card-table td:nth-child(2) { width: 68px; font-weight: 700; }
.card-table .score-in { width: 72px; min-height: 46px; padding: 6px 8px; text-align: center; font-size: 1.1rem; font-weight: 700; }
.card-table .dots { margin-left: 4px; color: var(--fairway); font-size: 0.9rem; }
.totals { display: flex; flex-wrap: wrap; gap: 10px; }
.totals div {
  flex: 1 1 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.totals strong { font-family: var(--display); font-size: 1.4rem; }

/* Uitleg bij de start */
.intro { min-height: 100dvh; justify-content: center; gap: 28px; }
.dots-row { display: flex; gap: 8px; justify-content: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot-on { background: var(--fairway); }
.pick summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--fairway); cursor: pointer; }
.pick .chips { padding-top: 8px; }

/* EDS-label */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--flag);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.tag-big { margin: 0; padding: 4px 12px; font-size: 0.85rem; }

/* EDS-label */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--flag);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.tag-big { margin: 0; padding: 4px 12px; font-size: 0.85rem; }
