:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --ink: #1c1c1a;
  --muted: #6b6b64;
  --line: #e3e3de;
  --accent: #2f6f4e;
  --accent-soft: #e8f1ec;
  --danger: #a33a2c;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --card: #1e2024;
    --ink: #e8e8e4;
    --muted: #9a9a93;
    --line: #2e3136;
    --accent: #6cbf94;
    --accent-soft: #22302a;
    --danger: #e08573;
  }
}

* { box-sizing: border-box; }

/* Moet vóór de display-regels hieronder staan en specifiek genoeg zijn: een
   id-selector met display:grid wint anders van de browserregel [hidden]{display:none}. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- toegangspoort ---------- */

#gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

#gate-form {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}

.gate-mark { font-size: 34px; line-height: 1; margin-bottom: 12px; }
#gate-form h1 { font-size: 20px; }
.gate-sub { color: var(--muted); font-size: 14px; margin: 6px 0 20px; }

#code {
  width: 100%;
  padding: 12px 14px;
  font-size: 20px;
  text-align: center;
  letter-spacing: 0.35em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
}

#code:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#gate-form button {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

#gate-form button:hover { filter: brightness(1.08); }

.gate-error {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
  margin: 12px 0 0;
}

/* ---------- kop ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 { font-size: 18px; }
.sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.ghost:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- voortgangsbalk ---------- */

.bar {
  height: 3px;
  background: var(--line);
  overflow: hidden;
}

.bar-lg { height: 4px; }

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.28s ease;
}

/* ---------- layout ---------- */

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 20px 64px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

/* ---------- notities ---------- */

.notes { padding: 18px 20px 20px; }

.notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.notes h2 { font-size: 15px; }

.status {
  font-size: 12px;
  color: var(--muted);
  transition: opacity 0.2s;
}

#notes {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
}

#notes:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- secties ---------- */

.sec-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.sec-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sec-title h2 { font-size: 15px; }

.count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sec-intro {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.sec-bar { margin-top: 12px; border-radius: 2px; }

/* ---------- taken ---------- */

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.task:last-child { border-bottom: 0; }
.task:hover { background: var(--accent-soft); }

.task-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  min-width: 0;
}

.task input {
  appearance: none;
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  border: 1.5px solid var(--muted);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.task input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task input:checked::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.task-body { min-width: 0; }

.task-label {
  font-size: 15px;
  line-height: 1.45;
  transition: color 0.18s;
}

.task-hint {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}

.task.done .task-label {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  color: var(--muted);
}

.task.done .task-hint { opacity: 0.55; }

/* ---------- notitie per taak ---------- */

.note-btn {
  align-self: start;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: -2px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s, color 0.15s;
}

.task:hover .note-btn,
.note-btn:focus-visible { opacity: 1; }

.note-btn:hover {
  color: var(--ink);
  border-color: var(--line);
}

/* Een taak met notitie houdt de knop zichtbaar en in accentkleur, zodat je in de
   lijst ziet waar iets bij staat. */
.task.has-note .note-btn {
  opacity: 1;
  color: var(--accent);
}

.task-note {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 8px;
  padding: 8px 11px;
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: var(--accent-soft);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
}

.task-note:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-note::placeholder { color: var(--muted); opacity: 0.7; }

.task.done .task-note { opacity: 0.6; }

/* ---------- voet ---------- */

.foot {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
  line-height: 1.6;
}

.dot { margin: 0 6px; }

@media (max-width: 520px) {
  .wrap { padding: 16px 12px 48px; }
  .topbar-inner { padding: 14px 16px 10px; }
  .task { padding: 12px 16px; }
  .note-btn { opacity: 0.6; }
  .sec-head { padding: 14px 16px 12px; }
  .notes { padding: 16px; }
  .foot .dot, .foot span:last-child { display: none; }
}
