/* MSL Sprit-App — mobile-first styles */
:root {
  --msl-blue: #1aa3e8;
  --msl-blue-dark: #1487c2;
  --msl-yellow: #F5C400;
  --msl-yellow-dark: #d4aa00;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #22c55e;
  --gold: #f5c400;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* App Bar */
.app-bar {
  position: sticky; top: 0; z-index: 100;
  background: var(--msl-blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-bar h1 { font-size: 17px; font-weight: 600; flex: 1; }
.app-bar .logo { width: 28px; height: 28px; border-radius: 6px; }
.icon-btn {
  background: transparent; border: none; color: #fff;
  font-size: 20px; cursor: pointer; padding: 6px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(255,255,255,.15); }

/* Net pill */
.net-pill { font-size: 14px; color: #a0e8b0; }
.net-pill.offline { color: #f87171; }

/* Main layout */
main { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }

/* Form fields */
.field-group { margin-bottom: 10px; }
.field-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.input-row { display: flex; gap: 6px; align-items: center; }
input[type=text], input[type=number] {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 15px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--msl-blue); }
.unit-label { font-size: 14px; color: var(--text-muted); min-width: 28px; }

/* Suggestions dropdown */
.suggestions {
  list-style: none; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; max-height: 200px; overflow-y: auto;
  box-shadow: var(--shadow); position: relative; z-index: 20;
}
.suggestion-item { padding: 10px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: #f0f9ff; }

/* Tab bar */
.tab-bar { display: flex; gap: 4px; margin-bottom: 10px; background: var(--bg); border-radius: 8px; padding: 3px; }
.tab {
  flex: 1; padding: 7px; border: none; background: transparent;
  border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--text-muted);
  transition: background .15s, color .15s;
}
.tab.active { background: #fff; color: var(--msl-blue); font-weight: 600; box-shadow: var(--shadow); }

/* Filter row */
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.filter-label { font-size: 13px; color: var(--text-muted); }
.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.toggle-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--msl-blue); }

/* Pills */
.pill-row { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 20px;
  background: #fff; font-size: 13px; cursor: pointer; color: var(--text-muted);
  transition: border-color .15s, color .15s, background .15s;
}
.pill.active { border-color: var(--msl-blue); color: var(--msl-blue); background: #e8f5fd; font-weight: 600; }

/* Action buttons */
.action {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.action:active { transform: scale(.97); opacity: .85; }
.action.primary { background: var(--msl-blue); color: #fff; }
.action.primary:disabled { background: #a0c8e8; cursor: not-allowed; transform: none; }
.action.secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.action.danger { background: var(--danger); color: #fff; }
.action.full-width { width: 100%; }
.action-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Onboarding */
.onboarding { display: flex; flex-direction: column; align-items: center; padding: 32px 20px; gap: 20px; }
.hero { text-align: center; }
.hero-logo { width: 80px; height: 80px; border-radius: 16px; margin-bottom: 12px; }
.hero h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.hero p { color: var(--text-muted); font-size: 15px; }
.cta-block { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.hint { font-size: 13px; color: var(--text-muted); text-align: center; }

/* Vehicle pill */
.vehicle-pill {
  display: inline-block; padding: 6px 14px;
  background: var(--msl-yellow); color: #1a1a2e; border-radius: 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}

/* Main view */
.main-view { display: flex; flex-direction: column; gap: 12px; }
.form-card { display: flex; flex-direction: column; }
.gps-btn { color: var(--msl-blue); font-size: 18px; }

/* Map */
.map-container { height: 220px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* Map pins */
.map-pin {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  border: 2px solid rgba(0,0,0,.2); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.map-pin-gold { background: var(--gold); color: #1a1a2e; }
.map-pin-green { background: var(--success); }
.map-pin-gray { background: #9ca3af; }

/* Station cards */
.station-list { display: flex; flex-direction: column; gap: 8px; }
.station-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer;
  border-left: 4px solid transparent;
  transition: transform .1s;
}
.station-card:active { transform: scale(.98); }
.rank-gold { border-left-color: var(--gold); }
.rank-green { border-left-color: var(--success); }
.rank-gray { border-left-color: #d1d5db; }
.station-rank { font-size: 20px; min-width: 28px; text-align: center; }
.station-info { flex: 1; min-width: 0; }
.station-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.station-addr { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-meta { display: flex; gap: 10px; font-size: 13px; margin-top: 2px; flex-wrap: wrap; }
.station-price { font-weight: 700; color: var(--msl-blue); }
.station-dist, .station-detour { color: var(--text-muted); }
.station-chevron { color: var(--text-muted); font-size: 18px; }
.msl-badge { background: var(--msl-yellow); color: #1a1a2e; font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.closed-badge { background: #fee2e2; color: var(--danger); font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.open-badge { background: #dcfce7; color: #16a34a; font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* Result view */
.result-view { display: flex; flex-direction: column; gap: 10px; }
.strand-banner {
  background: #fef3c7; border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 12px 14px; font-size: 14px;
}

/* Station detail modal */
.station-detail { max-width: 380px; }
.detail-rank { font-size: 32px; text-align: center; margin-bottom: 6px; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.detail-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.detail-table td:first-child { color: var(--text-muted); width: 50%; }
.savings { color: var(--success); }
.detail-actions { display: flex; flex-direction: column; gap: 8px; }
.maps-cta { justify-content: flex-start; }

/* Profile */
.profile-view { display: flex; flex-direction: column; gap: 12px; }
.vehicle-detail { margin-bottom: 12px; }
.vd-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.vd-row:last-child { border-bottom: none; }
.vd-label { color: var(--text-muted); }
.vd-value { font-weight: 500; }
.mono { font-family: monospace; letter-spacing: .05em; }
.app-info { color: var(--text-muted); }

/* Modal */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45); align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px 14px 0 0;
  padding: 20px 16px; width: 100%; max-width: 520px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 80dvh; overflow-y: auto;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

/* Toast */
#toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 6px; }
.toast {
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  background: #1a1a2e; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25);
  animation: fadeIn .2s ease;
  max-width: 320px; text-align: center;
}
.toast.success { background: #16a34a; }
.toast.error { background: var(--danger); }
.toast.info { background: var(--msl-blue); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Install banner */
.install-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 250;
  background: var(--card-bg); border-top: 1px solid var(--border);
  padding: 16px; box-shadow: 0 -4px 16px rgba(0,0,0,.1);
  display: flex; flex-direction: column; gap: 8px;
}
.install-banner strong { font-size: 15px; }
.install-banner p { font-size: 13px; color: var(--text-muted); }
.install-banner button { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; }
.install-banner #install-yes { background: var(--msl-blue); color: #fff; }
.install-banner #install-no { background: var(--bg); color: var(--text); }

/* Empty states */
.empty-hint { color: var(--text-muted); font-size: 14px; text-align: center; padding: 32px 16px; }
