:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fcfcfb;
  --surface-2: #efece5;
  --line: #e2ded4;
  --ink: #1b1b19;
  --ink-2: #52514e;
  --ink-3: #8a887f;
  --accent: #c8502a;
  --accent-ink: #ffffff;
  --accent-soft: #f7e4dc;
  --good: #1f7a4d;
  --good-soft: #e1f1e8;
  --warn: #9a6400;
  --warn-soft: #fbf0d6;
  --series-1: #2a78d6;
  --series-ref: #c9c6bc;
  --series-2: #eb6834;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 4px 16px rgba(20, 20, 15, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #2f2e2b;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #8d8b82;
    --accent: #e0693f;
    --accent-ink: #1a1a19;
    --accent-soft: #3a2219;
    --good: #5cc28e;
    --good-soft: #17301f;
    --warn: #e0b04a;
    --warn-soft: #33290f;
    --series-1: #3987e5;
    --series-ref: #4a4944;
    --series-2: #d95926;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2f2e2b;
  --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #8d8b82; --accent: #e0693f; --accent-ink: #1a1a19;
  --accent-soft: #3a2219; --good: #5cc28e; --good-soft: #17301f; --warn: #e0b04a; --warn-soft: #33290f;
  --series-1: #3987e5; --series-ref: #4a4944; --series-2: #d95926; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 750; font-size: 1.05rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); display: inline-grid; place-items: center; color: var(--accent-ink); font-size: 13px; }
nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; }
nav a {
  color: var(--ink-2); text-decoration: none; padding: 7px 11px; border-radius: 999px; font-size: .92rem; white-space: nowrap;
}
nav a.on { background: var(--ink); color: var(--bg); }
nav a:not(.on):hover { background: var(--surface-2); }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }
.grid { align-items: start; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: #c0392b; border: 1px solid currentColor; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.note { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.note.ok { background: var(--good-soft); color: var(--good); }
.note.err { background: var(--accent-soft); color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.pill.actief { background: var(--good-soft); color: var(--good); }
.pill.gepauzeerd { background: var(--warn-soft); color: var(--warn); }

/* chat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 58px); max-width: 760px; margin: 0 auto; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.assistant p:last-child, .msg.assistant ul:last-child, .msg.assistant ol:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { padding-left: 1.2rem; margin: 0 0 .75rem; }
.msg.assistant table { border-collapse: collapse; font-size: .9rem; margin: 6px 0; }
.msg.assistant td, .msg.assistant th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.msg .tag { display: block; font-size: .75rem; color: var(--ink-3); margin-bottom: 4px; font-weight: 600; }
.typing { align-self: flex-start; color: var(--ink-3); font-size: .9rem; padding: 4px 6px; }
.typing span { animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }
.composer { display: flex; gap: 8px; padding: 10px 16px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { resize: none; min-height: 46px; max-height: 160px; border-radius: 14px; }
.composer .btn { border-radius: 14px; }

/* dashboard */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.goal { font-size: 1.05rem; color: var(--ink-2); max-width: 60ch; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.kpi .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: .95rem; color: var(--ink-3); font-weight: 600; }
.sessions { list-style: none; padding: 0; margin: 0; }
.sessions li { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.sessions li:first-child { border-top: 0; }
.sessions .day { font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sessions li.today .day { color: var(--accent); font-weight: 700; }
.sessions .what { min-width: 0; }
.sessions .title { font-weight: 600; }
.sessions .meta { font-size: .82rem; color: var(--ink-2); }
.st { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st.done { background: var(--good-soft); color: var(--good); }
.st.planned { background: var(--surface-2); color: var(--ink-2); }
.st.missed, .st.skipped { background: var(--warn-soft); color: var(--warn); }
.st.cancelled { background: transparent; color: var(--ink-3); text-decoration: line-through; }
details.desc summary { cursor: pointer; font-size: .82rem; color: var(--ink-3); list-style: none; }
details.desc summary::-webkit-details-marker { display: none; }
details.desc div { font-size: .88rem; color: var(--ink-2); white-space: pre-wrap; margin-top: 6px; }
.chart-box { position: relative; height: 220px; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-2); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 110px 1fr 60px; gap: 10px; align-items: center; font-size: .9rem; padding: 4px 0; }
.bars .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--series-1); border-radius: 4px; }
.bars .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.banner { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: .88rem; color: var(--ink-2); margin-bottom: 14px; }
.empty { color: var(--ink-3); font-size: .92rem; }

/* admin table */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .78rem; color: var(--ink-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
.linkbox { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { max-width: 260px; }

.center-page { min-height: 70dvh; display: grid; place-items: center; }
.center-page .card { max-width: 520px; }
.steps { padding-left: 1.2rem; margin: 6px 0 0; }
.steps li { margin-bottom: 6px; }
table.t td.goalcol { min-width: 220px; }
table.t .btn { white-space: nowrap; }
@media (max-width: 480px) {
  .brand-text { display: none; }
  nav a { padding: 7px 9px; font-size: .88rem; }
}

/* welcome / consent */
.welcome { max-width: 560px; margin: 0 auto; }
.welcome .card + .card, .welcome .hero + .card { margin-top: 14px; }
.hero { text-align: center; padding: 18px 8px 8px; }
.hero-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 28px; margin: 0 auto 14px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero h1 { font-size: 2rem; margin-bottom: 8px; }
.hero-lead { font-size: 1.1rem; color: var(--ink-2); max-width: 30ch; margin: 0 auto; }
.note-from { background: var(--accent-soft); border-color: transparent; }
.note-from p { margin-bottom: 8px; }
.note-from .sig { margin: 0; color: var(--ink-2); }
.features { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 12px; }
.features li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; }
.features .ic { font-size: 1.3rem; line-height: 1.4; }
.btn-big { width: 100%; justify-content: center; padding: 14px 16px; font-size: 1.05rem; margin-top: 6px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
