/* iOS-achtige shell: system fonts, large titles, frosted tab bar */
:root {
  --bg: #f2f2f7;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --separator: rgba(60, 60, 67, 0.12);
  --label: rgba(60, 60, 67, 0.6);
  --text: #000000;
  --accent: #007aff;
  --danger: #ff3b30;
  --good: #34c759;
  /* Donkergroen: “perfect” op Yazio-doel — valt op t.o.v. helder groen (goed) */
  --perfect: #1a6b3d;
  --warn: #ff9500;
  --radius-lg: 14px;
  --radius-md: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --safe-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  --safe-top: max(12px, env(safe-area-inset-top, 0px));
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
    system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Volledige schermhoogte in standalone/PWA (geen “browserpagina”-gevoel) */
body.eb-app {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: calc(100vh - 1px);
  min-height: calc(100dvh - 1px);
  min-height: calc(100svh - 1px);
  padding: var(--safe-top) 16px calc(88px + var(--safe-bottom));
  position: relative;
}

.large-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.35px;
  margin: 8px 0 4px;
}

.subtitle {
  font-size: 15px;
  color: var(--label);
  margin: 0 0 20px;
}

.card {
  background: var(--card-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.card.inset {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--separator);
  font-size: 17px;
}

.row > span:first-child {
  flex: 1 0 auto;
  padding-right: 12px;
}

.row > span:last-child {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  text-align: right;
  overflow-wrap: break-word;
}

.row-sub {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
}

.row:last-child {
  border-bottom: none;
}

.row-multiline {
  align-items: flex-start;
  padding-top: 12px;
  padding-bottom: 12px;
}

.row-label {
  color: var(--label);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 16px 4px;
}

.muted {
  color: var(--label);
  font-size: 15px;
}

.muted.row-sub {
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.pill.perfect {
  background: rgba(26, 107, 61, 0.16);
  color: #14532d;
}

.pill.good {
  background: rgba(52, 199, 89, 0.15);
  color: #1a7f37;
}

.pill.ok {
  background: rgba(142, 142, 147, 0.16);
  color: #3a3a3c;
}

.pill.bad {
  background: rgba(255, 59, 48, 0.14);
  color: #c41e14;
}

.pill.neutral {
  background: rgba(142, 142, 147, 0.12);
  color: var(--label);
}

.metric-big {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.metric-unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
  margin-left: 4px;
}

/* Hero / balanskaart */
.hero-card {
  padding: 20px 16px 18px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

.hero-kicker {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.hero-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.hero-pill {
  margin-bottom: 0;
}

.hero-message {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.4;
}

.hero-metric {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--separator);
}

.hero-metric--kg .hero-kg-sub {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
}

.explain-card {
  padding: 16px;
}

.explain-block {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--label);
}

.explain-block:last-child {
  margin-bottom: 0;
}

.explain-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.metric-caption {
  font-size: 13px;
  margin-bottom: 2px;
}

/* Inname-ring (Activity-achtig) */
.intake-ring {
  flex-shrink: 0;
  width: 108px;
  height: 108px;
}

.intake-ring-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.intake-ring-track {
  stroke: rgba(142, 142, 147, 0.22);
  stroke-width: 10;
  stroke-linecap: round;
}

.intake-ring-arc {
  stroke-width: 10;
  stroke-linecap: round;
  fill: none;
}

.intake-ring-arc--perfect {
  stroke: var(--perfect);
}

.intake-ring-arc--good {
  stroke: var(--good);
}

.intake-ring-arc--ok {
  stroke: rgba(142, 142, 147, 0.75);
}

.intake-ring-arc--bad {
  stroke: var(--danger);
}

.intake-ring-arc--neutral {
  stroke: rgba(142, 142, 147, 0.45);
}

.intake-ring--empty .intake-ring-track {
  stroke: rgba(142, 142, 147, 0.14);
  stroke-width: 10;
}

.grid-blocks {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 8px 4px 4px;
}

.block {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(142, 142, 147, 0.2);
}

.block.perfect {
  background: rgba(26, 107, 61, 0.58);
}

.block.good {
  background: rgba(52, 199, 89, 0.55);
}

.block.ok {
  background: rgba(142, 142, 147, 0.35);
}

.block.bad {
  background: rgba(255, 59, 48, 0.45);
}

.block.empty {
  background: rgba(142, 142, 147, 0.12);
}

.block.block-off {
  background: repeating-linear-gradient(
    -45deg,
    rgba(142, 142, 147, 0.08),
    rgba(142, 142, 147, 0.08) 4px,
    rgba(142, 142, 147, 0.02) 4px,
    rgba(142, 142, 147, 0.02) 8px
  );
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5px;
}

.block.block-off .block-day-num {
  font-size: 11px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.35);
}

.block.neutral {
  background: rgba(142, 142, 147, 0.28);
}

.grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 0 4px 6px;
  text-align: center;
}

.weekday-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--label);
  text-transform: lowercase;
  letter-spacing: 0.2px;
}

a.block-day {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

a.block-day:active {
  transform: scale(0.93);
  filter: brightness(0.92);
  transition-duration: 0.06s;
}

.block-day-num {
  font-size: 11px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.48);
  line-height: 1;
}

.month-cell .block-day-num {
  font-size: 10px;
}

.legend-mixed-goal {
  margin: 12px 4px 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 122, 255, 0.07);
  border: 0.5px solid rgba(0, 122, 255, 0.2);
  font-size: 13px;
  line-height: 1.4;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  margin-top: 12px;
  padding: 0 4px 4px;
  font-size: 12px;
  color: var(--label);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.swatch-perfect {
  background: rgba(26, 107, 61, 0.58);
}

.swatch-good {
  background: rgba(52, 199, 89, 0.55);
}

.swatch-ok {
  background: rgba(142, 142, 147, 0.35);
}

.swatch-neutral {
  background: rgba(142, 142, 147, 0.38);
}

.swatch-bad {
  background: rgba(255, 59, 48, 0.45);
}

.swatch-empty {
  background: rgba(142, 142, 147, 0.12);
}

.swatch-off {
  background: repeating-linear-gradient(
    -45deg,
    rgba(142, 142, 147, 0.2),
    rgba(142, 142, 147, 0.2) 2px,
    rgba(142, 142, 147, 0.06) 2px,
    rgba(142, 142, 147, 0.06) 4px
  );
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  text-align: center;
}

.week-card,
.month-card {
  padding: 12px 12px 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
  transition: transform 0.1s ease, filter 0.1s ease, opacity 0.1s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
  transition-duration: 0.06s;
}

.btn-primary:active:not(:disabled) {
  filter: brightness(0.88);
  opacity: 0.96;
}

.btn-secondary:active:not(:disabled),
a.btn-secondary:active {
  filter: brightness(0.9);
  opacity: 0.94;
}

.btn-danger:active:not(:disabled) {
  filter: brightness(0.92);
  opacity: 0.95;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.18);
}

.btn-primary.is-loading:disabled {
  opacity: 1;
  cursor: wait;
}

.btn-primary.is-loading::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  margin-left: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: eb-spin 0.65s linear infinite;
}

@keyframes eb-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-secondary {
  background: rgba(142, 142, 147, 0.16);
  color: var(--text);
}

.btn-danger {
  background: rgba(255, 59, 48, 0.12);
  color: var(--danger);
}

.field {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 0.5px solid var(--separator);
  font-size: 17px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
}

.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 13px;
  color: var(--label);
  margin-bottom: 6px;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 15px;
}

.flash.error {
  background: rgba(255, 59, 48, 0.12);
  color: #8b1e16;
}

.flash.success {
  background: rgba(52, 199, 89, 0.14);
  color: #1a6b32;
}

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  padding: 8px 12px var(--safe-bottom);
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 50;
  user-select: none;
  -webkit-user-select: none;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--label);
  letter-spacing: 0.2px;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 122, 255, 0.12);
  transition: transform 0.1s ease, color 0.15s ease, opacity 0.1s ease;
}

.tab:active {
  transform: scale(0.92);
  opacity: 0.78;
  transition-duration: 0.06s;
}

.tab.active {
  color: var(--accent);
}

.tab .icon {
  line-height: 0;
  display: block;
  margin-bottom: 4px;
}

.tab-svg {
  width: 26px;
  height: 26px;
  display: block;
  margin: 0 auto;
  color: inherit;
}

.top-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.top-actions .btn {
  width: auto;
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
}

.top-actions .btn-nav {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 12px;
}

.btn-nav-disabled {
  opacity: 0.38;
  pointer-events: none;
  cursor: default;
  box-shadow: none;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.nav-bar .btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 17px;
  font-weight: 400;
  padding: 8px 0;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 122, 255, 0.15);
  transition: opacity 0.08s ease, transform 0.08s ease;
}

.nav-bar .btn-link:active {
  opacity: 0.55;
  transform: scale(0.98);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  a.block-day {
    transition: none;
  }

  a.block-day:active {
    transform: none;
    filter: none;
  }

  .btn,
  .tab {
    transition: none;
  }

  .btn:active:not(:disabled),
  .tab:active {
    transform: none;
  }

  .btn-primary.is-loading::before {
    animation: none;
    border-color: rgba(255, 255, 255, 0.55);
    border-top-color: #fff;
  }

  .nav-bar .btn-link:active {
    transform: none;
  }
}
