/* runwise. — brand tokens
   Bone #F4F2EC · Track Black #0A0C0A · Pulse Cyan #00FFFF · Deep Blue #0A1F5C · Flag Orange #FF5A2C · Paper #FBFAF5
*/
:root {
  --bone: #F4F2EC;
  --black: #0A0C0A;
  --cyan: #00FFFF;
  --cyan-ink: #00CCCC;
  --blue: #0A1F5C;
  --orange: #FF5A2C;
  --paper: #FBFAF5;
  --muted: #6b6b6b;
  --line: rgba(10,12,10,.12);

  --display: 'Archivo Black', system-ui, sans-serif;
  --body: 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --tab-h: 64px;
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* fix: voorkomt dat .ib/.ios/.tabbar met display:flex|grid de hidden-attribute overschrijven */
html, body { margin: 0; padding: 0; background: var(--bone); color: var(--black); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
#app { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-bot)); }
body.no-tabbar #app { padding-bottom: 0; }

/* type */
h1, h2, h3 { font-family: var(--display); font-weight: 900; letter-spacing: -0.045em; line-height: .95; margin: 0; }
h1 { font-size: clamp(40px, 10vw, 72px); }
h2 { font-size: clamp(28px, 6vw, 40px); }
h3 { font-size: 20px; letter-spacing: -0.02em; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
p { line-height: 1.5; }
a { color: inherit; }

/* layout */
.screen { padding: 28px 20px 20px; max-width: 560px; margin: 0 auto; }
.screen-pad-top { padding-top: max(28px, env(safe-area-inset-top)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.hr { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 1.5px solid var(--black); background: var(--black); color: var(--bone);
  font-family: var(--body); font-weight: 700; font-size: 15px;
  padding: 14px 18px; border-radius: 999px; cursor: pointer; width: 100%;
  transition: transform .04s ease;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--black); }
.btn.cyan { background: var(--cyan); color: var(--black); border-color: var(--black); }
.btn.orange { background: var(--orange); color: var(--bone); border-color: var(--orange); }
.btn.strava { background: #FC4C02; color: #fff; border-color: #FC4C02; }
.btn.sm { padding: 10px 14px; font-size: 13px; width: auto; }

/* inputs */
.field { display: block; }
.field label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 14px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--black);
  font-family: var(--body); font-size: 16px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--black); }
.error { color: var(--orange); font-size: 13px; margin-top: 8px; }
.info  { color: var(--blue);   font-size: 13px; margin-top: 8px; }

/* card */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.card.dark { background: var(--black); color: var(--bone); border-color: var(--black); }

/* ---------- splash / loader (boot screen) ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bone);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 32px;
  transition: opacity .35s ease, visibility .35s ease;
}
.splash.fade { opacity: 0; visibility: hidden; }
.splash-mark {
  height: 36px; width: auto;
  animation: splash-pulse 1.4s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%, 100% { opacity: .35; transform: scale(.98); }
  50%      { opacity: 1;   transform: scale(1);   }
}
.splash-bar {
  width: 140px; height: 2px;
  background: rgba(10,12,10,.08);
  border-radius: 999px; overflow: hidden;
}
.splash-bar-fill {
  height: 100%; width: 40%;
  background: var(--black);
  border-radius: 999px;
  animation: splash-slide 1.1s ease-in-out infinite;
}
@keyframes splash-slide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(150%);  }
  100% { transform: translateX(-100%); }
}

/* hint-card (subtiele CTA naar profiel als Strava nog niet gekoppeld is) */
.hint-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: var(--paper); border: 1px dashed var(--line); border-radius: 14px;
  font-size: 14px; color: var(--muted); cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.hint-card:hover { background: var(--bone); border-color: var(--black); color: var(--black); }
.hint-card b { color: var(--black); font-weight: 600; }

/* kpi tegels */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  background: var(--black); color: var(--bone);
  border-radius: 18px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 110px; justify-content: space-between;
  position: relative; overflow: hidden;
}
.kpi:nth-child(2), .kpi:nth-child(3) {
  background: var(--cyan); color: var(--black);
}
.kpi-num {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(36px, 9vw, 48px); line-height: 1;
  letter-spacing: -.045em;
}
.kpi-lbl {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .65;
}
.kpi:nth-child(2) .kpi-lbl, .kpi:nth-child(3) .kpi-lbl { opacity: .8; color: rgba(10,12,10,.75); }
.kpi-skel {
  display: inline-block; min-width: 1.4em;
  background: rgba(244,242,236,.08); border-radius: 6px;
  color: transparent; animation: kpi-pulse 1.4s ease-in-out infinite;
}
.kpi:nth-child(2) .kpi-skel, .kpi:nth-child(3) .kpi-skel { background: rgba(10,12,10,.08); }
@keyframes kpi-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* ---------- admin dashboard ---------- */
.admin .kpi-num { font-size: clamp(24px, 6vw, 32px); }
.admin .kpi { min-height: 92px; padding: 14px; }
.chart-wrap { position: relative; width: 100%; height: 240px; }
.chart-wrap.chart-sm { height: 200px; }

/* Admin charts grid wrapper — pakt 2 koloms op desktop */
.admin .chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Desktop: dashboard breder + KPI's in 4-7 koloms grid + charts naast elkaar */
@media (min-width: 720px) {
  section.admin { max-width: 1200px; padding-left: 32px; padding-right: 32px; }
  .admin .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .admin .kpi { min-height: 110px; padding: 18px; }
  .admin .kpi-num { font-size: clamp(24px, 2.8vw, 34px); }
  .admin .chart-grid { grid-template-columns: 1fr 1fr; }
  .admin .chart-wrap { height: 300px; }
  .admin .chart-wrap.chart-sm { height: 260px; }
}

@media (min-width: 1100px) {
  .admin .kpi-grid { grid-template-columns: repeat(7, 1fr); }
  .admin .kpi-num { font-size: clamp(20px, 1.8vw, 28px); }
}

/* wordmark logo */
.wordmark { height: 22px; width: auto; display: block; }
.auth-hero .wordmark { height: 26px; }

/* ---------- install banner (floating chip onderaan) ---------- */
.ib {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + var(--safe-bot) + 12px);
  z-index: 70;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 10px;
  background: var(--black); color: var(--bone);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(10,12,10,.22), 0 0 0 1px rgba(244,242,236,.06) inset;
  animation: ib-in .35s cubic-bezier(.2,.8,.2,1);
}
/* als de tabbar verborgen is (login/signup), dock 'm laag */
body.no-tabbar .ib { bottom: calc(var(--safe-bot) + 12px); }

@keyframes ib-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ib-icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 10px; display: block;
}
.ib-copy { flex: 1; min-width: 0; line-height: 1.25; }
.ib-title {
  font-family: var(--body); font-weight: 700; font-size: 14px;
  letter-spacing: -.01em;
}
.ib-sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(244,242,236,.55);
  margin-top: 2px;
}
.ib-cta {
  background: var(--cyan); color: var(--black); border: 0;
  font-family: var(--body); font-weight: 700; font-size: 13px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.ib-cta:active { transform: translateY(1px); }
.ib-close {
  flex: 0 0 28px; width: 28px; height: 28px;
  display: grid; place-items: center;
  background: transparent; border: 0; color: rgba(244,242,236,.55);
  border-radius: 999px; cursor: pointer;
  margin-left: -4px;
}
.ib-close:hover { color: var(--bone); background: rgba(244,242,236,.08); }

/* op smalle telefoons: 2-rij layout */
@media (max-width: 380px) {
  .ib { flex-wrap: wrap; padding: 10px 12px 12px; }
  .ib-copy { flex: 1 1 auto; }
  .ib-cta { order: 3; flex: 1 1 100%; margin-top: 6px; padding: 11px; }
  .ib-close { order: 2; }
}

/* ---------- iOS install modal ---------- */
.ios {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: end center;
  background: rgba(10,12,10,.55);
  backdrop-filter: blur(6px);
  animation: ios-bg .2s ease both;
}
@keyframes ios-bg { from { opacity: 0; } to { opacity: 1; } }

.ios-card {
  position: relative;
  width: 100%; max-width: 440px;
  margin: 0 12px 12px;
  background: var(--paper); color: var(--black);
  border-radius: 22px;
  padding: 22px 22px 20px;
  box-shadow: 0 24px 60px rgba(10,12,10,.35);
  animation: ios-card-in .32s cubic-bezier(.2,.8,.2,1) both;
}
@media (min-width: 560px) {
  .ios { place-items: center; }
  .ios-card { margin: 0; }
}
@keyframes ios-card-in {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ios-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent; border: 0;
  color: var(--muted); cursor: pointer; border-radius: 999px;
}
.ios-close:hover { background: rgba(10,12,10,.06); color: var(--black); }

.ios-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: block; margin-bottom: 14px;
}
.ios-title {
  font-family: var(--display); font-size: 28px;
  letter-spacing: -.035em; margin: 0 0 4px;
}
.ios-lead { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.ios-steps {
  list-style: none; padding: 0; margin: 0 0 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.ios-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14px; line-height: 1.45;
}
.ios-num {
  flex: 0 0 22px; height: 22px; border-radius: 999px;
  background: var(--black); color: var(--bone);
  font-family: var(--mono); font-size: 11px;
  display: grid; place-items: center; margin-top: 1px;
}
.ios-share-ico {
  display: inline-block; vertical-align: -3px;
  width: 16px; height: 16px;
  padding: 2px; border: 1px solid var(--line); border-radius: 5px;
  margin: 0 2px;
}

/* tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--black); color: var(--bone);
  z-index: 50;
}
.tab { background: transparent; border: 0; color: var(--bone); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; cursor: pointer; }
.tab[aria-current="page"] { color: var(--cyan); }

/* ad slot — fullscreen PWA overlay */
.ad-slot {
  position: fixed; inset: 0;
  background: var(--blue); color: var(--bone);
  padding: calc(env(safe-area-inset-top, 0px) + 72px) 24px calc(var(--safe-bot) + 32px);
  display: flex; flex-direction: column;
  z-index: 100;
  opacity: 0; transition: opacity .25s ease;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.ad-slot.show { opacity: 1; }

/* per-variant background accents */
.ad-slot.v-blue   { background: var(--blue);   color: var(--bone); }
.ad-slot.v-black  { background: var(--black);  color: var(--bone); }
.ad-slot.v-orange { background: var(--orange); color: var(--bone); }
.ad-slot.v-cyan   { background: var(--cyan);   color: var(--black); }
.ad-slot.v-bone   { background: var(--bone);   color: var(--black); }

/* subtle brand mark in corner */
.ad-slot .ad-mark {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 20px); left: 20px;
  font-family: var(--display); letter-spacing: -.03em; font-size: 18px;
  opacity: .9;
}
.ad-slot .ad-mark::after { content: '.'; color: var(--cyan); }
.ad-slot.v-cyan .ad-mark::after,
.ad-slot.v-bone .ad-mark::after { color: var(--orange); }

/* decorative bar */
.ad-slot .ad-deco {
  position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  opacity: .8;
}
.ad-slot.v-cyan .ad-deco { background: linear-gradient(90deg, var(--black), var(--orange)); }

/* main column */
.ad-slot .ad-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 18px; max-width: 560px; margin: 0 auto; width: 100%;
}
.ad-slot .ad-eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  opacity: .75;
}
.ad-slot .ad-text {
  font-family: var(--display); letter-spacing: -.035em; line-height: .95;
  font-size: clamp(40px, 11vw, 64px);
  margin: 0;
}
.ad-slot .ad-text b { color: var(--cyan); }
.ad-slot.v-cyan .ad-text b { color: var(--blue); }
.ad-slot.v-bone .ad-text b { color: var(--orange); }
.ad-slot.v-orange .ad-text b { color: var(--black); }
.ad-slot .ad-sub {
  font-size: 16px; line-height: 1.45; opacity: .85; max-width: 440px;
}

/* CTA group, pinned bottom for thumb reach */
.ad-slot .ad-actions {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 420px; margin: 0 auto;
  padding-top: 16px;
}
.ad-slot .ad-cta {
  background: var(--cyan); color: var(--black); border: 0;
  border-radius: 999px; padding: 18px 24px;
  font-family: var(--body); font-weight: 700; font-size: 17px;
  cursor: pointer; min-height: 56px;
  transition: transform .06s ease;
}
.ad-slot .ad-cta:active { transform: translateY(1px); }
.ad-slot.v-cyan .ad-cta { background: var(--black); color: var(--bone); }
.ad-slot.v-bone .ad-cta { background: var(--orange); color: var(--bone); }
.ad-slot .ad-fineprint {
  text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; opacity: .55;
}

/* close + countdown — top right */
.ad-slot .ad-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px;
  width: 48px; height: 48px; border-radius: 999px;
  background: rgba(255,255,255,.10); border: 0; color: inherit;
  display: grid; place-items: center; cursor: not-allowed; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.ad-slot.v-cyan .ad-close,
.ad-slot.v-bone .ad-close { background: rgba(0,0,0,.10); }
.ad-slot .ad-close[data-ready="1"] { cursor: pointer; background: rgba(255,255,255,.18); }
.ad-slot.v-cyan .ad-close[data-ready="1"],
.ad-slot.v-bone .ad-close[data-ready="1"] { background: rgba(0,0,0,.18); }
.ad-slot .ad-close .ad-count {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
}
.ad-slot .ad-close .ad-x {
  font-size: 26px; line-height: 1;
}
.ad-slot .ad-close svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}
.ad-slot .ad-close svg circle.track { stroke: currentColor; opacity: .25; }
.ad-slot .ad-close svg circle.bar   {
  stroke: currentColor;
  stroke-dasharray: 131.95;
  stroke-dashoffset: 0;
}
.ad-slot.show .ad-close[data-ready="0"] svg circle.bar {
  animation: ad-ring 15s linear forwards;
}
@keyframes ad-ring {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: 131.95; }
}

/* lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 14px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list li:first-child { border-top: 0; }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--bone); border: 1.5px solid var(--black); display: grid; place-items: center; font-family: var(--display); }

/* empty state */
.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty .em-icon { font-size: 40px; margin-bottom: 10px; }

/* login hero */
.auth-hero {
  background: var(--black); color: var(--bone);
  border-radius: 24px; padding: 28px 22px;
  display: flex; flex-direction: column; gap: 8px;
}
.auth-hero .dot { color: var(--cyan); }
.auth-hero p { color: rgba(244,242,236,.7); margin: 0; }

/* tag */
.tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: var(--bone); border: 1px solid var(--line); }
.tag.cyan { background: var(--cyan); border-color: var(--black); }
.tag.ok { background: #e6fff7; border-color: #00b399; color: #006e5f; }
