:root {
  --primary: #1B5E20;
  --primary-light: #4C8C4A;
  --accent: #FFA000;
  --bg: #F7F8F5;
  --surface: #FFFFFF;
  --text: #1C1C1C;
  --text2: #666;
  --border: #E0E0E0;
  --danger: #B3261E;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }

.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

#app { padding: 14px; padding-bottom: 90px; max-width: 560px; margin: 0 auto; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 20px;
  color: var(--text2);
}
.tab-btn span { font-size: 11px; font-weight: 600; }
.tab-btn.active { color: var(--primary); }

.roadshow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.roadshow-arrow { font-size: 22px; color: var(--text2); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 15px;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}

.phone-input-row {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #FAFAFA;
}
.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  background: #EFEFEF;
  border-right: 1px solid var(--border);
}
.phone-input-row input {
  border: none;
  border-radius: 0;
  flex: 1;
  background: transparent;
}
.phone-input-row input:focus {
  outline: none;
}

label {

  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
  margin-top: 10px;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=tel], input[type=email], input[type=date],
select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFAFA;
  color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; border-radius: 26px; transition: 0.2s;
}
.slider:before {
  content: ""; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s;
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  margin-top: 6px;
}
.btn.secondary { background: #EFF4EF; color: var(--primary); }
.btn.whatsapp { background: #25D366; }
.btn.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn:active { opacity: 0.85; }

.small-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.gps-status { font-size: 13px; color: var(--text2); margin-top: 6px; }

.photo-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
}

.lead-card { margin-bottom: 10px; }
.lead-title { font-weight: 600; font-size: 16px; }
.lead-detail { font-size: 13px; color: var(--text2); margin-top: 2px; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge.synced { background: #E5F3E6; color: var(--primary); }
.badge.unsynced { background: #FCEBEA; color: var(--danger); }

.empty-state {
  text-align: center;
  color: var(--text2);
  padding: 60px 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.modal-sheet {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  border-radius: 18px 18px 0 0;
  padding: 18px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-sheet h3 { margin-top: 0; }

.template-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.template-option:last-of-type { border-bottom: none; }

.btn.outline.danger { color: var(--danger); border-color: #F3D3D0; }

.fab {
  position: fixed;
  right: 20px;
  bottom: 78px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 28px;
  border: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  z-index: 15;
  line-height: 1;
}

.install-banner {
  position: sticky;
  top: 0;
  z-index: 9;
  background: #FFF3DC;
  color: #6b4c00;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.install-banner span { flex: 1; }
.install-banner button {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.install-banner #installNowBtn { background: var(--primary); color: white; }
.install-banner #installDismissBtn { background: transparent; color: #6b4c00; font-size: 15px; padding: 6px 8px; }

.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
  padding: 20px;
}
.auth-logo {
  font-size: 48px;
  margin-bottom: 8px;
}
.auth-title {
  margin: 0 0 20px 0;
  color: var(--primary);
  font-size: 20px;
}
.auth-screen .card {
  width: 100%;
  max-width: 360px;
}
.auth-error {
  background: #FCEBEA;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 10px;
}

.field-hint { font-size: 12px; color: var(--text2); margin-top: 4px; }

