/* ScoopOS Dashboard — mobile-first, field-ready */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #166534;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--gray-900);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* NAV */
.nav {
  background: var(--green-dark);
  color: white;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  height: 56px;
}
.nav-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.nav-brand span { color: #86efac; }
.nav-tabs {
  display: flex;
  gap: 4px;
}
.nav-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}
.nav-tab.active, .nav-tab:hover {
  background: rgba(255,255,255,.15);
  color: white;
}

/* LAYOUT */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* TABS */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; line-height: 1; }
.stat-card.green .value { color: var(--green); }
.stat-card.yellow .value { color: var(--yellow); }

/* SECTION */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 17px; font-weight: 700; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fca5a5; }

/* CARD */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

/* CUSTOMER CARD */
.customer-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}
.customer-card + .customer-card { border-top: 1px solid var(--border); }
.cust-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.cust-info { flex: 1; min-width: 0; }
.cust-name { font-weight: 600; font-size: 15px; }
.cust-address { color: var(--gray-500); font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.badge {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.cust-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ROUTE STOP */
.stop-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  transition: background .1s;
}
.stop-card.done { background: var(--gray-50); }
.stop-card + .stop-card { border-top: 1px solid var(--border); }
.stop-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-700);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stop-card.done .stop-num { background: var(--green-light); color: var(--green-dark); }
.stop-info { flex: 1; min-width: 0; }
.stop-name { font-weight: 600; font-size: 15px; }
.stop-card.done .stop-name { text-decoration: line-through; color: var(--gray-500); }
.stop-address { color: var(--gray-500); font-size: 13px; margin-top: 1px; }
.stop-dogs { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stop-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.check-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-size: 18px;
}
.check-btn:hover { border-color: var(--green); background: var(--green-light); }
.check-btn.done { border-color: var(--green); background: var(--green); color: white; }

/* DATE PICKER */
.date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.date-row input[type="date"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--card);
}

/* INVOICE TABLE */
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th, .invoice-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.invoice-table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--gray-500); background: var(--gray-50); }
.invoice-table tr:last-child td { border-bottom: none; }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
}
@media (min-width: 640px) {
  .modal { border-radius: var(--radius); }
}
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* FORM */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: white;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--green); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* EMPTY STATE */
.empty { text-align: center; padding: 48px 20px; color: var(--gray-500); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }
.empty p { font-size: 15px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* NOTES */
.notes-text { font-size: 12px; color: var(--gray-500); font-style: italic; margin-top: 3px; }

/* Progress bar */
.progress-bar { background: var(--gray-200); border-radius: 99px; height: 6px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
