/* Shakha Outreach Tracker — mobile-first styles */

:root {
  --green:  #2e7d32;
  --orange: #ef6c00;
  --red:    #c62828;
  --white:  #ffffff;
  --ink:    #1a1a1a;
  --muted:  #666;
  --line:   #e0e0e0;
  --bg:     #f5f5f5;
  --accent: #2e7d32;
  --danger: #c62828;
  --tap:    44px;              /* min touch target */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 500;
}
.topbar h1 { font-size: 1.05rem; margin: 0; flex: 1; font-weight: 600; }
.topbar a, .topbar button.link {
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,.15);
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn.secondary { background: #eee; color: var(--ink); }
.btn.danger    { background: var(--danger); }
.btn:disabled  { opacity: .5; }
.btn-block     { width: 100%; }

/* ---- Login ---- */
.center-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.card h1 { margin: 0 0 4px; font-size: 1.3rem; }
.card p.sub { margin: 0 0 20px; color: var(--muted); font-size: .9rem; }

label { display: block; font-size: .8rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=url],
input[type=tel], input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: var(--tap);
}
textarea { min-height: 72px; resize: vertical; }

.msg { margin-top: 12px; font-size: .85rem; }
.msg.error { color: var(--danger); }

/* ---- Map ---- */
#map { position: absolute; inset: 0; }
body.map-page { overflow: hidden; }
.map-shell { position: absolute; top: 48px; left: 0; right: 0; bottom: 0; }

.banner {
  position: absolute;
  left: 12px; right: 12px; top: 60px;
  z-index: 600;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner span { flex: 1; font-size: .9rem; }

.toast {
  position: fixed;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: .85rem;
  z-index: 1200;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; }

/* ---- Map pins (divIcon): house-shaped, colored by status ---- */
.home-icon {
  position: relative;
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}
.home-icon.pending::after {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 9px; height: 9px;
  background: #1e88e5;
  border: 1.5px solid #fff;
  border-radius: 50%;
}

/* ---- List ---- */
.list-wrap { padding: 12px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 160px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
  font-size: .85rem;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.home-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.3); flex: 0 0 auto; }
.dot.green {background:var(--green)} .dot.orange {background:var(--orange)}
.dot.red {background:var(--red)} .dot.white {background:var(--white)}
.home-card .info { flex: 1; min-width: 0; }
.home-card .info .name { font-weight: 600; }
.home-card .info .meta { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-card .badge { font-size: .7rem; color: #1e88e5; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---- Dialog / form ---- */
dialog {
  width: min(520px, 94vw);
  max-height: 90vh;
  border: 0;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
}
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-head {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.dialog-head-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.dialog-head-title h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-body { padding: 16px; overflow-y: auto; max-height: calc(90vh - 128px); }
.dialog-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.dialog-foot .btn { flex: 1; }
.icon-btn {
  border: 0; background: none; font-size: 1.4rem; line-height: 1;
  width: var(--tap); height: var(--tap); cursor: pointer; color: var(--muted);
}

/* ---- View (read-only) dialog ---- */
.view-row { margin-bottom: 14px; }
.view-row .label { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.view-row .value { font-size: .95rem; word-break: break-word; }
.view-row .value a { color: var(--accent); }

/* Status swatches */
.swatches { display: flex; gap: 10px; margin-top: 6px; }
.swatch {
  flex: 1;
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: #000;
  position: relative;
}
.swatch[data-status=green]  { background: #c8e6c9; }
.swatch[data-status=orange] { background: #ffe0b2; }
.swatch[data-status=red]    { background: #ffcdd2; }
.swatch[data-status=white]  { background: #fafafa; }
.swatch.selected { border-color: #000; font-weight: 700; }

.radio-row { display: flex; gap: 16px; align-items: center; margin-top: 6px; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
.radio-row input { width: auto; min-height: auto; }

.field-note { font-size: .75rem; color: var(--muted); margin-top: 2px; }

/* Offline indicator */
.net-badge {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.2);
}
.net-badge.offline { background: #b71c1c; }
