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

:root {
  --primary: #2D6A4F;
  --primary-light: #40916C;
  --primary-dark: #1B4332;
  --accent: #F4A261;
  --accent-dark: #E76F51;
  --bg: #F8FAF9;
  --surface: #FFFFFF;
  --surface-2: #F0F4F2;
  --border: #D8E6E0;
  --text: #1A2E22;
  --text-muted: #5A7A68;
  --danger: #E63946;
  --warning: #F4A261;
  --success: #2D6A4F;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

/* ── App shell ── */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--primary-dark);
  color: white;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-logo { font-weight: 700; font-size: 18px; letter-spacing: -0.5px; }
.topbar-logo span { color: var(--accent); }
.topbar-date { font-size: 13px; color: rgba(255,255,255,0.7); }

/* ── Nav tabs ── */
.nav-tabs {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  flex: 0 0 auto;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.nav-tab:hover { color: var(--primary); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Page sections ── */
.page { display: none; padding: 16px; }
.page.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Stop list (route) ── */
.stop-list { list-style: none; }
.stop-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.stop-item:last-child { border-bottom: none; }
.stop-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.stop-item.done .stop-num {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.stop-item.skipped .stop-num { opacity: 0.4; }
.stop-info { flex: 1; min-width: 0; }
.stop-name { font-weight: 600; font-size: 15px; }
.stop-address { font-size: 13px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.stop-dogs { font-weight: 600; color: var(--primary-light); }
.stop-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.stop-item.done .stop-name { text-decoration: line-through; opacity: 0.6; }
.stop-item.done .stop-address { opacity: 0.5; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }
.badge-primary { background: #D1FAE5; color: var(--primary-dark); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent  { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── Customer list ── */
.customer-list { list-style: none; }
.customer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.customer-item:last-child { border-bottom: none; }
.customer-item:active { background: var(--surface-2); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.customer-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-weight: 600; font-size: 15px; }
.customer-sub { font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.customer-price { font-weight: 700; color: var(--primary); margin-left: auto; font-size: 15px; white-space: nowrap; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Invoice list ── */
.invoice-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.invoice-item:last-child { border-bottom: none; }
.invoice-amount { font-weight: 700; font-size: 17px; color: var(--primary); white-space: nowrap; }
.invoice-info { flex: 1; min-width: 0; }
.invoice-name { font-weight: 600; font-size: 14px; }
.invoice-date { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

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

/* ── Payment status color ── */
.status-current  { color: var(--success); }
.status-overdue  { color: var(--danger); }
.status-inactive { color: var(--text-muted); }

/* ── Empty states ── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Progress bar ── */
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--primary-dark); color: white;
  padding: 10px 20px; border-radius: 24px;
  font-size: 14px; font-weight: 500;
  z-index: 999; opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; }

/* ── Tablet+ layout ── */
@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .page { padding: 20px; }
  .topbar { padding: 0 24px; }
  .modal { border-radius: 12px; margin: auto; }
  .modal-overlay { align-items: center; }
}

/* ── Floating action button ── */
.fab {
  position: fixed; bottom: 24px; right: 20px;
  width: 56px; height: 56px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  border: none;
  font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244,162,97,0.5);
  z-index: 50;
  transition: transform 0.15s, background 0.15s;
}
.fab:active { transform: scale(0.93); }
.fab:hover { background: var(--accent-dark); }
