:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #6b7686;
  --line: #e3e7ee;
  --accent: #1f7a5c;
  --accent-dark: #175e46;
  --warn: #b45309;
  --warn-bg: #fff7e6;
  --ok: #1a7f37;
}

* { box-sizing: border-box; }

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

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  background: var(--accent-dark);
  color: #fff;
  padding: .65rem 1.25rem;
}
.brand { font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a {
  color: #e8f1ee;
  text-decoration: none;
  padding: .35rem .8rem;
  border-radius: 999px;
  font-weight: 600;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); }
.topbar nav a.active { background: #fff; color: var(--accent-dark); }

main { max-width: 1180px; margin: 1.5rem auto; padding: 0 1rem; }

h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.datum { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); font-weight: 600; gap: .2rem; }
.datum input {
  font: inherit;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: inherit;
  font-weight: 600;
  padding: .5rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.off {
  background: #eef0f3;
  border-color: #d5dbe3;
  color: #98a1ad;
  text-decoration: line-through;
  opacity: .75;
}
.chip.off:hover { border-color: #b42318; color: #b42318; }

/* ---------- Buttons ---------- */
.actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.btn {
  font: inherit;
  font-weight: 700;
  padding: .55rem 1.1rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.status { color: var(--muted); font-size: .9rem; }
.status.ok { color: var(--ok); font-weight: 700; }

/* ---------- Tafels ---------- */
.tafels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1rem;
}
.tafel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem .95rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.tafel.warn { border-color: #f0c37b; background: var(--warn-bg); }
.tafel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: .5rem;
}
.badge {
  background: #fde8c8;
  color: var(--warn);
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
  cursor: help;
}

.spelers { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.spelers li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.spelers .naam { font-weight: 600; font-size: .92rem; }
.move {
  font: inherit;
  font-size: .78rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .12rem .2rem;
  background: #fff;
}

.rondes { border-top: 1px dashed var(--line); padding-top: .5rem; display: flex; flex-direction: column; gap: .25rem; }
.ronde { display: flex; gap: .45rem; font-size: .85rem; }
.ronde-label { color: var(--muted); font-weight: 700; white-space: nowrap; }
.ronde-body { color: var(--ink); }

/* ---------- Tabel (matrix) ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: .78rem; }
table.matrix th, table.matrix td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  padding: .28rem .3rem;
  white-space: nowrap;
}
table.matrix th:first-child, table.matrix td:first-child {
  text-align: left;
  font-weight: 600;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
}
table.matrix thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  font-weight: 700;
}
table.matrix thead th:first-child { z-index: 3; }
table.matrix .ja { color: var(--ok); font-weight: 800; }
table.matrix .nee { color: #c9cfd8; }
table.matrix .diag { background: #f1f3f7; color: #b6bdc9; }
table.matrix tr.done td:not(:first-child):not(.diag) { color: var(--ok); }

/* ---------- Voortgang ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.stat .waarde { font-size: 1.6rem; font-weight: 800; }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.bar { height: 10px; background: #e7ebf1; border-radius: 999px; overflow: hidden; margin-top: .5rem; }
.bar > div { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Lijsten (historie / leden) ---------- */
.items { display: flex; flex-direction: column; gap: .6rem; }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem 1.1rem;
}
.item .left { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.item .date { font-weight: 800; }
.item .desc { color: var(--muted); font-size: .85rem; }
.item .btns { display: flex; gap: .4rem; }
.btn.small { padding: .3rem .7rem; font-size: .82rem; border-radius: 7px; }
.btn.danger { color: #b42318; border-color: #f3c4bf; }
.btn.danger:hover { background: #fef3f2; }

form.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
input[type="text"] {
  font: inherit;
  padding: .5rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
textarea {
  font: inherit;
  width: 100%;
  min-height: 90px;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.note { color: var(--muted); font-size: .85rem; margin: .25rem 0 .75rem; }
.archief .item { opacity: .6; }

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 0 1.5rem; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f3d2e, #1f7a5c);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 2.25rem;
  width: min(360px, 92vw);
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  text-align: center;
}
.login-card .brand { color: var(--accent-dark); font-size: 1.3rem; }
.login-card form { display: flex; flex-direction: column; gap: .7rem; }
.login-card input[type="password"] {
  font: inherit;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: center;
}
.login-card .btn { width: 100%; }
.login-error {
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #f3c4bf;
  border-radius: 9px;
  padding: .5rem .75rem;
  font-size: .85rem;
  margin-bottom: .8rem;
}

/* ---------- Seizoen ---------- */
.season-tag {
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  padding: .3rem .7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.season-meta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }


@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .datum { flex-direction: row; justify-content: space-between; align-items: center; }
}
