/* Fetch — design system, direction A: light, clean, editorial.
   One accent (deep teal), neutral greys, an 8px rhythm, real shadows.
   If a new screen needs a new color, the answer is almost always no. */

:root {
  --bg:           #f7f8fa;
  --surface:      #ffffff;
  --surface-2:    #f2f4f7;
  --line:         #e3e7ee;
  --line-strong:  #cdd4e0;
  --ink:          #101828;
  --ink-2:        #475467;
  --ink-3:        #98a2b3;
  --accent:       #0f5d5a;
  --accent-hover: #0c4d4a;
  --accent-soft:  #e6f2f1;
  --accent-ink:   #ffffff;
  --hot:          #b42318;
  --hot-soft:     #fef3f2;
  --warm:         #b54708;
  --warm-soft:    #fffaeb;
  --good:         #027a48;
  --good-soft:    #ecfdf3;
  --info:         #175cd3;
  --info-soft:    #eff8ff;
  --shadow:       0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --shadow-lg:    0 12px 16px -4px rgba(16,24,40,.08), 0 4px 6px -2px rgba(16,24,40,.03);
  --radius:       12px;
  --radius-sm:    8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
a { color: var(--accent); }

h1, h2, h3, p { margin: 0; }

/* ---------- primitives ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:focus-visible, .lead:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.wide { width: 100%; }

.btn.quiet {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn.quiet:hover:not(:disabled) { background: var(--surface-2); }

.btn.danger {
  background: var(--surface);
  color: var(--hot);
  border: 1px solid var(--line-strong);
}
.btn.danger:hover:not(:disabled) { background: var(--hot-soft); border-color: var(--hot); }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.fld { margin-bottom: 16px; }

input[type=text], input[type=email], input[type=password], input[type=search],
textarea, select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.55; }

.hint { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }

.alert {
  display: none;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  background: var(--hot-soft);
  color: var(--hot);
  font-size: 13.5px;
}
.alert.show { display: block; }

.note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
}
.note.working { background: var(--accent-soft); border-color: #bfdedd; color: var(--accent); }
.note.bad { background: var(--hot-soft); border-color: #fecdca; color: var(--hot); }
.note.info { background: var(--info-soft); border-color: #b2ddff; color: var(--info); }
.note b { color: inherit; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
}
.tag.hot  { background: var(--hot-soft);  color: var(--hot); }
.tag.warm { background: var(--warm-soft); color: var(--warm); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.meta { color: var(--ink-3); font-size: 12.5px; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.wordmark { display: flex; align-items: center; gap: 9px; }
.wordmark b { font-size: 20px; letter-spacing: -.4px; font-weight: 700; }
.wordmark svg { display: block; flex: none; }

/* ---------- the gate (login) ---------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.gate-card { width: 100%; max-width: 400px; padding: 32px 30px; }
.gate-card h1 { margin: 22px 0 5px; font-size: 24px; letter-spacing: -.5px; font-weight: 650; }
.gate-card .sub { margin-bottom: 24px; color: var(--ink-2); font-size: 14.5px; }
.gate-switch { margin-top: 20px; text-align: center; color: var(--ink-2); font-size: 13.5px; }
.gate-switch a { font-weight: 600; text-decoration: none; cursor: pointer; }

/* ---------- onboarding ---------- */

.onb-wrap {
  min-height: 100vh;
  padding: 28px 16px 60px;
  display: grid;
  justify-items: center;
  align-content: start;
}
.onb { width: 100%; max-width: 620px; padding: 26px 26px 22px; margin-top: 18px; }
.onb h1 { margin-bottom: 6px; font-size: 22px; letter-spacing: -.4px; font-weight: 650; }
.onb .sub { margin-bottom: 20px; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }

.steps { display: flex; gap: 8px; width: 100%; max-width: 620px; }
.step { flex: 1; }
.step .bar { height: 4px; border-radius: 99px; background: var(--line); }
.step.done .bar, .step.now .bar { background: var(--accent); }
.step .t { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.step.now .t, .step.done .t { color: var(--ink); }

#onb-map { height: 300px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.leaflet-container { background: var(--surface-2); font: inherit; }

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 18px 0 10px;
}
.slider-head .val { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.slider-head .val em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--ink-2); }

input[type=range] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line);
  border-radius: 99px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: pointer;
}

.covered {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.covered .n { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.suggest {
  position: absolute;
  z-index: 800;
  left: 0; right: 0; top: 100%;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.suggest button {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
}
.suggest button:hover { background: var(--surface-2); }
.suggest .pop { color: var(--ink-3); font-size: 12px; }

/* ---------- app shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar .who { margin-left: auto; text-align: right; }
.topbar .who .nm { font-size: 13px; font-weight: 600; }
.topbar .who button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12.5px;
}
.topbar .who button:hover { color: var(--ink); }

.nav {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.nav button {
  padding: 10px 14px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
}
.nav button:hover { color: var(--ink); }
.nav button[aria-selected=true] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 650;
}
.nav .count {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}

main { max-width: 1060px; margin: 0 auto; padding: 20px 16px 80px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .grow { flex: 1; min-width: 170px; }
.toolbar select { width: auto; }

/* ---------- leads ---------- */

.lead-list { overflow: hidden; }
.lead {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s ease;
}
.lead:last-child { border-bottom: 0; }
.lead:hover { background: var(--surface-2); }
.lead:hover .ph { transform: scale(1.03); }
.lead .ph { transition: transform .25s ease; }
.lead .ph {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-2);
}
.lead .body { min-width: 0; flex: 1; }
.lead .nm {
  margin-bottom: 2px;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead .ad {
  margin-bottom: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.6;
}
.empty b { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 15px; }

/* ---------- detail sheet ---------- */

.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16,24,40,.55);
  display: grid;
  place-items: end center;
  animation: fadein .2s ease;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 680px;
  max-height: 93vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 30px;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetup .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes sheetup { from { transform: translateY(48px); opacity: .4; } }
@media (min-width: 720px) {
  .sheet-back { place-items: center; }
  .sheet { border-radius: 16px; }
}
.sheet-pad { padding: 0 22px; }

/* photo hero at the top of the sheet */
.sheet-hero {
  position: relative;
  height: 220px;
  background: var(--surface-2);
  cursor: zoom-in;
  overflow: hidden;
}
.sheet-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.sheet-hero:hover img { transform: scale(1.03); }
.sheet-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,24,40,.28), transparent 36%, transparent 70%, rgba(16,24,40,.42));
  pointer-events: none;
}
.sheet-hero .expand {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.94); color: var(--ink);
  font: 600 12.5px/1 inherit; font-family: inherit;
  box-shadow: var(--shadow);
  cursor: zoom-in;
}
.sheet-hero .count-pill {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(16,24,40,.55); color: #fff;
  font-size: 12px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.sheet-close-x {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.94); color: var(--ink);
  font-size: 17px; line-height: 1;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.sheet-head { position: relative; padding-top: 18px; }
.sheet-head.no-hero { padding-top: 46px; }
.sheet-head.no-hero .sheet-close-x { background: var(--surface-2); box-shadow: none; }

.shots img { cursor: zoom-in; transition: transform .2s ease, opacity .2s ease; }
.shots img:hover { transform: translateY(-2px); opacity: .92; }
.sheet h2 { font-size: 20px; font-weight: 650; letter-spacing: -.3px; }
.sheet .sub { margin: 3px 0 14px; color: var(--ink-2); font-size: 13.5px; }
.sheet section { margin-top: 20px; }
.sheet h3 {
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.shots { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.shots img {
  flex: none;
  width: 112px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.btnrow .btn { flex: 1 1 auto; min-width: 110px; }

.msgbox { position: relative; margin-bottom: 8px; }
.msgbox textarea { min-height: 116px; padding-top: 26px; }
.msgbox .lang {
  position: absolute;
  top: 7px; left: 13px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
}

.reason {
  padding: 11px 13px;
  border-left: 3px solid var(--warm);
  border-radius: 0 8px 8px 0;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 13px;
  line-height: 1.5;
}

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  padding: 8px 0 8px 14px;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}
.history time { display: block; color: var(--ink-3); font-size: 11.5px; }

/* ---------- follow-ups ---------- */

.fup { padding: 16px; margin-bottom: 12px; }
.fup .nm { font-size: 15.5px; font-weight: 650; }
.fup .ad { margin: 1px 0 10px; color: var(--ink-2); font-size: 13.5px; }
.fup textarea { margin-top: 10px; }

/* ---------- stats ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.tile { padding: 16px; }
.tile .k {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tile .n { margin-top: 7px; font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.tile .d { margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--good); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 130px;
  padding: 14px;
}
.chart div {
  flex: 1;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: .85;
}
.chart div.zero { background: var(--line); }

.spend { margin-top: 14px; padding: 13px 15px; color: var(--ink-2); font-size: 13px; line-height: 1.6; }
.spend b { color: var(--ink); }

/* ---------- settings ---------- */

.set-grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .set-grid { grid-template-columns: 1fr 1fr; } }
.set-card { padding: 20px; }
.set-card h3 {
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.set-card.span { grid-column: 1 / -1; }

.langrow { display: flex; gap: 8px; }
.langrow .opt {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
}
.langrow .opt[aria-pressed=true] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

#set-map { height: 240px; border-radius: var(--radius-sm); border: 1px solid var(--line); }

.saved { margin-left: 10px; color: var(--good); font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.saved.show { opacity: 1; }

.attrib { margin-top: 26px; text-align: center; color: var(--ink-3); font-size: 11.5px; }
.attrib a { color: var(--ink-3); }

/* ---------- lightbox: photos at full size ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8,12,20,.94);
  display: grid;
  place-items: center;
  animation: fadein .18s ease;
}
.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  animation: lbin .25s cubic-bezier(.2,.9,.3,1);
  user-select: none;
}
@keyframes lbin { from { transform: scale(.96); opacity: .5; } }
.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 21px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-btn.prev { left: 14px; }
.lb-btn.next { right: 14px; }
.lb-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 19px;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.lb-close:hover { background: rgba(255,255,255,.24); }
.lb-count {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 13px; font-weight: 600;
}
@media (max-width: 600px) {
  .lb-btn.prev { left: 6px; }
  .lb-btn.next { right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
