/* Posimeter — donker en licht thema.
   Het thema staat op <html data-theme="dark|light"> (zie js/theme.js en het
   scriptje in <head>). Alle kleuren hieronder zijn variabelen; elk thema geeft
   ze een eigen waarde. */

:root {
  --bg-0: #101018;
  --bg-glow: #232135;
  --ink: #f5f3ff;
  --ink-dim: #9a97ad;
  --card: #1b1a26;
  --card-press: #22212f;
  --card-border: rgba(255, 255, 255, 0.08);
  --dot-off: #3a394a;
  --accent: #ffd76a;
  --accent-soft: rgba(255, 215, 106, 0.1);
  --accent-line: rgba(255, 215, 106, 0.2);
  --accent-focus: rgba(255, 215, 106, 0.6);
  --brand-gradient: linear-gradient(90deg, #ff8a8a, #ffd76a, #8affa0);
  --tint-1: rgba(255, 255, 255, 0.04);
  --tint-2: rgba(255, 255, 255, 0.07);
  --tint-3: rgba(255, 255, 255, 0.1);
  --tint-4: rgba(255, 255, 255, 0.18);
  --inset: rgba(0, 0, 0, 0.2);
  --ring: rgba(255, 255, 255, 0.9);
  --bar-bg: rgba(20, 19, 30, 0.88);
  --danger: #ff8a80;
  --danger-soft: rgba(255, 138, 128, 0.1);
  --warn-ink: #ffd9a0;
  --warn-soft: rgba(245, 169, 59, 0.12);
  --warn-line: rgba(245, 169, 59, 0.35);
  --ok-ink: #8affa0;
  --doodle: rgba(255, 255, 255, 0.06);
  --tabbar-h: 64px;
  --font-display: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

/* Licht thema: zachte lila-witte achtergrond, witte kaarten, donkere tekst.
   De meter zelf (sticker met witte rand) blijft hetzelfde. */
html[data-theme="light"] {
  --bg-0: #f5f3fa;
  --bg-glow: #e4dcf6;
  --ink: #1d1b2b;
  --ink-dim: #676380;
  --card: #ffffff;
  --card-press: #f1eef8;
  --card-border: rgba(29, 27, 43, 0.09);
  --dot-off: #d9d5e4;
  --accent: #a8700a;
  --accent-soft: rgba(168, 112, 10, 0.09);
  --accent-line: rgba(168, 112, 10, 0.28);
  --accent-focus: rgba(168, 112, 10, 0.6);
  --brand-gradient: linear-gradient(90deg, #e8483c, #e09a00, #2f9e4f);
  --tint-1: rgba(29, 27, 43, 0.035);
  --tint-2: rgba(29, 27, 43, 0.06);
  --tint-3: rgba(29, 27, 43, 0.09);
  --tint-4: rgba(29, 27, 43, 0.2);
  --inset: rgba(29, 27, 43, 0.05);
  --ring: #ffffff;
  --bar-bg: rgba(255, 255, 255, 0.92);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.08);
  --warn-ink: #8a5200;
  --warn-soft: rgba(245, 169, 59, 0.14);
  --warn-line: rgba(245, 169, 59, 0.5);
  --ok-ink: #2f8f4a;
  --doodle: rgba(70, 50, 140, 0.09);
  color-scheme: light;
}
html[data-theme="light"] .readout,
html[data-theme="light"] .card,
html[data-theme="light"] .stat,
html[data-theme="light"] .friend-row { box-shadow: 0 6px 20px rgba(60, 40, 120, 0.08); }
html[data-theme="light"] .avatar { box-shadow: 0 0 0 3px #ffffff, 0 2px 8px rgba(60, 40, 120, 0.15); }
/* Gekleurde labels (geel, limegroen) zijn op wit slecht leesbaar: iets donkerder */
html[data-theme="light"] .readout-label,
html[data-theme="light"] .detail-label,
html[data-theme="light"] .quote-kicker { filter: brightness(0.68) saturate(1.3); }

/* De tekeningetjes op de achtergrond volgen het thema */
.doodles g { stroke: var(--doodle); stroke-opacity: 1; }
.doodles circle { fill: var(--doodle); fill-opacity: 1; }

/* iPhone-app op het beginscherm: de statusbalk (tijd, batterij) heeft altijd
   witte tekst. In het lichte thema zetten we er daarom een donkere strook achter. */
.statusbar-shim { display: none; }
@media (display-mode: standalone) {
  html[data-theme="light"] .statusbar-shim {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background: #1d1b2b;
    z-index: 30;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

/* iPhone-app op het beginscherm: bij een korte pagina (Groepen, Vrienden)
   rekent iOS met een scherm dat de statusbalk korter is, waardoor de menubalk
   onderin te hoog komt te staan. Daarom is de pagina daar altijd minstens
   schermhoog (inclusief de strook van de statusbalk). */
@media (display-mode: standalone) {
  html { min-height: calc(100% + env(safe-area-inset-top, 0px)); }
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, var(--bg-glow) 0%, transparent 60%),
    var(--bg-0);
  background-color: var(--bg-0);
  background-attachment: fixed;
  font-family: var(--font-display);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.doodles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Pagina-opbouw ---------- */

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding-top: max(28px, env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.screen[hidden] { display: none; }

.screen-header { text-align: center; margin-bottom: 6px; }

.brand {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
}
.tagline {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-dim);
  font-weight: 500;
}

.card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.placeholder {
  margin-top: 16px;
  text-align: center;
  color: var(--ink-dim);
  font-weight: 500;
  line-height: 1.45;
}
.placeholder-emoji { font-size: 40px; margin: 4px 0 8px; }

.hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-dim);
  text-align: center;
  font-weight: 500;
  opacity: 0.8;
}

/* ---------- De meter ---------- */

.meter { width: 100%; display: flex; flex-direction: column; align-items: center; }

.gauge-stage {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-top: 10px;
}
.glow {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  transition: background-color .6s ease;
  z-index: 0;
  pointer-events: none;
}
.gauge {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.gauge.dragging { cursor: grabbing; }
/* Geen (blauwe) focusrand na tikken of klikken. Alleen bij bediening met het
   toetsenbord op een computer een subtiele gele rand. */
.gauge, .gauge:focus { outline: none; }
@media (hover: hover) and (pointer: fine) {
  .gauge:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
}

.needle-group {
  transform-box: view-box;
  transform-origin: 230px 260px;
  transition: transform .65s cubic-bezier(.34, 1.56, .64, 1);
}
.needle-group.dragging { transition: none; }

.emoji-hit { cursor: pointer; }
.emoji-hit text { pointer-events: none; }

.readout {
  margin-top: 2px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.readout-emoji {
  font-size: 44px;
  line-height: 1;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.readout-emoji.bump { transform: scale(1.25) rotate(-6deg); }
.readout-text { flex: 1; min-width: 0; }
.readout-label {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  transition: color .4s ease;
}
.readout-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.dots { display: flex; gap: 6px; flex-shrink: 0; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-off);
  transition: background-color .3s ease, transform .3s ease;
}
.dot.active { transform: scale(1.25); }

/* ---------- Menu onderin ---------- */

.tabbar {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px max(12px, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px);
  background: var(--bar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-border);
}
.tabbar a {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.tab-icon { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabbar a[aria-current="page"] { color: var(--ink); background: var(--tint-2); }
.tabbar a[aria-current="page"] .tab-icon { filter: none; opacity: 1; }
.tabbar a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Incheckscherm ---------- */

.today-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--ink-dim); }
.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--tint-2);
  border: 1px solid var(--card-border);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.checkin-form {
  width: 100%;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px 4px;
}
.optional { color: var(--ink-dim); font-weight: 500; }

.note-wrap { position: relative; }
.note-wrap textarea {
  width: 100%;
  resize: none;
  font: inherit;
  font-size: 16px;               /* 16px voorkomt inzoomen op iPhone */
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
}
.note-wrap textarea::placeholder { color: var(--ink-dim); opacity: .8; }
.note-wrap textarea:focus { border-color: var(--accent-focus); }
.note-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

.segmented {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
}
.segmented button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.segmented button.active { background: var(--tint-3); color: var(--ink); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.vis-hint {
  margin: 6px 4px 0;
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 500;
  min-height: 1.3em;
}

.btn-primary {
  --btn-color: var(--accent);
  margin-top: 16px;
  width: 100%;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #14131c;
  background: var(--btn-color);
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: background-color .3s ease, transform .1s ease, opacity .2s ease;
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn-primary:disabled { cursor: default; opacity: .55; }
.btn-primary.done {
  opacity: 1;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: none;
}

/* Bevestigde posi-status: meter op slot */
.meter.locked .gauge { cursor: default; }
.meter.locked .emoji-hit { cursor: default; }
.lock-line {
  margin: 10px 0 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--tint-2);
  border: 1px solid var(--card-border);
}
.change-warn {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--warn-ink);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
}
#changeBtn, #cancelChangeBtn { margin-top: 8px; }

.checkin-status {
  margin: 10px 4px 0;
  min-height: 1.3em;
  font-size: 13px;
  text-align: center;
  color: var(--ink-dim);
  font-weight: 500;
}

/* ---------- Quote na het inchecken ---------- */

.quote-dialog {
  width: min(360px, calc(100% - 32px));
  border: 1px solid var(--card-border);
  border-radius: 26px;
  padding: 26px 22px 20px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.quote-dialog::backdrop {
  background: rgba(8, 8, 14, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.quote-dialog[open] { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.quote-emoji { font-size: 52px; line-height: 1; }
.quote-kicker { margin: 10px 0 0; font-size: 14px; font-weight: 600; }
.quote-text {
  margin: 12px 0 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}
.quote-from { margin: 10px 0 0; font-size: 13px; color: var(--ink-dim); font-weight: 500; }
.quote-dialog form { margin: 0; }

/* ---------- Verloop ---------- */

.history { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

.demo-note {
  align-self: center;
  margin: -4px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  text-align: center;
}
.stat-icon { font-size: 22px; line-height: 1.1; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--ink-dim); }
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--ink-dim); line-height: 1.2; }

.streak-hint {
  margin: -4px 4px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-align: center;
}
.streak-hint[hidden] { display: none; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { margin: 0; font-size: 17px; font-weight: 600; }
.segmented.three { grid-template-columns: repeat(3, 1fr); margin-top: 12px; }
.segmented.small { margin: 0; width: 150px; padding: 3px; border-radius: 12px; background: var(--inset); }
.segmented.small button { font-size: 13px; padding: 6px 4px; border-radius: 9px; }

.period-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.period-title { margin: 0; font-size: 15px; font-weight: 600; }
.period-title::first-letter { text-transform: uppercase; }
.cal-card .period-nav { margin-top: 0; }
.nav-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  background: var(--tint-2);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.nav-btn:disabled { opacity: .25; cursor: default; }
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chart { margin-top: 6px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid-line { stroke: var(--tint-2); stroke-width: 1; }
.chart-svg .base-line { stroke: var(--tint-4); stroke-width: 1; }
.chart-svg .axis-emoji { font-size: 11px; }
.chart-svg .axis-label { font-size: 10.5px; font-weight: 500; fill: var(--ink-dim); }
.chart-svg .axis-label.today { fill: var(--ink); font-weight: 700; }
.chart-svg .missing-dot { fill: var(--dot-off); }
.chart-svg .bar.selected { stroke: var(--ink); stroke-width: 1.5; }
.chart-svg .avg-line { stroke: var(--ink-dim); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.chart-svg .hit { fill: transparent; cursor: pointer; }
.chart-caption {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
  text-align: center;
  min-height: 1.3em;
}

.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays { margin-top: 12px; }
.cal-weekdays span { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--ink-dim); }
.cal-grid { margin-top: 6px; }
.cal-day {
  --day-color: transparent;
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font: inherit;
  color: var(--ink-dim);
  background: var(--tint-1);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.cal-day.has {
  color: var(--ink);
  background: color-mix(in srgb, var(--day-color) 30%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--day-color) 70%, transparent);
}
.cal-num { font-size: 11px; font-weight: 600; line-height: 1; }
.cal-day.has .cal-num { position: absolute; top: 4px; left: 6px; font-size: 9.5px; }
.cal-emoji { font-size: 18px; line-height: 1; margin-top: 4px; }
.cal-day.today .cal-num { color: var(--accent); }
.cal-changed { position: absolute; top: 2px; right: 3px; font-size: 9px; line-height: 1; }
.detail-change {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--warn-ink);
  background: var(--warn-soft);
}
.cal-day.today:not(.has) { box-shadow: inset 0 0 0 1.5px var(--accent-focus); }
.cal-day.selected { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-day.future { opacity: .3; cursor: default; }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-summary { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--ink-dim); text-align: center; }

.day-detail { display: flex; flex-direction: column; gap: 8px; }
.detail-date { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-dim); }
.detail-date::first-letter { text-transform: uppercase; }
.detail-empty { margin: 0; font-size: 15px; font-weight: 500; }
.detail-empty a { color: var(--accent); font-weight: 600; }
.detail-row { display: flex; align-items: center; gap: 14px; }
.detail-emoji { font-size: 40px; line-height: 1; }
.detail-label { margin: 0; font-size: 19px; font-weight: 600; }
.detail-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-dim); font-weight: 500; }
.detail-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tint-1);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}
.detail-vis { margin: 0; font-size: 13px; color: var(--ink-dim); font-weight: 500; }

/* ---------- Vrienden ---------- */

[hidden] { display: none !important; }

.friends-list-view, .friend-detail-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.friends-list-view .screen-header { margin-bottom: 0; }
.friends-list-view .demo-note { margin: 0; }

.friend-list { display: flex; flex-direction: column; gap: 8px; }

.avatar {
  --avatar-color: #3a394a;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 19px;
  font-weight: 700;
  color: #14131c;
  background: var(--avatar-color);
  box-shadow: 0 0 0 3px var(--ring);
}
.avatar.large { width: 72px; height: 72px; font-size: 32px; box-shadow: 0 0 0 4px var(--ring); }
/* Met profielfoto: de foto vult het rondje; de rand krijgt de kleur van de stemming */
.avatar.has-photo { overflow: hidden; background: #26252f; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-photo.has-mood { box-shadow: 0 0 0 3px var(--avatar-color); }
.avatar.large.has-photo.has-mood { box-shadow: 0 0 0 4px var(--avatar-color); }

/* Profielfoto kiezen */
.photo-actions { margin-top: 12px; display: flex; flex-direction: column; align-items: stretch; }
.photo-pick { margin-top: 0; cursor: pointer; }
.photo-actions .btn-danger-link { margin-top: 4px; }

.friend-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  color: var(--ink);
  text-decoration: none;
  transition: transform .1s ease, background-color .2s ease;
}
.friend-row:active { transform: scale(0.99); background: var(--card-press); }
.friend-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.friend-text { flex: 1; min-width: 0; }
.friend-name { margin: 0; font-size: 17px; font-weight: 600; }
.friend-sub {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-emoji { font-size: 30px; line-height: 1; }
.friend-emoji.none { font-size: 24px; color: var(--ink-dim); }

.invite-card { display: flex; flex-direction: column; }
.invite-explain { margin: 6px 0 0; font-size: 14px; font-weight: 500; color: var(--ink-dim); line-height: 1.4; }
.invite-card .btn-primary { margin-top: 14px; }

.btn-secondary {
  display: block;
  margin-top: 8px;
  width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--tint-2);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
}
.btn-secondary.quiet { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-status { margin: 8px 0 0; font-size: 13px; font-weight: 500; color: var(--accent); text-align: center; word-break: break-all; }
.share-status:empty { display: none; }

.empty-state { margin: 0; text-align: center; color: var(--ink-dim); font-weight: 500; line-height: 1.45; }

.back-link {
  align-self: flex-start;
  padding: 6px 10px 6px 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-dim);
  text-decoration: none;
}
.back-link:focus-visible { outline: 2px solid var(--accent); border-radius: 8px; }

.friend-head { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin-top: -6px; }
.friend-head .avatar { margin-bottom: 8px; }

.friend-today { display: flex; align-items: center; gap: 14px; }
.friend-today .detail-sub { margin: 0 0 2px; }
.friend-note { margin: 4px 0 0; font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.4; }
.friend-detail-view .history { margin-top: 0; }

.fine-print { margin: 0 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-dim); text-align: center; line-height: 1.4; }
.btn-danger-link {
  align-self: center;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
}
.btn-danger-link:focus-visible { outline: 2px solid var(--accent); border-radius: 8px; }

.invite-page { margin-top: 10vh; display: flex; flex-direction: column; text-align: center; }
.invite-emoji { margin: 0 0 8px; font-size: 56px; line-height: 1; }
.invite-text { margin: 8px 0 4px; font-size: 15px; font-weight: 500; color: var(--ink-dim); line-height: 1.45; }

/* ---------- Groepen ---------- */

.member-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.member-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot-off); }

.group-avg { display: flex; flex-direction: column; align-items: center; min-width: 40px; }
.group-avg-emoji { font-size: 28px; line-height: 1; }
.group-avg-num { margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.group-today { display: flex; flex-direction: column; gap: 8px; }
.group-today > .detail-sub { margin: 0; }
.group-week { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink-dim); }

.section-title { margin: 4px 4px -4px; font-size: 16px; font-weight: 600; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: 2px;
  color: var(--accent);
  background: var(--accent-soft);
}
.member-row { align-items: flex-start; }
.member-row .avatar, .member-row .friend-emoji, .member-row .remove-btn { align-self: center; }
.member-note {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--tint-1);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}
.remove-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-soft);
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
}

.text-input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background: var(--inset);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
}
.text-input:focus { border-color: var(--accent-focus); }
.text-input::placeholder { color: var(--ink-dim); }

.create-form { margin-top: 14px; display: flex; flex-direction: column; }
.create-form .btn-primary { margin-top: 10px; }

.owner-card { display: flex; flex-direction: column; }
.rename-form { margin-top: 12px; display: flex; gap: 8px; }
.btn-secondary.small { width: auto; margin-top: 0; flex-shrink: 0; }

/* ---------- Inloggen, account maken, profiel ---------- */

body.signed-out .tabbar { display: none; }
body.signed-out .wrap { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px); }

a.btn-primary { display: block; text-align: center; text-decoration: none; }
.invite-page a.btn-primary, .invite-page .btn-primary { margin-top: 16px; }

.auth-screen { gap: 14px; }
.auth-header { margin: 4vh 0 4px; }
.auth-emoji { margin: 0 0 6px; font-size: 22px; letter-spacing: 2px; }
.brand.big { font-size: 40px; }
.auth-pending {
  margin: 0;
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--accent);
  background: var(--accent-soft);
}
.auth-form { display: flex; flex-direction: column; }
.auth-form .field-label { margin-top: 14px; }
.auth-form .card-title + .field-label { margin-top: 10px; }
.pw-wrap { position: relative; }
.pw-wrap .text-input { padding-right: 70px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  background: var(--tint-2);
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.form-error { margin: 10px 0 0; min-height: 1.2em; font-size: 14px; font-weight: 600; color: var(--danger); }
.form-error:empty { min-height: 0; margin: 0; }
.auth-switch { margin: 0; font-size: 15px; font-weight: 500; color: var(--ink-dim); text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-help { width: 100%; font-size: 14px; color: var(--ink-dim); text-align: center; }
.auth-help summary { cursor: pointer; font-weight: 600; }
.auth-help p { margin: 8px 12px 0; line-height: 1.45; font-weight: 500; }

/* ---------- Tip: op je beginscherm zetten ---------- */

.install-tip {
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.install-tip-icon { font-size: 20px; }
.install-tip-text { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; line-height: 1.35; }
.install-tip-text b { color: var(--accent); font-weight: 600; }
.install-tip-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

/* ---------- Meldingen (Profiel) ---------- */

.notify-note { margin: 12px 0 0; font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--ink); }
.notify-on { margin: 12px 0 4px; font-size: 14px; font-weight: 600; color: var(--ok-ink); }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
  cursor: pointer;
}
.switch-label { font-size: 15px; font-weight: 500; line-height: 1.3; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--dot-off);
  position: relative;
  cursor: pointer;
  transition: background-color .2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.switch:checked { background: #43A85A; }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-notify-card] .btn-secondary { margin-top: 14px; }
[data-notify-card] .btn-danger-link { align-self: center; margin-top: 4px; }

/* Vijf tabs: iets compacter */
.tabbar { gap: 2px; padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
.tabbar a { font-size: 11.5px; }

@media (prefers-reduced-motion: reduce) {
  .needle-group, .readout-emoji, .dot, .glow { transition: none !important; }
  .quote-dialog[open] { animation: none; }
}

/* ---------- Tags ---------- */
.tags-label { margin-top: 16px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-dim);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.tag-chip.active { color: var(--ink); background: var(--accent-soft); border-color: var(--accent-line); }
.tag-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-tags { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink-dim); }

/* ---------- Reacties en knuffels ---------- */
.social-box { width: 100%; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.social-hug, .social-reactions {
  margin: 0;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.reaction-bar { display: flex; justify-content: center; gap: 10px; }
.reaction-btn {
  min-width: 64px;
  height: 48px;
  font-size: 22px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease;
}
.reaction-btn:active { transform: scale(0.94); }
.reaction-btn.active { background: var(--accent-soft); border-color: var(--accent-line); transform: scale(1.06); }
.reaction-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hug-btn { margin-top: 0; }
.hug-btn.warm:not(:disabled) { background: var(--warn-soft); border-color: var(--warn-line); }
.hug-btn:disabled { opacity: .7; cursor: default; }

/* ---------- Inzichten en mijlpalen ---------- */
.insights { margin-top: 10px; display: flex; flex-direction: column; }
.insight-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 15px;
  font-weight: 500;
}
.insight-row:last-child { border-bottom: 0; }
.insight-count { font-size: 12px; color: var(--ink-dim); }
.insight-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.insight-val.up { color: var(--ok-ink); }
.insight-val.down { color: var(--danger); }
.milestones { margin-top: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 14px;
  background: var(--tint-1);
  text-align: center;
  opacity: .55;
  filter: grayscale(1);
}
.milestone.done { opacity: 1; filter: none; background: var(--accent-soft); }
.milestone-emoji { font-size: 26px; line-height: 1.1; }
.milestone-label { font-size: 12px; font-weight: 700; }
.milestone-sub { font-size: 11px; color: var(--ink-dim); font-weight: 500; }

/* ---------- Herinneringstijd ---------- */
.time-select {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--inset);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px 10px;
}
