:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #21252e;
  --accent: #f5a623;
  --accent-dark: #d98c0f;
  --text: #f2f2f2;
  --muted: #9aa0a8;
  --danger: #e0554a;
  --success: #3ecf8e;
  --star: #f5c518;
  --radius: 16px;
  --panel-w: 420px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.topbar {
  padding: 14px 18px 8px;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  z-index: 20;
  background: var(--bg);
}

.role-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.flow-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  position: relative;
}
.screen.active { display: flex; }

/* --- Home / hero --- */
.home-hero, .onboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 8px;
  overflow-y: auto;
}
.home-emoji { font-size: 64px; margin-bottom: 8px; }
.home-hero h1, .onboard h1 { font-size: 22px; margin: 0 0 4px; }
.muted { color: var(--muted); margin: 0; }
.muted.small { font-size: 13px; margin-top: 10px; }

.text-input {
  width: 100%;
  max-width: 320px;
  background: var(--card-2);
  border: 1px solid #2b303b;
  color: var(--text);
  font-size: 15px;
  padding: 13px 16px;
  border-radius: 12px;
  margin-top: 10px;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #17130a;
  border: none;
  font-weight: 700;
  font-size: 16px;
  padding: 15px 24px;
  border-radius: 999px;
  width: 100%;
  max-width: 320px;
  margin-top: 22px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 999px;
  width: 100%;
  cursor: pointer;
  margin-top: 14px;
}
.btn-secondary:hover { background: rgba(245, 166, 35, 0.1); }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0;
  margin-bottom: 8px;
  cursor: pointer;
  align-self: flex-start;
}
.btn-link:hover { color: var(--text); }
.btn-logout { color: var(--danger); margin-top: 18px; align-self: center; }

.drive-upsell {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #4a3410, var(--card));
  border: 1px solid #5a3f12;
  border-radius: 14px;
  padding: 14px;
  margin-top: 18px;
}
.drive-upsell-text { flex: 1; min-width: 0; }
.drive-upsell-title { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.drive-upsell-btn { width: auto; margin-top: 0; padding: 10px 18px; flex-shrink: 0; }
.drive-form { flex-direction: column; align-items: stretch; gap: 0; margin-top: 10px; }
.drive-form .btn-primary { max-width: none; }

/* --- Auth / login --- */
.auth-screen { background: var(--bg); }
.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
  gap: 4px;
  overflow-y: auto;
}
.auth-content h1 { font-size: 26px; margin: 4px 0 2px; }

.auth-quick-resume { width: 100%; max-width: 320px; margin-bottom: 6px; }
.btn-quick-resume {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border: 1px solid #2b303b;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
}
.btn-quick-resume:hover { border-color: var(--accent); }
.qr-avatar { width: 40px; height: 40px; font-size: 15px; flex-shrink: 0; }
.qr-text { display: flex; flex-direction: column; min-width: 0; }
.qr-title { font-weight: 700; font-size: 14.5px; }
.qr-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }

.auth-legal { max-width: 320px; line-height: 1.4; margin-top: 20px; }

.btn-social {
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border: 1px solid #2b303b;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 18px;
  border-radius: 12px;
  margin-top: 14px;
  cursor: pointer;
}
.btn-social:hover { border-color: var(--accent); }
.social-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.btn-google .social-icon { background: #fff; color: #4285f4; }
.btn-facebook .social-icon { background: #1877f2; color: #fff; }

.auth-divider {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 320px;
  color: var(--muted);
  font-size: 12.5px;
  margin: 22px 0 4px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #2b303b;
}
.auth-divider span { padding: 0 10px; }

.demo-links { text-align: center; margin-top: 26px; }
.demo-links a { color: var(--accent); text-decoration: none; }
.demo-links a:hover { color: var(--accent-dark); }

/* --- Map screens --- */
#map-driver, #map-destination, #map-home, #map-searching, #map-tracking {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.map-screen { padding: 0; }
.fullscreen-map { position: absolute; inset: 0; z-index: 1; }

.avatar-fab {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 15;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #17130a;
  border: 2px solid rgba(0,0,0,0.15);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.avatar-fab::before { content: "🧑"; }

.home-sheet {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  z-index: 15;
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px 10px;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.45);
}
.dest-fake-input {
  width: 100%;
  text-align: left;
  background: var(--card-2);
  border: 1px solid #2b303b;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
}
.dest-fake-input:hover { border-color: var(--accent); }

.searching-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 24px 24px 28px;
  text-align: center;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
}
.searching-overlay h2 { font-size: 18px; margin: 4px 0 2px; }
.pulse-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 10px;
  animation: pulse 1.3s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245,166,35,0.55); }
  70% { box-shadow: 0 0 0 18px rgba(245,166,35,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,166,35,0); }
}

.chat-fab {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 15;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.driver-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-2);
  border-radius: 14px;
  padding: 14px;
  margin: 4px 0 6px;
}
.driver-card .avatar { width: 48px; height: 48px; font-size: 17px; }
.driver-card .dc-info { flex: 1; min-width: 0; }
.driver-card .dc-name { font-weight: 700; font-size: 15.5px; }
.driver-card .dc-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.driver-card .dc-right { text-align: right; flex-shrink: 0; }
.driver-card .dc-fare { font-weight: 700; font-size: 16px; color: var(--accent); }
.driver-card .dc-eta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* --- Chat --- */
.chat-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  height: 68%;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.chat-panel.open { transform: translateY(0); }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  font-weight: 700;
  border-bottom: 1px solid #262932;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
}
.chat-bubble.mine { align-self: flex-end; background: var(--accent); color: #17130a; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 4px; }
.chat-bubble .cb-time { display: block; font-size: 10px; opacity: 0.65; margin-top: 3px; }
.chat-quick-replies { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; flex-shrink: 0; }
.chat-quick-replies .qr-chip {
  background: var(--card-2);
  border: 1px solid #2b303b;
  color: var(--text);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-quick-replies .qr-chip:hover { border-color: var(--accent); }
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px 16px;
  border-top: 1px solid #262932;
  flex-shrink: 0;
}
.chat-input { max-width: none; margin-top: 0; flex: 1; }

.sheet {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px 20px;
  flex-shrink: 0;
  max-height: 55%;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
  z-index: 10;
}
.sheet-handle {
  width: 40px;
  height: 4px;
  background: #3a3f4a;
  border-radius: 999px;
  margin: 4px auto 12px;
}
.sheet h2 { font-size: 16px; margin: 0 0 10px; }

.taxi-list { display: flex; flex-direction: column; gap: 10px; }

.taxi-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border: 1px solid #2b303b;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.taxi-item:hover, .taxi-item:active { border-color: var(--accent); }

.taxi-icon {
  font-size: 26px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2b303b;
  border-radius: 50%;
  flex-shrink: 0;
}

.taxi-info { flex: 1; min-width: 0; }
.taxi-name { font-weight: 700; font-size: 14.5px; }
.taxi-plate { color: var(--muted); font-size: 12.5px; }

.taxi-eta { text-align: right; flex-shrink: 0; }
.taxi-eta .min { font-weight: 700; font-size: 16px; color: var(--accent); }
.taxi-eta .km { display: block; font-size: 11.5px; color: var(--muted); }

/* --- Destination screen --- */
.dest-sheet { max-height: 68%; }
.dest-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dest-input { max-width: none; margin-top: 0; flex: 1; }
.btn-search {
  background: var(--accent);
  color: #17130a;
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 13px 16px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-search:hover { background: var(--accent-dark); }
.dest-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.dest-result-item {
  background: var(--card-2);
  border: 1px solid #2b303b;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
}
.dest-result-item:hover, .dest-result-item:active { border-color: var(--accent); }
.dest-empty { color: var(--muted); font-size: 13px; padding: 4px 2px; }

.trip-summary {
  background: var(--card-2);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.trip-summary .ts-dest { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-summary .ts-fare { font-weight: 700; color: var(--accent); flex-shrink: 0; }

/* --- Confirm screen --- */
.confirm-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
  overflow-y: auto;
}
.taxi-picked {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.taxi-picked .taxi-icon { width: 52px; height: 52px; font-size: 30px; }
.taxi-picked .taxi-name { font-size: 16px; }

.fare-box {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: auto;
}
.fare-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14.5px;
  color: var(--muted);
}
.fare-row.fare-total {
  border-top: 1px solid #2b303b;
  margin-top: 6px;
  padding-top: 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}

/* --- Tracking --- */
#tracking-status h2 { margin: 0 0 4px; font-size: 17px; }
#tracking-eta { font-size: 14px; }

.rate-box { margin-top: 14px; text-align: center; }
.stars { display: inline-flex; gap: 6px; font-size: 28px; }
.star { color: #3a3f4a; }
.star.filled { color: var(--star); }
.stars-interactive .star { cursor: pointer; }
.rating-line { color: var(--star); font-size: 14px; margin: 4px 0 14px; }

/* --- Bottom nav --- */
.bottom-nav {
  display: flex;
  border-top: 1px solid #262932;
  background: var(--bg);
  flex-shrink: 0;
}
.bottom-nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.bottom-nav-btn span { font-size: 11px; font-weight: 600; }
.bottom-nav-btn.active { color: var(--accent); }

/* --- Profile screens --- */
.profile-screen {
  display: none;
  padding: 20px 20px 8px;
  overflow-y: auto;
  flex: 1;
}
.profile-screen.active { display: block; }

.profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #17130a;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-name { font-weight: 700; font-size: 17px; }
.profile-sub { color: var(--muted); font-size: 13.5px; }

.stat-row, .stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.stat-card.accent { background: linear-gradient(135deg, #4a3410, var(--card)); border: 1px solid #5a3f12; }
.stat-num { font-size: 20px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

.section-title { font-size: 15px; margin: 18px 0 8px; }

.history-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.history-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
}
.history-item .hi-left .hi-title { font-weight: 600; }
.history-item .hi-left .hi-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.history-item .hi-fare { font-weight: 700; }
.history-empty { color: var(--muted); font-size: 13.5px; padding: 8px 2px; }

/* --- Driver home --- */
.driver-home {
  padding: 18px 18px 4px;
  flex-shrink: 0;
}
.online-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.online-label { font-weight: 700; font-size: 15px; }

.switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #2b303b;
  border: none;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.switch[aria-pressed="true"] { background: var(--success); }
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: left 0.2s ease;
}
.switch[aria-pressed="true"] .switch-knob { left: 25px; }

.waiting-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 10px;
  gap: 4px;
}
.waiting-box .home-emoji { font-size: 46px; margin-bottom: 2px; }

.request-card {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
  z-index: 15;
}
.request-title { font-weight: 700; margin-bottom: 10px; }
.request-actions { display: flex; gap: 10px; margin-top: 6px; }
.request-actions .btn-secondary, .request-actions .btn-primary { margin-top: 0; }

.big-money { font-size: 40px; font-weight: 700; color: var(--accent); margin: 6px 0 4px; }

/* --- Admin panel --- */
.admin-screen {
  padding: 18px 20px 30px;
  overflow-y: auto;
  display: block;
}
.admin-title { font-size: 20px; margin: 0 0 2px; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-col .bar { width: 100%; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.bar-col .bar-count { font-size: 11px; color: var(--muted); }
.bar-col .bar-day { font-size: 10px; color: var(--muted); }

.admin-table { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.admin-row {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.admin-row .ar-left { min-width: 0; }
.admin-row .ar-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.admin-row .ar-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.admin-row .ar-right { text-align: right; flex-shrink: 0; }
.admin-row .ar-money { font-weight: 700; }
.admin-row .ar-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #444; display: inline-block; flex-shrink: 0; }
.status-dot.online { background: var(--success); }

/* --- Leaflet: mapa e íconos propios (no el estilo por defecto de OSM/Google) --- */
.leaflet-container { background: var(--bg); font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(15, 17, 21, 0.75) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }

.taxi-div-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.taxi-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffd688 0%, var(--accent) 55%, var(--accent-dark) 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55), 0 0 0 3px rgba(15,17,21,0.85);
  border: 2px solid rgba(255,255,255,0.2);
}

.dest-div-icon { display: flex; align-items: flex-end; justify-content: center; }
.dest-badge { filter: drop-shadow(0 3px 5px rgba(0,0,0,0.6)); }

.user-div-icon { display: flex; align-items: center; justify-content: center; }
.user-dot-pulse {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  background: #3b82f6;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.35);
}
.user-dot-pulse::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.55);
  animation: userPulse 1.8s ease-out infinite;
}
@keyframes userPulse {
  0% { transform: scale(0.55); opacity: 0.85; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ======================= RESPONSIVE: tablet / desktop / web ======================= */
@media (min-width: 860px) {
  #app { max-width: 1180px; }

  .topbar { padding: 18px 28px 10px; }

  /* Pantallas con mapa: panel fijo a la izquierda + mapa ocupando el resto,
     en vez de la hoja flotante encima de todo el mapa (patrón app de escritorio). */
  .map-screen { flex-direction: row; }
  .fullscreen-map { position: relative; inset: auto; flex: 1; height: 100%; }

  .map-screen .sheet,
  .map-screen .home-sheet,
  .map-screen .searching-overlay {
    position: relative;
    left: auto; right: auto; bottom: auto; top: auto;
    order: -1;
    width: var(--panel-w);
    max-width: var(--panel-w);
    height: 100%;
    max-height: none;
    border-radius: 0;
    box-shadow: 6px 0 30px rgba(0,0,0,0.4);
    padding-top: 26px;
  }
  .map-screen .sheet-handle { display: none; }
  .map-screen .searching-overlay { display: flex; flex-direction: column; justify-content: center; }

  .avatar-fab { top: 20px; left: calc(var(--panel-w) + 20px); }
  .chat-fab { top: 20px; right: 20px; }

  /* Formularios y perfiles: centrados con ancho cómodo, no estirados a todo el panel. */
  .profile-screen { max-width: 560px; margin: 0 auto; width: 100%; padding: 32px 24px 20px; }
  .admin-screen { max-width: 920px; margin: 0 auto; width: 100%; padding: 32px 28px 40px; }

  /* Chat como panel lateral derecho, no una hoja desde abajo. */
  .chat-panel {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: 380px;
    max-width: 92vw;
    margin: 0;
    border-radius: 0;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    transform: translateX(110%);
  }
  .chat-panel.open { transform: translateX(0); }

  .btn-primary, .btn-secondary { cursor: pointer; }
}

@media (min-width: 1180px) {
  #app { max-width: 100%; }
  :root { --panel-w: 440px; }
}
