/* Faras design language — specs/04 §1–2 */
:root {
  --green: #1BA351;
  --green-soft: #EAF7EF;
  --ink: #17232D;
  --muted: #8A94A0;
  --alert: #D93025;
  --route: #2A5BD7;
  --radius: 1rem;
  --shadow: 0 8px 28px rgba(23, 35, 45, 0.12);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); background: #f4f6f8; }
#app { position: relative; height: 100%; overflow: hidden; }

/* Map-first: 80% viewport on load */
#map {
  position: absolute;
  inset: 0 0 20% 0;
  z-index: 1;
}

.search-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search-bar input {
  flex: 1 1 100px;
  min-height: 48px;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 16px;
}
.chip {
  min-height: 48px;
  min-width: 48px;
  border: none;
  border-radius: 999px;
  background: #f0f2f4;
  color: var(--ink);
  font-weight: 600;
  padding: 0 16px;
  cursor: pointer;
}
.chip.plus { background: var(--green); color: #fff; font-size: 22px; }
.chip[aria-pressed="true"] { background: var(--green-soft); color: var(--green); outline: 2px solid var(--green); }

/* Login sits under search bar, above map content; z-index above sheet */
.auth-strip {
  position: absolute;
  top: 76px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 10px 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid var(--green);
}
.auth-strip.logged-in {
  border-color: #c8ecd4;
  background: var(--green-soft);
}
.auth-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100%;
}
.auth-strip input {
  min-height: 48px;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 0 12px;
  flex: 1 1 110px;
  font-size: 16px;
  background: #fff;
}
.auth-strip .btn-auth {
  min-height: 48px;
  min-width: 48px;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.auth-strip .btn-auth.primary {
  background: var(--green);
}
.auth-strip.logged-in #phone,
.auth-strip.logged-in #otp,
.auth-strip.logged-in #btnOtp,
.auth-strip.logged-in #btnVerify,
.auth-strip.logged-in #regPanel {
  display: none;
}
.reg-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.reg-panel.hidden { display: none !important; }
.reg-panel .check {
  font-size: 12px;
  color: var(--ink);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.3;
}
.muted { color: var(--muted); font-size: 13px; align-self: center; }

.route-pill {
  position: absolute;
  top: 168px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  background: #fff;
  color: var(--route);
  border: 2px solid var(--route);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.route-pill.hidden { display: none; }

/* Bottom sheet */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  z-index: 6;
  background: #fff;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -8px 32px rgba(23,35,45,0.15);
  display: flex;
  flex-direction: column;
  transition: height 0.2s ease;
}
.sheet.expanded { height: 72%; }
.sheet-handle {
  display: flex;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
}
.sheet-handle span {
  width: 42px; height: 5px;
  background: #d5dbe1;
  border-radius: 999px;
}
.sheet-hint { margin: 0 16px 6px; color: var(--muted); font-size: 12px; text-align: center; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
  border-bottom: 1px solid #eef1f4;
}
.tab {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
}
.tab.active { background: var(--green-soft); color: var(--green); }

.tab-panel {
  display: none;
  overflow: auto;
  padding: 12px;
  flex: 1;
}
.tab-panel.active { display: block; }

/* Faras option cards */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.option-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 1rem;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: 0 2px 10px rgba(23,35,45,0.06);
  cursor: pointer;
  min-height: 88px;
  text-align: left;
  width: 100%;
}
.option-card.selected {
  background: var(--green-soft);
  border-color: var(--green);
}
.option-card.busy { opacity: 0.55; filter: grayscale(0.3); }
.thumb {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #c8ecd4, #e8f5ec);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.card-sub { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.card-price { font-weight: 800; font-size: 16px; text-align: right; }
.card-total { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}
.why-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.why-chip {
  background: #eef2ff;
  color: var(--route);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}

.cta {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border: none;
  border-radius: 1rem;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.cta.secondary { background: #fff; color: var(--green); border: 2px solid var(--green); }
.ghost {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.lot-detail label {
  display: block;
  margin: 10px 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.lot-detail input[type="number"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid #e2e6ea;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 16px;
}
.move-ind { font-size: 13px; color: var(--muted); margin: 6px 0; }
.status-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef1f4;
}
.status-chip.CONFIRMED, .status-chip.TRAVEL_SAFE, .status-chip.FULFILLED {
  background: var(--green-soft); color: var(--green);
}
.status-chip.DISPUTED { background: #fde8e6; color: var(--alert); }

.contact-card {
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  background: #f6f8fa;
  padding: 10px;
  border-radius: 10px;
}

.modal {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(23,35,45,0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 480px;
  background: #fff;
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 20px;
}
.modal-card h2 { margin: 0 0 12px; }
.modal-card label { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
.modal-card input {
  display: block; width: 100%; min-height: 48px;
  margin-top: 4px; border: 1px solid #e2e6ea; border-radius: 12px; padding: 0 12px;
}

/* Leaflet pin colors via divIcon */
.pin-lot, .pin-demand {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.pin-lot { background: var(--green); }
.pin-demand { background: #f59e0b; }
