/* TurfHealth CRM — mobile-first, big-button UI */
:root {
  --pine: #1F4E44;
  --pine-dark: #16382F;
  --mint: #9DCEAE;
  --gold: #C9A24B;
  --cream: #F6F4EF;
  --card: #FFFFFF;
  --ink: #1D2A26;
  --muted: #6B7A74;
  --line: #E4E0D6;
  --red: #B4462E;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(31, 78, 68, 0.08);
  --nav-h: 72px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; color: var(--pine); }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea {
  font-family: inherit; font-size: 1.05rem; width: 100%;
  padding: 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mint); border-color: var(--pine); }
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; color: var(--pine); }
a { color: var(--pine); }

.wrap { max-width: 680px; margin: 0 auto; padding: 16px; }

/* ---------- header ---------- */
.topbar {
  background: var(--pine); color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { max-width: 680px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar h1 { color: #fff; font-size: 1.25rem; line-height: 1.2; }
.topbar .sub { color: var(--mint); font-size: 0.85rem; font-weight: 500; }
.topbar .icon-btn { background: rgba(255,255,255,0.12); color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; font-weight: 600; }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(31,78,68,0.08);
}
.bottomnav button {
  flex: 1; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 0.75rem; font-weight: 600; color: var(--muted);
}
.bottomnav button .nav-ico { line-height: 1; display: flex; }
.bottomnav button.active .nav-ico svg { stroke-width: 2.4; }
.bottomnav button.active { color: var(--pine); }
.bottomnav button.active .nav-ico { transform: scale(1.1); }
.bottomnav .fab {
  flex: 0 0 84px; position: relative;
}
.bottomnav .fab > span {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--pine); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(31,78,68,0.35);
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.card.tappable:active { transform: scale(0.985); }
.job-time { font-size: 1.05rem; font-weight: 700; color: var(--pine); display: flex; align-items: center; gap: 6px; }
.job-name { font-family: 'Fraunces', Georgia, serif; font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 2px 0; }
.job-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.job-meta .icon { flex: 0 0 auto; opacity: 0.75; }
.job-price { color: var(--gold); font-weight: 700; }
.icon { vertical-align: -0.18em; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.actions.three { grid-template-columns: repeat(3, 1fr); }
.action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 4px; font-size: 0.78rem; font-weight: 600; color: var(--pine);
  text-decoration: none; min-height: 58px;
}
.action-btn .ico { line-height: 1; display: flex; }
.action-btn:active { background: var(--mint); }
.action-btn.done { background: var(--pine); color: #fff; border-color: var(--pine); }
.action-btn.done:active { background: var(--pine-dark); }

/* ---------- stops map ---------- */
.map-card {
  height: 230px; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 12px; background: #E8EDE9;
  position: relative; z-index: 1; /* keep Leaflet panes under the sticky topbar/sheets */
}
.map-card.tall { height: 300px; }
.map-pin { background: none; border: none; }
.map-pin span {
  display: flex; width: 30px; height: 30px; border-radius: 50%;
  background: var(--pine); color: #fff; font-weight: 700; font-size: 0.92rem;
  align-items: center; justify-content: center;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.map-pin.done span { background: #9AA5A0; }
.map-pin.home span { background: var(--gold); color: #3D3012; }
.leaflet-popup-content { font-family: 'Inter', system-ui, sans-serif; font-size: 0.9rem; line-height: 1.45; }
.leaflet-popup-content a { font-weight: 700; }

/* ---------- money dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 2px;
}
.stat .v { font-family: 'Fraunces', Georgia, serif; font-size: 1.5rem; font-weight: 700; color: var(--pine); }
.stat .k { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.src-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 10px;
  color: var(--muted); font-size: 0.9rem;
}

/* ---------- more menu ---------- */
.more-item { padding: 18px 16px; }
.more-ico {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 12px;
  background: var(--cream); color: var(--pine);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- price sheet / sell ---------- */
.pkg-card {
  display: block; width: 100%; text-align: left; position: relative;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.pkg-card.selected { border-color: var(--pine); background: #F2F7F3; }
.pkg-card .pkg-name { font-family: 'Fraunces', Georgia, serif; font-weight: 700; font-size: 1.12rem; color: var(--ink); }
.pkg-card .pkg-price { font-weight: 700; color: var(--gold); font-size: 1.15rem; white-space: nowrap; }
.pkg-card .pkg-desc { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.pkg-card .pkg-pop {
  position: absolute; top: -9px; left: 14px; background: var(--gold); color: #3D3012;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; border-radius: 999px; padding: 3px 9px;
}
.total-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25;
  background: var(--pine-dark); color: #fff; display: flex; justify-content: center; gap: 18px;
  padding: 13px 16px; font-size: 1rem;
}
.total-bar b { color: var(--mint); }
.total-bar s { color: rgba(255,255,255,0.55); font-size: 0.88rem; margin-left: 4px; }

/* ---------- sms log ---------- */
.sms-body {
  background: var(--cream); border-radius: 10px; padding: 10px 12px;
  font-size: 0.92rem; white-space: pre-wrap; overflow-wrap: anywhere;
}
.sms-row { padding: 14px 16px; }

/* ---------- route ---------- */
.stop-num {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--pine); color: #fff; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.route-note {
  background: #F7EEDB; border: 1.5px solid var(--gold); color: #7A5F1E;
  border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; font-weight: 500; margin: 10px 0;
}
.route-note.plain { background: transparent; border: none; color: var(--muted); padding: 6px 2px; }
.linklike { background: none; color: var(--pine); font-weight: 700; text-decoration: underline; font-size: 0.9rem; padding: 0 2px; }
.btn.route-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.btn.gold { color: #3D3012; }

/* ---------- month grid ---------- */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.mg-head { text-align: center; font-size: 0.66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0 2px; }
.mg-cell {
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-weight: 600; font-size: 0.95rem; color: var(--ink); padding: 0;
}
.mg-cell.blank { background: transparent; border: none; }
.mg-cell .dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.mg-cell .dot.has { background: var(--gold); }
.mg-cell .dot.proj { background: transparent; border: 1.5px solid var(--gold); box-sizing: border-box; }
.mg-cell.todaycell { border-color: var(--pine); }
.mg-cell.selected { background: var(--pine); border-color: var(--pine); color: #fff; }
.mg-cell.selected .dot.has { background: var(--mint); }
.mg-cell.selected .dot.proj { border-color: var(--mint); }
.mg-sel-title { margin: 14px 0 10px; font-size: 1.05rem; }

/* ---------- projected (auto-schedule) cards ---------- */
.card.projected { border: 1.5px dashed var(--pine); background: transparent; box-shadow: none; }
.card.projected .job-name { color: var(--pine); }
.projected-badge { background: #EAF3ED; color: var(--pine); margin-left: 8px; }
.btn.small-book { background: #fff; color: var(--pine); border: 2px solid var(--pine); padding: 12px; font-size: 0.95rem; margin-top: 10px; }
.job-meta.plan, .li-sub.plan { color: var(--pine); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.daystrip .dot.proj { background: transparent; border: 1.5px solid var(--gold); box-sizing: border-box; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: var(--pine); color: #fff; font-size: 1.1rem; font-weight: 700;
  padding: 16px; border-radius: 14px; margin-top: 14px;
}
.btn:active { background: var(--pine-dark); }
.btn.secondary { background: #fff; color: var(--pine); border: 2px solid var(--pine); }
.btn.ghost { background: none; color: var(--muted); font-weight: 600; box-shadow: none; padding: 12px; }
.btn.danger { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn.gold { background: var(--gold); }
.btn:disabled { opacity: 0.5; }

/* ---------- chips & badges ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chip {
  background: #fff; border: 1.5px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 10px 16px; font-size: 0.9rem; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--pine); color: #fff; border-color: var(--pine); }
.badge {
  display: inline-block; border-radius: 999px; padding: 4px 10px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.lead { background: #EFE7D3; color: #8A6D1F; }
.badge.quoted { background: #E3ECF6; color: #2C5A88; }
.badge.scheduled { background: #DDEDE3; color: var(--pine); }
.badge.completed { background: #E8E6E0; color: var(--muted); }
.badge.recurring { background: var(--pine); color: var(--mint); }
.badge.canceled { background: #F3DDD6; color: var(--red); }

/* ---------- today / calendar ---------- */
.screen-title { font-size: 1.5rem; margin: 6px 0 2px; }
.screen-sub { color: var(--muted); margin-bottom: 14px; font-size: 0.95rem; }
.empty {
  text-align: center; color: var(--muted); padding: 44px 20px; background: #fff;
  border-radius: var(--radius); border: 1.5px dashed var(--line);
}
.empty .big { display: block; margin-bottom: 10px; color: #C3BFB2; }

.daystrip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.daystrip button {
  flex: 0 0 58px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.daystrip .dow { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.daystrip .dom { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.daystrip .dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.daystrip .dot.has { background: var(--gold); }
.daystrip button.active { background: var(--pine); border-color: var(--pine); }
.daystrip button.active .dow { color: var(--mint); }
.daystrip button.active .dom { color: #fff; }

.weekday-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 8px; }
.weekday-head h3 { font-size: 1.05rem; }
.weekday-head .count { color: var(--muted); font-size: 0.85rem; }
.cal-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-controls .arrow { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 16px; font-size: 1.1rem; font-weight: 700; color: var(--pine); }
.cal-controls .label { flex: 1; text-align: center; font-weight: 700; color: var(--pine); }
.toggle { display: flex; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.toggle button { flex: 1; padding: 12px; background: none; font-weight: 700; color: var(--muted); font-size: 0.95rem; }
.toggle button.active { background: var(--pine); color: #fff; }

/* ---------- detail rows ---------- */
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--muted); font-size: 0.9rem; flex: 0 0 auto; }
.detail-row .v { font-weight: 600; text-align: right; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo-grid .ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .del {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.55); color: #fff;
  border-radius: 50%; width: 26px; height: 26px; font-size: 0.8rem; line-height: 1;
}
.photo-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--cream); border: 1.5px dashed var(--pine); color: var(--pine);
  border-radius: 12px; padding: 14px; font-weight: 700; width: 100%; margin-top: 10px; font-size: 0.95rem;
}

/* ---------- modal / sheet ---------- */
.sheet-back {
  position: fixed; inset: 0; background: rgba(22, 40, 35, 0.5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 680px; max-height: 88vh; overflow-y: auto;
  animation: slideup 0.18s ease-out;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 1.3rem; margin-bottom: 4px; }
.sheet .sheet-sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 10px; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.preset-grid button {
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 16px 8px; font-weight: 700; color: var(--pine); font-size: 1rem;
}
.preset-grid button:active, .preset-grid button.active { background: var(--mint); border-color: var(--pine); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--pine-dark); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; z-index: 80; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  animation: fadein 0.2s ease-out; max-width: 90vw; text-align: center;
}
.toast.err { background: var(--red); }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--pine); padding: 24px;
}
.login-card { background: #fff; border-radius: 20px; padding: 30px 24px; width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { font-size: 1.7rem; margin-bottom: 2px; }
.login-card .tag { color: var(--muted); margin-bottom: 18px; font-size: 0.9rem; }
.login-logo { color: var(--pine); margin-bottom: 8px; }

/* ---------- forms ---------- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 10px; width: 100%; text-align: left; border: none; font-size: 1rem;
}
.list-item .li-name { font-weight: 700; font-size: 1.08rem; margin-bottom: 2px; }
.list-item .li-sub { color: var(--muted); font-size: 0.88rem; }
.list-item .chev { color: var(--line); font-size: 1.3rem; }

@media (min-width: 700px) {
  html { font-size: 17px; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}
