/* Fruter research version — shared styles */
:root {
  --cream: #FFFFFF;
  --cream-2: #FFF6CC;
  --ink: #1D1714;
  --ink-2: #5E5249;
  --line: #EEE7DB;
  --orange: #FF4B1B;
  --yellow: #FEDE46;
  --yellow-soft: #FFF3B0;
  --teal: #FF98E0;           /* brand pink (kept the old name so nothing else changes) */
  --pink: #FF98E0;
  --teal-soft: #FFE1F6;
  --grey: #8E8276;
  --grey-soft: #EFEBE5;
  --white: #FFFFFF;
  --danger: #B3261E;
  --display: var(--brand-font, 'Bricolage Grotesque'), 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --radius: 16px;
  --shadow: 3px 3px 0 var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
a { color: var(--ink); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.4px; line-height: 1.08; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---------- App shell ---------- */
.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.view { flex: 1; padding: 16px 20px 110px; display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .logo { height: 36px; width: auto; display: block; }
.demo-banner { background: var(--yellow); border-bottom: 2px solid var(--ink); text-align: center; font-size: 13px; font-weight: 700; padding: 6px 12px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 2px solid var(--ink); z-index: 1000; padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 8px 6px 10px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--ink-2); text-decoration: none; min-height: 48px; justify-content: center; }
.tab .ic { width: 44px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: 2px solid transparent; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab[aria-current="page"] .ic { background: var(--orange); border-color: var(--ink); }
.tab.report .ic { background: var(--teal); border-color: var(--ink); }
svg.i { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Building blocks ---------- */
.card { background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius); padding: 14px; }
.card.pop { box-shadow: var(--shadow); }
.card.teal { background: var(--teal-soft); }
.card.yellow { background: var(--yellow-soft); }
.card.dashed { border-style: dashed; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 14px; background: var(--white); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--orange); box-shadow: 4px 4px 0 var(--ink); font-family: var(--display); font-weight: 800; font-size: 18px; }
.btn.yellow { background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); font-family: var(--display); font-weight: 800; font-size: 18px; }
.btn.teal { background: var(--teal); box-shadow: 3px 3px 0 var(--ink); font-family: var(--display); font-weight: 800; font-size: 18px; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 12px; border-radius: 10px; box-shadow: none; font-family: var(--body); font-weight: 700; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.linkbtn { background: none; border: 0; padding: 10px 0; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); cursor: pointer; text-decoration: none; flex: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); font-size: 14px; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--yellow); font-weight: 700; }
.chip.orange[aria-pressed="true"] { background: var(--orange); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 700; font-size: 15px; }
.input { min-height: 50px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 14px; background: var(--white); font-size: 16px; width: 100%; }
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.search { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; background: var(--white); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; min-width: 0; }

.fresh { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.fresh .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); }
.fresh.today { background: var(--teal-soft); } .fresh.today .dot { background: var(--teal); }
.fresh.week { background: var(--yellow-soft); } .fresh.week .dot { background: var(--yellow); }
.fresh.old { background: var(--grey-soft); } .fresh.old .dot { background: var(--grey); }
.fresh.out { background: #FFD6C8; } .fresh.out .dot { background: var(--orange); }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; border: 1.5px solid var(--ink); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; background: var(--white); }

.result { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius); text-decoration: none; color: inherit; }
.result.pop { box-shadow: var(--shadow); }
.result .badge { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: var(--display); font-size: 17px; background: var(--grey-soft); }
.result .title { font-weight: 700; font-size: 15px; }
.result .sub { font-size: 13px; color: var(--ink-2); }
.score { text-align: right; flex: none; }
.score b { display: block; font-family: var(--display); font-size: 20px; }
.score span { font-size: 11px; color: var(--ink-2); }

.bars { display: grid; grid-template-columns: 84px 1fr 32px; align-items: center; gap: 8px 10px; font-size: 14px; }
.bar { height: 10px; border-radius: 6px; background: var(--cream-2); border: 1.5px solid var(--ink); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); }

.rate-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.rate-row button { min-height: 46px; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); font-weight: 700; font-size: 16px; cursor: pointer; }
.rate-row button[aria-pressed="true"], .rate-row button.lit { background: var(--yellow); }

.toggle { width: 54px; height: 32px; border: 2px solid var(--ink); border-radius: 999px; background: var(--grey-soft); padding: 0 3px; display: flex; align-items: center; cursor: pointer; flex: none; }
.toggle::after { content: ''; width: 22px; height: 22px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
.toggle[aria-pressed="true"] { background: var(--teal); justify-content: flex-end; }

.empty { text-align: center; padding: 18px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty img { width: auto; height: 90px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 2000; max-width: 90vw; text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--cream-2); border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--danger); font-weight: 700; font-size: 14px; }

.map { height: 320px; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: var(--cream-2); }
.map.tall { height: calc(100vh - 260px); min-height: 360px; }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid var(--ink); }
.pin.today { background: var(--teal); } .pin.week { background: var(--yellow); } .pin.old { background: var(--grey-soft); } .pin.out { background: var(--orange); }
.leaflet-popup-content { font-family: var(--body); }

.hero { display: flex; justify-content: center; position: relative; padding: 8px 0; }
.hero .disc { position: absolute; top: 50%; left: 50%; width: 250px; height: 250px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--cream); border: 2px solid var(--ink); }
.hero img { position: relative; width: auto; height: 190px; }
.welcome { background: var(--yellow); min-height: 100vh; }
.welcome .view { padding-bottom: 32px; }

.photo-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); }
.history { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.history div { height: 10px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--white); }
.history div.in { background: var(--teal); }
.history div.out { background: var(--orange); }
.points-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; box-shadow: 2px 2px 0 var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.osm-credit { font-size: 11px; color: var(--ink-2); text-align: center; }

/* ---------- Desktop pages (insights, admin) ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-family: var(--display); font-weight: 800; font-size: 34px; }
.kpi.hot { background: var(--orange); }
.cols { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.cols > * { flex: 1 1 380px; min-width: 0; }
.tablebox { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; }
table.data th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-2); text-align: left; padding: 0 10px 8px; white-space: nowrap; }
table.data td { padding: 10px; border-top: 1.5px solid var(--line); font-size: 14px; vertical-align: middle; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tr.mine td { background: #FFE6DD; }
.gapbar { height: 14px; border-radius: 7px; background: var(--cream-2); overflow: hidden; min-width: 80px; }
.gapbar > i { display: block; height: 100%; background: var(--orange); }
.login { max-width: 420px; margin: 40px auto; }

/* Warm Fruter tint on the OpenStreetMap map. Only the map tiles are tinted,
   so the coloured pins keep their true colours. */
.leaflet-container { background: var(--cream); }
.leaflet-tile-pane { filter: saturate(0.7) sepia(0.15) hue-rotate(-6deg) brightness(1.02); }
