:root {
  --accent: #FF5A36;
  --accent-dark: #E8481F;
  --teal: #123C3D;
  --bg: #FBF8F4;
  --card: #FFFFFF;
  --border: #EDE7DC;
  --text: #1A1A18;
  --muted: #8A8A86;
  --muted-2: #B3ACA0;
  --soft: #F1F6F4;
  --soft-2: #F8F5EE;
  --green: #1E9E5A;
  --danger: #C0392B;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
}

.display { font-family: 'Space Grotesk', 'Manrope', sans-serif; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

button { font-family: inherit; cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px 20px;
}

.wordmark {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wordmark .city { color: var(--accent); }
.wordmark .connect { color: var(--teal); }
.wordmark.inverted .city, .wordmark.inverted .connect { color: #fff; }

.app-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(26,26,24,0.18);
}

/* Small persistent brand watermark, bottom-right of the app column (see
   index.html) -- stays put while the content scrolls, and clamps to the
   #app card's actual right edge (max-width 480px, centered) instead of
   the raw viewport edge, so it never drifts off onto blank page margin
   on a wide desktop window. */
.watermark {
  position: fixed;
  bottom: 8px;
  right: max(8px, calc(50vw - 232px));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(26,26,24,0.4);
  background: rgba(255,255,255,0.6);
  padding: 3px 9px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
}

/* Splash/auth-flow hero background: coral -> teal gradient with an
   abstract route-line + map-pin illustration (see heroDeco() in app.js)
   layered on top. Bleeds full-width by cancelling .content's own padding,
   then rounds off into the cream page background below it. */
.auth-hero {
  position: relative;
  overflow: hidden;
  margin: -14px -20px 26px -20px;
  padding: 68px 20px 44px;
  border-radius: 0 0 36px 36px;
  background: linear-gradient(155deg, #FF7A54 0%, var(--accent) 38%, #2C5C55 72%, var(--teal) 100%);
  text-align: center;
}
.auth-hero.compact { padding: 30px 20px 26px; border-radius: 0 0 28px 28px; margin-bottom: 22px; }
.auth-hero-deco { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-hero-inner { position: relative; z-index: 1; }
.auth-hero .tagline { color: rgba(255,255,255,0.9); font-weight: 600; font-size: 13px; margin-top: 10px; }

.pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--soft);
  color: var(--teal);
  border: none;
}
.pill.alt { background: #FFF1EC; color: var(--accent); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 24px 20px;
}

.h1 { font-size: 24px; font-weight: 700; line-height: 1.25; margin: 8px 0 18px 0; }
.h2 { font-size: 18px; font-weight: 700; margin: 0 0 4px 0; }
.h3 { font-size: 15.5px; font-weight: 700; margin: 0; }
.muted { color: var(--muted); font-weight: 600; font-size: 12.5px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(26,26,24,0.04);
}

.field-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 16px;
  box-shadow: 0 6px 18px rgba(26,26,24,0.05);
}
.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
}
.field-row + .field-row { border-top: 1px solid #EFEAE0; }
.field-label { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 0.02em; }

input[type=text], input[type=tel], input[type=number], input[type=datetime-local], select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.text-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

label.block-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 8px 2px;
}

.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255,90,54,0.28);
}
.btn-outline {
  background: #fff;
  color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn-danger.solid {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn-small {
  width: auto;
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 12.5px;
}

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; }
.row.gap-6 { gap: 6px; }
.stack { display: flex; flex-direction: column; }
.stack.gap-8 > * + * { margin-top: 8px; }
.stack.gap-12 > * + * { margin-top: 12px; }
.stack.gap-16 > * + * { margin-top: 16px; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }

.back-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: #F4F0E8;
  display: flex; align-items: center; justify-content: center;
  border: none;
}

/* Same look as .back-btn, but for buttons that aren't a "go back"
   navigation control (e.g. the from/to swap button) -- kept as a
   separate class so tests and future edits never confuse the two. */
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: #F4F0E8;
  display: flex; align-items: center; justify-content: center;
  border: none; flex-shrink: 0;
}

.live-wrap { position: relative; width: 8px; height: 8px; display: inline-block; }
.live-wrap .ring, .live-wrap .core {
  position: absolute; inset: 0; border-radius: 50%; background: var(--green);
}
.live-wrap .ring { animation: pulseRing 1.8s ease-out infinite; }
.live-wrap .core { animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.55; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.live-label { font-size: 10.5px; font-weight: 700; color: var(--green); margin-left: 6px; }

.badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 10px; }
.badge.pending { background: #FFF3D6; color: #92650A; }
.badge.confirmed { background: #E4F5EA; color: var(--green); }
.badge.rejected { background: #FCE8E6; color: var(--danger); }
.badge.cancelled { background: #FCE8E6; color: var(--danger); }
.badge.full { background: #F1EDE4; color: var(--muted); }

.notif-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid #fff;
}

.card.unread { border-color: var(--accent); background: #FFF8F5; }

.route-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.route-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 20px;
  background: var(--soft-2);
  color: var(--teal);
  border: 1px solid var(--border);
  cursor: pointer;
}
.route-chip:active { background: var(--soft); }

.bottom-bar {
  padding: 14px 20px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.error-banner {
  background: #FCE8E6;
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.hint-banner {
  background: var(--soft);
  color: #3A4F45;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.stepper {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 14px;
}
.stepper button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #D8D2C6; background: var(--bg);
  font-size: 16px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.stepper .val { font-size: 15px; font-weight: 700; min-width: 44px; text-align: center; }

.link-btn {
  background: none; border: none; color: var(--teal); font-weight: 700; font-size: 13px; padding: 0;
}

.nav-tabs { display: flex; gap: 8px; padding: 0 20px; margin-bottom: 6px; }
.nav-tab {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: var(--muted); background: transparent; border: none;
}
.nav-tab.active { background: var(--soft-2); color: var(--text); }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 75%; padding: 11px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.msg.mine { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.theirs { align-self: flex-start; background: #F1EDE4; color: var(--text); }
.msg-sender { font-size: 10.5px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }

.chat-input-row {
  display: flex; gap: 10px; padding: 12px 20px 20px 20px; border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1; padding: 12px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); font-family: inherit; font-size: 13.5px;
}

.map-box {
  position: relative; width: 100%; height: 240px; overflow: hidden;
  background-color: var(--soft);
  background-image: radial-gradient(circle, #D8E5E0 1.4px, transparent 1.4px);
  background-size: 16px 16px;
  border-radius: 16px;
}
.map-marker {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%);
  transition: left 1s linear, top 1s linear;
}
.map-endpoint {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Real OpenStreetMap tile map (see maplib.js) -- mounted imperatively into
   a .map-box container (#live-map-mount on the tracking screen, or the
   share page's own mount point), rather than emitted as part of a
   template string, since it needs the container's actual measured pixel
   width. touch-action:none stops the browser's own scroll/pan gestures
   from fighting with the drag-to-pan handling in maplib.js. */
.map-box, .share-map-box { touch-action: none; }
.osm-pannable {
  position: absolute; inset: 0; cursor: grab;
}
.osm-pannable:active { cursor: grabbing; }
.osm-tile {
  position: absolute; user-select: none; -webkit-user-drag: none;
}
.osm-pin {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none;
}
.osm-pin-dot {
  width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg) translate(3px, -1px);
  background: var(--teal); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.osm-pin-to .osm-pin-dot { background: var(--accent); }
.osm-pin-live {
  transform: translate(-50%, -50%);
}
.osm-pin-live .osm-pin-dot {
  width: 16px; height: 16px; border-radius: 50%; transform: none;
  background: var(--accent); border: 3px solid #fff;
}
.osm-attribution {
  position: absolute; right: 6px; bottom: 4px; font-size: 9.5px; color: #5A554C;
  background: rgba(255,255,255,0.78); padding: 1px 5px; border-radius: 6px; line-height: 1.6;
}
.osm-attribution a { color: inherit; text-decoration: underline; }
.osm-zoom-controls {
  position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px;
}
.osm-zoom-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--teal); font-size: 15px; font-weight: 700; line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

::-webkit-scrollbar { width: 0; height: 0; }

.empty-state {
  padding: 24px 20px; background: var(--soft-2); border-radius: 14px; text-align: center;
}
.empty-state .title { font-size: 13px; color: #5A554C; font-weight: 600; }
.empty-state .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.spacer { flex: 1; }

.google-map-recenter, .map-provider-notice {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: white; color: #173d38; border: 1px solid #ddd;
  border-radius: 4px; padding: 8px; font: 12px system-ui;
  max-width: 65%; box-shadow: 0 1px 4px #0002;
}
.google-map-recenter { cursor: pointer; }

.mode-switch{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 16px;background:#edf5f2;font-size:12px}.mode-switch .btn{width:auto} details summary{cursor:pointer;font-weight:600} input[type=checkbox],input[type=radio]{width:auto} #chat-alert{width:100%;cursor:pointer}
