/* Kynfold Outreach — mobile-first. Built on the brand tokens. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { font-family: var(--font-body); color: var(--text-body);
  background: var(--surface-app); font-size: var(--text-sm); }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
h1,h2,h3 { font-family: var(--font-heading); color: var(--text-strong); margin: 0; letter-spacing: var(--tracking-tight); }
.mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-size: var(--text-xs); color: var(--text-subtle); }

/* ---- App frame: a phone-sized column, centered on big screens ---- */
#app { position: fixed; inset: 0; max-width: 460px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--surface-app);
  box-shadow: 0 0 60px rgba(53,34,26,.10); }
#topbar { height: 56px; flex: none; display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-4); background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-subtle); position: relative; z-index: 5; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text-strong); letter-spacing: -.03em; }
.wordmark span { color: var(--brand); }
#top-context { margin-left: auto; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius-pill); background: var(--surface-hover);
  display: grid; place-items: center; }
.icon-btn::before { content: "◔"; font-size: 16px; color: var(--text-muted); }

#view { flex: 1; position: relative; overflow: hidden; }
.scroll { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---- Bottom tab bar ---- */
#tabbar { flex: none; height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4,1fr);
  background: var(--surface-card); border-top: 1px solid var(--border-subtle); z-index: 5; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--text-subtle); }
.tab .ic { font-size: 19px; line-height: 1; }
.tab.is-active { color: var(--brand); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-pill); font-weight: 700;
  font-size: var(--text-base); transition: transform var(--dur-fast) var(--ease-bounce), background var(--dur-normal); }
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--brand); color: var(--text-on-brand); box-shadow: var(--shadow-brand); }
.btn-primary:active { background: var(--brand-active); }
.btn-ghost { background: var(--surface-hover); color: var(--text-body); }
.btn-block { display: flex; width: 100%; }
.btn-lg { height: 56px; font-size: var(--text-md); }
.fab { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--space-4);
  z-index: 6; width: calc(100% - var(--space-8)); }

/* ---- Cards & sheets ---- */
.card { background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pad { padding: var(--space-4); }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.stat { padding: var(--space-4); }
.stat b { display:block; font-family: var(--font-display); font-weight: 800; font-size: var(--text-2xl); line-height: 1; }
.stat.coral b { color: var(--brand); } .stat.berry b { color: var(--berry-600); }
.stat small { color: var(--text-muted); font-size: var(--text-xs); }

/* Bottom sheet */
.sheet-scrim { position: absolute; inset: 0; background: rgba(36,28,26,.45); backdrop-filter: blur(3px);
  z-index: 2000; opacity: 0; transition: opacity var(--dur-normal); }
.sheet-scrim.show { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2001; background: var(--surface-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-xl);
  max-height: 92%; display: flex; flex-direction: column; transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-bounce); padding-bottom: env(safe-area-inset-bottom); }
.sheet.show { transform: translateY(0); }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-default);
  margin: var(--space-3) auto var(--space-1); flex: none; }
.sheet .body { overflow-y: auto; padding: var(--space-4) var(--space-5) var(--space-6); }

/* ---- Lists ---- */
.list-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  background: var(--surface-card); border-bottom: 1px solid var(--border-subtle); }
.list-row:active { background: var(--surface-hover); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 700; color: var(--text-strong); }
.list-row .addr { color: var(--text-muted); font-size: var(--text-xs); }
.dist { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); white-space: nowrap; }

/* status dot */
.sdot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.s-new { background: var(--coral-500); } .s-open { background: var(--amber-500); }
.s-visited { background: var(--teal-500); } .s-dnc { background: var(--ink-400); }

/* ---- Tags / chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface-hover);
  font-size: var(--text-xs); font-weight: 600; color: var(--text-body); border: 1.5px solid transparent; }
.chip.on { background: var(--brand-subtle); color: var(--brand-on-subtle); border-color: var(--brand); }
.chip.teal { background: var(--teal-50); color: var(--teal-700); }
.chip.berry { background: var(--berry-50); color: var(--berry-600); }
.badge { padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.badge.teal { background: var(--teal-50); color: var(--teal-700); }
.badge.amber { background: var(--amber-50); color: var(--amber-700); }
.badge.ink { background: var(--surface-hover); color: var(--text-muted); }

/* ---- Outcome tiles (driveway-usable) ---- */
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.outcome { height: 88px; border-radius: var(--radius-lg); background: var(--surface-card);
  border: 1.5px solid var(--border-subtle); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; font-weight: 700; font-size: var(--text-base); color: var(--text-strong);
  transition: transform var(--dur-fast) var(--ease-bounce); }
.outcome:active { transform: scale(.96); }
.outcome.sel { border-color: var(--brand); background: var(--brand-subtle); color: var(--brand-on-subtle); }
.outcome .em { font-size: 24px; }

/* ---- Forms ---- */
label.field { display: block; margin: var(--space-4) 0; }
label.field > span { display: block; font-size: var(--text-xs); font-weight: 700; color: var(--text-muted);
  margin-bottom: 6px; text-transform: none; }
input, textarea, select { width: 100%; padding: 12px 14px; font: inherit; color: var(--text-body);
  background: var(--surface-card); border: 1.5px solid var(--border-default); border-radius: var(--radius-md); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.switch-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border-subtle); }
.switch-row .grow { flex: 1; } .switch-row .grow b { color: var(--text-strong); }
.switch-row .grow small { display: block; color: var(--text-muted); font-size: 11px; }
.switch { width: 48px; height: 28px; border-radius: 999px; background: var(--border-default); position: relative;
  flex: none; transition: background var(--dur-normal); }
.switch.on { background: var(--brand); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-normal) var(--ease-bounce); }
.switch.on::after { transform: translateX(20px); }

/* ---- Map ---- */
#leaf { position: absolute; inset: 0; background: var(--ink-100); }
.leaflet-tile-pane { filter: sepia(.22) saturate(.72) hue-rotate(-6deg) brightness(1.05) contrast(.93); }
.mapfilters { position: absolute; top: var(--space-3); left: var(--space-3); right: var(--space-3); z-index: 1001;
  display: flex; gap: var(--space-2); pointer-events: none; overflow-x: auto; }
.mapfilters .chip { pointer-events: auto; background: var(--surface-card); box-shadow: var(--shadow-sm); white-space: nowrap; }
.map-list { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1001; background: var(--surface-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg); max-height: 46%;
  display: flex; flex-direction: column; }
.map-list .hd { padding: var(--space-3) var(--space-4) 0; }
.map-list .rows { overflow-y: auto; }

/* Zoom + / - buttons (Leaflet), brand-styled, below the filter chips */
.leaflet-top.leaflet-right { top: 56px; z-index: 1000; }
.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow-md); border-radius: var(--radius-md); overflow: hidden; margin-right: var(--space-3) !important; }
.leaflet-control-zoom a { width: 42px; height: 42px; line-height: 42px; font-size: 22px; font-weight: 700;
  background: var(--surface-card); color: var(--text-strong); border: none;
  border-bottom: 1px solid var(--border-subtle); }
.leaflet-control-zoom a:last-child { border-bottom: none; }
.leaflet-control-zoom a:hover { background: var(--surface-hover); color: var(--brand); }
.leaflet-control-zoom a.leaflet-disabled { color: var(--text-subtle); background: var(--surface-card); }

/* login / hero */
.hero { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  padding: var(--space-6); background: linear-gradient(160deg, var(--coral-500), var(--berry-500)); color: #fff; }
.hero h1 { color: #fff; font-size: var(--text-3xl); }
.hero .card { color: var(--text-body); margin-top: var(--space-6); }
.muted { color: var(--text-muted); } .tiny { font-size: 11px; }
.section-t { padding: var(--space-4) var(--space-4) var(--space-2); }
.timeline .t { border-left: 2px solid var(--border-subtle); padding: 2px 0 var(--space-3) var(--space-4); position: relative; margin-left: 6px; }
.timeline .t::before { content:""; position:absolute; left:-6px; top:4px; width:10px; height:10px; border-radius:50%; background: var(--brand); }
.timeline .t.mail::before { background: var(--berry-500); }
.timeline .t b { color: var(--text-strong); } .timeline .t .when { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }

#toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--surface-inverse); color: #fff; padding: 12px 18px; border-radius: var(--radius-pill);
  font-weight: 600; box-shadow: var(--shadow-lg); }

@media (prefers-color-scheme: dark) {
  :root { --surface-app: #17110F; --surface-card: #221A17; --surface-hover: #2C221E;
    --text-strong:#F6EFEA; --text-body:#E7DDD6; --text-muted:#B7A79E; --text-subtle:#9C8B82;
    --border-subtle:#3A2E28; --border-default:#4A3A33; --surface-inverse:#0E0A09; }
}
