:root {
  --bg: #050B18;
  --ink: #E6F7FF;
  --muted: #8FB3C8;
  --cyan: #3FE0FF;
  --orange: #FFA24C;
  --line: rgba(63, 224, 255, 0.3);
  --panel: rgba(63, 224, 255, 0.04);
  --head: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
body {
  min-height: 100dvh;
  background-image: linear-gradient(rgba(63,224,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(63,224,255,0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
a { color: var(--cyan); }

#view {
  max-width: 520px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 100px);
  display: flex; flex-direction: column; gap: 16px;
}

.eyebrow { font-family: var(--head); font-size: 11px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.h1 { margin: 0; font-family: var(--head); font-weight: 700; font-size: 26px; letter-spacing: .5px; }
.big { font-family: var(--head); font-weight: 700; line-height: 1; }
.unit { font-size: 14px; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); font-size: 13px; }
.cyan { color: var(--cyan); }
.orange { color: var(--orange); }
.glow { text-shadow: 0 0 16px rgba(63,224,255,.45); }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line); background: transparent; color: var(--cyan);
  font-family: var(--head); font-size: 11px; letter-spacing: 1px; cursor: pointer;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot.warn { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { border: 1px solid var(--line); background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.panel.orange { border-color: rgba(255,162,76,.35); background: rgba(255,162,76,.04); }
.panel.white { border-color: rgba(230,247,255,.25); background: rgba(230,247,255,.03); }
.panel.dashed { border-style: dashed; border-color: rgba(255,162,76,.6); background: transparent; }
.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.row.center { align-items: center; }
.stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tag { font-family: var(--head); font-size: 11px; padding: 0 5px; border: 1px solid currentColor; }

/* stappen */
.bars { position: relative; height: 130px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; border-bottom: 1px solid rgba(63,224,255,.35); }
.bars .goalline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--orange); }
.bars .goalline span { position: absolute; right: 0; top: -14px; font-family: var(--head); font-size: 10px; color: var(--orange); }
.bar { width: 100%; min-height: 2px; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.labels7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; text-align: center; font-family: var(--head); font-size: 10px; color: var(--muted); margin-top: -4px; }
.labels7 .today { color: var(--cyan); }

/* meters */
.segs { display: grid; gap: 2px; align-items: end; }
.svg-wrap svg { display: block; width: 100%; height: auto; }

.scale { position: relative; height: 60px; }
.scale .track, .scale .fill { position: absolute; left: 0; top: 22px; height: 8px; }
.scale .track { right: 0; background: repeating-linear-gradient(90deg, rgba(63,224,255,.35) 0 2px, transparent 2px 7px); }
.scale .fill { background: repeating-linear-gradient(90deg, var(--cyan) 0 2px, transparent 2px 7px); }
.scale .mark { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; transform: translateX(-50%); gap: 2px; font-family: var(--head); font-size: 10px; }
.scale .mark i { width: 2px; height: 30px; background: currentColor; display: block; }
.scale .mark.now i { box-shadow: 0 0 8px var(--cyan); }
.scale .ticks { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-family: var(--head); font-size: 10px; color: var(--muted); }

.week7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.week7 button { background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 9px; color: var(--muted); }
.sq { width: 14px; height: 14px; display: block; }
.sq.on { background: var(--ink); box-shadow: 0 0 6px rgba(230,247,255,.6); }
.sq.off { border: 1px solid var(--orange); background: rgba(255,162,76,.25); }
.sq.today { border: 1px dashed var(--ink); }
.sq.unknown { border: 1px solid rgba(143,179,200,.6); }
.sq.future { border: 1px solid rgba(143,179,200,.25); }

/* knoppen */
.btn { min-height: 52px; border: 1px solid rgba(230,247,255,.35); background: transparent; color: var(--ink); font-family: var(--head); font-weight: 600; font-size: 14px; letter-spacing: 1px; cursor: pointer; padding: 0 12px; }
.btn.primary { background: var(--cyan); color: var(--bg); border: 0; font-weight: 700; }
.btn.warm { background: var(--orange); color: var(--bg); border: 0; font-weight: 700; }
.btn.ghost-cyan { border-color: var(--cyan); color: var(--cyan); }
.btn.ghost-orange { border-color: var(--orange); color: var(--orange); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; }

/* advies */
.adv { display: flex; gap: 12px; align-items: flex-start; }
.adv .d { font-family: var(--head); font-size: 12px; color: var(--bg); background: var(--cyan); padding: 2px 6px; min-width: 34px; text-align: center; }
.adv .d.plank { background: var(--orange); }
.adv .t { font-size: 14px; line-height: 1.4; flex: 1; }
.adv.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(143,179,200,.5); }
.adv .ok { font-family: var(--head); font-size: 11px; color: var(--cyan); }

/* doelen */
.goal { border: 1px solid rgba(63,224,255,.22); background: rgba(5,11,24,.85); padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.goal.o { border-color: rgba(255,162,76,.3); }
.goal.w { border-color: rgba(230,247,255,.22); }
.goal .vis { width: 130px; flex-shrink: 0; }
.chips3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chip { border: 1px solid rgba(63,224,255,.25); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.chip b { font-family: var(--head); font-size: 15px; }

.ladder { display: grid; gap: 4px; align-items: end; height: 72px; }
.ladder > div { display: flex; flex-direction: column; align-items: center; gap: 3px; font-family: var(--head); font-size: 9px; color: var(--muted); }
.ladder i { display: block; width: 100%; border: 1px solid rgba(255,162,76,.35); }
.ladder .done i { background: rgba(255,162,76,.45); border-color: transparent; }
.ladder .active { color: var(--orange); }
.ladder .active i { background: var(--orange); box-shadow: 0 0 10px rgba(255,162,76,.6); border: 0; }

.progress { height: 6px; background: rgba(143,179,200,.18); }
.progress i { display: block; height: 6px; }

/* log */
.log-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(63,224,255,.12); }
.log-item .k { font-family: var(--head); font-size: 11px; width: 54px; color: var(--muted); }
.log-item .v { flex: 1; }
.icon-btn { background: none; border: 1px solid rgba(143,179,200,.3); color: var(--muted); width: 40px; height: 40px; cursor: pointer; }

/* nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid rgba(63,224,255,.25); background: rgba(5,11,24,.96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; text-decoration: none; color: var(--muted); font-family: var(--head); font-size: 11px; letter-spacing: 1px; }
.nav a.active { color: var(--cyan); }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* sheet + toast */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(2,6,14,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; }
.sheet .card { width: 100%; max-width: 520px; background: var(--bg); border-top: 1px solid var(--cyan); padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 20px); display: flex; flex-direction: column; gap: 14px; }
.sheet.full { align-items: stretch; }
.sheet.full .card { max-width: none; border: 0; justify-content: center; align-items: center; text-align: center; min-height: 100dvh; }
.input { width: 100%; min-height: 56px; background: rgba(63,224,255,.06); border: 1px solid var(--line); color: var(--ink); font-family: var(--head); font-size: 28px; padding: 0 12px; }
.input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.timer { font-family: var(--head); font-weight: 700; font-size: 96px; line-height: 1; color: var(--orange); text-shadow: 0 0 30px rgba(255,162,76,.45); font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); transform: translateX(-50%); z-index: 50; background: var(--bg); border: 1px solid var(--cyan); color: var(--ink); padding: 10px 14px; font-family: var(--head); font-size: 13px; letter-spacing: .5px; box-shadow: 0 0 20px rgba(63,224,255,.25); max-width: 90vw; }

.login { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.skeleton { height: 160px; border: 1px solid rgba(63,224,255,.15); background: linear-gradient(90deg, transparent, rgba(63,224,255,.06), transparent); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Doelen aanpassen */
.sheet .card.scroll { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.goalset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 12px 0 0; display: flex; flex-direction: column; gap: 14px; }
.goalset legend { padding: 0 8px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; color: var(--ink); }
.field .hint { font-size: 12px; }
.input.sm { min-height: 48px; font-size: 18px; }
.input[type="date"] { color-scheme: dark; }
.daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.daypick button { min-height: 44px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-family: var(--head); font-size: 12px; cursor: pointer; }
.daypick button.on { border-color: var(--cyan); color: var(--bg); background: var(--cyan); font-weight: 700; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--cyan); font: inherit; text-decoration: underline; cursor: pointer; }
.sheet .card .sticky { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); background: var(--bg); padding: 12px 0 0; margin-top: 4px; }
