/* Observation Tools — shared style layer
   Mobile-first, max content width 540px, iPhone safe areas. */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400..900&display=swap');

:root {
  --lav: #8E86E0;
  --lav-tint: #E7E5F8;
  --lime: #E6CE66;
  --lime-tint: #F5EDC9;
  --bg: #F1ECE7;
  --ink: #1A1A20;      /* near-black nav / dark badges */
  --white: #FFFFFF;

  --t1: #17171C;       /* primary text */
  --t2: #6B6B76;       /* secondary text */
  --t3: #A9A9B6;       /* tertiary text */

  /* activity colors */
  --a-walking:  #8E86E0;
  --a-sitting:  #7FB39C;
  --a-standing: #D9B24E;
  --a-cycling:  #D98B72;
  --a-playing:  #E6CE66;
  --a-eating:   #6FA0CF;

  --r-card: 26px;
  --r-sheet: 28px;
  --r-chip: 14px;

  --sh-sm: 0 1px 3px rgba(22,22,28,.06), 0 1px 2px rgba(22,22,28,.04);
  --sh-md: 0 6px 18px rgba(22,22,28,.07), 0 2px 6px rgba(22,22,28,.05);
  --sh-lg: 0 18px 40px rgba(22,22,28,.12), 0 6px 14px rgba(22,22,28,.06);
  --sh-nav: 0 14px 34px rgba(120,100,90,.20), 0 4px 12px rgba(120,100,90,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(42% 32% at 12% 8%, rgba(142,134,224,.30), transparent 70%),
    radial-gradient(38% 30% at 92% 4%, rgba(217,178,78,.26), transparent 72%),
    radial-gradient(46% 34% at 88% 62%, rgba(127,179,156,.26), transparent 72%),
    radial-gradient(44% 32% at 6% 78%, rgba(217,139,114,.24), transparent 72%),
    radial-gradient(40% 30% at 50% 108%, rgba(111,160,207,.24), transparent 70%);
  background-attachment: fixed;
  color: var(--t1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- app shell ---- */
.app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    calc(120px + env(safe-area-inset-bottom))
    env(safe-area-inset-left);
}
.app--flush { padding-bottom: 0; }

.pad { padding-left: 20px; padding-right: 20px; }

/* ---- typography ---- */
h1, h2, h3 { margin: 0; letter-spacing: -0.5px; }
.h1 { font-weight: 800; font-size: 30px; line-height: 1.08; letter-spacing: -0.8px; }
.h2 { font-weight: 800; font-size: 21px; line-height: 1.15; }
.h3 { font-weight: 700; font-size: 16px; }
.eyebrow { font-weight: 700; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--t3); }
.muted { color: var(--t2); }
.dim { color: var(--t3); }

/* hand-drawn underline accent under a word */
/* reference treatment: emphasis word is simply bolder, no underline stroke */
.accent { font-weight: 800; white-space: nowrap; }
.accent > svg { display: none; }

/* ---- cards (liquid glass) ---- */
.card {
  background: rgba(255,255,255,.52);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: var(--r-card);
  box-shadow: 0 10px 30px rgba(120,100,90,.12), inset 0 1px 0 rgba(255,255,255,.65);
  padding: 18px;
}

/* ---- pills / badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
}
.pill--soft { background: var(--bg); color: var(--t2); }
.pill--public { background: var(--lime-tint); color: #5a6b1e; }
.pill--private { background: var(--lav-tint); color: #5646c9; }

/* dark stat badge */
.stat-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff;
  padding: 9px 14px; border-radius: 999px;
  font-weight: 700; font-size: 13.5px; white-space: nowrap;
}
.stat-badge svg { flex: none; opacity: .9; }
.stat-badge .sb-sub { color: rgba(255,255,255,.55); font-weight: 500; }

/* ---- buttons ---- */
.btn {
  border: none; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; border-radius: 999px;
  padding: 14px 22px; transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--lav); color: #fff; box-shadow: 0 8px 18px rgba(142,134,224,.35); }
.btn--primary:hover { filter: brightness(1.04); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--ghost { background: var(--white); color: var(--t1); box-shadow: var(--sh-sm); }
.btn--lime { background: var(--lime); color: #2f3a10; }
.btn--block { width: 100%; }

/* ---- chips ---- */
.chip {
  border: 1.5px solid rgba(22,22,28,.08); background: var(--white);
  color: var(--t2); font-family: inherit; cursor: pointer;
  padding: 10px 15px; border-radius: var(--r-chip);
  font-weight: 600; font-size: 13.5px; line-height: 1;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all .14s ease;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
/* default active fill so a chip is never white-text-on-white-background —
   activity chips override this inline with their own color when selected */
.chip.is-active { color: #fff; border-color: transparent; background: var(--ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 9px; }

/* segmented toggle */
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button {
  border: none; background: transparent; font-family: inherit; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--t2);
}
.seg button.is-active { background: var(--white); color: var(--t1); box-shadow: var(--sh-sm); }

/* ---- floating dark pill bottom nav ---- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(14px);
  border-radius: 999px; padding: 7px; box-shadow: var(--sh-nav);
}
.nav a {
  width: 50px; height: 50px; border-radius: 16px;
  display: grid; place-items: center; color: #A6A09A;
  text-decoration: none; transition: all .18s ease;
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { background: var(--ink); color: #fff; border-radius: 50%; box-shadow: 0 8px 16px rgba(26,26,32,.26); }
.nav a svg { width: 22px; height: 22px; }

/* floating add action */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 55;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--lav); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 26px rgba(142,134,224,.5);
  transition: transform .14s ease;
}
.fab:active { transform: scale(.93); }
.fab svg { width: 28px; height: 28px; }

/* ---- bottom sheet ---- */
.sheet-scrim {
  position: fixed; inset: 0; background: rgba(22,22,28,.45); z-index: 70;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
  backdrop-filter: blur(2px);
}
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: 100%; max-width: 540px; z-index: 75;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border-top: 1px solid rgba(255,255,255,.6);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--sh-lg), inset 0 1px 0 rgba(255,255,255,.7);
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  transition: transform .34s cubic-bezier(.22,1,.36,1);
  max-height: 92dvh; overflow-y: auto;
}
.sheet.is-open { transform: translate(-50%, 0); }
.sheet-grab { width: 40px; height: 5px; border-radius: 999px; background: #E2E1EA; margin: 8px auto 14px; }

/* stepper */
.stepper { display: inline-flex; align-items: center; gap: 14px; background: var(--bg); border-radius: 999px; padding: 6px; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--white); color: var(--ink); box-shadow: var(--sh-sm);
  font-size: 22px; font-weight: 700; display: grid; place-items: center; font-family: inherit;
}
.stepper button:active { transform: scale(.94); }
.stepper .val { min-width: 42px; text-align: center; font-weight: 800; font-size: 24px; }

/* ---- form fields (shared) ---- */
.field-lbl { font-size: 12px; font-weight: 700; color: var(--t2); letter-spacing: .2px; margin-bottom: 9px; }
.input {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 500; color: var(--t1);
  background: var(--bg); border: 1.5px solid transparent; border-radius: 14px;
  padding: 13px 15px; outline: none; transition: border-color .15s ease, background .15s ease;
}
.input::placeholder { color: var(--t3); font-weight: 500; }
.input:focus { border-color: var(--lav); background: var(--white); }
.input.is-error { border-color: #DE6E88; background: #FBEEF2; }
.err-text { display: none; margin-top: 7px; font-size: 12px; font-weight: 600; color: #C74B69; }
.err-text.show { display: block; }
.hint-text { margin-top: 8px; font-size: 12px; font-weight: 500; color: var(--t2); display: flex; align-items: center; gap: 6px; }

/* color swatches */
.swatch-row { display: flex; gap: 11px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px; border-radius: 13px; cursor: pointer; border: none;
  position: relative; padding: 0; transition: transform .12s ease;
}
.swatch:active { transform: scale(.9); }
.swatch.is-active { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px rgba(22,22,28,.20); }
.swatch.is-active::after {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}

/* "custom" swatch — opens the native color picker for any hex */
.swatch--custom {
  background: conic-gradient(from 180deg, #E15B5B, #E6CE66, #7FB39C, #6FA0CF, #8E86E0, #D98B72, #E15B5B);
  display: grid; place-items: center;
}
.swatch--custom svg { filter: drop-shadow(0 1px 2px rgba(22,22,28,.35)); }
.swatch--custom.is-active::after { background-color: rgba(22,22,28,.22); }

/* full-width segmented toggle */
.seg--full { display: flex; width: 100%; }
.seg--full button { flex: 1; }

/* small dark header add button */
.add-btn {
  border: none; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 5px;
  background: var(--ink); color: #fff; padding: 8px 14px 8px 11px; border-radius: 999px;
  font-weight: 700; font-size: 13px; transition: transform .12s ease, filter .2s ease;
}
.add-btn:active { transform: scale(.95); }
.add-btn:hover { filter: brightness(1.12); }
.add-btn svg { width: 16px; height: 16px; }

/* delete button on custom project cards */
.proj-del {
  width: 32px; height: 32px; border-radius: 10px; flex: none; border: none; cursor: pointer;
  background: var(--bg); color: var(--t3); display: grid; place-items: center;
  transition: background .14s ease, color .14s ease;
}
.proj-del:hover { background: #FBEEF2; color: #C74B69; }
.proj-del:active { transform: scale(.92); }
.proj-del svg { width: 16px; height: 16px; }

/* lock badge (unlock sheet) */
.ul-lock {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--lav-tint); color: #5646c9; display: grid; place-items: center;
}

/* generic layout helpers */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.stack > * + * { margin-top: var(--s, 14px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scroll-x { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
