/* Ridgeline crew app — mobile-first (~380px). Desktop can look plain. */

:root {
  --bg: #0f172a;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --lead: #06b6d4;
  --callback: #f59e0b;
  --sold: #22c55e;
  --danger: #b00020;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }

/* ---------- generic screens (loading / disclosure / pickers) ---------- */
.screen { min-height: 100%; display: flex; flex-direction: column; }
.screen.center { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.screen.pad { padding: 20px 16px; gap: 14px; }
.pad { padding: 16px; }

.brand { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.title { font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; }
.err-text { color: var(--danger); }
.disclosure { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 340px; }
.notice {
  background: #fef3c7; color: #7c4a00; border: 1px solid #fde68a;
  padding: 8px 10px; border-radius: 8px; font-size: 14px;
}

.spinner {
  width: 36px; height: 36px; margin-top: 8px;
  border: 4px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  min-height: 48px; padding: 0 18px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; max-width: 320px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.tap { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ---------- name picker ---------- */
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.name-btn {
  min-height: 72px; border: 2px solid var(--line); background: #fff;
  border-radius: 14px; font-size: 19px; font-weight: 700; cursor: pointer;
}
.name-btn:active { background: #eff6ff; border-color: var(--primary); }

/* ---------- chunk picker ---------- */
.chunk-list { display: flex; flex-direction: column; gap: 12px; }
.chunk-card {
  display: flex; align-items: stretch; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; background: #fff;
}
.chunk-bar { width: 10px; flex: 0 0 10px; }
.chunk-body { flex: 1; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.chunk-title { font-size: 17px; font-weight: 700; }
.claimed-by { font-style: italic; }
.claim-btn { width: 100%; }

/* ---------- work view ---------- */
.workview { height: 100%; display: flex; flex-direction: column; }
.topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg); color: #fff;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 2px; }
.hamburger {
  min-width: 44px; min-height: 44px; background: transparent; border: none;
  color: #fff; font-size: 22px; cursor: pointer;
}

/* sync indicator: 12px dot inside a 40px tap target */
.sync-dot {
  min-width: 40px; min-height: 40px; background: transparent; border: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.sync-dot-inner {
  width: 12px; height: 12px; border-radius: 50%; background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}
.sync-dot-inner.green { background: #22c55e; }
.sync-dot-inner.amber { background: #f59e0b; }
.sync-dot-inner.red { background: #ef4444; }
.map { flex: 1 1 auto; min-height: 0; width: 100%; background: #e5e7eb; z-index: 0; }

.bottom {
  flex: 0 0 auto; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.panel-head { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.panel-addr { font-size: 18px; font-weight: 700; margin-top: 2px; }
.panel-coord { font-size: 13px; }
.panel-stop { font-size: 13px; }
.panel-saved {
  height: 0; overflow: hidden; opacity: 0; color: var(--sold); font-weight: 700;
  transition: opacity 0.2s; font-size: 14px;
}
.panel-saved.show { height: auto; opacity: 1; margin-top: 4px; }

.note-wrap { margin-top: 6px; }
.note-link { background: none; border: none; color: var(--primary); font-size: 14px; padding: 4px 0; cursor: pointer; }
.note-box { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; }
.note-input {
  flex: 1; resize: vertical; min-height: 44px; padding: 8px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 8px; font-family: inherit;
}

.status-row { display: flex; gap: 8px; margin-top: 10px; }
.status-btn {
  flex: 1; min-height: 56px; border: none; border-radius: 12px;
  font-size: 17px; font-weight: 700; color: #06283d; cursor: pointer;
}
.status-callback { background: var(--callback); }
.status-lead { background: var(--lead); }
.status-sold { background: var(--sold); color: #06321a; }
.status-btn:active { filter: brightness(0.93); }

/* ---------- Leaflet markers ---------- */
.house-pin {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4); color: #111827;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.you-dot {
  width: 16px; height: 16px; border-radius: 50%; background: #2563eb;
  border: 2px solid #fff; box-shadow: 0 0 0 rgba(37,99,235,0.6);
  animation: pulse 1.6s infinite; margin: 2px;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}

/* toast (undo + sync messages) */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 12px);
  max-width: 92%; display: flex; align-items: center; gap: 12px;
  background: #1e293b; color: #fff; padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35); font-size: 14px; z-index: 1200;
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-action {
  flex: 0 0 auto; background: transparent; border: 1px solid #475569; color: #93c5fd;
  font-weight: 700; font-size: 14px; padding: 6px 12px; border-radius: 8px;
  min-height: 36px; cursor: pointer;
}

/* Desktop: keep the app phone-width and centered (layout can be plain). */
@media (min-width: 600px) {
  #app { max-width: 420px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); }
}
